[Lldb-commits] [PATCH] D55434: ObjectFileBreakpad: Implement sections

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 7 08:51:43 PST 2018

clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

So sections should correspond to different kinds of sections, like .text, .data, etc. If we have the following breakpad file:

  MODULE Linux x86_64 0000000024B5D199F0F766FFFFFF5DC30 linux.out
  INFO CODE_ID 00000000B52499D1F0F766FFFFFF5DC3
  FILE 0 /tmp/a.c
  FUNC 1010 10 0 _start
  1010 4 4 0
  1014 5 5 0
  1019 5 6 0
  101e 2 7 0
  FUNC 2010 10 0 main
  2010 4 4 0
  2014 5 5 0
  2019 5 6 0
  201e 2 7 0
  PUBLIC 1010 0 _start
  PUBLIC 2010 0 main
  PUBLIC 3010 0 nodebuginfo1
  PUBLIC 3020 0 nodebuginfo2

I would expect to have just 1 section named ".text" with read and execute permissions. This section would have its m_file_addr set to 0x1010 (from FUNC or PUBLIC with lowest address ("FUNC 1010 10 0 _start" in this case)). The size of the section would be set to the max code address + size minus the lowest code address (0x3020 - 0x1010 in this case). The file offset and file size should be set to zero since section contents are typically the bytes for the disassembly.

One other way to do this would be to create a section for each FUNC whose m_file_addr it set to the FUNC start address, and whose size is set to the last line entry - FUNC start address. Then name of the section can be set to the function name in this case. I am not a huge fan of this since it just creates extra sections for no reason and the debug info will have this info anyway so it will be duplicated.

I see no reason to create sections for MODULE, INFO, FILE, or STACK records. Was there a reason you wanted to create sections for all these? Might be better to create symbols for any of these you need to reference later.

Once you start parsing the debug info, the lldb::user_id_t for any items, like FUNC, can just be the line number or character offset for the FUNC source line within the file.



More information about the lldb-commits mailing list