[all-commits] [llvm/llvm-project] 5f71aa: [lldb] [Mach-O] don't strip the end of the "kern v...

Jason Molenda via All-commits all-commits at lists.llvm.org
Tue Jan 9 15:20:20 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f71aa9270c3d680babfbc6e766773d113c2a79a
      https://github.com/llvm/llvm-project/commit/5f71aa9270c3d680babfbc6e766773d113c2a79a
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2024-01-09 (Tue, 09 Jan 2024)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
    M lldb/test/API/macosx/lc-note/firmware-corefile/create-empty-corefile.cpp

  Log Message:
  -----------
  [lldb] [Mach-O] don't strip the end of the "kern ver str" LC_NOTE (#77538)

The "kern ver str" LC_NOTE gives lldb a kernel version string -- with a
UUID and/or a load address (stext) to load it at. The LC_NOTE specifies
a size of the identifier string in bytes. In
ObjectFileMachO::GetIdentifierString, I copy that number of bytes into a
std::string, and in case there were additional nul characters at the end
of the sting for padding reasons, I tried to shrink the std::string to
not include these extra nul's.

However, I did this resizing without handling the case of an empty
identifier string. I don't know why any corefile creator would do that,
but of course at least one does. This patch removes the resizing
altogether; I was solving something that hasn't ever shown to be a
problem. I also added a test case for this, to check that lldb doesn't
crash when given one of these corefiles.

rdar://120390199




More information about the All-commits mailing list