1 Status: Checked in to HEAD after 6.3.
3 2004-11-07 Andrew Cagney <cagney@redhat.com>
4 Daniel Jacobowitz <dan@debian.org>
5 Roland McGrath <roland@redhat.com>
7 * Makefile.in (symfile-mem.o): Update dependencies.
8 * i386-linux-tdep.c (i386_linux_dwarf_signal_frame_p): New.
9 (i386_linux_init_abi): Call dwarf2_frame_set_signal_frame_p.
10 * inf-ptrace.c (inf_ptrace_attach): Call
11 observer_notify_inferior_created.
12 * inftarg.c (child_attach): Likewise.
13 * symfile-mem.c: Include "observer.h", "auxv.h", and "elf/common.h".
14 (symbol_file_add_from_memory): Take NAME argument. Use it for
15 the new BFD's filename.
16 (add_symbol_file_from_memory_command): Update call to
17 symbol_file_add_from_memory.
18 (struct symbol_file_add_from_memory_args, add_vsyscall_page)
19 (symbol_file_add_from_memory_wrapper): New.
20 (_initialize_symfile_mem): Register add_vsyscall_page as an
21 inferior_created observer.
23 Index: gdb-6.3/gdb/i386-linux-tdep.c
24 ===================================================================
25 --- gdb-6.3.orig/gdb/i386-linux-tdep.c 2004-08-06 16:58:28.000000000 -0400
26 +++ gdb-6.3/gdb/i386-linux-tdep.c 2004-11-10 00:55:06.669398770 -0500
30 #include "reggroups.h"
31 +#include "dwarf2-frame.h"
33 #include "gdb_string.h"
35 @@ -244,6 +245,27 @@ i386_linux_sigtramp_p (struct frame_info
36 || strcmp ("__restore_rt", name) == 0);
39 +/* Return one if the unwound PC from NEXT_FRAME is in a signal trampoline
40 + which may have DWARF-2 CFI. */
43 +i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
44 + struct frame_info *next_frame)
46 + CORE_ADDR pc = frame_pc_unwind (next_frame);
49 + find_pc_partial_function (pc, &name, NULL, NULL);
51 + /* If a vsyscall DSO is in use, the signal trampolines may have these
53 + if (name && (strcmp (name, "__kernel_sigreturn") == 0
54 + || strcmp (name, "__kernel_rt_sigreturn") == 0))
60 /* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
61 #define I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 20
63 @@ -414,6 +436,8 @@ i386_linux_init_abi (struct gdbarch_info
65 /* GNU/Linux uses the dynamic linker included in the GNU C Library. */
66 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
68 + dwarf2_frame_set_signal_frame_p (gdbarch, i386_linux_dwarf_signal_frame_p);
71 /* Provide a prototype to silence -Wmissing-prototypes. */
72 Index: gdb-6.3/gdb/inf-ptrace.c
73 ===================================================================
74 --- gdb-6.3.orig/gdb/inf-ptrace.c 2004-10-15 09:29:33.000000000 -0400
75 +++ gdb-6.3/gdb/inf-ptrace.c 2004-11-10 00:53:43.697615843 -0500
76 @@ -220,6 +220,10 @@ inf_ptrace_attach (char *args, int from_
78 inferior_ptid = pid_to_ptid (pid);
79 push_target (ptrace_ops_hack);
81 + /* Do this first, before anything has had a chance to query the
82 + inferior's symbol table or similar. */
83 + observer_notify_inferior_created (¤t_target, from_tty);
87 Index: gdb-6.3/gdb/inftarg.c
88 ===================================================================
89 --- gdb-6.3.orig/gdb/inftarg.c 2004-10-08 16:29:47.000000000 -0400
90 +++ gdb-6.3/gdb/inftarg.c 2004-11-10 00:53:43.711613107 -0500
91 @@ -211,6 +211,10 @@ child_attach (char *args, int from_tty)
93 inferior_ptid = pid_to_ptid (pid);
94 push_target (&deprecated_child_ops);
96 + /* Do this first, before anything has had a chance to query the
97 + inferior's symbol table or similar. */
98 + observer_notify_inferior_created (¤t_target, from_tty);
101 #if !defined(CHILD_POST_ATTACH)
102 Index: gdb-6.3/gdb/symfile-mem.c
103 ===================================================================
104 --- gdb-6.3.orig/gdb/symfile-mem.c 2004-07-17 10:24:07.000000000 -0400
105 +++ gdb-6.3/gdb/symfile-mem.c 2004-11-10 00:53:43.722610958 -0500
110 +#include "observer.h"
112 +#include "elf/common.h"
115 /* Read inferior memory at ADDR to find the header of a loaded object file
116 and read its in-core symbols out of inferior memory. TEMPL is a bfd
117 - representing the target's format. */
118 + representing the target's format. NAME is the name to use for this
119 + symbol file in messages; it can be NULL or a malloc-allocated string
120 + which will be attached to the BFD. */
121 static struct objfile *
122 -symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, int from_tty)
123 +symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name,
126 struct objfile *objf;
128 @@ -75,7 +81,10 @@ symbol_file_add_from_memory (struct bfd
130 error ("Failed to read a valid object file image from memory.");
132 - nbfd->filename = xstrdup ("shared object read from target memory");
134 + nbfd->filename = xstrdup ("shared object read from target memory");
136 + nbfd->filename = name;
138 if (!bfd_check_format (nbfd, bfd_object))
140 @@ -129,7 +138,73 @@ add_symbol_file_from_memory_command (cha
142 Must use symbol-file or exec-file before add-symbol-file-from-memory.");
144 - symbol_file_add_from_memory (templ, addr, from_tty);
145 + symbol_file_add_from_memory (templ, addr, NULL, from_tty);
148 +/* Arguments for symbol_file_add_from_memory_wrapper. */
150 +struct symbol_file_add_from_memory_args
153 + CORE_ADDR sysinfo_ehdr;
158 +/* Wrapper function for symbol_file_add_from_memory, for
159 + catch_exceptions. */
162 +symbol_file_add_from_memory_wrapper (struct ui_out *uiout, void *data)
164 + struct symbol_file_add_from_memory_args *args = data;
166 + symbol_file_add_from_memory (args->bfd, args->sysinfo_ehdr, args->name,
171 +/* Try to add the symbols for the vsyscall page, if there is one. This function
172 + is called via the inferior_created observer. */
175 +add_vsyscall_page (struct target_ops *target, int from_tty)
177 + CORE_ADDR sysinfo_ehdr;
179 + if (target_auxv_search (target, AT_SYSINFO_EHDR, &sysinfo_ehdr) > 0
180 + && sysinfo_ehdr != (CORE_ADDR) 0)
183 + struct symbol_file_add_from_memory_args args;
185 + if (core_bfd != NULL)
187 + else if (exec_bfd != NULL)
190 + /* FIXME: cagney/2004-05-06: Should not require an existing
191 + BFD when trying to create a run-time BFD of the VSYSCALL
192 + page in the inferior. Unfortunately that's the current
193 + interface so for the moment bail. Introducing a
194 + ``bfd_runtime'' (a BFD created using the loaded image) file
195 + format should fix this. */
197 + warning ("could not load vsyscall page because no executable was specified");
198 + warning ("try using the \"file\" command first");
202 + args.sysinfo_ehdr = sysinfo_ehdr;
203 + xasprintf (&args.name, "system-supplied DSO at 0x%s",
204 + paddr_nz (sysinfo_ehdr));
205 + /* Pass zero for FROM_TTY, because the action of loading the
206 + vsyscall DSO was not triggered by the user, even if the user
207 + typed "run" at the TTY. */
209 + catch_exceptions (uiout, symbol_file_add_from_memory_wrapper,
210 + &args, NULL, RETURN_MASK_ALL);
215 @@ -143,4 +218,7 @@ Load the symbols out of memory from a dy
216 Give an expression for the address of the file's shared object file header.",
219 + /* Want to know of each new inferior so that its vsyscall info can
221 + observer_attach_inferior_created (add_vsyscall_page);
223 Index: gdb-6.3/gdb/Makefile.in
224 ===================================================================
225 --- gdb-6.3.orig/gdb/Makefile.in 2004-11-10 00:29:00.000000000 -0500
226 +++ gdb-6.3/gdb/Makefile.in 2004-11-10 00:54:47.728100986 -0500
227 @@ -2020,7 +2020,7 @@ i386-linux-nat.o: i386-linux-nat.c $(def
228 i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
229 $(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
230 $(gdb_string_h) $(i386_tdep_h) $(i386_linux_tdep_h) $(glibc_tdep_h) \
232 + $(solib_svr4_h) $(dwarf2_frame_h)
233 i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
234 $(regcache_h) $(target_h) $(osabi_h) $(i386_tdep_h)
235 i386-nat.o: i386-nat.c $(defs_h) $(breakpoint_h) $(command_h) $(gdbcmd_h)
236 @@ -2606,7 +2606,8 @@ symfile.o: symfile.c $(defs_h) $(bfdlink
237 $(hashtab_h) $(readline_h) $(gdb_assert_h) $(block_h) \
238 $(gdb_string_h) $(gdb_stat_h)
239 symfile-mem.o: symfile-mem.c $(defs_h) $(symtab_h) $(gdbcore_h) \
240 - $(objfiles_h) $(gdbcmd_h) $(target_h) $(value_h) $(symfile_h)
241 + $(objfiles_h) $(gdbcmd_h) $(target_h) $(value_h) $(symfile_h) \
242 + $(observer_h) $(auxv_h) $(elf_common_h)
243 symmisc.o: symmisc.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(bfd_h) \
244 $(symfile_h) $(objfiles_h) $(breakpoint_h) $(command_h) \
245 $(gdb_obstack_h) $(language_h) $(bcache_h) $(block_h) $(gdb_regex_h) \