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

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 20 15:19:06 PDT 2021


shafik 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) {
----------------
JDevlieghere wrote:
> 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? 
I also noticed in one of the places we are doing this work we do:

```
memset(data_owner, 0, sizeof(data_owner));
```

Should we be doing this in all places? We can also do that simpler by:

```
char data_owner[17]{0}
```



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