aboutsummaryrefslogtreecommitdiff
path: root/gdb/corelow.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-01-26 16:44:29 +0000
committerPedro Alves <palves@redhat.com>2012-01-26 16:44:29 +0000
commit88f38a04788e0a788dbc3159c87d4c96c867f681 (patch)
tree04f82576dd5a95d961ea7eb5e74971dbf9e8d150 /gdb/corelow.c
parentf8819316e7a78afb1f71e461b1d85b624e129855 (diff)
downloadfsf-binutils-gdb-88f38a04788e0a788dbc3159c87d4c96c867f681.zip
fsf-binutils-gdb-88f38a04788e0a788dbc3159c87d4c96c867f681.tar.gz
fsf-binutils-gdb-88f38a04788e0a788dbc3159c87d4c96c867f681.tar.bz2
2012-01-26 Pedro Alves <palves@redhat.com>
* corelow.c (core_has_fake_pid): Delete. (core_close): Delete references to `core_has_fake_pid'. (add_to_thread_list): Adjust to mark the inferior's pid as fake. (core_open): Delete references to `core_has_fake_pid'. (core_pid_to_str): Adjust to check inferior->fake_pid_p instead of the removed global.
Diffstat (limited to 'gdb/corelow.c')
-rw-r--r--gdb/corelow.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 3e0c7cd..aa344c6 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -75,9 +75,6 @@ struct gdbarch *core_gdbarch = NULL;
unix child targets. */
static struct target_section_table *core_data;
-/* True if we needed to fake the pid of the loaded core inferior. */
-static int core_has_fake_pid = 0;
-
static void core_files_info (struct target_ops *);
static struct core_fns *sniff_core_bfd (bfd *);
@@ -217,7 +214,6 @@ core_close (int quitting)
xfree (core_data);
core_data = NULL;
}
- core_has_fake_pid = 0;
name = bfd_get_filename (core_bfd);
gdb_bfd_close_or_warn (core_bfd);
@@ -244,6 +240,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
int core_tid;
int pid, lwpid;
asection *reg_sect = (asection *) reg_sect_arg;
+ int fake_pid_p = 0;
+ struct inferior *inf;
if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
return;
@@ -253,14 +251,18 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
pid = bfd_core_file_pid (core_bfd);
if (pid == 0)
{
- core_has_fake_pid = 1;
+ fake_pid_p = 1;
pid = CORELOW_PID;
}
lwpid = core_tid;
- if (current_inferior ()->pid == 0)
- inferior_appeared (current_inferior (), pid);
+ inf = current_inferior ();
+ if (inf->pid == 0)
+ {
+ inferior_appeared (inf, pid);
+ inf->fake_pid_p = fake_pid_p;
+ }
ptid = ptid_build (pid, lwpid, 0);
@@ -382,7 +384,6 @@ core_open (char *filename, int from_tty)
init_thread_list ();
inferior_ptid = null_ptid;
- core_has_fake_pid = 0;
/* Need to flush the register cache (and the frame cache) from a
previous debug session. If inferior_ptid ends up the same as the
@@ -849,6 +850,7 @@ static char *
core_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[64];
+ struct inferior *inf;
int pid;
/* The preferred way is to have a gdbarch/OS specific
@@ -867,7 +869,8 @@ core_pid_to_str (struct target_ops *ops, ptid_t ptid)
/* Otherwise, this isn't a "threaded" core -- use the PID field, but
only if it isn't a fake PID. */
- if (!core_has_fake_pid)
+ inf = find_inferior_pid (ptid_get_pid (ptid));
+ if (inf != NULL && !inf->fake_pid_p)
return normal_pid_to_str (ptid);
/* No luck. We simply don't have a valid PID to print. */