[lldb-dev] Patch to support ELF coredumps

Samuel Jacob samueldotj at gmail.com
Wed Feb 27 10:40:57 PST 2013

On Wed, Feb 27, 2013 at 10:19 AM, Greg Clayton <gclayton at apple.com> wrote:

> Is there anyway to check the byte size of the thread context and do
> something intelligent so we can correctly identify the register context to
> be used?

The current idea I have to differentiate FreeBSD/Linux core is to use
ELFHeader's OS/ABI field or to useELFNote section's owner field
Linux core output
$eu-readelf -n test/core
Note segment of 1368 bytes at offset 0x3f8:
  Owner          Data size  Type
  CORE                 336  PRSTATUS
  CORE                 136  PRPSINFO
  CORE                 304  AUXV

FreeBSD core's output
$eu-readelf -h a.out.core  | grep OS
  OS/ABI:                            FreeBSD

$eu-readelf -n a.out.core
Note segment of 960 bytes at offset 0x200:
  Owner          Data size  Type
  FreeBSD              120  PRPSINFO
  FreeBSD              224  PRSTATUS
  FreeBSD              512  FPREGSET
  FreeBSD               24  GWINDOWS

But the real problem is creating another class which abstracts and handles
the two or more ABI.

> The ELF file contains a machine type which isn't much help in identifying
> exactly what kind of machine this was generated on. Especially for ARM we
> would have trouble identifying the correct register context for a armv5,
> armv6 or armv7 core, each which might also contain completely different
> floating pointer registers.

Yea - I havent looked at ARM cores. If you have ELF ARM cores please attach
readelf -a output.

> I would like to be able to read ELF core files on MacOSX so I can help
> diagnose issues when people file bugs, so I would really like to get this
> working prior to checkin if possible. The ELF object file parser should be
> able to include the two register contexts and maybe look at the sizes
> (hopefully they aren't the same) and "do the right thing", no?

I will take a look again.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130227/d7f9c160/attachment.html>

More information about the lldb-dev mailing list