[Lldb-commits] [PATCH] D106348: Write the # of addressable bits into Mach-O corefiles, read it back out again

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 20 10:49:04 PDT 2021


JDevlieghere added inline comments.


================
Comment at: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:5575-5613
+addr_t ObjectFileMachO::GetAddressMask() {
+  addr_t mask = 0;
+  ModuleSP module_sp(GetModule());
+  if (module_sp) {
+    std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
+    lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
+    for (uint32_t i = 0; i < m_header.ncmds; ++i) {
----------------
Given that this function and the one below are basically doing the same thing, would it make sense to make this a generic helper that takes a lambda so we can share the logic to get to the LC_NOTE data? 


================
Comment at: lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp:544-545
 
+  addr_t address_mask = core_objfile->GetAddressMask();
+  if (address_mask != 0) {
+    SetCodeAddressMask(address_mask);
----------------
```
if (addr_t address_mask = core_objfile->GetAddressMask()) {
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106348/new/

https://reviews.llvm.org/D106348



More information about the lldb-commits mailing list