summaryrefslogtreecommitdiff
path: root/gdb/linux-proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/linux-proc.c')
-rw-r--r--gdb/linux-proc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c
index aa3b5711da0..f76def3a3a2 100644
--- a/gdb/linux-proc.c
+++ b/gdb/linux-proc.c
@@ -31,6 +31,7 @@
#include "gdbthread.h" /* for struct thread_info etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
#include "cli/cli-decode.h" /* for add_info */
+#include "gdb_string.h"
/* Function: child_pid_to_exec_file
*
@@ -197,10 +198,12 @@ linux_do_thread_registers (bfd *obfd, ptid_t ptid,
return note_data;
}
-struct linux_corefile_thread_data {
- bfd *obfd;
+struct linux_corefile_thread_data
+{
+ bfd *obfd;
char *note_data;
- int *note_size;
+ int *note_size;
+ int num_notes;
};
/* Function: linux_corefile_thread_callback
@@ -223,6 +226,7 @@ linux_corefile_thread_callback (struct thread_info *ti, void *data)
ti->ptid,
args->note_data,
args->note_size);
+ args->num_notes++;
inferior_ptid = saved_ptid;
registers_changed ();
target_fetch_registers (-1); /* FIXME should not be necessary;
@@ -270,11 +274,12 @@ linux_make_note_section (bfd *obfd, int *note_size)
thread_args.obfd = obfd;
thread_args.note_data = note_data;
thread_args.note_size = note_size;
+ thread_args.num_notes = 0;
iterate_over_threads (linux_corefile_thread_callback, &thread_args);
- if (thread_args.note_data == note_data)
+ if (thread_args.num_notes == 0)
{
/* iterate_over_threads didn't come up with any threads;
- just use inferior_ptid. */
+ just use inferior_ptid. */
note_data = linux_do_thread_registers (obfd, inferior_ptid,
note_data, note_size);
}