Bug 11957 - cross-target core file registers are not supported
Summary: cross-target core file registers are not supported
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: corefiles (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-30 10:45 UTC by Jan Kratochvil
Modified: 2010-08-30 11:43 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: alpha-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments
alpha.core.gz (15.18 KB, application/octet-stream)
2010-08-30 10:45 UTC, Jan Kratochvil
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kratochvil 2010-08-30 10:45:04 UTC
adding corelow.o to `alpha*-*-linux*' really enables reading the core file.
It does not display registers, essential to make it useful:

GNU gdb (GDB) 7.2.50.20100830-cvs
This GDB was configured as "--host=x86_64-unknown-linux-gnu
--target=alpha-unknown-linux-gnu".
./gdb -nx -c alpha.core
warning: Couldn't find general-purpose registers in core file.
warning: Couldn't find general-purpose registers in core file.
Cannot access memory at address 0x0
(gdb) info registers 
v0             0x0	0
t0             0x0	0
[...]
Comment 1 Jan Kratochvil 2010-08-30 10:45:48 UTC
Created attachment 4955 [details]
alpha.core.gz

alpha-unknown-linux-gnu .gz core file.
Comment 2 Jan Kratochvil 2010-08-30 10:47:49 UTC
The file is otherwise loaded:

(gdb) info files 
Local core dump file:
	`/home/jkratoch/t/alpha.core', file type elf64-alpha.
	0x000000011f3d4000 - 0x000000011f3fe000 is load1
	0x0000000120000000 - 0x0000000120000000 is load2
	0x0000000120014000 - 0x0000000120016000 is load3
	0x0000000120016000 - 0x0000000120038000 is load4
	0x0000020000000000 - 0x0000020000000000 is load5
	0x0000020000020000 - 0x0000020000022000 is load6
	0x000002000002e000 - 0x0000020000030000 is load7
	0x0000020000030000 - 0x0000020000032000 is load8
	0x0000020000046000 - 0x0000020000046000 is load9
	0x00000200001c2000 - 0x00000200001c2000 is load10
	0x00000200001d2000 - 0x00000200001d6000 is load11
	0x00000200001d6000 - 0x00000200001d8000 is load12
	0x00000200001d8000 - 0x00000200001dc000 is load13
	0x00000200001dc000 - 0x00000200001dc000 is load14

fetch_osf_core_registers is in alpha-nat.c, not *-tdep.c.

Roland McGrath has confirmed native gdb loads it:
---------------------------------------------------------------------------
I logged into albeniz.debian.org, an alpha available to Debian developers.
Debian's gdb (6.8) reads core files there.  I don't know if they have fixes
or just that native builds already do work.
Comment 3 Pedro Alves 2010-08-30 11:43:52 UTC
Looking at bfd/elf64-alpha.c, I don't see any core note 'grok'ing routines,
so it's not surprising that this would only work natively currently.

See below for a relevant snippet of bfd/elf.c that points the way.  For being
host-independent, the bfd backend needs to implement the
elf_backend_grok_prstatus callback, otherwise, we fallback to the host-dependent
elfcore_grok_prstatus.

static bfd_boolean
elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
{
  const struct elf_backend_data *bed = get_elf_backend_data (abfd);

  switch (note->type)
    {
    default:
      return TRUE;

    case NT_PRSTATUS:
      if (bed->elf_backend_grok_prstatus)
	if ((*bed->elf_backend_grok_prstatus) (abfd, note))
	  return TRUE;
#if defined (HAVE_PRSTATUS_T)
      return elfcore_grok_prstatus (abfd, note);
#else
      return TRUE;
#endif