aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2010-08-18 12:24:13 +0000
committerPedro Alves <palves@redhat.com>2010-08-18 12:24:13 +0000
commit261b8d0859fcd2ee7a43e1b3d2db6b2496bd6d61 (patch)
tree26da7642d3d3a806ac577223ef3975681a392308 /gdb
parentd1f52f54d5ddf44dcb214ebfddca5d6b549eb7f7 (diff)
downloadgdb-261b8d0859fcd2ee7a43e1b3d2db6b2496bd6d61.zip
gdb-261b8d0859fcd2ee7a43e1b3d2db6b2496bd6d61.tar.gz
gdb-261b8d0859fcd2ee7a43e1b3d2db6b2496bd6d61.tar.bz2
2010-08-18 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. * netbsd-core.c (netbsd_core_core_file_pid): New define. gdb/ 2010-08-18 Pedro Alves <pedro@codesourcery.com> PR corefile/8210 gdb/ * corelow.c (add_to_thread_list): Don't use gdbarch_core_reg_section_encodes_pid. Use bfd_core_file_pid. (get_core_register_section): Don't use gdbarch_core_reg_section_encodes_pid. * gdbarch.sh (core_reg_section_encodes_pid): Delete. * gdbarch.h, gdbarch.c: Regenerate. * amd64-sol2-tdep.c (amd64_sol2_init_abi): Don't set gdbarch_core_reg_section_encodes_pid. * i386-sol2-tdep.c (i386_sol2_init_abi): Ditto. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Ditto. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Ditto.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/amd64-sol2-tdep.c4
-rw-r--r--gdb/corelow.c38
-rw-r--r--gdb/gdbarch.c23
-rw-r--r--gdb/gdbarch.h9
-rwxr-xr-xgdb/gdbarch.sh7
-rw-r--r--gdb/i386-sol2-tdep.c4
-rw-r--r--gdb/sparc-sol2-tdep.c4
-rw-r--r--gdb/sparc64-sol2-tdep.c4
9 files changed, 22 insertions, 88 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 02b2e5a..eb3491a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-18 Pedro Alves <pedro@codesourcery.com>
+
+ PR corefile/8210
+
+ * corelow.c (add_to_thread_list): Don't use
+ gdbarch_core_reg_section_encodes_pid. Use bfd_core_file_pid.
+ (get_core_register_section): Don't use
+ gdbarch_core_reg_section_encodes_pid.
+
+ * gdbarch.sh (core_reg_section_encodes_pid): Delete.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * amd64-sol2-tdep.c (amd64_sol2_init_abi): Don't set
+ gdbarch_core_reg_section_encodes_pid.
+ * i386-sol2-tdep.c (i386_sol2_init_abi): Ditto.
+ * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Ditto.
+ * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Ditto.
+
2010-08-18 Yao Qi <yao@codesourcery.com>
* MAINTAINERS : Add myself under Write After Approval.
diff --git a/gdb/amd64-sol2-tdep.c b/gdb/amd64-sol2-tdep.c
index 0cf5e83..e8c0a80 100644
--- a/gdb/amd64-sol2-tdep.c
+++ b/gdb/amd64-sol2-tdep.c
@@ -114,10 +114,6 @@ amd64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
- /* Solaris encodes the pid of the inferior in regset section
- names. */
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
-
/* How to print LWP PTIDs from core files. */
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 9d00471..6e97962 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -252,29 +252,15 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
core_tid = atoi (bfd_section_name (abfd, asect) + 5);
- if (core_gdbarch
- && gdbarch_core_reg_section_encodes_pid (core_gdbarch))
- {
- uint32_t merged_pid = core_tid;
- pid = merged_pid & 0xffff;
- lwpid = merged_pid >> 16;
-
- /* This can happen on solaris core, for example, if we don't
- find a NT_PSTATUS note in the core, but do find NT_LWPSTATUS
- notes. */
- if (pid == 0)
- {
- core_has_fake_pid = 1;
- pid = CORELOW_PID;
- }
- }
- else
+ pid = bfd_core_file_pid (core_bfd);
+ if (pid == 0)
{
core_has_fake_pid = 1;
pid = CORELOW_PID;
- lwpid = core_tid;
}
+ lwpid = core_tid;
+
if (current_inferior ()->pid == 0)
inferior_appeared (current_inferior (), pid);
@@ -520,21 +506,7 @@ get_core_register_section (struct regcache *regcache,
xfree (section_name);
- if (core_gdbarch
- && gdbarch_core_reg_section_encodes_pid (core_gdbarch))
- {
- uint32_t merged_pid;
- int pid = ptid_get_pid (inferior_ptid);
-
- if (core_has_fake_pid)
- pid = 0;
-
- merged_pid = ptid_get_lwp (inferior_ptid);
- merged_pid = merged_pid << 16 | pid;
-
- section_name = xstrprintf ("%s/%s", name, plongest (merged_pid));
- }
- else if (ptid_get_lwp (inferior_ptid))
+ if (ptid_get_lwp (inferior_ptid))
section_name = xstrprintf ("%s/%ld", name, ptid_get_lwp (inferior_ptid));
else
section_name = xstrdup (name);
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 4ff9f54..78e5c48 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -234,7 +234,6 @@ struct gdbarch
gdbarch_register_reggroup_p_ftype *register_reggroup_p;
gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
gdbarch_regset_from_core_section_ftype *regset_from_core_section;
- int core_reg_section_encodes_pid;
struct core_regset_section * core_regset_sections;
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
gdbarch_core_pid_to_str_ftype *core_pid_to_str;
@@ -385,7 +384,6 @@ struct gdbarch startup_gdbarch =
default_register_reggroup_p, /* register_reggroup_p */
0, /* fetch_pointer_argument */
0, /* regset_from_core_section */
- 0, /* core_reg_section_encodes_pid */
0, /* core_regset_sections */
0, /* core_xfer_shared_libraries */
0, /* core_pid_to_str */
@@ -667,7 +665,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of register_reggroup_p, invalid_p == 0 */
/* Skip verify of fetch_pointer_argument, has predicate */
/* Skip verify of regset_from_core_section, has predicate */
- /* Skip verify of core_reg_section_encodes_pid, invalid_p == 0 */
/* Skip verify of core_xfer_shared_libraries, has predicate */
/* Skip verify of core_pid_to_str, has predicate */
/* Skip verify of gcore_bfd_target, has predicate */
@@ -818,9 +815,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: core_read_description = <%s>\n",
host_address_to_string (gdbarch->core_read_description));
fprintf_unfiltered (file,
- "gdbarch_dump: core_reg_section_encodes_pid = %s\n",
- plongest (gdbarch->core_reg_section_encodes_pid));
- fprintf_unfiltered (file,
"gdbarch_dump: core_regset_sections = %s\n",
host_address_to_string (gdbarch->core_regset_sections));
fprintf_unfiltered (file,
@@ -3095,23 +3089,6 @@ set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch,
gdbarch->regset_from_core_section = regset_from_core_section;
}
-int
-gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- /* Skip verify of core_reg_section_encodes_pid, invalid_p == 0 */
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_core_reg_section_encodes_pid called\n");
- return gdbarch->core_reg_section_encodes_pid;
-}
-
-void
-set_gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch,
- int core_reg_section_encodes_pid)
-{
- gdbarch->core_reg_section_encodes_pid = core_reg_section_encodes_pid;
-}
-
struct core_regset_section *
gdbarch_core_regset_sections (struct gdbarch *gdbarch)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f6c7ce8..443e1d5 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -666,15 +666,6 @@ typedef const struct regset * (gdbarch_regset_from_core_section_ftype) (struct g
extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section);
-/* When creating core dumps, some systems encode the PID in addition
- to the LWP id in core file register section names. In those cases, the
- "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID]. This setting
- is set to true for such architectures; false if "XXX" represents an LWP
- or thread id with no special encoding. */
-
-extern int gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch);
-extern void set_gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch, int core_reg_section_encodes_pid);
-
/* Supported register notes in a core file. */
extern struct core_regset_section * gdbarch_core_regset_sections (struct gdbarch *gdbarch);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 10f9477..5b66116 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -612,13 +612,6 @@ F:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct ty
# name SECT_NAME and size SECT_SIZE.
M:const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size
-# When creating core dumps, some systems encode the PID in addition
-# to the LWP id in core file register section names. In those cases, the
-# "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID]. This setting
-# is set to true for such architectures; false if "XXX" represents an LWP
-# or thread id with no special encoding.
-v:int:core_reg_section_encodes_pid:::0:0::0
-
# Supported register notes in a core file.
v:struct core_regset_section *:core_regset_sections:const char *name, int len::::::host_address_to_string (gdbarch->core_regset_sections)
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
index 49a3387..d656d87 100644
--- a/gdb/i386-sol2-tdep.c
+++ b/gdb/i386-sol2-tdep.c
@@ -136,10 +136,6 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
- /* Solaris encodes the pid of the inferior in regset section
- names. */
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
-
/* How to print LWP PTIDs from core files. */
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
}
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index a2f3521..62d113c 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -232,10 +232,6 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_append_unwinder (gdbarch, &sparc32_sol2_sigtramp_frame_unwind);
- /* Solaris encodes the pid of the inferior in regset section
- names. */
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
-
/* How to print LWP PTIDs from core files. */
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
}
diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c
index 0c2b901..4e57ff1 100644
--- a/gdb/sparc64-sol2-tdep.c
+++ b/gdb/sparc64-sol2-tdep.c
@@ -181,10 +181,6 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Solaris has kernel-assisted single-stepping support. */
set_gdbarch_software_single_step (gdbarch, NULL);
- /* Solaris encodes the pid of the inferior in regset section
- names. */
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
-
/* How to print LWP PTIDs from core files. */
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
}