- Upgrade to GDB 6.7. Drop redundant patches, forward-port remaining ones.

- Fix rereading of the main executable on its change.
This commit is contained in:
Jan Kratochvil 2007-11-01 20:24:20 +00:00
commit eb9d945afa
55 changed files with 1702 additions and 7915 deletions

View file

@ -1,8 +1,8 @@
Index: gdb-6.6/gdb/dwarf2read.c
Index: gdb-6.7/gdb/dwarf2read.c
===================================================================
--- gdb-6.6.orig/gdb/dwarf2read.c
+++ gdb-6.6/gdb/dwarf2read.c
@@ -1219,7 +1219,7 @@ dwarf2_build_psymtabs (struct objfile *o
--- 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
else
dwarf2_per_objfile->loc_buffer = NULL;
@ -11,11 +11,11 @@ Index: gdb-6.6/gdb/dwarf2read.c
|| (objfile->global_psymbols.size == 0
&& objfile->static_psymbols.size == 0))
{
Index: gdb-6.6/gdb/auxv.c
Index: gdb-6.7/gdb/auxv.c
===================================================================
--- gdb-6.6.orig/gdb/auxv.c
+++ gdb-6.6/gdb/auxv.c
@@ -82,7 +82,7 @@ procfs_xfer_auxv (struct target_ops *ops
--- 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
Return 1 if an entry was read into *TYPEP and *VALP. */
int
target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
@ -24,7 +24,7 @@ Index: gdb-6.6/gdb/auxv.c
{
const int sizeof_auxv_field = TYPE_LENGTH (builtin_type_void_data_ptr);
gdb_byte *ptr = *readptr;
@@ -107,9 +107,10 @@ target_auxv_parse (struct target_ops *op
@@ -105,9 +105,10 @@ target_auxv_parse (struct target_ops *op
an error getting the information. On success, return 1 after
storing the entry's value field in *VALP. */
int
@ -37,7 +37,7 @@ Index: gdb-6.6/gdb/auxv.c
gdb_byte *data;
LONGEST n = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL, &data);
gdb_byte *ptr = data;
@@ -119,10 +120,10 @@ target_auxv_search (struct target_ops *o
@@ -117,10 +118,10 @@ target_auxv_search (struct target_ops *o
return n;
while (1)
@ -50,7 +50,7 @@ Index: gdb-6.6/gdb/auxv.c
{
xfree (data);
*valp = val;
@@ -145,7 +146,8 @@ target_auxv_search (struct target_ops *o
@@ -143,7 +144,8 @@ target_auxv_search (struct target_ops *o
int
fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
{
@ -60,7 +60,7 @@ Index: gdb-6.6/gdb/auxv.c
gdb_byte *data;
LONGEST len = target_read_alloc (ops, TARGET_OBJECT_AUXV, NULL,
&data);
@@ -155,14 +157,14 @@ fprint_target_auxv (struct ui_file *file
@@ -153,14 +155,14 @@ fprint_target_auxv (struct ui_file *file
if (len <= 0)
return len;
@ -77,7 +77,7 @@ Index: gdb-6.6/gdb/auxv.c
{
#define TAG(tag, text, kind) \
case tag: name = #tag; description = text; flavor = kind; break
@@ -213,7 +215,7 @@ fprint_target_auxv (struct ui_file *file
@@ -211,7 +213,7 @@ fprint_target_auxv (struct ui_file *file
}
fprintf_filtered (file, "%-4s %-20s %-30s ",
@ -86,11 +86,11 @@ Index: gdb-6.6/gdb/auxv.c
switch (flavor)
{
case dec:
Index: gdb-6.6/gdb/auxv.h
Index: gdb-6.7/gdb/auxv.h
===================================================================
--- gdb-6.6.orig/gdb/auxv.h
+++ gdb-6.6/gdb/auxv.h
@@ -37,14 +37,14 @@ struct target_ops; /* Forward declarati
--- 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
Return 1 if an entry was read into *TYPEP and *VALP. */
extern int target_auxv_parse (struct target_ops *ops,
gdb_byte **readptr, gdb_byte *endptr,
@ -107,11 +107,11 @@ Index: gdb-6.6/gdb/auxv.h
/* 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);
Index: gdb-6.6/gdb/breakpoint.h
Index: gdb-6.7/gdb/breakpoint.h
===================================================================
--- gdb-6.6.orig/gdb/breakpoint.h
+++ gdb-6.6/gdb/breakpoint.h
@@ -159,6 +159,7 @@ enum enable_state
--- 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
automatically enabled and reset when the call
"lands" (either completes, or stops at another
eventpoint). */
@ -121,7 +121,7 @@ Index: gdb-6.6/gdb/breakpoint.h
breakpoint instruction on top of it, or restore
@@ -807,8 +808,12 @@ extern void remove_thread_event_breakpoi
extern void disable_breakpoints_in_shlibs (int silent);
extern void disable_breakpoints_in_shlibs (void);
+extern void disable_breakpoints_at_startup (int silent);
+
@ -132,11 +132,11 @@ Index: gdb-6.6/gdb/breakpoint.h
extern void create_solib_load_event_breakpoint (char *, int, char *, char *);
extern void create_solib_unload_event_breakpoint (char *, int,
Index: gdb-6.6/gdb/symfile-mem.c
Index: gdb-6.7/gdb/symfile-mem.c
===================================================================
--- gdb-6.6.orig/gdb/symfile-mem.c
+++ gdb-6.6/gdb/symfile-mem.c
@@ -110,7 +110,7 @@ symbol_file_add_from_memory (struct bfd
--- 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
}
objf = symbol_file_add_from_bfd (nbfd, from_tty,
@ -145,11 +145,11 @@ Index: gdb-6.6/gdb/symfile-mem.c
/* This might change our ideas about frames already looked at. */
reinit_frame_cache ();
Index: gdb-6.6/gdb/infrun.c
Index: gdb-6.7/gdb/infrun.c
===================================================================
--- gdb-6.6.orig/gdb/infrun.c
+++ gdb-6.6/gdb/infrun.c
@@ -2249,6 +2249,11 @@ process_event_stop_test:
--- 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:
code segments in shared libraries might be mapped in now. */
re_enable_breakpoints_in_shlibs ();
@ -161,11 +161,11 @@ Index: gdb-6.6/gdb/infrun.c
/* 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
Index: gdb-6.6/gdb/objfiles.c
Index: gdb-6.7/gdb/objfiles.c
===================================================================
--- gdb-6.6.orig/gdb/objfiles.c
+++ gdb-6.6/gdb/objfiles.c
@@ -50,6 +50,9 @@
--- 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 @@
#include "dictionary.h"
#include "source.h"
@ -175,7 +175,7 @@ Index: gdb-6.6/gdb/objfiles.c
/* Prototypes for local functions */
static void objfile_alloc_data (struct objfile *objfile);
@@ -261,7 +264,19 @@ init_entry_point_info (struct objfile *o
@@ -259,7 +262,19 @@ init_entry_point_info (struct objfile *o
CORE_ADDR
entry_point_address (void)
{
@ -196,11 +196,11 @@ Index: gdb-6.6/gdb/objfiles.c
}
/* Create the terminating entry of OBJFILE's minimal symbol table.
Index: gdb-6.6/gdb/solib-svr4.c
Index: gdb-6.7/gdb/solib-svr4.c
===================================================================
--- gdb-6.6.orig/gdb/solib-svr4.c
+++ gdb-6.6/gdb/solib-svr4.c
@@ -34,6 +34,8 @@
--- 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 @@
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
@ -209,7 +209,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
#include "gdb_assert.h"
@@ -267,7 +269,9 @@ static char *debug_loader_name;
@@ -249,7 +251,9 @@ static char *debug_loader_name;
/* Local function prototypes */
@ -217,44 +217,57 @@ Index: gdb-6.6/gdb/solib-svr4.c
static int match_main (char *);
+#endif
static CORE_ADDR bfd_lookup_symbol (bfd *, char *, flagword);
static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
@@ -389,22 +393,79 @@ elf_locate_base (void)
{
struct bfd_section *dyninfo_sect;
int dyninfo_sect_size;
- CORE_ADDR dyninfo_addr;
+ CORE_ADDR dyninfo_addr, relocated_dyninfo_addr, entry_addr;
gdb_byte *buf;
gdb_byte *bufend;
int arch_size;
@@ -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;
+ int ret;
+
+ /* Find the address of the entry point of the program from the
+ auxv vector. */
+ ret = target_auxv_search (&current_target, AT_ENTRY, &entry_addr);
+
+ 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);
+ }
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);
+
+ if (ptr != NULL)
+ {
+ /* Find the address of the entry point of the program from the
+ auxv vector. */
+ ret = target_auxv_search (&current_target, AT_ENTRY, &entry_addr);
+
+ 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);
+ }
+ }
+
/* Find the start address of the .dynamic section. */
dyninfo_sect = bfd_get_section_by_name (exec_bfd, ".dynamic");
if (dyninfo_sect == NULL)
sect = bfd_get_section_by_name (abfd, ".dynamic");
if (sect == NULL)
- return 0;
+ {
+ if (debug_solib)
@ -271,50 +284,78 @@ Index: gdb-6.6/gdb/solib-svr4.c
+ exec_bfd->filename);
+ }
+
dyninfo_addr = bfd_section_vma (exec_bfd, dyninfo_sect);
dyn_addr = bfd_section_vma (abfd, sect);
+ if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog,
+ "elf_locate_base: unrelocated .dynamic addr 0x%s\n",
+ paddr_nz (dyninfo_addr));
+
+ relocated_dyninfo_addr = dyninfo_addr
+ + entry_addr - bfd_get_start_address(exec_bfd);
+ if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog,
+ "elf_locate_base: relocated .dyn addr 0x%s for %s\n",
+ paddr_nz(relocated_dyninfo_addr), exec_bfd->filename);
+ "elf_locate_base: .dynamic addr 0x%s\n",
+ paddr_nz (dyn_addr));
/* Read in .dynamic section, silently ignore errors. */
dyninfo_sect_size = bfd_section_size (exec_bfd, dyninfo_sect);
buf = alloca (dyninfo_sect_size);
- if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size))
- return 0;
/* 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);
+ if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog,
+ "elf_locate_base: read in .dynamic section\n");
+ if (target_read_memory (relocated_dyninfo_addr, buf, dyninfo_sect_size))
if (!bfd_get_section_contents (abfd, sect,
buf, 0, sect_size))
- return 0;
+ {
+ if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog,
+ "elf_locate_base: couldn't read .dynamic section at 0x%s -- return now\n",
+ paddr_nz (relocated_dyninfo_addr));
+ "elf_locate_base: couldn't read .dynamic section -- return now\n");
+ return 0;
+ }
/* Find the DT_DEBUG entry in the the .dynamic section.
For mips elf we look for DT_MIPS_RLD_MAP, mips elf apparently has
@@ -431,6 +492,10 @@ elf_locate_base (void)
{
dyn_ptr = bfd_h_get_32 (exec_bfd,
(bfd_byte *) x_dynp->d_un.d_ptr);
+ if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog,
+ "elf_locate_base: DT_DEBUG entry has value 0x%s -- return now\n",
+ paddr_nz (dyn_ptr));
return dyn_ptr;
}
else if (dyn_tag == DT_MIPS_RLD_MAP)
@@ -556,6 +621,10 @@ solib_svr4_r_map (void)
/* 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)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
@ -325,7 +366,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
return read_memory_typed_address (debug_base + lmo->r_map_offset,
builtin_type_void_data_ptr);
}
@@ -713,6 +782,11 @@ svr4_current_sos (void)
@@ -704,6 +799,11 @@ svr4_current_sos (void)
struct so_list **link_ptr = &head;
CORE_ADDR ldsomap = 0;
@ -337,7 +378,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
/* Make sure we've looked up the inferior's dynamic linker's base
structure. */
if (! debug_base)
@@ -722,11 +796,21 @@ svr4_current_sos (void)
@@ -713,11 +813,21 @@ svr4_current_sos (void)
/* If we can't find the dynamic linker's base structure, this
must not be a dynamically linked executable. Hmm. */
if (! debug_base)
@ -360,7 +401,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
lm = solib_svr4_r_map ();
while (lm)
@@ -742,23 +826,103 @@ svr4_current_sos (void)
@@ -733,23 +843,103 @@ svr4_current_sos (void)
new->lm_info->lm = xzalloc (lmo->link_map_size);
make_cleanup (xfree, new->lm_info->lm);
@ -465,15 +506,15 @@ Index: gdb-6.6/gdb/solib-svr4.c
target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
@@ -766,22 +930,37 @@ svr4_current_sos (void)
@@ -757,23 +947,35 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- xfree (buffer);
- strcpy (new->so_original_name, new->so_name);
- }
- xfree (buffer);
-
- /* If this entry has no name, or its name matches the name
- for the main executable, don't include it in the list. */
@ -485,22 +526,18 @@ Index: gdb-6.6/gdb/solib-svr4.c
- new->next = 0;
- *link_ptr = new;
- link_ptr = &new->next;
+ 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)
+ 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
+ {
+ xfree (buffer);
+ free_so (new);
+ }
+ else
+ {
+ strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+ xfree (buffer);
+ strcpy (new->so_original_name, new->so_name);
+ if (debug_solib)
+ {
@ -517,9 +554,11 @@ Index: gdb-6.6/gdb/solib-svr4.c
+ link_ptr = &new->next;
+ }
}
+ xfree (buffer);
}
@@ -798,6 +977,11 @@ svr4_current_sos (void)
/* On Solaris, the dynamic linker is not in the normal list of
@@ -789,6 +991,11 @@ svr4_current_sos (void)
if (head == NULL)
return svr4_default_sos ();
@ -531,7 +570,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
return head;
}
@@ -874,7 +1058,7 @@ svr4_fetch_objfile_link_map (struct objf
@@ -868,7 +1075,7 @@ svr4_fetch_objfile_link_map (struct objf
/* 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. */
@ -540,7 +579,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
static int
match_main (char *soname)
{
@@ -888,6 +1072,7 @@ match_main (char *soname)
@@ -882,6 +1089,7 @@ match_main (char *soname)
return (0);
}
@ -548,7 +587,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
/* Return 1 if PC lies in the dynamic symbol resolution code of the
SVR4 run time loader. */
@@ -987,6 +1172,11 @@ enable_break (void)
@@ -979,6 +1187,11 @@ enable_break (void)
/* 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");
@ -560,7 +599,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
if (interp_sect)
{
unsigned int interp_sect_size;
@@ -1025,6 +1215,9 @@ enable_break (void)
@@ -1018,6 +1231,9 @@ enable_break (void)
if (tmp_fd >= 0)
tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
@ -570,7 +609,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
if (tmp_bfd == NULL)
goto bkpt_at_symbol;
@@ -1111,6 +1304,9 @@ enable_break (void)
@@ -1115,6 +1331,9 @@ enable_break (void)
if (sym_addr != 0)
{
create_solib_event_breakpoint (load_addr + sym_addr);
@ -580,7 +619,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
return 1;
}
@@ -1372,6 +1568,8 @@ svr4_solib_create_inferior_hook (void)
@@ -1375,6 +1594,8 @@ svr4_solib_create_inferior_hook (void)
while (stop_signal != TARGET_SIGNAL_TRAP);
stop_soon = NO_STOP_QUIETLY;
#endif /* defined(_SCO_DS) */
@ -589,7 +628,7 @@ Index: gdb-6.6/gdb/solib-svr4.c
}
static void
@@ -1558,6 +1756,75 @@ svr4_lp64_fetch_link_map_offsets (void)
@@ -1551,6 +1772,75 @@ svr4_lp64_fetch_link_map_offsets (void)
return lmp;
}
@ -664,8 +703,8 @@ Index: gdb-6.6/gdb/solib-svr4.c
+
static struct target_so_ops svr4_so_ops;
@@ -1580,4 +1847,8 @@ _initialize_svr4_solib (void)
struct target_so_ops svr4_so_ops;
@@ -1592,4 +1882,8 @@ _initialize_svr4_solib (void)
/* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */
current_target_so_ops = &svr4_so_ops;
@ -674,12 +713,12 @@ Index: gdb-6.6/gdb/solib-svr4.c
+ "Display the inferior's linkmap.");
+
}
Index: gdb-6.6/gdb/varobj.c
Index: gdb-6.7/gdb/varobj.c
===================================================================
--- gdb-6.6.orig/gdb/varobj.c
+++ gdb-6.6/gdb/varobj.c
@@ -870,6 +870,62 @@ varobj_list (struct varobj ***varlist)
return rootcount;
--- 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;
}
+void
@ -741,11 +780,11 @@ Index: gdb-6.6/gdb/varobj.c
/* 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
Index: gdb-6.6/gdb/solist.h
Index: gdb-6.7/gdb/solist.h
===================================================================
--- gdb-6.6.orig/gdb/solist.h
+++ gdb-6.6/gdb/solist.h
@@ -62,6 +62,8 @@ struct so_list
--- 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
bfd *abfd;
char symbols_loaded; /* flag: symbols read in yet? */
char from_tty; /* flag: print msgs? */
@ -754,7 +793,7 @@ Index: gdb-6.6/gdb/solist.h
struct objfile *objfile; /* objfile for loaded lib */
struct section_table *sections;
struct section_table *sections_end;
@@ -113,9 +115,15 @@ void free_so (struct so_list *so);
@@ -123,9 +125,15 @@ void free_so (struct so_list *so);
/* Return address of first so_list entry in master shared object list. */
struct so_list *master_so_list (void);
@ -770,29 +809,29 @@ Index: gdb-6.6/gdb/solist.h
/* FIXME: gdbarch needs to control this variable */
extern struct target_so_ops *current_target_so_ops;
@@ -126,4 +134,6 @@ extern struct target_so_ops *current_tar
#define TARGET_SO_IN_DYNSYM_RESOLVE_CODE \
(current_target_so_ops->in_dynsym_resolve_code)
@@ -143,4 +151,6 @@ struct symbol *solib_global_lookup (cons
const domain_enum domain,
struct symtab **symtab);
+/* Controls the printing of debugging output. */
+extern int debug_solib;
#endif
Index: gdb-6.6/gdb/varobj.h
Index: gdb-6.7/gdb/varobj.h
===================================================================
--- gdb-6.6.orig/gdb/varobj.h
+++ gdb-6.6/gdb/varobj.h
@@ -99,4 +99,6 @@ extern int varobj_list (struct varobj **
--- 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
extern int varobj_update (struct varobj **varp, struct varobj ***changelist);
extern void varobj_invalidate (void);
+extern void varobj_refresh(void);
+
#endif /* VAROBJ_H */
Index: gdb-6.6/gdb/symfile.c
Index: gdb-6.7/gdb/symfile.c
===================================================================
--- gdb-6.6.orig/gdb/symfile.c
+++ gdb-6.6/gdb/symfile.c
@@ -49,6 +49,7 @@
--- 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 @@
#include "readline/readline.h"
#include "gdb_assert.h"
#include "block.h"
@ -800,7 +839,7 @@ Index: gdb-6.6/gdb/symfile.c
#include "observer.h"
#include "exec.h"
#include "parser-defs.h"
@@ -659,7 +660,7 @@ syms_from_objfile (struct objfile *objfi
@@ -779,7 +780,7 @@ syms_from_objfile (struct objfile *objfi
/* Now either addrs or offsets is non-zero. */
@ -809,7 +848,7 @@ Index: gdb-6.6/gdb/symfile.c
{
/* We will modify the main symbol table, make sure that all its users
will be cleaned up if an error occurs during symbol reading. */
@@ -687,7 +688,7 @@ syms_from_objfile (struct objfile *objfi
@@ -807,7 +808,7 @@ syms_from_objfile (struct objfile *objfi
We no longer warn if the lowest section is not a text segment (as
happens for the PA64 port. */
@ -818,7 +857,7 @@ Index: gdb-6.6/gdb/symfile.c
{
asection *lower_sect;
asection *sect;
@@ -856,17 +857,21 @@ new_symfile_objfile (struct objfile *obj
@@ -976,17 +977,21 @@ new_symfile_objfile (struct objfile *obj
/* 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. */
@ -842,7 +881,7 @@ Index: gdb-6.6/gdb/symfile.c
/* We're done reading the symbol file; finish off complaints. */
clear_complaints (&symfile_complaints, 0, verbo);
@@ -909,7 +914,7 @@ symbol_file_add_with_addrs_or_offsets (b
@@ -1029,7 +1034,7 @@ symbol_file_add_with_addrs_or_offsets (b
interactively wiping out any existing symbols. */
if ((have_full_symbols () || have_partial_symbols ())
@ -851,7 +890,7 @@ Index: gdb-6.6/gdb/symfile.c
&& from_tty
&& !query ("Load new symbol table from \"%s\"? ", name))
error (_("Not confirmed."));
@@ -1090,6 +1095,10 @@ symbol_file_clear (int from_tty)
@@ -1213,6 +1218,10 @@ symbol_file_clear (int from_tty)
symfile_objfile->name)
: !query (_("Discard symbol table? "))))
error (_("Not confirmed."));
@ -862,7 +901,7 @@ Index: gdb-6.6/gdb/symfile.c
free_all_objfiles ();
/* solib descriptors may have handles to objfiles. Since their
@@ -2204,6 +2213,8 @@ reread_symbols (void)
@@ -2470,6 +2479,8 @@ reread_symbols (void)
/* Discard cleanups as symbol reading was successful. */
discard_cleanups (old_cleanups);
@ -871,19 +910,19 @@ Index: gdb-6.6/gdb/symfile.c
/* 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. */
@@ -2579,6 +2590,7 @@ clear_symtab_users (void)
@@ -2837,6 +2848,7 @@ clear_symtab_users (void)
breakpoint_re_set ();
set_default_breakpoint (0, 0, 0, 0);
clear_pc_function_cache ();
if (deprecated_target_new_objfile_hook)
deprecated_target_new_objfile_hook (NULL);
+ varobj_refresh ();
observer_notify_new_objfile (NULL);
/* Clear globals which might have pointed into a removed objfile.
FIXME: It's not clear which of these are supposed to persist
Index: gdb-6.6/gdb/breakpoint.c
Index: gdb-6.7/gdb/breakpoint.c
===================================================================
--- gdb-6.6.orig/gdb/breakpoint.c
+++ gdb-6.6/gdb/breakpoint.c
@@ -781,15 +781,15 @@ insert_watchpoints_for_new_thread (ptid_
--- 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_
struct value *v = b->owner->val_chain;
/* Look at each value on the value chain. */
@ -902,7 +941,7 @@ Index: gdb-6.6/gdb/breakpoint.c
/* We only watch structs and arrays if user asked
for it explicitly, never if they just happen to
@@ -801,8 +801,8 @@ insert_watchpoints_for_new_thread (ptid_
@@ -860,8 +860,8 @@ insert_watchpoints_for_new_thread (ptid_
CORE_ADDR addr;
int len, type;
@ -913,7 +952,7 @@ Index: gdb-6.6/gdb/breakpoint.c
type = hw_write;
if (b->owner->type == bp_read_watchpoint)
type = hw_read;
@@ -2682,12 +2682,12 @@ mark_triggered_watchpoints (CORE_ADDR st
@@ -2749,12 +2749,12 @@ mark_triggered_watchpoints (CORE_ADDR st
|| b->type == bp_read_watchpoint
|| b->type == bp_access_watchpoint)
{
@ -929,7 +968,7 @@ Index: gdb-6.6/gdb/breakpoint.c
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -2695,11 +2695,11 @@ mark_triggered_watchpoints (CORE_ADDR st
@@ -2762,11 +2762,11 @@ mark_triggered_watchpoints (CORE_ADDR st
{
CORE_ADDR vaddr;
@ -943,7 +982,7 @@ Index: gdb-6.6/gdb/breakpoint.c
b->watchpoint_triggered = 1;
}
}
@@ -2869,12 +2869,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
@@ -2936,12 +2936,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bs->stop = 0;
continue;
}
@ -959,7 +998,7 @@ Index: gdb-6.6/gdb/breakpoint.c
if (v == b->val_chain
|| (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
@@ -2882,11 +2882,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
@@ -2949,11 +2949,11 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
{
CORE_ADDR vaddr;
@ -973,7 +1012,7 @@ Index: gdb-6.6/gdb/breakpoint.c
must_check_value = 1;
}
}
@@ -3937,6 +3937,7 @@ describe_other_breakpoints (CORE_ADDR pc
@@ -3996,6 +3996,7 @@ describe_other_breakpoints (CORE_ADDR pc
printf_filtered ("%s%s ",
((b->enable_state == bp_disabled ||
b->enable_state == bp_shlib_disabled ||
@ -981,7 +1020,7 @@ Index: gdb-6.6/gdb/breakpoint.c
b->enable_state == bp_call_disabled)
? " (disabled)"
: b->enable_state == bp_permanent
@@ -4615,6 +4616,62 @@ re_enable_breakpoints_in_shlibs (void)
@@ -4669,6 +4670,62 @@ re_enable_breakpoints_in_shlibs (void)
}
}
@ -1044,7 +1083,7 @@ Index: gdb-6.6/gdb/breakpoint.c
static void
solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
char *cond_string, enum bptype bp_kind)
@@ -6961,6 +7018,7 @@ delete_breakpoint (struct breakpoint *bp
@@ -7084,6 +7141,7 @@ delete_breakpoint (struct breakpoint *bp
&& !b->loc->duplicate
&& b->enable_state != bp_disabled
&& b->enable_state != bp_shlib_disabled
@ -1052,7 +1091,7 @@ Index: gdb-6.6/gdb/breakpoint.c
&& !b->pending
&& b->enable_state != bp_call_disabled)
{
@@ -7176,7 +7234,8 @@ breakpoint_re_set_one (void *bint)
@@ -7308,7 +7366,8 @@ breakpoint_re_set_one (void *bint)
break;
save_enable = b->enable_state;
@ -1062,20 +1101,20 @@ Index: gdb-6.6/gdb/breakpoint.c
b->enable_state = bp_disabled;
else
/* If resetting a shlib-disabled breakpoint, we don't want to
Index: gdb-6.6/gdb/solib.c
Index: gdb-6.7/gdb/solib.c
===================================================================
--- gdb-6.6.orig/gdb/solib.c
+++ gdb-6.6/gdb/solib.c
@@ -72,6 +72,8 @@ solib_ops (struct gdbarch *gdbarch)
--- 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,
/* external data declarations */
+int debug_solib;
+
/* FIXME: gdbarch needs to control this variable */
/* FIXME: gdbarch needs to control this variable, or else every
configuration needs to call set_solib_ops. */
struct target_so_ops *current_target_so_ops;
@@ -102,6 +104,8 @@ The search path for loading non-absolute
@@ -105,6 +107,8 @@ The search path for loading non-absolute
value);
}
@ -1084,7 +1123,7 @@ Index: gdb-6.6/gdb/solib.c
/*
GLOBAL FUNCTION
@@ -376,7 +380,6 @@ free_so (struct so_list *so)
@@ -394,7 +398,6 @@ free_so (struct so_list *so)
xfree (so);
}
@ -1092,7 +1131,7 @@ Index: gdb-6.6/gdb/solib.c
/* Return address of first so_list entry in master shared object list. */
struct so_list *
master_so_list (void)
@@ -384,7 +387,6 @@ master_so_list (void)
@@ -402,7 +405,6 @@ master_so_list (void)
return so_list_head;
}
@ -1100,7 +1139,7 @@ Index: gdb-6.6/gdb/solib.c
/* A small stub to get us past the arg-passing pinhole of catch_errors. */
static int
@@ -396,15 +398,40 @@ symbol_add_stub (void *arg)
@@ -414,15 +416,40 @@ symbol_add_stub (void *arg)
/* Have we already loaded this shared object? */
ALL_OBJFILES (so->objfile)
{
@ -1144,7 +1183,7 @@ Index: gdb-6.6/gdb/solib.c
free_section_addr_info (sap);
return (1);
@@ -532,6 +559,10 @@ update_solib_list (int from_tty, struct
@@ -550,6 +577,10 @@ update_solib_list (int from_tty, struct
the inferior's current list. */
while (i)
{
@ -1155,7 +1194,7 @@ Index: gdb-6.6/gdb/solib.c
if (! strcmp (gdb->so_original_name, i->so_original_name))
break;
@@ -585,28 +616,7 @@ update_solib_list (int from_tty, struct
@@ -603,28 +634,7 @@ update_solib_list (int from_tty, struct
/* Fill in the rest of each of the `struct so_list' nodes. */
for (i = inferior; i; i = i->next)
{
@ -1185,7 +1224,7 @@ Index: gdb-6.6/gdb/solib.c
/* Notify any observer that the shared object has been
loaded now that we've added it to GDB's tables. */
@@ -702,6 +712,41 @@ solib_add (char *pattern, int from_tty,
@@ -720,6 +730,41 @@ solib_add (char *pattern, int from_tty,
}
}
@ -1227,7 +1266,7 @@ Index: gdb-6.6/gdb/solib.c
/*
@@ -1006,4 +1051,12 @@ This takes precedence over the environme
@@ -1045,4 +1090,12 @@ This takes precedence over the environme
reload_shared_libraries,
show_solib_search_path,
&setlist, &showlist);
@ -1240,11 +1279,11 @@ Index: gdb-6.6/gdb/solib.c
+ NULL, NULL,
+ &setdebuglist, &showdebuglist);
}
Index: gdb-6.6/gdb/elfread.c
Index: gdb-6.7/gdb/elfread.c
===================================================================
--- gdb-6.6.orig/gdb/elfread.c
+++ gdb-6.6/gdb/elfread.c
@@ -556,7 +556,7 @@ elf_symfile_read (struct objfile *objfil
--- 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
/* 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. */
@ -1253,3 +1292,125 @@ Index: gdb-6.6/gdb/elfread.c
{
init_psymbol_list (objfile, 0);
mainline = 0;
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;
}