2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/dwarf2read.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/dwarf2read.c 2007-10-13 05:27:15.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/dwarf2read.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -1226,7 +1226,7 @@ dwarf2_build_psymtabs (struct objfile *o
|
2005-01-11 00:15:58 +00:00
|
|
|
|
else
|
|
|
|
|
dwarf2_per_objfile->loc_buffer = NULL;
|
|
|
|
|
|
|
|
|
|
- if (mainline
|
|
|
|
|
+ if ((mainline == 1)
|
|
|
|
|
|| (objfile->global_psymbols.size == 0
|
|
|
|
|
&& objfile->static_psymbols.size == 0))
|
|
|
|
|
{
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/auxv.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/auxv.c 2007-08-23 20:08:26.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/auxv.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -80,7 +80,7 @@ procfs_xfer_auxv (struct target_ops *ops
|
2005-01-11 00:15:58 +00:00
|
|
|
|
Return 1 if an entry was read into *TYPEP and *VALP. */
|
|
|
|
|
int
|
2006-07-11 06:33:02 +00:00
|
|
|
|
target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
|
|
|
|
|
- gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
|
|
|
|
|
+ gdb_byte *endptr, ULONGEST *typep, CORE_ADDR *valp)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
{
|
|
|
|
|
const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
gdb_byte *ptr = *readptr;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -105,9 +105,10 @@ target_auxv_parse (struct target_ops *op
|
2005-01-11 00:15:58 +00:00
|
|
|
|
an error getting the information. On success, return 1 after
|
|
|
|
|
storing the entry's value field in *VALP. */
|
|
|
|
|
int
|
|
|
|
|
-target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
|
|
|
|
|
+target_auxv_search (struct target_ops *ops, ULONGEST match, CORE_ADDR *valp)
|
|
|
|
|
{
|
|
|
|
|
- CORE_ADDR type, val;
|
|
|
|
|
+ CORE_ADDR val;
|
|
|
|
|
+ ULONGEST at_type;
|
2006-07-11 06:33:02 +00:00
|
|
|
|
gdb_byte *data;
|
2007-01-21 01:53:01 +00:00
|
|
|
|
LONGEST n = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL, &data);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
gdb_byte *ptr = data;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -117,10 +118,10 @@ target_auxv_search (struct target_ops *o
|
2005-01-11 00:15:58 +00:00
|
|
|
|
return n;
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
- switch (target_auxv_parse (ops, &ptr, data + n, &type, &val))
|
|
|
|
|
+ switch (target_auxv_parse (ops, &ptr, data + n, &at_type, &val))
|
|
|
|
|
{
|
|
|
|
|
case 1: /* Here's an entry, check it. */
|
|
|
|
|
- if (type == match)
|
|
|
|
|
+ if (at_type == match)
|
|
|
|
|
{
|
|
|
|
|
xfree (data);
|
|
|
|
|
*valp = val;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -143,7 +144,8 @@ target_auxv_search (struct target_ops *o
|
2005-01-11 00:15:58 +00:00
|
|
|
|
int
|
|
|
|
|
fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
|
|
|
|
|
{
|
|
|
|
|
- CORE_ADDR type, val;
|
|
|
|
|
+ CORE_ADDR val;
|
|
|
|
|
+ ULONGEST at_type;
|
2006-07-11 06:33:02 +00:00
|
|
|
|
gdb_byte *data;
|
2007-01-21 01:53:01 +00:00
|
|
|
|
LONGEST len = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL,
|
|
|
|
|
&data);
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -153,14 +155,14 @@ fprint_target_auxv (struct ui_file *file
|
2005-01-11 00:15:58 +00:00
|
|
|
|
if (len <= 0)
|
|
|
|
|
return len;
|
|
|
|
|
|
|
|
|
|
- while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0)
|
|
|
|
|
+ while (target_auxv_parse (ops, &ptr, data + len, &at_type, &val) > 0)
|
|
|
|
|
{
|
|
|
|
|
extern int addressprint;
|
|
|
|
|
const char *name = "???";
|
|
|
|
|
const char *description = "";
|
|
|
|
|
enum { dec, hex, str } flavor = hex;
|
|
|
|
|
|
|
|
|
|
- switch (type)
|
|
|
|
|
+ switch (at_type)
|
|
|
|
|
{
|
|
|
|
|
#define TAG(tag, text, kind) \
|
|
|
|
|
case tag: name = #tag; description = text; flavor = kind; break
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -211,7 +213,7 @@ fprint_target_auxv (struct ui_file *file
|
2005-01-11 00:15:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf_filtered (file, "%-4s %-20s %-30s ",
|
|
|
|
|
- paddr_d (type), name, description);
|
|
|
|
|
+ paddr_d (at_type), name, description);
|
|
|
|
|
switch (flavor)
|
|
|
|
|
{
|
|
|
|
|
case dec:
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/auxv.h
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/auxv.h 2007-08-23 20:08:26.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/auxv.h 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -35,14 +35,14 @@ struct target_ops; /* Forward declarati
|
2005-01-11 00:15:58 +00:00
|
|
|
|
Return 1 if an entry was read into *TYPEP and *VALP. */
|
|
|
|
|
extern int target_auxv_parse (struct target_ops *ops,
|
2006-07-11 06:33:02 +00:00
|
|
|
|
gdb_byte **readptr, gdb_byte *endptr,
|
2005-01-11 00:15:58 +00:00
|
|
|
|
- CORE_ADDR *typep, CORE_ADDR *valp);
|
|
|
|
|
+ ULONGEST *typep, CORE_ADDR *valp);
|
|
|
|
|
|
|
|
|
|
/* Extract the auxiliary vector entry with a_type matching MATCH.
|
|
|
|
|
Return zero if no such entry was found, or -1 if there was
|
|
|
|
|
an error getting the information. On success, return 1 after
|
|
|
|
|
storing the entry's value field in *VALP. */
|
|
|
|
|
extern int target_auxv_search (struct target_ops *ops,
|
|
|
|
|
- CORE_ADDR match, CORE_ADDR *valp);
|
|
|
|
|
+ ULONGEST match, CORE_ADDR *valp);
|
|
|
|
|
|
|
|
|
|
/* Print the contents of the target's AUXV on the specified file. */
|
|
|
|
|
extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/breakpoint.h
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/breakpoint.h 2007-10-13 05:09:50.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/breakpoint.h 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -153,6 +153,7 @@ enum enable_state
|
2005-01-11 00:15:58 +00:00
|
|
|
|
automatically enabled and reset when the call
|
|
|
|
|
"lands" (either completes, or stops at another
|
|
|
|
|
eventpoint). */
|
|
|
|
|
+ bp_startup_disabled,
|
|
|
|
|
bp_permanent /* There is a breakpoint instruction hard-wired into
|
|
|
|
|
the target's code. Don't try to write another
|
|
|
|
|
breakpoint instruction on top of it, or restore
|
2006-07-11 06:33:02 +00:00
|
|
|
|
@@ -807,8 +808,12 @@ extern void remove_thread_event_breakpoi
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
extern void disable_breakpoints_in_shlibs (void);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+extern void disable_breakpoints_at_startup (int silent);
|
|
|
|
|
+
|
|
|
|
|
extern void re_enable_breakpoints_in_shlibs (void);
|
|
|
|
|
|
|
|
|
|
+void re_enable_breakpoints_at_startup (void);
|
|
|
|
|
+
|
|
|
|
|
extern void create_solib_load_event_breakpoint (char *, int, char *, char *);
|
|
|
|
|
|
|
|
|
|
extern void create_solib_unload_event_breakpoint (char *, int,
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/symfile-mem.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/symfile-mem.c 2007-08-23 20:08:39.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/symfile-mem.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -108,7 +108,7 @@ symbol_file_add_from_memory (struct bfd
|
2005-01-11 00:15:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
objf = symbol_file_add_from_bfd (nbfd, from_tty,
|
|
|
|
|
- sai, 0, OBJF_SHARED);
|
|
|
|
|
+ sai, 2, OBJF_SHARED);
|
|
|
|
|
|
|
|
|
|
/* This might change our ideas about frames already looked at. */
|
|
|
|
|
reinit_frame_cache ();
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/infrun.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/infrun.c 2007-10-13 05:09:50.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/infrun.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -2305,6 +2305,11 @@ process_event_stop_test:
|
2005-01-11 00:15:58 +00:00
|
|
|
|
code segments in shared libraries might be mapped in now. */
|
|
|
|
|
re_enable_breakpoints_in_shlibs ();
|
|
|
|
|
|
|
|
|
|
+ /* For PIE executables, we dont really know where the
|
|
|
|
|
+ breakpoints are going to be until we start up the
|
|
|
|
|
+ inferior. */
|
|
|
|
|
+ re_enable_breakpoints_at_startup ();
|
|
|
|
|
+
|
|
|
|
|
/* If requested, stop when the dynamic linker notifies
|
|
|
|
|
gdb of events. This allows the user to get control
|
|
|
|
|
and place breakpoints in initializer routines for
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/objfiles.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/objfiles.c 2007-08-23 20:08:36.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/objfiles.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -48,6 +48,9 @@
|
2005-01-11 00:15:58 +00:00
|
|
|
|
#include "dictionary.h"
|
2006-07-11 06:33:02 +00:00
|
|
|
|
#include "source.h"
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+#include "auxv.h"
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+#include "elf/common.h"
|
|
|
|
|
+
|
|
|
|
|
/* Prototypes for local functions */
|
|
|
|
|
|
|
|
|
|
static void objfile_alloc_data (struct objfile *objfile);
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -259,7 +262,19 @@ init_entry_point_info (struct objfile *o
|
2005-01-11 00:15:58 +00:00
|
|
|
|
CORE_ADDR
|
|
|
|
|
entry_point_address (void)
|
|
|
|
|
{
|
|
|
|
|
- return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
|
|
|
|
|
+ int ret;
|
|
|
|
|
+ CORE_ADDR entry_addr;
|
|
|
|
|
+
|
|
|
|
|
+ /* Find the address of the entry point of the program from the
|
|
|
|
|
+ auxv vector. */
|
|
|
|
|
+ ret = target_auxv_search (¤t_target, AT_ENTRY, &entry_addr);
|
|
|
|
|
+ if (ret == 1)
|
|
|
|
|
+ return entry_addr;
|
|
|
|
|
+ /*if (ret == 0 || ret == -1)*/
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ return symfile_objfile ? symfile_objfile->ei.entry_point : 0;
|
|
|
|
|
+ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create the terminating entry of OBJFILE's minimal symbol table.
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/solib-svr4.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/solib-svr4.c 2007-10-12 22:34:03.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/solib-svr4.c 2007-10-14 23:04:45.000000000 +0200
|
|
|
|
|
@@ -31,6 +31,8 @@
|
2005-01-11 00:15:58 +00:00
|
|
|
|
#include "gdbcore.h"
|
|
|
|
|
#include "target.h"
|
|
|
|
|
#include "inferior.h"
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+#include "auxv.h"
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+#include "command.h"
|
|
|
|
|
|
2006-07-11 06:33:02 +00:00
|
|
|
|
#include "gdb_assert.h"
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -249,7 +251,9 @@ static char *debug_loader_name;
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
/* Local function prototypes */
|
|
|
|
|
|
|
|
|
|
+#if 0
|
|
|
|
|
static int match_main (char *);
|
|
|
|
|
+#endif
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -352,10 +356,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
|
|
|
|
|
int arch_size, step, sect_size;
|
|
|
|
|
long dyn_tag;
|
|
|
|
|
CORE_ADDR dyn_ptr, dyn_addr;
|
|
|
|
|
+ CORE_ADDR entry_addr;
|
|
|
|
|
gdb_byte *bufend, *bufstart, *buf;
|
|
|
|
|
Elf32_External_Dyn *x_dynp_32;
|
|
|
|
|
Elf64_External_Dyn *x_dynp_64;
|
|
|
|
|
struct bfd_section *sect;
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ int ret;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
|
|
|
|
|
if (abfd == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
@@ -363,19 +369,74 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
|
|
|
|
|
if (arch_size == -1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
+ /* The auxv vector based relocatable files reading is limited to the main
|
|
|
|
|
+ executable. */
|
|
|
|
|
+ gdb_assert (abfd == exec_bfd || ptr == NULL);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+ if (ptr != NULL)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ {
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+ /* Find the address of the entry point of the program from the
|
|
|
|
|
+ auxv vector. */
|
|
|
|
|
+ ret = target_auxv_search (¤t_target, AT_ENTRY, &entry_addr);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+ if (ret == 0 || ret == -1)
|
|
|
|
|
+ {
|
|
|
|
|
+ /* No auxv info, maybe an older kernel. Fake our way through. */
|
|
|
|
|
+ entry_addr = bfd_get_start_address (exec_bfd);
|
|
|
|
|
+
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: program entry address not found. Using bfd's 0x%s for %s\n",
|
|
|
|
|
+ paddr_nz (entry_addr), exec_bfd->filename);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: found program entry address 0x%s for %s\n",
|
|
|
|
|
+ paddr_nz (entry_addr), exec_bfd->filename);
|
|
|
|
|
+ }
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ }
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* Find the start address of the .dynamic section. */
|
2007-11-01 20:24:20 +00:00
|
|
|
|
sect = bfd_get_section_by_name (abfd, ".dynamic");
|
|
|
|
|
if (sect == NULL)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
- return 0;
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: .dynamic section not found in %s -- return now\n",
|
|
|
|
|
+ exec_bfd->filename);
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: .dynamic section found in %s\n",
|
|
|
|
|
+ exec_bfd->filename);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
2007-11-01 20:24:20 +00:00
|
|
|
|
dyn_addr = bfd_section_vma (abfd, sect);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+ "elf_locate_base: .dynamic addr 0x%s\n",
|
|
|
|
|
+ paddr_nz (dyn_addr));
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
/* Read in .dynamic from the BFD. We will get the actual value
|
|
|
|
|
from memory later. */
|
|
|
|
|
sect_size = bfd_section_size (abfd, sect);
|
|
|
|
|
buf = bufstart = alloca (sect_size);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: read in .dynamic section\n");
|
2007-11-01 20:24:20 +00:00
|
|
|
|
if (!bfd_get_section_contents (abfd, sect,
|
|
|
|
|
buf, 0, sect_size))
|
|
|
|
|
- return 0;
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+ "elf_locate_base: couldn't read .dynamic section -- return now\n");
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
/* Iterate over BUF and scan for DYNTAG. If found, set PTR and return. */
|
|
|
|
|
step = (arch_size == 32) ? sizeof (Elf32_External_Dyn)
|
|
|
|
|
@@ -408,9 +469,43 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
|
|
|
|
|
CORE_ADDR ptr_addr;
|
|
|
|
|
|
|
|
|
|
ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
|
|
|
|
|
+ if (ptr != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: unrelocated ptr addr 0x%s\n",
|
|
|
|
|
+ paddr_nz (ptr_addr));
|
|
|
|
|
+ ptr_addr += entry_addr - bfd_get_start_address (exec_bfd);
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: relocated ptr addr 0x%s"
|
|
|
|
|
+ " (auxv entry 0x%s, bfd start address 0x%s)"
|
|
|
|
|
+ " for %s\n",
|
|
|
|
|
+ paddr_nz (ptr_addr), paddr_nz (entry_addr),
|
|
|
|
|
+ paddr_nz (bfd_get_start_address (exec_bfd)),
|
|
|
|
|
+ exec_bfd->filename);
|
|
|
|
|
+ }
|
|
|
|
|
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
|
|
|
|
|
- dyn_ptr = extract_typed_address (ptr_buf,
|
|
|
|
|
- builtin_type_void_data_ptr);
|
|
|
|
|
+ {
|
|
|
|
|
+ dyn_ptr = extract_typed_address (ptr_buf,
|
|
|
|
|
+ builtin_type_void_data_ptr);
|
|
|
|
|
+ if (ptr != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: Tag entry has value 0x%s -- return now\n",
|
|
|
|
|
+ paddr_nz (dyn_ptr));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (ptr != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "elf_locate_base: Couldn't read tag entry value -- return now\n");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
*ptr = dyn_ptr;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
@@ -547,6 +638,10 @@ solib_svr4_r_map (void)
|
2006-07-11 06:33:02 +00:00
|
|
|
|
{
|
|
|
|
|
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ "solib_svr4_r_map: read at 0x%s\n",
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ paddr_nz (debug_base + lmo->r_map_offset));
|
2006-07-11 06:33:02 +00:00
|
|
|
|
return read_memory_typed_address (debug_base + lmo->r_map_offset,
|
|
|
|
|
builtin_type_void_data_ptr);
|
|
|
|
|
}
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -704,6 +799,11 @@ svr4_current_sos (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
struct so_list **link_ptr = &head;
|
2006-07-11 06:33:02 +00:00
|
|
|
|
CORE_ADDR ldsomap = 0;
|
|
|
|
|
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: exec_bfd %s\n",
|
|
|
|
|
+ exec_bfd->filename);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* Make sure we've looked up the inferior's dynamic linker's base
|
|
|
|
|
structure. */
|
2006-07-11 06:33:02 +00:00
|
|
|
|
if (! debug_base)
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -713,11 +813,21 @@ svr4_current_sos (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* If we can't find the dynamic linker's base structure, this
|
|
|
|
|
must not be a dynamically linked executable. Hmm. */
|
|
|
|
|
if (! debug_base)
|
2007-01-21 01:53:01 +00:00
|
|
|
|
- return svr4_default_sos ();
|
|
|
|
|
+ {
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: no DT_DEBUG found in %s -- return now\n",
|
|
|
|
|
+ exec_bfd->filename);
|
2007-01-21 01:53:01 +00:00
|
|
|
|
+ return svr4_default_sos ();
|
|
|
|
|
+ }
|
2005-01-11 00:15:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Walk the inferior's link map list, and build our list of
|
|
|
|
|
`struct so_list' nodes. */
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: walk link map in %s\n",
|
|
|
|
|
+ exec_bfd->filename);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
lm = solib_svr4_r_map ();
|
2007-01-21 01:53:01 +00:00
|
|
|
|
|
2005-01-11 00:15:58 +00:00
|
|
|
|
while (lm)
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -733,23 +843,103 @@ svr4_current_sos (void)
|
2006-07-11 06:33:02 +00:00
|
|
|
|
new->lm_info->lm = xzalloc (lmo->link_map_size);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
make_cleanup (xfree, new->lm_info->lm);
|
|
|
|
|
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: read lm at 0x%s\n", paddr_nz(lm));
|
|
|
|
|
read_memory (lm, new->lm_info->lm, lmo->link_map_size);
|
|
|
|
|
|
|
|
|
|
lm = LM_NEXT (new);
|
|
|
|
|
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: is first link entry? %d\n",
|
|
|
|
|
+ IGNORE_FIRST_LINK_MAP_ENTRY (new));
|
|
|
|
|
+
|
|
|
|
|
/* For SVR4 versions, the first entry in the link map is for the
|
|
|
|
|
inferior executable, so we must ignore it. For some versions of
|
|
|
|
|
SVR4, it has no name. For others (Solaris 2.3 for example), it
|
|
|
|
|
does have a name, so we can no longer use a missing name to
|
|
|
|
|
decide when to ignore it. */
|
2006-07-11 06:33:02 +00:00
|
|
|
|
if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
- free_so (new);
|
|
|
|
|
+ {
|
|
|
|
|
+ /* It is the first link map entry, i.e. it is the main executable. */
|
|
|
|
|
+
|
|
|
|
|
+ if (bfd_get_start_address (exec_bfd) == entry_point_address ())
|
|
|
|
|
+ {
|
|
|
|
|
+ /* Non-pie case, main executable has not been relocated. */
|
|
|
|
|
+ free_so (new);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ /* Pie case, main executable has been relocated. */
|
|
|
|
|
+ struct so_list *gdb_solib;
|
|
|
|
|
+
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: Processing first link map entry\n");
|
|
|
|
|
+ strncpy (new->so_name, exec_bfd->filename,
|
|
|
|
|
+ SO_NAME_MAX_PATH_SIZE - 1);
|
|
|
|
|
+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
|
|
|
|
+ strcpy (new->so_original_name, new->so_name);
|
|
|
|
|
+ /*new->main = 1;*/
|
|
|
|
|
+ new->main_relocated = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ {
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: Processing nameless DSO\n");
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: adding name %s\n",
|
|
|
|
|
+ new->so_name);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (gdb_solib = master_so_list ();
|
|
|
|
|
+ gdb_solib;
|
|
|
|
|
+ gdb_solib = gdb_solib->next)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: compare gdb %s and new %s\n",
|
|
|
|
|
+ gdb_solib->so_name, new->so_name);
|
|
|
|
|
+ if (strcmp (gdb_solib->so_name, new->so_name) == 0)
|
|
|
|
|
+ if (gdb_solib->main_relocated)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: found main relocated\n");
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ((gdb_solib && !gdb_solib->main_relocated) || (!gdb_solib))
|
|
|
|
|
+ {
|
|
|
|
|
+ add_to_target_sections (0 /*from_tty*/, ¤t_target, new);
|
|
|
|
|
+ new->main = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* We need this in the list of shared libs we return because
|
|
|
|
|
+ solib_add_stub will loop through it and add the symbol file. */
|
|
|
|
|
+ new->next = 0;
|
|
|
|
|
+ *link_ptr = new;
|
|
|
|
|
+ link_ptr = &new->next;
|
|
|
|
|
+ }
|
|
|
|
|
+ } /* End of IGNORE_FIRST_LINK_MAP_ENTRY */
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
+ /* This is not the first link map entry, i.e. is not the main
|
|
|
|
|
+ executable. Note however that it could be the DSO supplied on
|
|
|
|
|
+ certain systems (i.e. Linux 2.6) containing information about
|
|
|
|
|
+ the vsyscall page. We must ignore such entry. This entry is
|
|
|
|
|
+ nameless (just like the one for the main executable, sigh). */
|
|
|
|
|
+
|
|
|
|
|
int errcode;
|
|
|
|
|
char *buffer;
|
|
|
|
|
|
|
|
|
|
/* Extract this shared object's name. */
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: read LM_NAME\n");
|
|
|
|
|
+
|
|
|
|
|
target_read_string (LM_NAME (new), &buffer,
|
|
|
|
|
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
|
|
|
|
|
if (errcode != 0)
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -757,23 +947,35 @@ svr4_current_sos (void)
|
2006-07-11 06:33:02 +00:00
|
|
|
|
safe_strerror (errcode));
|
2005-01-11 00:15:58 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2006-07-11 06:33:02 +00:00
|
|
|
|
- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
|
|
|
|
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
|
|
|
|
- strcpy (new->so_original_name, new->so_name);
|
|
|
|
|
- }
|
2007-11-01 20:24:20 +00:00
|
|
|
|
- xfree (buffer);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
-
|
|
|
|
|
- /* If this entry has no name, or its name matches the name
|
|
|
|
|
- for the main executable, don't include it in the list. */
|
|
|
|
|
- if (! new->so_name[0]
|
|
|
|
|
- || match_main (new->so_name))
|
|
|
|
|
- free_so (new);
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- new->next = 0;
|
|
|
|
|
- *link_ptr = new;
|
|
|
|
|
- link_ptr = &new->next;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: LM_NAME is <%s>\n",
|
|
|
|
|
+ buffer);
|
|
|
|
|
+ /* The name could be empty, in which case it is the
|
|
|
|
|
+ system supplied DSO. */
|
|
|
|
|
+ if (strcmp (buffer, "") == 0)
|
|
|
|
|
+ free_so (new);
|
|
|
|
|
+ else
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ {
|
|
|
|
|
+ strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
|
|
|
|
+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
|
|
|
|
+ strcpy (new->so_original_name, new->so_name);
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ {
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: Processing DSO: %s\n",
|
|
|
|
|
+ new->so_name);
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: first link entry %d\n",
|
|
|
|
|
+ IGNORE_FIRST_LINK_MAP_ENTRY (new));
|
|
|
|
|
+ }
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ new->next = 0;
|
|
|
|
|
+ *link_ptr = new;
|
|
|
|
|
+ link_ptr = &new->next;
|
|
|
|
|
+ }
|
|
|
|
|
}
|
2007-11-01 20:24:20 +00:00
|
|
|
|
+ xfree (buffer);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
/* On Solaris, the dynamic linker is not in the normal list of
|
|
|
|
|
@@ -789,6 +991,11 @@ svr4_current_sos (void)
|
2007-01-21 01:53:01 +00:00
|
|
|
|
if (head == NULL)
|
|
|
|
|
return svr4_default_sos ();
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_current_sos: ENDS %s\n",
|
|
|
|
|
+ exec_bfd->filename);
|
|
|
|
|
+
|
|
|
|
|
return head;
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -868,7 +1075,7 @@ svr4_fetch_objfile_link_map (struct objf
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* On some systems, the only way to recognize the link map entry for
|
|
|
|
|
the main executable file is by looking at its name. Return
|
|
|
|
|
non-zero iff SONAME matches one of the known main executable names. */
|
|
|
|
|
-
|
|
|
|
|
+#if 0
|
|
|
|
|
static int
|
|
|
|
|
match_main (char *soname)
|
|
|
|
|
{
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -882,6 +1089,7 @@ match_main (char *soname)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
/* Return 1 if PC lies in the dynamic symbol resolution code of the
|
|
|
|
|
SVR4 run time loader. */
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -979,6 +1187,11 @@ enable_break (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* Find the .interp section; if not found, warn the user and drop
|
|
|
|
|
into the old breakpoint at symbol code. */
|
|
|
|
|
interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
|
|
|
|
|
+
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "enable_break: search for .interp in %s\n",
|
|
|
|
|
+ exec_bfd->filename);
|
|
|
|
|
if (interp_sect)
|
|
|
|
|
{
|
|
|
|
|
unsigned int interp_sect_size;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -1018,6 +1231,9 @@ enable_break (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
if (tmp_fd >= 0)
|
2006-07-11 06:33:02 +00:00
|
|
|
|
tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "enable_break: opening %s\n", tmp_pathname);
|
|
|
|
|
if (tmp_bfd == NULL)
|
|
|
|
|
goto bkpt_at_symbol;
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -1115,6 +1331,9 @@ enable_break (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
if (sym_addr != 0)
|
|
|
|
|
{
|
|
|
|
|
create_solib_event_breakpoint (load_addr + sym_addr);
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "enable_break: solib bp set\n");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -1375,6 +1594,8 @@ svr4_solib_create_inferior_hook (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
while (stop_signal != TARGET_SIGNAL_TRAP);
|
|
|
|
|
stop_soon = NO_STOP_QUIETLY;
|
|
|
|
|
#endif /* defined(_SCO_DS) */
|
|
|
|
|
+
|
|
|
|
|
+ disable_breakpoints_at_startup (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -1551,6 +1772,75 @@ svr4_lp64_fetch_link_map_offsets (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
return lmp;
|
|
|
|
|
}
|
|
|
|
|
+void
|
|
|
|
|
+info_linkmap_command (char *cmd, int from_tty)
|
|
|
|
|
+{
|
|
|
|
|
+ CORE_ADDR lm;
|
|
|
|
|
+
|
|
|
|
|
+ /* Make sure we've looked up the inferior's dynamic linker's base
|
|
|
|
|
+ structure. */
|
|
|
|
|
+ if (! debug_base)
|
|
|
|
|
+ {
|
|
|
|
|
+ debug_base = locate_base ();
|
|
|
|
|
+
|
|
|
|
|
+ /* If we can't find the dynamic linker's base structure, this
|
|
|
|
|
+ must not be a dynamically linked executable. Hmm. */
|
|
|
|
|
+ if (! debug_base)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_print_linkmap: no DT_DEBUG found in %s -- return now\n",
|
|
|
|
|
+ exec_bfd->filename);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /* Walk the inferior's link map list, and print the info. */
|
|
|
|
|
+
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ lm = solib_svr4_r_map ();
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ while (lm)
|
|
|
|
|
+ {
|
|
|
|
|
+ int errcode;
|
|
|
|
|
+ char *buffer;
|
|
|
|
|
+ CORE_ADDR load_addr;
|
|
|
|
|
+
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ struct so_list *new
|
|
|
|
|
+ = (struct so_list *) xmalloc (sizeof (struct so_list));
|
|
|
|
|
+ struct cleanup *old_chain = make_cleanup (xfree, new);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ memset (new, 0, sizeof (*new));
|
|
|
|
|
+
|
|
|
|
|
+ new->lm_info = xmalloc (sizeof (struct lm_info));
|
|
|
|
|
+ make_cleanup (xfree, new->lm_info);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ new->lm_info->lm = xmalloc (lmo->link_map_size);
|
|
|
|
|
+ make_cleanup (xfree, new->lm_info->lm);
|
|
|
|
|
+ memset (new->lm_info->lm, 0, lmo->link_map_size);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "svr4_print_linkmap: read lm at 0x%s\n", paddr_nz(lm));
|
|
|
|
|
+ read_memory (lm, new->lm_info->lm, lmo->link_map_size);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ lm = LM_NEXT (new);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ /* Load address. */
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ load_addr = LM_ADDR_CHECK (new, NULL);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ /* Shared object's name. */
|
|
|
|
|
+ target_read_string (LM_NAME (new), &buffer,
|
|
|
|
|
+ SO_NAME_MAX_PATH_SIZE - 1, &errcode);
|
|
|
|
|
+ make_cleanup (xfree, buffer);
|
|
|
|
|
+ if (errcode != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ warning ("svr4_print_linkmap: Can't read pathname for load map: %s\n",
|
|
|
|
|
+ safe_strerror (errcode));
|
|
|
|
|
+ }
|
|
|
|
|
+ fprintf_filtered (gdb_stdout, "%-8s %-30s\n", paddr(load_addr), buffer);
|
|
|
|
|
+ do_cleanups (old_chain);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
struct target_so_ops svr4_so_ops;
|
|
|
|
|
@@ -1592,4 +1882,8 @@ _initialize_svr4_solib (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
/* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */
|
|
|
|
|
current_target_so_ops = &svr4_so_ops;
|
|
|
|
|
+
|
|
|
|
|
+ add_info ("linkmap", info_linkmap_command,
|
|
|
|
|
+ "Display the inferior's linkmap.");
|
|
|
|
|
+
|
|
|
|
|
}
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/varobj.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/varobj.c 2007-08-31 21:01:17.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/varobj.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -1116,6 +1116,62 @@ install_new_value (struct varobj *var, s
|
|
|
|
|
return changed;
|
2005-01-11 00:15:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+void
|
|
|
|
|
+varobj_refresh (void)
|
|
|
|
|
+{
|
|
|
|
|
+ struct varobj *var;
|
|
|
|
|
+ struct varobj_root *croot;
|
|
|
|
|
+ int mycount = rootcount;
|
|
|
|
|
+ char * name;
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ croot = rootlist;
|
|
|
|
|
+ while ((croot != NULL) && (mycount > 0))
|
|
|
|
|
+ {
|
|
|
|
|
+ var = croot->rootvar;
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ /* Get rid of the memory for the old expression. This also
|
|
|
|
|
+ leaves var->root->exp == NULL, which is ok for the parsing
|
|
|
|
|
+ below. */
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ free_current_contents (&var->root->exp);
|
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ value_free (var->value);
|
|
|
|
|
+ var->type = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ name = xstrdup (var->name);
|
|
|
|
|
+
|
|
|
|
|
+ /* Reparse the expression. Wrap the call to parse expression,
|
|
|
|
|
+ so we can return a sensible error. */
|
|
|
|
|
+ if (!gdb_parse_exp_1 (&name, var->root->valid_block, 0, &var->root->exp))
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ /* We definitively need to catch errors here.
|
|
|
|
|
+ If evaluate_expression succeeds we got the value we wanted.
|
|
|
|
|
+ But if it fails, we still go on with a call to evaluate_type() */
|
|
|
|
|
+ if (gdb_evaluate_expression (var->root->exp, &var->value))
|
|
|
|
|
+ {
|
|
|
|
|
+ /* no error */
|
|
|
|
|
+ release_value (var->value);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ if (value_lazy (var->value))
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ gdb_value_fetch_lazy (var->value);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ var->value = evaluate_type (var->root->exp);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
|
|
|
|
+ var->type = value_type (var->value);
|
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ mycount--;
|
|
|
|
|
+ croot = croot->next;
|
|
|
|
|
+ }
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+ if (mycount || (croot != NULL))
|
|
|
|
|
+ warning
|
|
|
|
|
+ ("varobj_refresh: assertion failed - wrong tally of root vars (%d:%d)",
|
|
|
|
|
+ rootcount, mycount);
|
|
|
|
|
+}
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+
|
|
|
|
|
/* Update the values for a variable and its children. This is a
|
|
|
|
|
two-pronged attack. First, re-parse the value for the root's
|
|
|
|
|
expression to see if it's changed. Then go all the way
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/solist.h
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/solist.h 2007-08-23 20:08:38.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/solist.h 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -61,6 +61,8 @@ struct so_list
|
2005-01-11 00:15:58 +00:00
|
|
|
|
bfd *abfd;
|
|
|
|
|
char symbols_loaded; /* flag: symbols read in yet? */
|
|
|
|
|
char from_tty; /* flag: print msgs? */
|
|
|
|
|
+ char main; /* flag: is this the main executable? */
|
|
|
|
|
+ char main_relocated; /* flag: has it been relocated yet? */
|
|
|
|
|
struct objfile *objfile; /* objfile for loaded lib */
|
|
|
|
|
struct section_table *sections;
|
|
|
|
|
struct section_table *sections_end;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -123,9 +125,15 @@ void free_so (struct so_list *so);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* Return address of first so_list entry in master shared object list. */
|
|
|
|
|
struct so_list *master_so_list (void);
|
|
|
|
|
|
|
|
|
|
+/* Return address of first so_list entry in master shared object list. */
|
|
|
|
|
+struct so_list *master_so_list (void);
|
|
|
|
|
+
|
|
|
|
|
/* Find solib binary file and open it. */
|
|
|
|
|
extern int solib_open (char *in_pathname, char **found_pathname);
|
|
|
|
|
|
|
|
|
|
+/* Add the list of sections in so_list to the target to_sections. */
|
|
|
|
|
+extern void add_to_target_sections (int, struct target_ops *, struct so_list *);
|
|
|
|
|
+
|
|
|
|
|
/* FIXME: gdbarch needs to control this variable */
|
|
|
|
|
extern struct target_so_ops *current_target_so_ops;
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -143,4 +151,6 @@ struct symbol *solib_global_lookup (cons
|
|
|
|
|
const domain_enum domain,
|
|
|
|
|
struct symtab **symtab);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+/* Controls the printing of debugging output. */
|
|
|
|
|
+extern int debug_solib;
|
|
|
|
|
#endif
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/varobj.h
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/varobj.h 2007-08-31 20:52:05.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/varobj.h 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -114,4 +114,6 @@ extern int varobj_update (struct varobj
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
extern void varobj_invalidate (void);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+extern void varobj_refresh(void);
|
|
|
|
|
+
|
|
|
|
|
#endif /* VAROBJ_H */
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/symfile.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/symfile.c 2007-09-24 23:48:05.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/symfile.c 2007-10-13 05:32:14.000000000 +0200
|
|
|
|
|
@@ -47,6 +47,7 @@
|
2005-01-11 00:15:58 +00:00
|
|
|
|
#include "readline/readline.h"
|
|
|
|
|
#include "gdb_assert.h"
|
|
|
|
|
#include "block.h"
|
|
|
|
|
+#include "varobj.h"
|
2006-07-11 06:33:02 +00:00
|
|
|
|
#include "observer.h"
|
|
|
|
|
#include "exec.h"
|
2007-01-21 01:53:01 +00:00
|
|
|
|
#include "parser-defs.h"
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -779,7 +780,7 @@ syms_from_objfile (struct objfile *objfi
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
/* Now either addrs or offsets is non-zero. */
|
|
|
|
|
|
|
|
|
|
- if (mainline)
|
|
|
|
|
+ if (mainline == 1)
|
|
|
|
|
{
|
|
|
|
|
/* We will modify the main symbol table, make sure that all its users
|
|
|
|
|
will be cleaned up if an error occurs during symbol reading. */
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -807,7 +808,7 @@ syms_from_objfile (struct objfile *objfi
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
We no longer warn if the lowest section is not a text segment (as
|
|
|
|
|
happens for the PA64 port. */
|
|
|
|
|
- if (!mainline && addrs && addrs->other[0].name)
|
|
|
|
|
+ if (/*!mainline &&*/ addrs && addrs->other[0].name)
|
|
|
|
|
{
|
|
|
|
|
asection *lower_sect;
|
|
|
|
|
asection *sect;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -976,17 +977,21 @@ new_symfile_objfile (struct objfile *obj
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* If this is the main symbol file we have to clean up all users of the
|
|
|
|
|
old main symbol file. Otherwise it is sufficient to fixup all the
|
|
|
|
|
breakpoints that may have been redefined by this symbol file. */
|
|
|
|
|
- if (mainline)
|
|
|
|
|
+ if (mainline == 1)
|
|
|
|
|
{
|
|
|
|
|
/* OK, make it the "real" symbol file. */
|
|
|
|
|
symfile_objfile = objfile;
|
|
|
|
|
|
|
|
|
|
clear_symtab_users ();
|
|
|
|
|
}
|
|
|
|
|
- else
|
|
|
|
|
+ else if (mainline == 0)
|
|
|
|
|
{
|
|
|
|
|
breakpoint_re_set ();
|
|
|
|
|
}
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ /* Don't reset breakpoints or it will screw up PIE. */
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
/* We're done reading the symbol file; finish off complaints. */
|
|
|
|
|
clear_complaints (&symfile_complaints, 0, verbo);
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -1029,7 +1034,7 @@ symbol_file_add_with_addrs_or_offsets (b
|
2005-01-11 00:15:58 +00:00
|
|
|
|
interactively wiping out any existing symbols. */
|
|
|
|
|
|
|
|
|
|
if ((have_full_symbols () || have_partial_symbols ())
|
|
|
|
|
- && mainline
|
|
|
|
|
+ && (mainline == 1)
|
|
|
|
|
&& from_tty
|
|
|
|
|
&& !query ("Load new symbol table from \"%s\"? ", name))
|
2006-07-11 06:33:02 +00:00
|
|
|
|
error (_("Not confirmed."));
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -1213,6 +1218,10 @@ symbol_file_clear (int from_tty)
|
2006-07-11 06:33:02 +00:00
|
|
|
|
symfile_objfile->name)
|
|
|
|
|
: !query (_("Discard symbol table? "))))
|
|
|
|
|
error (_("Not confirmed."));
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+#ifdef CLEAR_SOLIB
|
|
|
|
|
+ CLEAR_SOLIB ();
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
free_all_objfiles ();
|
|
|
|
|
|
|
|
|
|
/* solib descriptors may have handles to objfiles. Since their
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -2470,6 +2479,8 @@ reread_symbols (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* Discard cleanups as symbol reading was successful. */
|
|
|
|
|
discard_cleanups (old_cleanups);
|
|
|
|
|
|
|
|
|
|
+ init_entry_point_info (objfile);
|
|
|
|
|
+
|
|
|
|
|
/* If the mtime has changed between the time we set new_modtime
|
|
|
|
|
and now, we *want* this to be out of date, so don't call stat
|
|
|
|
|
again now. */
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -2837,6 +2848,7 @@ clear_symtab_users (void)
|
|
|
|
|
breakpoint_re_set ();
|
|
|
|
|
set_default_breakpoint (0, 0, 0, 0);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
clear_pc_function_cache ();
|
|
|
|
|
+ varobj_refresh ();
|
2007-11-01 20:24:20 +00:00
|
|
|
|
observer_notify_new_objfile (NULL);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
2007-01-21 01:53:01 +00:00
|
|
|
|
/* Clear globals which might have pointed into a removed objfile.
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/breakpoint.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/breakpoint.c 2007-10-13 05:27:15.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/breakpoint.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -840,15 +840,15 @@ insert_watchpoints_for_new_thread (ptid_
|
2006-07-11 06:33:02 +00:00
|
|
|
|
struct value *v = b->owner->val_chain;
|
|
|
|
|
|
|
|
|
|
/* Look at each value on the value chain. */
|
|
|
|
|
- for (; v; v = v->next)
|
|
|
|
|
+ for (; v; v = value_next (v))
|
|
|
|
|
{
|
|
|
|
|
/* If it's a memory location, and GDB actually needed
|
|
|
|
|
its contents to evaluate the expression, then we
|
|
|
|
|
must watch it. */
|
|
|
|
|
if (VALUE_LVAL (v) == lval_memory
|
|
|
|
|
- && ! VALUE_LAZY (v))
|
|
|
|
|
+ && ! value_lazy (v))
|
|
|
|
|
{
|
|
|
|
|
- struct type *vtype = check_typedef (VALUE_TYPE (v));
|
|
|
|
|
+ struct type *vtype = check_typedef (value_type (v));
|
|
|
|
|
|
|
|
|
|
/* We only watch structs and arrays if user asked
|
|
|
|
|
for it explicitly, never if they just happen to
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -860,8 +860,8 @@ insert_watchpoints_for_new_thread (ptid_
|
2006-07-11 06:33:02 +00:00
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
int len, type;
|
|
|
|
|
|
|
|
|
|
- addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
|
|
|
|
|
- len = TYPE_LENGTH (VALUE_TYPE (v));
|
|
|
|
|
+ addr = VALUE_ADDRESS (v) + value_offset (v);
|
|
|
|
|
+ len = TYPE_LENGTH (value_type (v));
|
|
|
|
|
type = hw_write;
|
|
|
|
|
if (b->owner->type == bp_read_watchpoint)
|
|
|
|
|
type = hw_read;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -2749,12 +2749,12 @@ mark_triggered_watchpoints (CORE_ADDR st
|
2006-07-11 06:33:02 +00:00
|
|
|
|
|| b->type == bp_read_watchpoint
|
|
|
|
|
|| b->type == bp_access_watchpoint)
|
|
|
|
|
{
|
|
|
|
|
- for (v = b->val_chain; v; v = v->next)
|
|
|
|
|
+ for (v = b->val_chain; v; v = value_next (v))
|
|
|
|
|
{
|
|
|
|
|
if (VALUE_LVAL (v) == lval_memory
|
|
|
|
|
- && ! VALUE_LAZY (v))
|
|
|
|
|
+ && ! value_lazy (v))
|
|
|
|
|
{
|
|
|
|
|
- struct type *vtype = check_typedef (VALUE_TYPE (v));
|
|
|
|
|
+ struct type *vtype = check_typedef (value_type (v));
|
|
|
|
|
|
|
|
|
|
if (v == b->val_chain
|
|
|
|
|
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -2762,11 +2762,11 @@ mark_triggered_watchpoints (CORE_ADDR st
|
2006-07-11 06:33:02 +00:00
|
|
|
|
{
|
|
|
|
|
CORE_ADDR vaddr;
|
|
|
|
|
|
|
|
|
|
- vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
|
|
|
|
|
+ vaddr = VALUE_ADDRESS (v) + value_offset (v);
|
|
|
|
|
/* Exact match not required. Within range is
|
|
|
|
|
sufficient. */
|
|
|
|
|
if (addr >= vaddr &&
|
|
|
|
|
- addr < vaddr + TYPE_LENGTH (VALUE_TYPE (v)))
|
|
|
|
|
+ addr < vaddr + TYPE_LENGTH (value_type (v)))
|
|
|
|
|
b->watchpoint_triggered = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -2936,12 +2936,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
|
2006-07-11 06:33:02 +00:00
|
|
|
|
bs->stop = 0;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
- for (v = b->val_chain; v; v = v->next)
|
|
|
|
|
+ for (v = b->val_chain; v; v = value_next (v))
|
|
|
|
|
{
|
|
|
|
|
if (VALUE_LVAL (v) == lval_memory
|
|
|
|
|
- && ! VALUE_LAZY (v))
|
|
|
|
|
+ && ! value_lazy (v))
|
|
|
|
|
{
|
|
|
|
|
- struct type *vtype = check_typedef (VALUE_TYPE (v));
|
|
|
|
|
+ struct type *vtype = check_typedef (value_type (v));
|
|
|
|
|
|
|
|
|
|
if (v == b->val_chain
|
|
|
|
|
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -2949,11 +2949,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
|
2006-07-11 06:33:02 +00:00
|
|
|
|
{
|
|
|
|
|
CORE_ADDR vaddr;
|
|
|
|
|
|
|
|
|
|
- vaddr = VALUE_ADDRESS (v) + VALUE_OFFSET (v);
|
|
|
|
|
+ vaddr = VALUE_ADDRESS (v) + value_offset (v);
|
|
|
|
|
/* Exact match not required. Within range is
|
|
|
|
|
sufficient. */
|
|
|
|
|
if (addr >= vaddr &&
|
|
|
|
|
- addr < vaddr + TYPE_LENGTH (VALUE_TYPE (v)))
|
|
|
|
|
+ addr < vaddr + TYPE_LENGTH (value_type (v)))
|
|
|
|
|
must_check_value = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -3996,6 +3996,7 @@ describe_other_breakpoints (CORE_ADDR pc
|
2007-01-21 01:53:01 +00:00
|
|
|
|
printf_filtered ("%s%s ",
|
2005-01-11 00:15:58 +00:00
|
|
|
|
((b->enable_state == bp_disabled ||
|
|
|
|
|
b->enable_state == bp_shlib_disabled ||
|
|
|
|
|
+ b->enable_state == bp_startup_disabled ||
|
|
|
|
|
b->enable_state == bp_call_disabled)
|
2007-01-21 01:53:01 +00:00
|
|
|
|
? " (disabled)"
|
2005-01-11 00:15:58 +00:00
|
|
|
|
: b->enable_state == bp_permanent
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -4669,6 +4670,62 @@ re_enable_breakpoints_in_shlibs (void)
|
2006-07-11 06:33:02 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+void
|
|
|
|
|
+disable_breakpoints_at_startup (int silent)
|
|
|
|
|
+{
|
|
|
|
|
+ struct breakpoint *b;
|
|
|
|
|
+ int disabled_startup_breaks = 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (bfd_get_start_address (exec_bfd) != entry_point_address ())
|
|
|
|
|
+ {
|
|
|
|
|
+ ALL_BREAKPOINTS (b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (((b->type == bp_breakpoint) ||
|
|
|
|
|
+ (b->type == bp_hardware_breakpoint)) &&
|
|
|
|
|
+ b->enable_state == bp_enabled &&
|
|
|
|
|
+ !b->loc->duplicate)
|
|
|
|
|
+ {
|
|
|
|
|
+ b->enable_state = bp_startup_disabled;
|
|
|
|
|
+ if (!silent)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!disabled_startup_breaks)
|
|
|
|
|
+ {
|
|
|
|
|
+ target_terminal_ours_for_output ();
|
|
|
|
|
+ warning ("Temporarily disabling breakpoints:");
|
|
|
|
|
+ }
|
|
|
|
|
+ disabled_startup_breaks = 1;
|
|
|
|
|
+ warning ("breakpoint #%d addr 0x%s", b->number, paddr_nz(b->loc->address));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Try to reenable any breakpoints after startup. */
|
|
|
|
|
+void
|
|
|
|
|
+re_enable_breakpoints_at_startup (void)
|
|
|
|
|
+{
|
|
|
|
|
+ struct breakpoint *b;
|
|
|
|
|
+
|
|
|
|
|
+ if (bfd_get_start_address (exec_bfd) != entry_point_address ())
|
|
|
|
|
+ {
|
|
|
|
|
+ ALL_BREAKPOINTS (b)
|
|
|
|
|
+ if (b->enable_state == bp_startup_disabled)
|
|
|
|
|
+ {
|
|
|
|
|
+ char buf[1];
|
|
|
|
|
+
|
|
|
|
|
+ /* Do not reenable the breakpoint if the shared library
|
|
|
|
|
+ is still not mapped in. */
|
|
|
|
|
+ if (target_read_memory (b->loc->address, buf, 1) == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ /*printf ("enabling breakpoint at 0x%s\n", paddr_nz(b->loc->address));*/
|
|
|
|
|
+ b->enable_state = bp_enabled;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
static void
|
|
|
|
|
solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
|
|
|
|
|
char *cond_string, enum bptype bp_kind)
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -7084,6 +7141,7 @@ delete_breakpoint (struct breakpoint *bp
|
2005-01-11 00:15:58 +00:00
|
|
|
|
&& !b->loc->duplicate
|
|
|
|
|
&& b->enable_state != bp_disabled
|
|
|
|
|
&& b->enable_state != bp_shlib_disabled
|
|
|
|
|
+ && b->enable_state != bp_startup_disabled
|
|
|
|
|
&& !b->pending
|
|
|
|
|
&& b->enable_state != bp_call_disabled)
|
|
|
|
|
{
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -7308,7 +7366,8 @@ breakpoint_re_set_one (void *bint)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
save_enable = b->enable_state;
|
|
|
|
|
- if (b->enable_state != bp_shlib_disabled)
|
|
|
|
|
+ if (b->enable_state != bp_shlib_disabled
|
|
|
|
|
+ || b->enable_state != bp_shlib_disabled)
|
|
|
|
|
b->enable_state = bp_disabled;
|
|
|
|
|
else
|
|
|
|
|
/* If resetting a shlib-disabled breakpoint, we don't want to
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/solib.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/solib.c 2007-08-23 20:08:38.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/solib.c 2007-10-13 05:32:46.000000000 +0200
|
|
|
|
|
@@ -78,6 +78,8 @@ set_solib_ops (struct gdbarch *gdbarch,
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
/* external data declarations */
|
|
|
|
|
|
|
|
|
|
+int debug_solib;
|
|
|
|
|
+
|
2007-11-01 20:24:20 +00:00
|
|
|
|
/* FIXME: gdbarch needs to control this variable, or else every
|
|
|
|
|
configuration needs to call set_solib_ops. */
|
2005-01-11 00:15:58 +00:00
|
|
|
|
struct target_so_ops *current_target_so_ops;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -105,6 +107,8 @@ The search path for loading non-absolute
|
2006-07-11 06:33:02 +00:00
|
|
|
|
value);
|
|
|
|
|
}
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
|
|
|
|
+void add_to_target_sections (int, struct target_ops *, struct so_list *);
|
|
|
|
|
+
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
GLOBAL FUNCTION
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -394,7 +398,6 @@ free_so (struct so_list *so)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
xfree (so);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/* Return address of first so_list entry in master shared object list. */
|
|
|
|
|
struct so_list *
|
|
|
|
|
master_so_list (void)
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -402,7 +405,6 @@ master_so_list (void)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
return so_list_head;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/* A small stub to get us past the arg-passing pinhole of catch_errors. */
|
|
|
|
|
|
|
|
|
|
static int
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -414,15 +416,40 @@ symbol_add_stub (void *arg)
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* Have we already loaded this shared object? */
|
|
|
|
|
ALL_OBJFILES (so->objfile)
|
|
|
|
|
{
|
|
|
|
|
- if (strcmp (so->objfile->name, so->so_name) == 0)
|
|
|
|
|
+ /* Found an already loaded shared library. */
|
|
|
|
|
+ if (strcmp (so->objfile->name, so->so_name) == 0
|
|
|
|
|
+ && !so->main)
|
|
|
|
|
return 1;
|
|
|
|
|
+ /* Found an already loaded main executable. This could happen in
|
|
|
|
|
+ two circumstances.
|
|
|
|
|
+ First case: the main file has already been read in
|
|
|
|
|
+ as the first thing that gdb does at startup, and the file
|
|
|
|
|
+ hasn't been relocated properly yet. Therefor we need to read
|
|
|
|
|
+ it in with the proper section info.
|
|
|
|
|
+ Second case: it has been read in with the correct relocation,
|
|
|
|
|
+ and therefore we need to skip it. */
|
|
|
|
|
+ if (strcmp (so->objfile->name, so->so_name) == 0
|
|
|
|
|
+ && so->main
|
|
|
|
|
+ && so->main_relocated)
|
|
|
|
|
+ return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sap = build_section_addr_info_from_section_table (so->sections,
|
|
|
|
|
so->sections_end);
|
|
|
|
|
|
|
|
|
|
- so->objfile = symbol_file_add (so->so_name, so->from_tty,
|
|
|
|
|
- sap, 0, OBJF_SHARED);
|
|
|
|
|
+ if (so->main)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "symbol_add_stub: adding symbols for main\n");
|
|
|
|
|
+ so->objfile = symbol_file_add (so->so_name, /*so->from_tty*/ 0,
|
|
|
|
|
+ sap, 1, 0);
|
|
|
|
|
+ so->main_relocated = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ so->objfile = symbol_file_add (so->so_name, so->from_tty,
|
|
|
|
|
+ sap, 0, OBJF_SHARED);
|
|
|
|
|
+
|
|
|
|
|
free_section_addr_info (sap);
|
|
|
|
|
|
|
|
|
|
return (1);
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -550,6 +577,10 @@ update_solib_list (int from_tty, struct
|
2005-01-11 00:15:58 +00:00
|
|
|
|
the inferior's current list. */
|
|
|
|
|
while (i)
|
|
|
|
|
{
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "update_solib_list: compare gdb:%s and inferior:%s\n",
|
|
|
|
|
+ gdb->so_original_name, i->so_original_name);
|
|
|
|
|
if (! strcmp (gdb->so_original_name, i->so_original_name))
|
|
|
|
|
break;
|
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -603,28 +634,7 @@ update_solib_list (int from_tty, struct
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* Fill in the rest of each of the `struct so_list' nodes. */
|
|
|
|
|
for (i = inferior; i; i = i->next)
|
|
|
|
|
{
|
|
|
|
|
- i->from_tty = from_tty;
|
|
|
|
|
-
|
|
|
|
|
- /* Fill in the rest of the `struct so_list' node. */
|
|
|
|
|
- catch_errors (solib_map_sections, i,
|
|
|
|
|
- "Error while mapping shared library sections:\n",
|
|
|
|
|
- RETURN_MASK_ALL);
|
|
|
|
|
-
|
|
|
|
|
- /* If requested, add the shared object's sections to the TARGET's
|
|
|
|
|
- section table. Do this immediately after mapping the object so
|
|
|
|
|
- that later nodes in the list can query this object, as is needed
|
|
|
|
|
- in solib-osf.c. */
|
|
|
|
|
- if (target)
|
|
|
|
|
- {
|
|
|
|
|
- int count = (i->sections_end - i->sections);
|
|
|
|
|
- if (count > 0)
|
|
|
|
|
- {
|
|
|
|
|
- int space = target_resize_to_sections (target, count);
|
|
|
|
|
- memcpy (target->to_sections + space,
|
|
|
|
|
- i->sections,
|
|
|
|
|
- count * sizeof (i->sections[0]));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
+ add_to_target_sections (from_tty, target, i);
|
2006-07-11 06:33:02 +00:00
|
|
|
|
|
|
|
|
|
/* Notify any observer that the shared object has been
|
|
|
|
|
loaded now that we've added it to GDB's tables. */
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -720,6 +730,41 @@ solib_add (char *pattern, int from_tty,
|
2007-01-21 01:53:01 +00:00
|
|
|
|
}
|
2005-01-11 00:15:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+void
|
|
|
|
|
+add_to_target_sections (int from_tty, struct target_ops *target, struct so_list *solib)
|
|
|
|
|
+{
|
|
|
|
|
+ /* If this is set, then the sections have been already added to the
|
|
|
|
|
+ target list. */
|
|
|
|
|
+ if (solib->main)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ solib->from_tty = from_tty;
|
|
|
|
|
+
|
|
|
|
|
+ /* Fill in the rest of the `struct so_list' node. */
|
|
|
|
|
+ catch_errors (solib_map_sections, solib,
|
|
|
|
|
+ "Error while mapping shared library sections:\n",
|
|
|
|
|
+ RETURN_MASK_ALL);
|
|
|
|
|
+
|
|
|
|
|
+ /* If requested, add the shared object's sections to the TARGET's
|
|
|
|
|
+ section table. Do this immediately after mapping the object so
|
|
|
|
|
+ that later nodes in the list can query this object, as is needed
|
|
|
|
|
+ in solib-osf.c. */
|
|
|
|
|
+ if (target)
|
|
|
|
|
+ {
|
|
|
|
|
+ int count = (solib->sections_end - solib->sections);
|
|
|
|
|
+ if (count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ int space = target_resize_to_sections (target, count);
|
|
|
|
|
+ if (debug_solib)
|
|
|
|
|
+ fprintf_unfiltered (gdb_stdlog,
|
|
|
|
|
+ "add_to_target_sections: add %s to to_sections\n",
|
|
|
|
|
+ solib->so_original_name);
|
|
|
|
|
+ memcpy (target->to_sections + space,
|
|
|
|
|
+ solib->sections,
|
|
|
|
|
+ count * sizeof (solib->sections[0]));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
2007-01-21 01:53:01 +00:00
|
|
|
|
/*
|
2005-01-11 00:15:58 +00:00
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
|
@@ -1045,4 +1090,12 @@ This takes precedence over the environme
|
2006-07-11 06:33:02 +00:00
|
|
|
|
reload_shared_libraries,
|
|
|
|
|
show_solib_search_path,
|
|
|
|
|
&setlist, &showlist);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
+
|
2006-07-11 06:33:02 +00:00
|
|
|
|
+ add_setshow_boolean_cmd ("solib", no_class, &debug_solib,
|
|
|
|
|
+ _("\
|
|
|
|
|
+Set debugging of GNU/Linux shlib module.\n"), _("\
|
|
|
|
|
+Show debugging status of GNU/Linux shlib module.\n"), _("\
|
|
|
|
|
+Enables printf debugging output of GNU/Linux shlib module.\n"),
|
|
|
|
|
+ NULL, NULL,
|
|
|
|
|
+ &setdebuglist, &showdebuglist);
|
2005-01-11 00:15:58 +00:00
|
|
|
|
}
|
2007-11-01 20:24:20 +00:00
|
|
|
|
Index: gdb-6.7/gdb/elfread.c
|
2006-07-11 06:33:02 +00:00
|
|
|
|
===================================================================
|
2007-11-01 20:24:20 +00:00
|
|
|
|
--- gdb-6.7.orig/gdb/elfread.c 2007-08-23 20:08:28.000000000 +0200
|
|
|
|
|
+++ gdb-6.7/gdb/elfread.c 2007-10-13 05:29:58.000000000 +0200
|
|
|
|
|
@@ -611,7 +611,7 @@ elf_symfile_read (struct objfile *objfil
|
2005-01-11 00:15:58 +00:00
|
|
|
|
/* If we are reinitializing, or if we have never loaded syms yet,
|
|
|
|
|
set table to empty. MAINLINE is cleared so that *_read_psymtab
|
|
|
|
|
functions do not all also re-initialize the psymbol table. */
|
|
|
|
|
- if (mainline)
|
|
|
|
|
+ if (mainline == 1)
|
|
|
|
|
{
|
|
|
|
|
init_psymbol_list (objfile, 0);
|
|
|
|
|
mainline = 0;
|
2007-11-01 20:24:20 +00:00
|
|
|
|
|
|
|
|
|
2007-10-31 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
|
|
Port to GDB-6.7 - workaround too early breakpoint address analysis.
|
|
|
|
|
|
|
|
|
|
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-orig/gdb/Makefile.in gdb-6.7-patched/gdb/Makefile.in
|
|
|
|
|
--- gdb-6.7-orig/gdb/Makefile.in 2007-10-31 12:50:10.000000000 +0100
|
|
|
|
|
+++ gdb-6.7-patched/gdb/Makefile.in 2007-10-31 00:38:11.000000000 +0100
|
|
|
|
|
@@ -1824,7 +1824,7 @@ amd64-tdep.o: amd64-tdep.c $(defs_h) $(a
|
|
|
|
|
$(dummy_frame_h) $(frame_h) $(frame_base_h) $(frame_unwind_h) \
|
|
|
|
|
$(inferior_h) $(gdbcmd_h) $(gdbcore_h) $(objfiles_h) $(regcache_h) \
|
|
|
|
|
$(regset_h) $(symfile_h) $(gdb_assert_h) $(amd64_tdep_h) \
|
|
|
|
|
- $(i387_tdep_h)
|
|
|
|
|
+ $(i387_tdep_h) $(exceptions_h)
|
|
|
|
|
annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) \
|
|
|
|
|
$(gdbtypes_h) $(breakpoint_h)
|
|
|
|
|
arch-utils.o: arch-utils.c $(defs_h) $(arch_utils_h) $(buildsym_h) \
|
|
|
|
|
diff -u -X /home/jkratoch/.diffi.list -rup gdb-6.7-orig/gdb/amd64-tdep.c gdb-6.7-patched/gdb/amd64-tdep.c
|
|
|
|
|
--- gdb-6.7-orig/gdb/amd64-tdep.c 2007-10-31 12:50:09.000000000 +0100
|
|
|
|
|
+++ gdb-6.7-patched/gdb/amd64-tdep.c 2007-10-31 00:46:13.000000000 +0100
|
|
|
|
|
@@ -36,6 +36,7 @@
|
|
|
|
|
#include "symfile.h"
|
|
|
|
|
#include "dwarf2-frame.h"
|
|
|
|
|
#include "gdb_assert.h"
|
|
|
|
|
+#include "exceptions.h"
|
|
|
|
|
|
|
|
|
|
#include "amd64-tdep.h"
|
|
|
|
|
#include "i387-tdep.h"
|
|
|
|
|
@@ -734,16 +735,28 @@ amd64_alloc_frame_cache (void)
|
|
|
|
|
Any function that doesn't start with this sequence will be assumed
|
|
|
|
|
to have no prologue and thus no valid frame pointer in %rbp. */
|
|
|
|
|
|
|
|
|
|
-static CORE_ADDR
|
|
|
|
|
-amd64_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
|
|
|
|
|
- struct amd64_frame_cache *cache)
|
|
|
|
|
+struct amd64_analyze_prologue_data
|
|
|
|
|
+ {
|
|
|
|
|
+ CORE_ADDR pc, current_pc;
|
|
|
|
|
+ struct amd64_frame_cache *cache;
|
|
|
|
|
+ CORE_ADDR retval;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+static int
|
|
|
|
|
+amd64_analyze_prologue_1 (void *data_pointer)
|
|
|
|
|
{
|
|
|
|
|
+ struct amd64_analyze_prologue_data *data = data_pointer;
|
|
|
|
|
+ CORE_ADDR pc = data->pc, current_pc = data->current_pc;
|
|
|
|
|
+ struct amd64_frame_cache *cache = data->cache;
|
|
|
|
|
static gdb_byte proto[3] = { 0x48, 0x89, 0xe5 }; /* movq %rsp, %rbp */
|
|
|
|
|
gdb_byte buf[3];
|
|
|
|
|
gdb_byte op;
|
|
|
|
|
|
|
|
|
|
if (current_pc <= pc)
|
|
|
|
|
- return current_pc;
|
|
|
|
|
+ {
|
|
|
|
|
+ data->retval = current_pc;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
op = read_memory_unsigned_integer (pc, 1);
|
|
|
|
|
|
|
|
|
|
@@ -756,18 +769,57 @@ amd64_analyze_prologue (CORE_ADDR pc, CO
|
|
|
|
|
|
|
|
|
|
/* If that's all, return now. */
|
|
|
|
|
if (current_pc <= pc + 1)
|
|
|
|
|
- return current_pc;
|
|
|
|
|
+ {
|
|
|
|
|
+ data->retval = current_pc;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
/* Check for `movq %rsp, %rbp'. */
|
|
|
|
|
read_memory (pc + 1, buf, 3);
|
|
|
|
|
if (memcmp (buf, proto, 3) != 0)
|
|
|
|
|
- return pc + 1;
|
|
|
|
|
+ {
|
|
|
|
|
+ data->retval = pc + 1;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
/* OK, we actually have a frame. */
|
|
|
|
|
cache->frameless_p = 0;
|
|
|
|
|
- return pc + 4;
|
|
|
|
|
+ data->retval = pc + 4;
|
|
|
|
|
+ return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ data->retval = pc;
|
|
|
|
|
+ return 1;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Catch memory read errors and return just PC in such case.
|
|
|
|
|
+ It occurs very early on enable_break->new_symfile_objfile->
|
|
|
|
|
+ ->breakpoint_re_set->decode_line_1->decode_variable_1->
|
|
|
|
|
+ ->find_function_start_sal */
|
|
|
|
|
+
|
|
|
|
|
+static CORE_ADDR
|
|
|
|
|
+amd64_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
|
|
|
|
|
+ struct amd64_frame_cache *cache)
|
|
|
|
|
+{
|
|
|
|
|
+ int status;
|
|
|
|
|
+ struct amd64_analyze_prologue_data data;
|
|
|
|
|
+ struct ui_file *saved_gdb_stderr;
|
|
|
|
|
+
|
|
|
|
|
+ /* Suppress error messages. */
|
|
|
|
|
+ saved_gdb_stderr = gdb_stderr;
|
|
|
|
|
+ gdb_stderr = ui_file_new ();
|
|
|
|
|
+
|
|
|
|
|
+ data.pc = pc;
|
|
|
|
|
+ data.current_pc = current_pc;
|
|
|
|
|
+ data.cache = cache;
|
|
|
|
|
+ status = catch_errors (amd64_analyze_prologue_1, &data, "", RETURN_MASK_ALL);
|
|
|
|
|
+
|
|
|
|
|
+ /* Stop suppressing error messages. */
|
|
|
|
|
+ ui_file_delete (gdb_stderr);
|
|
|
|
|
+ gdb_stderr = saved_gdb_stderr;
|
|
|
|
|
+
|
|
|
|
|
+ if (status)
|
|
|
|
|
+ return data.retval;
|
|
|
|
|
return pc;
|
|
|
|
|
}
|
|
|
|
|
|