[PATCH] add a bfd interface to get at a core file's PID
Pedro Alves
pedro@codesourcery.com
Tue Aug 17 20:04:00 GMT 2010
More information about the Binutils mailing list
Tue Aug 17 20:04:00 GMT 2010
- Previous message (by thread): [PATCH] add a bfd interface to get at a core file's PID
- Next message (by thread): [PATCH] add a bfd interface to get at a core file's PID
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[updated patch below] On Monday 16 August 2010 20:04:40, Pedro Alves wrote: > On Saturday 14 August 2010 19:28:24, Pedro Alves wrote: > > Hi all, > > > > This patch gets rid of the bfd/elf.c:elfcore_make_pid hack, and > > in its place adds an API that GDB can use to query the PID of the > > process that a core dump was generated from (bfd_core_file_pid). > > GDB needs to know this PID in order to be able to support > > thread_db/pthread debugging on core files. > > > > The current elfcore_make_pid hack is a nop on most targets, since > > they don't fill in the elf_tdata(bfd)->core_lwpid field, only the > > core_pid field. Currently, on most targets, since GDB can't get at > > the core's PID, it fakes one up. Except on Solaris, where a while ago > > I had added the opposite hack of elfcore_make_pid, thus extracting > > the PID from .reg/NNN section names. This only worked because > > the solaris note groking routines in bfd do write to the core_lwpid > > field. But this is all a hack, and I'd prefer not propagating > > it on either bfd or gdb, and instead add a cleaner interface to bfd, > > hence this patch. > > > > The patch goes through all targets making them write to > > elf_tdata(bfd)->core_lwpid where it makes sense, > > leaving elf_tdata(bfd)->core_pid for the main process's PID. > > > > For linux x86/x86_64, I also added the necessary bits to extract > > the main process's PID from the psinfo note, and store it in > > elf_tdata(bfd)->core_pid, thus allowing the new interface to return > > something not zero. I didn't go look up the offsets into psinfo where > > the pid is stored for all other linux archs. Someone else interested > > in those archs can do that at any later time --- things will > > keep working as they did until that is done. > > > > Tested by building both gdb and binutils with --enable-targets=all, > > by running the gdb testsuite on x86_64-linux, manually confirming > > that with a couple of follow up patches I could activate > > libthread_db/pthread debugging on x86_64 and x86 linux, and, > > manually confirming that GDB can still grok core files > > on sparc-solaris, generated by both the kernel or gdb. > > > > Looks like I missed that there are some files that need updating > that are host dependent. E.g., (...) I've now gone through all files that for one target or another are set as COREFILE in bfd/configure.in. Hopefuly I didn't miss anything, but if I did, it's a trivial fix. Okay to apply? -- Pedro Alves 2010-08-17 Pedro Alves <pedro@codesourcery.com> PR corefile/8210 bfd/ * bfd-in2.h: Regenerate. * corefile.c (bfd_core_file_pid): New. * targets.c (BFD_JUMP_TABLE_CORE): Add NAME##_core_file_pid. (struct bfd_target) <_core_file_pid>: New. * libbfd-in.h (_bfd_nocore_core_file_pid): Declare. * libbfd.c (_bfd_nocore_core_file_pid): New. * elf-bfd.h (bfd_elf32_core_file_pid, bfd_elf64_core_file_pid): Declare. * elfcode.h (elf_core_file_pid): New define. * elfcore.h (elf_core_file_pid): New function. * elf.c (elfcore_make_pid): Rewrite. (elfcore_grok_prstatus): Only set core_pid if not set yet. (elfcore_grok_prstatus) [!HAVE_PRSTATUS_T_PR_WHO]: Fallback to getting the lwpid from prstat.pr_pid. * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. (elf64_x86_64_grok_psinfo): Extract the the main process's PID, and store it in elf_tdata's core_pid field. * elf32-i386.c (elf_i386_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. (elf_i386_grok_psinfo): Extract the the main process's PID, and store it in elf_tdata's core_pid field. * elf32-am33lin.c (elf32_am33lin_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-arm.c (elf32_arm_nabi_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-cris.c (cris_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-frv.c (elf32_frv_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-hppa.c (elf32_hppa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-ppc.c (ppc_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-s390.c (elf_s390_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-score.c (s3_bfd_score_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-score7.c (s7_bfd_score_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-sh.c (elf32_shlin_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf32-xtensa.c (elf_xtensa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-hppa.c (elf64_hppa_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-mips.c (elf64_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elf64-ppc.c (ppc64_elf_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * elfn32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to elf_tdata's core_lwpid instead of to core_pid. * plugin.c (bfd_plugin_core_file_pid): New function. * aout-target.h (MY_core_file_pid): Define. * aout-tic30.c (MY_core_file_pid, MY_core_file_p): New defines. * coff-rs6000.c (coff_core_file_pid): New define. (rs6000coff_vec, pmac_xcoff_vec): Use BFD_JUMP_TABLE_CORE. * coff64-rs6000.c (coff_core_file_pid): New define. (rs6000coff64_vec): Use BFD_JUMP_TABLE_CORE. (xcoff64_core_file_pid): New define. (aix5coff64_vec): Use BFD_JUMP_TABLE_CORE. * mach-o-target.c (bfd_mach_o_core_file_pid): New define. * aix386-core.c (aix386_core_file_pid): New define. * hppabsd-core.c (hppabsd_core_core_file_pid): New define. * hpux-core.c (hpux_core_core_file_pid): New define. * irix-core.c (irix_core_core_file_pid): New define. * lynx-core.c (lynx_core_file_pid): New define. * osf-core.c (osf_core_core_file_pid): New define. * ptrace-core.c (ptrace_unix_core_file_pid): New define. * sco5-core.c (sco5_core_file_pid): New define. * xcoff-target.h (coff_core_file_pid): New define. --- bfd/aix386-core.c | 2 ++ bfd/aout-target.h | 3 +++ bfd/aout-tic30.c | 3 +++ bfd/bfd-in2.h | 10 +++++++--- bfd/coff-rs6000.c | 12 ++++++------ bfd/coff64-rs6000.c | 14 ++++++++------ bfd/corefile.c | 25 +++++++++++++++++++++++++ bfd/elf-bfd.h | 4 ++++ bfd/elf.c | 22 +++++++++++++++++----- bfd/elf32-am33lin.c | 2 +- bfd/elf32-arm.c | 2 +- bfd/elf32-cris.c | 4 ++-- bfd/elf32-frv.c | 2 +- bfd/elf32-hppa.c | 2 +- bfd/elf32-i386.c | 6 ++++-- bfd/elf32-mips.c | 2 +- bfd/elf32-ppc.c | 2 +- bfd/elf32-s390.c | 2 +- bfd/elf32-score.c | 2 +- bfd/elf32-score7.c | 2 +- bfd/elf32-sh.c | 2 +- bfd/elf32-xtensa.c | 2 +- bfd/elf64-hppa.c | 2 +- bfd/elf64-mips.c | 2 +- bfd/elf64-ppc.c | 2 +- bfd/elf64-x86-64.c | 4 +++- bfd/elfcode.h | 1 + bfd/elfcore.h | 6 ++++++ bfd/elfn32-mips.c | 2 +- bfd/hppabsd-core.c | 1 + bfd/hpux-core.c | 1 + bfd/irix-core.c | 1 + bfd/libbfd-in.h | 2 ++ bfd/libbfd.c | 10 ++++++++++ bfd/libbfd.h | 2 ++ bfd/lynx-core.c | 1 + bfd/mach-o-target.c | 1 + bfd/osf-core.c | 1 + bfd/plugin.c | 7 +++++++ bfd/ptrace-core.c | 1 + bfd/sco5-core.c | 1 + bfd/targets.c | 4 +++- bfd/trad-core.c | 1 + bfd/xcoff-target.h | 1 + 44 files changed, 140 insertions(+), 41 deletions(-) Index: src/bfd/bfd-in2.h =================================================================== --- src.orig/bfd/bfd-in2.h 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/bfd-in2.h 2010-08-16 19:37:06.000000000 +0100 @@ -1977,8 +1977,8 @@ enum bfd_architecture #define bfd_mach_v850 1 #define bfd_mach_v850e 'E' #define bfd_mach_v850e1 '1' -#define bfd_mach_v850e2 0x4532 /* ('E'<<8|'2') */ -#define bfd_mach_v850e2v3 0x45325633 /* ('E'<<24|'2'<<16|'V'<<8|'3') */ +#define bfd_mach_v850e2 0x4532 +#define bfd_mach_v850e2v3 0x45325633 bfd_arch_arc, /* ARC Cores */ #define bfd_mach_arc_5 5 #define bfd_mach_arc_6 6 @@ -5412,6 +5412,8 @@ const char *bfd_core_file_failing_comman int bfd_core_file_failing_signal (bfd *abfd); +int bfd_core_file_pid (bfd *abfd); + bfd_boolean core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd); @@ -5608,11 +5610,13 @@ typedef struct bfd_target #define BFD_JUMP_TABLE_CORE(NAME) \ NAME##_core_file_failing_command, \ NAME##_core_file_failing_signal, \ - NAME##_core_file_matches_executable_p + NAME##_core_file_matches_executable_p, \ + NAME##_core_file_pid char * (*_core_file_failing_command) (bfd *); int (*_core_file_failing_signal) (bfd *); bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); + int (*_core_file_pid) (bfd *); /* Archive entry points. */ #define BFD_JUMP_TABLE_ARCHIVE(NAME) \ Index: src/bfd/corefile.c =================================================================== --- src.orig/bfd/corefile.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/corefile.c 2010-08-16 19:37:06.000000000 +0100 @@ -84,6 +84,31 @@ bfd_core_file_failing_signal (bfd *abfd) /* FUNCTION + bfd_core_file_pid + +SYNOPSIS + int bfd_core_file_pid (bfd *abfd); + +DESCRIPTION + + Returns the PID of the process the core dump the BFD + @var{abfd} is attached to was generated from. +*/ + +int +bfd_core_file_pid (bfd *abfd) +{ + if (abfd->format != bfd_core) + { + bfd_set_error (bfd_error_invalid_operation); + return 0; + } + return BFD_SEND (abfd, _core_file_pid, (abfd)); +} + + +/* +FUNCTION core_file_matches_executable_p SYNOPSIS Index: src/bfd/elf64-x86-64.c =================================================================== --- src.orig/bfd/elf64-x86-64.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf64-x86-64.c 2010-08-16 19:37:06.000000000 +0100 @@ -308,7 +308,7 @@ elf64_x86_64_grok_prstatus (bfd *abfd, E = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32); /* pr_reg */ @@ -332,6 +332,8 @@ elf64_x86_64_grok_psinfo (bfd *abfd, Elf return FALSE; case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */ + elf_tdata (abfd)->core_pid + = bfd_get_32 (abfd, note->descdata + 24); elf_tdata (abfd)->core_program = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16); elf_tdata (abfd)->core_command Index: src/bfd/elf-bfd.h =================================================================== --- src.orig/bfd/elf-bfd.h 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf-bfd.h 2010-08-16 19:37:06.000000000 +0100 @@ -1989,6 +1989,8 @@ extern int bfd_elf32_core_file_failing_s (bfd *); extern bfd_boolean bfd_elf32_core_file_matches_executable_p (bfd *, bfd *); +extern int bfd_elf32_core_file_pid + (bfd *); extern bfd_boolean bfd_elf32_swap_symbol_in (bfd *, const void *, const void *, Elf_Internal_Sym *); @@ -2033,6 +2035,8 @@ extern int bfd_elf64_core_file_failing_s (bfd *); extern bfd_boolean bfd_elf64_core_file_matches_executable_p (bfd *, bfd *); +extern int bfd_elf64_core_file_pid + (bfd *); extern bfd_boolean bfd_elf64_swap_symbol_in (bfd *, const void *, const void *, Elf_Internal_Sym *); Index: src/bfd/elfcode.h =================================================================== --- src.orig/bfd/elfcode.h 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elfcode.h 2010-08-16 19:37:06.000000000 +0100 @@ -87,6 +87,7 @@ #define elf_core_file_failing_signal NAME(bfd_elf,core_file_failing_signal) #define elf_core_file_matches_executable_p \ NAME(bfd_elf,core_file_matches_executable_p) +#define elf_core_file_pid NAME(bfd_elf,core_file_pid) #define elf_object_p NAME(bfd_elf,object_p) #define elf_core_file_p NAME(bfd_elf,core_file_p) #define elf_get_symtab_upper_bound NAME(bfd_elf,get_symtab_upper_bound) Index: src/bfd/elfcore.h =================================================================== --- src.orig/bfd/elfcore.h 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elfcore.h 2010-08-16 19:37:06.000000000 +0100 @@ -31,6 +31,12 @@ elf_core_file_failing_signal (bfd *abfd) return elf_tdata (abfd)->core_signal; } +int +elf_core_file_pid (bfd *abfd) +{ + return elf_tdata (abfd)->core_pid; +} + bfd_boolean elf_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd) { Index: src/bfd/plugin.c =================================================================== --- src.orig/bfd/plugin.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/plugin.c 2010-08-16 19:37:06.000000000 +0100 @@ -319,6 +319,13 @@ bfd_plugin_core_file_failing_signal (bfd return 0; } +static int +bfd_plugin_core_file_pid (bfd *abfd ATTRIBUTE_UNUSED) +{ + BFD_ASSERT (0); + return 0; +} + static long bfd_plugin_get_symtab_upper_bound (bfd *abfd) { Index: src/bfd/targets.c =================================================================== --- src.orig/bfd/targets.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/targets.c 2010-08-16 19:37:06.000000000 +0100 @@ -314,11 +314,13 @@ BFD_JUMP_TABLE macros. .#define BFD_JUMP_TABLE_CORE(NAME) \ . NAME##_core_file_failing_command, \ . NAME##_core_file_failing_signal, \ -. NAME##_core_file_matches_executable_p +. NAME##_core_file_matches_executable_p, \ +. NAME##_core_file_pid . . char * (*_core_file_failing_command) (bfd *); . int (*_core_file_failing_signal) (bfd *); . bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); +. int (*_core_file_pid) (bfd *); . . {* Archive entry points. *} .#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ Index: src/bfd/aout-target.h =================================================================== --- src.orig/bfd/aout-target.h 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/aout-target.h 2010-08-16 19:37:06.000000000 +0100 @@ -401,6 +401,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd #define MY_core_file_matches_executable_p \ _bfd_nocore_core_file_matches_executable_p #endif +#ifndef MY_core_file_pid +#define MY_core_file_pid _bfd_nocore_core_file_pid +#endif #ifndef MY_core_file_p #define MY_core_file_p _bfd_dummy_target #endif Index: src/bfd/elf.c =================================================================== --- src.orig/bfd/elf.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf.c 2010-08-16 19:37:06.000000000 +0100 @@ -7519,13 +7519,19 @@ _bfd_elf_rel_vtable_reloc_fn # include <sys/procfs.h> #endif -/* FIXME: this is kinda wrong, but it's what gdb wants. */ +/* Return a PID that identifies a "thread" for threaded cores, or the + PID of the main process for non-thread cores. */ static int elfcore_make_pid (bfd *abfd) { - return ((elf_tdata (abfd)->core_lwpid << 16) - + (elf_tdata (abfd)->core_pid)); + int pid; + + pid = elf_tdata (abfd)->core_lwpid; + if (pid == 0) + pid = elf_tdata (abfd)->core_pid; + + return pid; } /* If there isn't a section called NAME, make one, using @@ -7615,7 +7621,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In has already been set by another thread. */ if (elf_tdata (abfd)->core_signal == 0) elf_tdata (abfd)->core_signal = prstat.pr_cursig; - elf_tdata (abfd)->core_pid = prstat.pr_pid; + if (elf_tdata (abfd)->core_pid == 0) + elf_tdata (abfd)->core_pid = prstat.pr_pid; /* pr_who exists on: solaris 2.5+ @@ -7625,6 +7632,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In */ #if defined (HAVE_PRSTATUS_T_PR_WHO) elf_tdata (abfd)->core_lwpid = prstat.pr_who; +#else + elf_tdata (abfd)->core_lwpid = prstat.pr_pid; #endif } #if defined (HAVE_PRSTATUS32_T) @@ -7641,7 +7650,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In has already been set by another thread. */ if (elf_tdata (abfd)->core_signal == 0) elf_tdata (abfd)->core_signal = prstat.pr_cursig; - elf_tdata (abfd)->core_pid = prstat.pr_pid; + if (elf_tdata (abfd)->core_pid == 0) + elf_tdata (abfd)->core_pid = prstat.pr_pid; /* pr_who exists on: solaris 2.5+ @@ -7651,6 +7661,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In */ #if defined (HAVE_PRSTATUS32_T_PR_WHO) elf_tdata (abfd)->core_lwpid = prstat.pr_who; +#else + elf_tdata (abfd)->core_lwpid = prstat.pr_pid; #endif } #endif /* HAVE_PRSTATUS32_T */ Index: src/bfd/elf32-i386.c =================================================================== --- src.orig/bfd/elf32-i386.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-i386.c 2010-08-16 19:37:06.000000000 +0100 @@ -419,7 +419,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_I elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 20); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 28; @@ -437,7 +437,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_I elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; @@ -475,6 +475,8 @@ elf_i386_grok_psinfo (bfd *abfd, Elf_Int return FALSE; case 124: /* Linux/i386 elf_prpsinfo. */ + elf_tdata (abfd)->core_pid + = bfd_get_32 (abfd, note->descdata + 12); elf_tdata (abfd)->core_program = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); elf_tdata (abfd)->core_command Index: src/bfd/libbfd-in.h =================================================================== --- src.orig/bfd/libbfd-in.h 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/libbfd-in.h 2010-08-16 19:37:06.000000000 +0100 @@ -270,6 +270,8 @@ extern int _bfd_nocore_core_file_failing (bfd *); extern bfd_boolean _bfd_nocore_core_file_matches_executable_p (bfd *, bfd *); +extern int _bfd_nocore_core_file_pid + (bfd *); /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ Index: src/bfd/libbfd.c =================================================================== --- src.orig/bfd/libbfd.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/libbfd.c 2010-08-16 19:37:06.000000000 +0100 @@ -150,6 +150,16 @@ _bfd_nocore_core_file_failing_signal (bf return 0; } +/* Routine to handle the core_file_pid entry point for targets without + core file support. */ + +int +_bfd_nocore_core_file_pid (bfd *ignore_abfd ATTRIBUTE_UNUSED) +{ + bfd_set_error (bfd_error_invalid_operation); + return 0; +} + const bfd_target * _bfd_dummy_target (bfd *ignore_abfd ATTRIBUTE_UNUSED) { Index: src/bfd/aout-tic30.c =================================================================== --- src.orig/bfd/aout-tic30.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/aout-tic30.c 2010-08-16 19:37:06.000000000 +0100 @@ -859,6 +859,9 @@ tic30_aout_set_arch_mach (bfd *abfd, #define MY_core_file_matches_executable_p \ _bfd_nocore_core_file_matches_executable_p #endif +#ifndef MY_core_file_pid +#define MY_core_file_pid _bfd_nocore_core_file_pid +#endif #ifndef MY_core_file_p #define MY_core_file_p _bfd_dummy_target #endif Index: src/bfd/coff-rs6000.c =================================================================== --- src.orig/bfd/coff-rs6000.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/coff-rs6000.c 2010-08-16 19:37:06.000000000 +0100 @@ -112,6 +112,8 @@ extern int rs6000coff_core_file_failing_ rs6000coff_core_file_failing_signal #define coff_core_file_matches_executable_p \ rs6000coff_core_file_matches_executable_p +#define coff_core_file_pid \ + _bfd_nocore_core_file_pid #else #define CORE_FILE_P _bfd_dummy_target #define coff_core_file_failing_command \ @@ -120,6 +122,8 @@ extern int rs6000coff_core_file_failing_ _bfd_nocore_core_file_failing_signal #define coff_core_file_matches_executable_p \ _bfd_nocore_core_file_matches_executable_p +#define coff_core_file_pid \ + _bfd_nocore_core_file_pid #endif #define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in #define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out @@ -4182,9 +4186,7 @@ const bfd_target rs6000coff_vec = _bfd_generic_bfd_print_private_bfd_data, /* Core */ - coff_core_file_failing_command, - coff_core_file_failing_signal, - coff_core_file_matches_executable_p, + BFD_JUMP_TABLE_CORE (coff), /* Archive */ _bfd_xcoff_slurp_armap, @@ -4437,9 +4439,7 @@ const bfd_target pmac_xcoff_vec = _bfd_generic_bfd_print_private_bfd_data, /* Core */ - coff_core_file_failing_command, - coff_core_file_failing_signal, - coff_core_file_matches_executable_p, + BFD_JUMP_TABLE_CORE (coff), /* Archive */ _bfd_xcoff_slurp_armap, Index: src/bfd/coff64-rs6000.c =================================================================== --- src.orig/bfd/coff64-rs6000.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/coff64-rs6000.c 2010-08-16 19:37:06.000000000 +0100 @@ -256,6 +256,8 @@ extern int rs6000coff_core_file_failing_ rs6000coff_core_file_failing_signal #define coff_core_file_matches_executable_p \ rs6000coff_core_file_matches_executable_p +#define coff_core_file_pid \ + _bfd_nocore_core_file_pid #else #define CORE_FILE_P _bfd_dummy_target #define coff_core_file_failing_command \ @@ -264,6 +266,8 @@ extern int rs6000coff_core_file_failing_ _bfd_nocore_core_file_failing_signal #define coff_core_file_matches_executable_p \ _bfd_nocore_core_file_matches_executable_p +#define coff_core_file_pid \ + _bfd_nocore_core_file_pid #endif #define coff_SWAP_sym_in _bfd_xcoff64_swap_sym_in #define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out @@ -2753,9 +2757,7 @@ const bfd_target rs6000coff64_vec = _bfd_generic_bfd_print_private_bfd_data, /* Core */ - coff_core_file_failing_command, - coff_core_file_failing_signal, - coff_core_file_matches_executable_p, + BFD_JUMP_TABLE_CORE (coff), /* Archive */ xcoff64_slurp_armap, @@ -2835,6 +2837,8 @@ extern char *xcoff64_core_file_failing_c PARAMS ((bfd *)); extern int xcoff64_core_file_failing_signal PARAMS ((bfd *)); +#define xcoff64_core_file_pid \ + _bfd_nocore_core_file_pid /* AIX 5 */ static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data = @@ -3009,9 +3013,7 @@ const bfd_target aix5coff64_vec = _bfd_generic_bfd_print_private_bfd_data, /* Core */ - xcoff64_core_file_failing_command, - xcoff64_core_file_failing_signal, - xcoff64_core_file_matches_executable_p, + BFD_JUMP_TABLE_CORE (xcoff64), /* Archive */ xcoff64_slurp_armap, Index: src/bfd/mach-o-target.c =================================================================== --- src.orig/bfd/mach-o-target.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/mach-o-target.c 2010-08-16 19:37:06.000000000 +0100 @@ -58,6 +58,7 @@ #define bfd_mach_o_bfd_define_common_symbol bfd_generic_define_common_symbol #define bfd_mach_o_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data #define bfd_mach_o_core_file_matches_executable_p generic_core_file_matches_executable_p +#define bfd_mach_o_core_file_pid _bfd_nocore_core_file_pid #define bfd_mach_o_get_dynamic_symtab_upper_bound bfd_mach_o_get_symtab_upper_bound #define bfd_mach_o_canonicalize_dynamic_symtab bfd_mach_o_canonicalize_symtab Index: src/bfd/elf32-am33lin.c =================================================================== --- src.orig/bfd/elf32-am33lin.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-am33lin.c 2010-08-16 19:37:06.000000000 +0100 @@ -55,7 +55,7 @@ elf32_am33lin_grok_prstatus (bfd *abfd, elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-arm.c =================================================================== --- src.orig/bfd/elf32-arm.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-arm.c 2010-08-16 19:37:06.000000000 +0100 @@ -1829,7 +1829,7 @@ elf32_arm_nabi_grok_prstatus (bfd *abfd, elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-cris.c =================================================================== --- src.orig/bfd/elf32-cris.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-cris.c 2010-08-16 19:37:06.000000000 +0100 @@ -580,7 +580,7 @@ cris_elf_grok_prstatus (abfd, note) elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22); /* pr_reg */ offset = 70; @@ -599,7 +599,7 @@ cris_elf_grok_prstatus (abfd, note) elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22); /* pr_reg */ offset = 70; Index: src/bfd/elf32-frv.c =================================================================== --- src.orig/bfd/elf32-frv.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-frv.c 2010-08-16 19:37:07.000000000 +0100 @@ -6935,7 +6935,7 @@ elf32_frv_grok_prstatus (bfd *abfd, Elf_ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* `pr_pid' is at offset 24. */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* `pr_reg' is at offset 72. */ offset = 72; Index: src/bfd/elf32-hppa.c =================================================================== --- src.orig/bfd/elf32-hppa.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-hppa.c 2010-08-16 19:37:07.000000000 +0100 @@ -1736,7 +1736,7 @@ elf32_hppa_grok_prstatus (bfd *abfd, Elf elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-mips.c =================================================================== --- src.orig/bfd/elf32-mips.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-mips.c 2010-08-16 19:37:07.000000000 +0100 @@ -1506,7 +1506,7 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-ppc.c =================================================================== --- src.orig/bfd/elf32-ppc.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-ppc.c 2010-08-16 19:37:07.000000000 +0100 @@ -1858,7 +1858,7 @@ ppc_elf_grok_prstatus (bfd *abfd, Elf_In elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-s390.c =================================================================== --- src.orig/bfd/elf32-s390.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-s390.c 2010-08-16 19:37:07.000000000 +0100 @@ -3462,7 +3462,7 @@ elf_s390_grok_prstatus (abfd, note) elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-score.c =================================================================== --- src.orig/bfd/elf32-score.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-score.c 2010-08-16 19:37:07.000000000 +0100 @@ -3917,7 +3917,7 @@ s3_bfd_score_elf_grok_prstatus (bfd *abf elf_tdata (abfd)->core_signal = score_bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = score_bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = score_bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-score7.c =================================================================== --- src.orig/bfd/elf32-score7.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-score7.c 2010-08-16 19:37:07.000000000 +0100 @@ -3734,7 +3734,7 @@ s7_bfd_score_elf_grok_prstatus (bfd *abf elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-sh.c =================================================================== --- src.orig/bfd/elf32-sh.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-sh.c 2010-08-16 19:37:07.000000000 +0100 @@ -7438,7 +7438,7 @@ elf32_shlin_grok_prstatus (bfd *abfd, El elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf32-xtensa.c =================================================================== --- src.orig/bfd/elf32-xtensa.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf32-xtensa.c 2010-08-16 19:37:07.000000000 +0100 @@ -3802,7 +3802,7 @@ elf_xtensa_grok_prstatus (bfd *abfd, Elf elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/elf64-hppa.c =================================================================== --- src.orig/bfd/elf64-hppa.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf64-hppa.c 2010-08-16 19:37:07.000000000 +0100 @@ -2611,7 +2611,7 @@ elf64_hppa_grok_prstatus (bfd *abfd, Elf elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32); /* pr_reg */ offset = 112; Index: src/bfd/elf64-mips.c =================================================================== --- src.orig/bfd/elf64-mips.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf64-mips.c 2010-08-16 19:37:07.000000000 +0100 @@ -3083,7 +3083,7 @@ elf64_mips_grok_prstatus (bfd *abfd, Elf elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32); /* pr_reg */ offset = 112; Index: src/bfd/elf64-ppc.c =================================================================== --- src.orig/bfd/elf64-ppc.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elf64-ppc.c 2010-08-16 19:37:07.000000000 +0100 @@ -2651,7 +2651,7 @@ ppc64_elf_grok_prstatus (bfd *abfd, Elf_ elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32); /* pr_reg */ offset = 112; Index: src/bfd/elfn32-mips.c =================================================================== --- src.orig/bfd/elfn32-mips.c 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/elfn32-mips.c 2010-08-16 19:37:07.000000000 +0100 @@ -2332,7 +2332,7 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); /* pr_pid */ - elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24); /* pr_reg */ offset = 72; Index: src/bfd/libbfd.h =================================================================== --- src.orig/bfd/libbfd.h 2010-08-16 14:42:28.000000000 +0100 +++ src/bfd/libbfd.h 2010-08-16 19:37:07.000000000 +0100 @@ -275,6 +275,8 @@ extern int _bfd_nocore_core_file_failing (bfd *); extern bfd_boolean _bfd_nocore_core_file_matches_executable_p (bfd *, bfd *); +extern int _bfd_nocore_core_file_pid + (bfd *); /* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */ Index: src/bfd/trad-core.c =================================================================== --- src.orig/bfd/trad-core.c 2010-08-04 19:01:09.000000000 +0100 +++ src/bfd/trad-core.c 2010-08-17 12:50:48.000000000 +0100 @@ -71,6 +71,7 @@ const bfd_target *trad_unix_core_file_p char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd)); int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd)); #define trad_unix_core_file_matches_executable_p generic_core_file_matches_executable_p +#define trad_unix_core_file_pid _bfd_nocore_core_file_pid static void swap_abort PARAMS ((void)); /* Handle 4.2-style (and perhaps also sysV-style) core dump file. */ Index: src/bfd/aix386-core.c =================================================================== --- src.orig/bfd/aix386-core.c 2009-09-02 17:44:14.000000000 +0100 +++ src/bfd/aix386-core.c 2010-08-17 12:51:23.000000000 +0100 @@ -211,6 +211,8 @@ aix386_core_file_failing_signal (abfd) #define aix386_core_file_matches_executable_p generic_core_file_matches_executable_p +#define aix386_core_file_pid _bfd_nocore_core_file_pid + /* If somebody calls any byte-swapping routines, shoot them. */ static void Index: src/bfd/hppabsd-core.c =================================================================== --- src.orig/bfd/hppabsd-core.c 2007-07-03 15:26:42.000000000 +0100 +++ src/bfd/hppabsd-core.c 2010-08-17 12:52:45.000000000 +0100 @@ -59,6 +59,7 @@ static char *hppabsd_core_core_file_fail static int hppabsd_core_core_file_failing_signal PARAMS ((bfd *)); #define hppabsd_core_core_file_matches_executable_p generic_core_file_matches_executable_p +#define hppabsd_core_core_file_pid _bfd_nocore_core_file_pid static void swap_abort PARAMS ((void)); Index: src/bfd/hpux-core.c =================================================================== --- src.orig/bfd/hpux-core.c 2009-09-02 17:44:21.000000000 +0100 +++ src/bfd/hpux-core.c 2010-08-17 13:00:03.000000000 +0100 @@ -103,6 +103,7 @@ struct hpux_core_struct #define core_kernel_thread_id(bfd) (core_hdr(bfd)->lwpid) #define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid) #define hpux_core_core_file_matches_executable_p generic_core_file_matches_executable_p +#define hpux_core_core_file_pid _bfd_nocore_core_file_pid static asection *make_bfd_asection (bfd *, const char *, flagword, bfd_size_type, bfd_vma, unsigned int); Index: src/bfd/irix-core.c =================================================================== --- src.orig/bfd/irix-core.c 2009-09-02 17:44:21.000000000 +0100 +++ src/bfd/irix-core.c 2010-08-17 12:59:32.000000000 +0100 @@ -44,6 +44,7 @@ struct sgi_core_struct #define core_command(bfd) (core_hdr(bfd)->cmd) #define irix_core_core_file_matches_executable_p generic_core_file_matches_executable_p +#define irix_core_core_file_pid _bfd_nocore_core_file_pid static asection *make_bfd_asection (bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr); Index: src/bfd/lynx-core.c =================================================================== --- src.orig/bfd/lynx-core.c 2009-09-02 17:44:22.000000000 +0100 +++ src/bfd/lynx-core.c 2010-08-17 12:59:42.000000000 +0100 @@ -53,6 +53,7 @@ struct lynx_core_struct #define core_command(bfd) (core_hdr(bfd)->cmd) #define lynx_core_file_matches_executable_p generic_core_file_matches_executable_p +#define lynx_core_file_pid _bfd_nocore_core_file_pid /* Handle Lynx core dump file. */ Index: src/bfd/osf-core.c =================================================================== --- src.orig/bfd/osf-core.c 2009-09-02 17:44:22.000000000 +0100 +++ src/bfd/osf-core.c 2010-08-17 13:00:50.000000000 +0100 @@ -43,6 +43,7 @@ static char *osf_core_core_file_failing_ static int osf_core_core_file_failing_signal PARAMS ((bfd *)); #define osf_core_core_file_matches_executable_p generic_core_file_matches_executable_p +#define osf_core_core_file_pid _bfd_nocore_core_file_pid static void swap_abort PARAMS ((void)); Index: src/bfd/ptrace-core.c =================================================================== --- src.orig/bfd/ptrace-core.c 2009-09-02 17:44:22.000000000 +0100 +++ src/bfd/ptrace-core.c 2010-08-17 13:01:29.000000000 +0100 @@ -53,6 +53,7 @@ const bfd_target *ptrace_unix_core_file_ char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd)); int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd)); #define ptrace_unix_core_file_matches_executable_p generic_core_file_matches_executable_p +#define ptrace_unix_core_file_pid _bfd_nocore_core_file_pid static void swap_abort PARAMS ((void)); const bfd_target * Index: src/bfd/sco5-core.c =================================================================== --- src.orig/bfd/sco5-core.c 2007-07-03 15:26:42.000000000 +0100 +++ src/bfd/sco5-core.c 2010-08-17 13:05:30.000000000 +0100 @@ -51,6 +51,7 @@ const bfd_target *sco5_core_file_p PARAM char *sco5_core_file_failing_command PARAMS ((bfd *abfd)); int sco5_core_file_failing_signal PARAMS ((bfd *abfd)); #define sco5_core_file_matches_executable_p generic_core_file_matches_executable_p +#define sco5_core_file_pid _bfd_nocore_core_file_pid static void swap_abort PARAMS ((void)); static asection * Index: src/bfd/xcoff-target.h =================================================================== --- src.orig/bfd/xcoff-target.h 2009-09-02 17:44:23.000000000 +0100 +++ src/bfd/xcoff-target.h 2010-08-17 13:03:54.000000000 +0100 @@ -51,6 +51,7 @@ #define coff_core_file_failing_command _bfd_nocore_core_file_failing_command #define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal #define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p +#define coff_core_file_pid _bfd_nocore_core_file_pid #define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents #define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section #define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
- Previous message (by thread): [PATCH] add a bfd interface to get at a core file's PID
- Next message (by thread): [PATCH] add a bfd interface to get at a core file's PID
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list