| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[lldb][NFC] Fix all formatting errors in .cpp file headers Summary: A *.cpp file header in LLDB (and in LLDB) should like this: //===-- TestUtilities.cpp -------------------------------------------------===// However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator -*- C++ -*- is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files). This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing ===// (mostly caused by clang-format breaking the line). Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere Reviewed By: JDevlieghere Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73258 | 6 年前 | |
【feature】统一优化下载机制,解决UT编译、挂死及失败问题 Co-authored-by: mengguangxin<mgx0018@163.com> # message auto-generated for no-merge-commit merge: !32 merge dev_0301 into master 【feature】统一优化下载机制,解决UT编译、挂死及失败问题 Created-by: mengguangxin Commit-by: mengguangxin Merged-by: ascend-robot Description: ### 1. 修改描述 - **修改原因:** 原有的单元测试代码存在多处问题导致测试无法通过: (1) AscendProcessLinuxTest 中的 AscendProcessLinux 构造函数签名已变更(从 Factory+MainLoop+socket 方式改为 Manager 方式),但测试未同步适配,导致编译失败; (2) SetBreakpoint 测试中 soc_version 使用了 "test" 这一未注册的值,无法通过工厂方法创建 DeviceContext,导致运行时报 "device context is null!" 错误; (3) GDB Remote 相关测试使用 GDBRemoteCommunication::ConnectLocally 进行 TCP 监听连接,在某些环境下不稳定或不可用; (4) TestClient 使用 --reverse-connect + TCP Listen/Accept 方式启动 lldb-server,存在端口竞争和环境兼容性问题; (5) DWARFExpressionTest 的 ReadMemory 方法签名缺少新增的 MemoryReaderParamClient 参数,导致编译失败; (6) NativeProcessTestUtils.h 中的 mock delegate 缺少新增的接口方法声明; (7) UT 运行时缺少 LD_LIBRARY_PATH 环境变量,导致动态库找不到。 (8) 新的依赖下载机制需要各仓统一同步 - **修改方案:** (1) 适配 AscendProcessLinux 新的构造函数接口,将 Factory+MainLoop+socket 替换为 Manager,去除 socket 通信相关的逻辑,改为直接调用 m_parser.ParseMessage 进行消息注入; (2) 新增 FakeDeviceContext 类继承 DeviceContext,重写关键虚方法以绕过真实设备初始化和地址校验,在 SetBreakpoint 测试中直接注入到 process->m_device_context; (3) 在 GDBRemoteTestUtils.h 中新增 ConnectLocallyViaSocketPair 工具函数,使用 socketpair 替代 TCP 监听方式建立本地连接,并将 GDB Remote 测试中的 ConnectLocally 调用统一替换; (4) 重构 TestClient 启动逻辑,使用 socketpair + --fd 参数替代 --reverse-connect + TCP Listen/Accept; (5) 补全 DWARFExpressionTest 中 ReadMemory 方法的新参数; (6) 在 NativeProcessTestUtils.h 的 mock delegate 中补充 SetSingleCoreRunFlag、SetClientDeviceId、ReadDeviceRegisterValueByName、ReadDeviceRegisterList 等新增接口的 mock 声明; (7) 在 lit.cfg.py 中追加 LD_LIBRARY_PATH 环境变量指向构建产物的 lib 目录。 (8) 同步统一依赖下载机制 - **修改内容:** (1) **lldb/unittests/Process/Linux/AscendProcessLinuxTest.cpp**:将 #include "AscendProcessLinux.h" 移至 #define private public 之后以暴露私有成员;删除 NativeProcessFactory 类型别名,新增 FakeDeviceContext 类(实现 Init、ReadGlobalMemory、WriteGlobalMemory、InvalidInstrCache 等方法的桩/mock 逻辑);HandleStubMessage 和 SetBreakpoint 两个测试用例中,将构造函数从 (pid, fd, gdb_server, arch, mainloop, tids, socket) 改为 (pid, fd, gdb_server, arch, manager, tids),去除 socket 读写方式的消息传递,改为直接调用 m_parser.ParseMessage;SetBreakpoint 测试新增 process->m_device_context = std::make_shared<FakeDeviceContext>() 注入,移除不再需要的 CMD_SQ_SEND/CMD_CQ_RECV mock 期望。 (2) **lldb/unittests/tools/lldb-server/tests/TestClient.cpp**:新增 #include <sys/socket.h>;移除 --reverse-connect 参数和 TCP Listen/Accept 逻辑,改用 socketpair 创建 socket 对,通过 --fd= 参数将 server 端 fd 传递给 lldb-server 子进程;使用 AppendDuplicateFileAction 保留 fd 继承;连接建立后关闭 server 端 fd,用 client 端 fd 构造 TCPSocket 作为通信连接;inferior 参数改为通过 SetInferior 方法设置。 (3) **lldb/unittests/Process/gdb-remote/GDBRemoteTestUtils.h**:新增 #include <sys/socket.h>、TCPSocket.h、ConnectionFileDescriptorPosix.h;新增 ConnectLocallyViaSocketPair 内联函数,使用 socketpair 创建 Unix 域 socket 对并分别设置为 client/server 的连接。 (4) **lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp、GDBRemoteCommunicationClientTest.cpp、GDBRemoteCommunicationTest.cpp**:将 SetUp 中的 GDBRemoteCommunication::ConnectLocally 替换为 ConnectLocallyViaSocketPair。 (5) **lldb/unittests/Expression/DWARFExpressionTest.cpp**:ReadMemory 方法签名新增 MemoryReaderParamClient param = {} 默认参数,适配上游接口变更。 (6) **lldb/unittests/TestingSupport/Host/NativeProcessTestUtils.h**:在 MS_DEBUGGER 宏分支内新增 SetSingleCoreRunFlag、SetClientDeviceId、ReadDeviceRegisterValueByName、ReadDeviceRegisterList 的 MOCK 方法声明,并添加 ReadDeviceRegisterValue(StringRef, uint64_t&) 的转发实现。 (7) **lldb/test/Unit/lit.cfg.py**:新增 LD_LIBRARY_PATH 环境变量配置,将 config.llvm_obj_root/lib 追加到库搜索路径中,确保 UT 运行时能找到动态链接库。 - [ ] **涉及代码双合**(贴上另一个PR链接):无 ---- ### 2. 功能验证 - [ ] **功能自验截图**(请确保不体现个人信息)  - [ ] **冒烟是否通过** 是 ---- ### 3. 代码检视 - **要求:** - 合入功能代码大于 200 行,需要sig会议申报代码检视议题,并在PR中标注会议。 - committer评估是否需要在sig会议进行代码检视。 - 参与检视的committer人员名单与检视时间。 - 大于 1000 行代码原则上不允许合入,需进行备案。 - [ ] **是否经过代码检视** 是 - [ ] **是否具备UT测试用例看护** 是 - [ ] **是否需要在sig会议中进行代码检视** 否 - **检视committer人员名单与检视时间:** ---- ### 4. 资料修改自检 - **资料修改:** 不涉及 ---- See merge request: Ascend/msdebug!32 | 3 个月前 | |
[lldb] Revise IDE folder structure (#89748) Update the folder titles for targets in the monorepository that have not seen taken care of for some time. These are the folders that targets are organized in Visual Studio and XCode ( set_property(TARGET <target> PROPERTY FOLDER "<title>")) when using the respective CMake's IDE generator. * Ensure that every target is in a folder * Use a folder hierarchy with each LLVM subproject as a top-level folder * Use consistent folder names between subprojects * When using target-creating functions from AddLLVM.cmake, automatically deduce the folder. This reduces the number of set_property/set_target_property, but are still necessary when add_custom_target, add_executable, add_library, etc. are used. A LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's root CMakeLists.txt. | 2 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 6 年前 | ||
| 3 个月前 | ||
| 2 年前 |