Accepting request 22254 from devel:gcc

Copy from devel:gcc/gdb based on submit request 22254 from user rguenther

OBS-URL: https://build.opensuse.org/request/show/22254
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=67
This commit is contained in:
OBS User autobuild 2009-10-12 14:27:52 +00:00 committed by Git OBS Bridge
parent 66ac274df9
commit 01c38154ce
12 changed files with 795 additions and 1316 deletions

View File

@ -26,10 +26,10 @@
Fix scan_dyntag() for binaries provided by valgrind (BZ 460319).
Index: gdb-6.8.91.20090917/gdb/amd64-tdep.c
Index: gdb-6.8.91.20090925/gdb/amd64-tdep.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/amd64-tdep.c 2009-09-17 12:48:49.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/amd64-tdep.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/amd64-tdep.c 2009-09-25 10:25:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/amd64-tdep.c 2009-09-25 10:25:45.000000000 +0200
@@ -36,6 +36,7 @@
#include "regcache.h"
#include "regset.h"
@ -138,10 +138,10 @@ Index: gdb-6.8.91.20090917/gdb/amd64-tdep.c
return pc;
}
Index: gdb-6.8.91.20090917/gdb/auxv.c
Index: gdb-6.8.91.20090925/gdb/auxv.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/auxv.c 2009-07-02 19:25:52.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/auxv.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/auxv.c 2009-07-02 19:25:52.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/auxv.c 2009-09-25 10:25:45.000000000 +0200
@@ -78,7 +78,7 @@ procfs_xfer_auxv (struct target_ops *ops
Return 1 if an entry was read into *TYPEP and *VALP. */
static int
@ -230,10 +230,10 @@ Index: gdb-6.8.91.20090917/gdb/auxv.c
break;
}
Index: gdb-6.8.91.20090917/gdb/auxv.h
Index: gdb-6.8.91.20090925/gdb/auxv.h
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/auxv.h 2009-06-07 21:07:08.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/auxv.h 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/auxv.h 2009-06-07 21:07:08.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/auxv.h 2009-09-25 10:25:45.000000000 +0200
@@ -31,14 +31,14 @@
Return 1 if an entry was read into *TYPEP and *VALP. */
extern int target_auxv_parse (struct target_ops *ops,
@ -251,10 +251,10 @@ Index: gdb-6.8.91.20090917/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.8.91.20090917/gdb/dwarf2read.c
Index: gdb-6.8.91.20090925/gdb/dwarf2read.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/dwarf2read.c 2009-09-17 12:49:20.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/dwarf2read.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/dwarf2read.c 2009-09-25 10:25:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/dwarf2read.c 2009-09-25 10:25:45.000000000 +0200
@@ -1717,7 +1717,7 @@ dwarf2_build_psymtabs (struct objfile *o
dwarf2_read_section (objfile, &dwarf2_per_objfile->eh_frame);
dwarf2_read_section (objfile, &dwarf2_per_objfile->frame);
@ -264,10 +264,10 @@ Index: gdb-6.8.91.20090917/gdb/dwarf2read.c
|| (objfile->global_psymbols.size == 0
&& objfile->static_psymbols.size == 0))
{
Index: gdb-6.8.91.20090917/gdb/elfread.c
Index: gdb-6.8.91.20090925/gdb/elfread.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/elfread.c 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/elfread.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/elfread.c 2009-09-25 10:25:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/elfread.c 2009-09-25 10:25:45.000000000 +0200
@@ -681,7 +681,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
@ -277,10 +277,10 @@ Index: gdb-6.8.91.20090917/gdb/elfread.c
{
init_psymbol_list (objfile, 0);
mainline = 0;
Index: gdb-6.8.91.20090917/gdb/infrun.c
Index: gdb-6.8.91.20090925/gdb/infrun.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/infrun.c 2009-09-17 12:48:50.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/infrun.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/infrun.c 2009-09-25 10:25:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/infrun.c 2009-09-25 10:25:45.000000000 +0200
@@ -3659,6 +3659,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
#endif
target_terminal_inferior ();
@ -292,10 +292,10 @@ Index: gdb-6.8.91.20090917/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.8.91.20090917/gdb/objfiles.c
Index: gdb-6.8.91.20090925/gdb/objfiles.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/objfiles.c 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/objfiles.c 2009-09-17 12:50:20.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/objfiles.c 2009-09-25 10:25:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/objfiles.c 2009-09-25 10:25:45.000000000 +0200
@@ -53,6 +53,9 @@
#include "observer.h"
#include "complaints.h"
@ -324,10 +324,10 @@ Index: gdb-6.8.91.20090917/gdb/objfiles.c
if (symfile_objfile == NULL)
return 0;
Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/solib-svr4.c 2009-09-17 12:48:50.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/solib-svr4.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c 2009-09-25 10:25:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/solib-svr4.c 2009-09-25 10:28:07.000000000 +0200
@@ -47,6 +47,7 @@
#include "exec.h"
#include "auxv.h"
@ -704,11 +704,19 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
@@ -1101,47 +1336,60 @@ svr4_current_sos (void)
@@ -1101,63 +1336,76 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
- struct build_id *build_id;
-
- strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
- new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- /* May get overwritten below. */
- strcpy (new->so_name, new->so_original_name);
-
- build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
- if (build_id != NULL)
+ if (debug_solib)
+ fprintf_unfiltered (gdb_stdlog,
+ "svr4_current_sos: LM_NAME is <%s>\n",
@ -718,25 +726,25 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
+ if (strcmp (buffer, "") == 0)
+ free_so (new);
+ else
+ {
{
- char *name, *build_id_filename;
+ struct build_id *build_id;
- strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
- new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- /* May get overwritten below. */
- strcpy (new->so_name, new->so_original_name);
+
+ strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+ new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+ /* May get overwritten below. */
+ strcpy (new->so_name, new->so_original_name);
- build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
- if (build_id != NULL)
- {
- char *name, *build_id_filename;
- /* Missing the build-id matching separate debug info file
- would be handled while SO_NAME gets loaded. */
- name = build_id_to_filename (build_id, &build_id_filename, 0);
- if (name != NULL)
+ build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
+ if (build_id != NULL)
+ {
{
- strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- xfree (name);
+ char *name, *build_id_filename;
+
+ /* Missing the build-id matching separate debug info file
@ -749,21 +757,46 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
+ xfree (name);
+ }
+ else
+ debug_print_missing (new->so_name, build_id_filename);
+ {
+ debug_print_missing (new->so_name, build_id_filename);
+
+ /* In the case the main executable was found according to
+ its build-id (from a core file) prevent loading
+ a different build of a library with accidentally the
+ same SO_NAME.
+
+ It suppresses bogus backtraces (and prints "??" there
+ instead) if the on-disk files no longer match the
+ running program version. */
+
+ if (symfile_objfile != NULL
+ && (symfile_objfile->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ new->so_name[0] = 0;
+ }
+
+ xfree (build_id_filename);
+ xfree (build_id);
+ }
}
- else
- {
- debug_print_missing (new->so_name, build_id_filename);
- /* Missing the build-id matching separate debug info file
- would be handled while SO_NAME gets loaded. */
- name = build_id_to_filename (build_id, &build_id_filename, 0);
- if (name != NULL)
- /* In the case the main executable was found according to
- its build-id (from a core file) prevent loading
- a different build of a library with accidentally the
- same SO_NAME.
-
- It suppresses bogus backtraces (and prints "??" there
- instead) if the on-disk files no longer match the
- running program version. */
-
- if (symfile_objfile != NULL
- && (symfile_objfile->flags
- & OBJF_BUILD_ID_CORE_LOADED) != 0)
- new->so_name[0] = 0;
+ if (debug_solib)
{
- strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- xfree (name);
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "svr4_current_sos: Processing DSO: %s\n",
+ new->so_name);
@ -771,8 +804,6 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
+ "svr4_current_sos: first link entry %d\n",
+ IGNORE_FIRST_LINK_MAP_ENTRY (new));
}
- else
- debug_print_missing (new->so_name, build_id_filename);
- xfree (build_id_filename);
- xfree (build_id);
@ -798,7 +829,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
}
/* On Solaris, the dynamic linker is not in the normal list of
@@ -1157,6 +1405,9 @@ svr4_current_sos (void)
@@ -1173,6 +1421,9 @@ svr4_current_sos (void)
if (head == NULL)
return svr4_default_sos ();
@ -808,7 +839,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
return head;
}
@@ -1189,7 +1440,7 @@ svr4_fetch_objfile_link_map (struct objf
@@ -1205,7 +1456,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. */
@ -817,7 +848,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
static int
match_main (char *soname)
{
@@ -1203,6 +1454,7 @@ match_main (char *soname)
@@ -1219,6 +1470,7 @@ match_main (char *soname)
return (0);
}
@ -825,7 +856,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
/* Return 1 if PC lies in the dynamic symbol resolution code of the
SVR4 run time loader. */
@@ -1354,15 +1606,29 @@ enable_break (struct svr4_info *info)
@@ -1370,15 +1622,29 @@ enable_break (struct svr4_info *info)
/* Find the program interpreter; if not found, warn the user and drop
into the old breakpoint at symbol code. */
interp_name = find_program_interpreter ();
@ -855,7 +886,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
sym_addr = 0;
@@ -1379,6 +1645,9 @@ enable_break (struct svr4_info *info)
@@ -1395,6 +1661,9 @@ enable_break (struct svr4_info *info)
{
tmp_bfd = solib_bfd_open (interp_name);
}
@ -865,7 +896,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
if (tmp_bfd == NULL)
goto bkpt_at_symbol;
@@ -1436,16 +1705,16 @@ enable_break (struct svr4_info *info)
@@ -1452,16 +1721,16 @@ enable_break (struct svr4_info *info)
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
if (interp_sect)
{
@ -886,7 +917,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
interp_plt_sect_high =
interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
}
@@ -1480,7 +1749,7 @@ enable_break (struct svr4_info *info)
@@ -1496,7 +1765,7 @@ enable_break (struct svr4_info *info)
if (sym_addr != 0)
{
@ -895,7 +926,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
xfree (interp_name);
return 1;
}
@@ -1753,6 +2022,9 @@ svr4_solib_create_inferior_hook (void)
@@ -1769,6 +2038,9 @@ svr4_solib_create_inferior_hook (void)
while (tp->stop_signal != TARGET_SIGNAL_TRAP);
inf->stop_soon = NO_STOP_QUIETLY;
#endif /* defined(_SCO_DS) */
@ -905,7 +936,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
}
static void
@@ -1929,6 +2201,76 @@ svr4_lp64_fetch_link_map_offsets (void)
@@ -1945,6 +2217,76 @@ svr4_lp64_fetch_link_map_offsets (void)
return lmp;
}
@ -982,7 +1013,7 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
struct target_so_ops svr4_so_ops;
@@ -1969,4 +2311,7 @@ _initialize_svr4_solib (void)
@@ -1985,4 +2327,7 @@ _initialize_svr4_solib (void)
svr4_so_ops.same = svr4_same;
observer_attach_inferior_exit (solib_svr4_inferior_exit);
@ -990,10 +1021,10 @@ Index: gdb-6.8.91.20090917/gdb/solib-svr4.c
+ add_info ("linkmap", info_linkmap_command,
+ "Display the inferior's linkmap.");
}
Index: gdb-6.8.91.20090917/gdb/solib.c
Index: gdb-6.8.91.20090925/gdb/solib.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/solib.c 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/solib.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/solib.c 2009-09-25 10:25:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/solib.c 2009-09-25 10:25:45.000000000 +0200
@@ -82,6 +82,8 @@ set_solib_ops (struct gdbarch *gdbarch,
/* external data declarations */
@ -1130,10 +1161,10 @@ Index: gdb-6.8.91.20090917/gdb/solib.c
+ NULL, NULL,
+ &setdebuglist, &showdebuglist);
}
Index: gdb-6.8.91.20090917/gdb/solist.h
Index: gdb-6.8.91.20090925/gdb/solist.h
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/solist.h 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/solist.h 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/solist.h 2009-09-25 10:25:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/solist.h 2009-09-25 10:25:45.000000000 +0200
@@ -61,6 +61,8 @@ struct so_list
bfd *abfd;
char symbols_loaded; /* flag: symbols read in yet? */
@ -1154,10 +1185,10 @@ Index: gdb-6.8.91.20090917/gdb/solist.h
+extern int debug_solib;
+
#endif
Index: gdb-6.8.91.20090917/gdb/symfile-mem.c
Index: gdb-6.8.91.20090925/gdb/symfile-mem.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/symfile-mem.c 2009-09-17 12:48:49.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/symfile-mem.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/symfile-mem.c 2009-09-25 10:25:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile-mem.c 2009-09-25 10:25:45.000000000 +0200
@@ -115,7 +115,7 @@ symbol_file_add_from_memory (struct bfd
++i;
}
@ -1167,10 +1198,10 @@ Index: gdb-6.8.91.20090917/gdb/symfile-mem.c
sai, OBJF_SHARED);
/* This might change our ideas about frames already looked at. */
Index: gdb-6.8.91.20090917/gdb/symfile.c
Index: gdb-6.8.91.20090925/gdb/symfile.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/symfile.c 2009-09-17 12:48:50.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/symfile.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/symfile.c 2009-09-25 10:25:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.c 2009-09-25 10:25:45.000000000 +0200
@@ -49,6 +49,7 @@
#include "readline/readline.h"
#include "gdb_assert.h"
@ -1250,7 +1281,7 @@ Index: gdb-6.8.91.20090917/gdb/symfile.c
free_all_objfiles ();
@@ -3369,6 +3378,8 @@ reread_symbols (void)
@@ -3367,6 +3376,8 @@ reread_symbols (void)
/* Discard cleanups as symbol reading was successful. */
discard_cleanups (old_cleanups);
@ -1259,10 +1290,10 @@ Index: gdb-6.8.91.20090917/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. */
Index: gdb-6.8.91.20090917/gdb/target.h
Index: gdb-6.8.91.20090925/gdb/target.h
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/target.h 2009-09-17 12:48:49.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/target.h 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/target.h 2009-09-25 10:25:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/target.h 2009-09-25 10:25:45.000000000 +0200
@@ -545,7 +545,7 @@ struct target_ops
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
@ -1272,10 +1303,10 @@ Index: gdb-6.8.91.20090917/gdb/target.h
/* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
sequence of bytes in PATTERN with length PATTERN_LEN.
Index: gdb-6.8.91.20090917/gdb/symfile.h
Index: gdb-6.8.91.20090925/gdb/symfile.h
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/symfile.h 2009-09-17 12:48:50.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/symfile.h 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/symfile.h 2009-09-25 10:25:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.h 2009-09-25 10:25:45.000000000 +0200
@@ -229,7 +229,13 @@ enum symfile_add_flags
SYMFILE_MAINLINE = 1 << 2,
@ -1291,10 +1322,10 @@ Index: gdb-6.8.91.20090917/gdb/symfile.h
};
extern void syms_from_objfile (struct objfile *,
Index: gdb-6.8.91.20090917/gdb/infcmd.c
Index: gdb-6.8.91.20090925/gdb/infcmd.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/infcmd.c 2009-09-17 12:49:01.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/infcmd.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/infcmd.c 2009-09-25 10:25:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/infcmd.c 2009-09-25 10:25:45.000000000 +0200
@@ -2308,6 +2308,9 @@ attach_command_post_wait (char *args, in
post_create_inferior (&current_target, from_tty);
@ -1305,10 +1336,10 @@ Index: gdb-6.8.91.20090917/gdb/infcmd.c
/* Install inferior's terminal modes. */
target_terminal_inferior ();
Index: gdb-6.8.91.20090917/gdb/linux-tdep.c
Index: gdb-6.8.91.20090925/gdb/linux-tdep.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/linux-tdep.c 2009-08-04 22:41:13.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/linux-tdep.c 2009-09-17 12:50:07.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/linux-tdep.c 2009-08-04 22:41:13.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/linux-tdep.c 2009-09-25 10:25:45.000000000 +0200
@@ -163,5 +163,7 @@ in this session.\n"));
void
_initialize_linux_tdep (void)

View File

@ -65,7 +65,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
--- gdb-6.8.50.20090811.orig/gdb/dwarf2read.c 2009-08-13 10:14:15.000000000 +0200
+++ gdb-6.8.50.20090811/gdb/dwarf2read.c 2009-08-13 10:14:29.000000000 +0200
@@ -53,6 +53,7 @@
#include "typeprint.h"
#include "jv-lang.h"
#include "vec.h"
#include "block.h"
+#include "top.h"

View File

@ -0,0 +1,19 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
Index: gdb-6.8.50.20081128/gdb/minsyms.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/minsyms.c 2008-10-01 18:56:52.000000000 +0200
+++ gdb-6.8.50.20081128/gdb/minsyms.c 2008-12-02 23:24:27.000000000 +0100
@@ -544,6 +544,11 @@ lookup_minimal_symbol_by_pc_section_1 (C
don't fill the bfd_section member, so don't
throw away symbols on those platforms. */
&& SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL
+ /* Don't ignore symbols for solib trampolines.
+ Limit its sideeffects - only for non-0 sized trampolines.
+ Red Hat Bug 200533 with its regression Bug 218379. */
+ && (MSYMBOL_TYPE (&msymbol[hi]) != mst_solib_trampoline
+ || MSYMBOL_SIZE (&msymbol[hi]))
&& (!matching_obj_sections
(SYMBOL_OBJ_SECTION (&msymbol[hi]), section)))
{

View File

@ -1,7 +1,7 @@
Index: gdb-6.8.50.20090909/gdb/corelow.c
Index: gdb-6.8.91.20090925/gdb/corelow.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/corelow.c 2009-09-09 19:09:35.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/corelow.c 2009-09-25 09:39:09.000000000 +0200
@@ -45,6 +45,10 @@
#include "exceptions.h"
#include "solib.h"
@ -13,7 +13,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c
#ifndef O_LARGEFILE
@@ -273,6 +277,50 @@ add_to_thread_list (bfd *abfd, asection
@@ -273,6 +277,52 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current */
}
@ -28,7 +28,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c
+ char *build_id_filename;
+ struct cleanup *back_to;
+
+ if (exec_bfd != NULL)
+ if (exec_bfd != NULL || symfile_objfile != NULL)
+ return;
+
+ if (target_auxv_search (&current_target, AT_ENTRY, &at_entry) <= 0)
@ -52,6 +52,8 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c
+ make_cleanup (xfree, exec_filename);
+ exec_file_attach (exec_filename, from_tty);
+ symbol_file_add_main (exec_filename, from_tty);
+ if (symfile_objfile != NULL)
+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
+ }
+ else
+ debug_print_missing (_("the main executable file"), build_id_filename);
@ -64,7 +66,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c
/* This routine opens and sets up the core file bfd. */
static void
@@ -371,6 +419,12 @@ core_open (char *filename, int from_tty)
@@ -371,6 +421,12 @@ core_open (char *filename, int from_tty)
push_target (&core_ops);
discard_cleanups (old_chain);
@ -77,7 +79,7 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c
add_inferior_silent (corelow_pid);
/* Do this before acknowledging the inferior, so if
@@ -878,4 +932,11 @@ _initialize_corelow (void)
@@ -878,4 +934,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target (&core_ops);
@ -89,11 +91,11 @@ Index: gdb-6.8.50.20090909/gdb/corelow.c
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
Index: gdb-6.8.50.20090909/gdb/doc/gdb.texinfo
Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/doc/gdb.texinfo 2009-09-09 19:09:31.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/doc/gdb.texinfo 2009-09-09 19:09:35.000000000 +0200
@@ -13764,6 +13764,27 @@ information files.
--- gdb-6.8.91.20090925.orig/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200
@@ -13895,6 +13895,27 @@ information files.
@end table
@ -121,11 +123,11 @@ Index: gdb-6.8.50.20090909/gdb/doc/gdb.texinfo
@cindex @code{.gnu_debuglink} sections
@cindex debug link sections
A debug link is a special section of the executable file named
Index: gdb-6.8.50.20090909/gdb/solib-svr4.c
Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/solib-svr4.c 2009-09-09 19:05:56.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/solib-svr4.c 2009-09-09 19:09:35.000000000 +0200
@@ -1101,9 +1101,33 @@ svr4_current_sos (void)
--- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/solib-svr4.c 2009-09-25 09:43:14.000000000 +0200
@@ -1101,9 +1101,49 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
@ -154,7 +156,23 @@ Index: gdb-6.8.50.20090909/gdb/solib-svr4.c
+ xfree (name);
+ }
+ else
+ debug_print_missing (new->so_name, build_id_filename);
+ {
+ debug_print_missing (new->so_name, build_id_filename);
+
+ /* In the case the main executable was found according to
+ its build-id (from a core file) prevent loading
+ a different build of a library with accidentally the
+ same SO_NAME.
+
+ It suppresses bogus backtraces (and prints "??" there
+ instead) if the on-disk files no longer match the
+ running program version. */
+
+ if (symfile_objfile != NULL
+ && (symfile_objfile->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ new->so_name[0] = 0;
+ }
+
+ xfree (build_id_filename);
+ xfree (build_id);
@ -162,10 +180,10 @@ Index: gdb-6.8.50.20090909/gdb/solib-svr4.c
}
xfree (buffer);
Index: gdb-6.8.50.20090909/gdb/symfile.c
Index: gdb-6.8.91.20090925/gdb/symfile.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/symfile.c 2009-09-09 19:09:31.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/symfile.c 2009-09-09 19:09:55.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/symfile.c 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.c 2009-09-25 09:29:58.000000000 +0200
@@ -56,6 +56,7 @@
#include "elf-bfd.h"
#include "solib.h"
@ -174,7 +192,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
#include <sys/types.h>
#include <fcntl.h>
@@ -1174,16 +1175,65 @@ symbol_file_clear (int from_tty)
@@ -1173,16 +1174,65 @@ symbol_file_clear (int from_tty)
printf_unfiltered (_("No symbol file now.\n"));
}
@ -242,7 +260,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
{
struct build_id *retval;
@@ -1199,6 +1249,348 @@ build_id_bfd_get (bfd *abfd)
@@ -1198,6 +1248,348 @@ build_id_bfd_get (bfd *abfd)
return retval;
}
@ -591,7 +609,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
@@ -1216,7 +1608,7 @@ build_id_verify (const char *filename, s
@@ -1215,7 +1607,7 @@ build_id_verify (const char *filename, s
if (abfd == NULL)
return 0;
@ -600,7 +618,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -1235,8 +1627,9 @@ build_id_verify (const char *filename, s
@@ -1234,8 +1626,9 @@ build_id_verify (const char *filename, s
return retval;
}
@ -612,7 +630,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
{
char *link, *s, *retval = NULL;
gdb_byte *data = build_id->data;
@@ -1244,7 +1637,9 @@ build_id_to_debug_filename (struct build
@@ -1243,7 +1636,9 @@ build_id_to_debug_filename (struct build
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
@ -623,7 +641,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
if (size > 0)
{
@@ -1255,12 +1650,14 @@ build_id_to_debug_filename (struct build
@@ -1254,12 +1649,14 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
@ -640,7 +658,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
if (retval != NULL && !build_id_verify (retval, build_id))
{
@@ -1268,9 +1665,150 @@ build_id_to_debug_filename (struct build
@@ -1267,9 +1664,150 @@ build_id_to_debug_filename (struct build
retval = NULL;
}
@ -791,7 +809,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
static char *
get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
{
@@ -1353,32 +1891,36 @@ static char *
@@ -1352,32 +1890,36 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
@ -836,7 +854,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
}
basename = get_debug_link_info (objfile, &crc32);
@@ -1386,7 +1928,7 @@ find_separate_debug_file (struct objfile
@@ -1385,7 +1927,7 @@ find_separate_debug_file (struct objfile
if (basename == NULL)
/* There's no separate debug info, hence there's no way we could
load it => no warning. */
@ -845,7 +863,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
dir = xstrdup (objfile->name);
@@ -1408,24 +1950,19 @@ find_separate_debug_file (struct objfile
@@ -1407,24 +1949,19 @@ find_separate_debug_file (struct objfile
if (canon_name && strlen (canon_name) > i)
i = strlen (canon_name);
@ -877,7 +895,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
strcpy (debugfile, dir);
@@ -1434,12 +1971,7 @@ find_separate_debug_file (struct objfile
@@ -1433,12 +1970,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
@ -891,7 +909,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
@@ -1448,12 +1980,7 @@ find_separate_debug_file (struct objfile
@@ -1447,12 +1979,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
@ -905,7 +923,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
/* If the file is in the sysroot, try using its base path in the
global debugfile directory. */
@@ -1467,20 +1994,18 @@ find_separate_debug_file (struct objfile
@@ -1466,20 +1993,18 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
@ -933,7 +951,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
}
@@ -4231,4 +4756,16 @@ the global debug-file directory prepende
@@ -4229,4 +4754,16 @@ the global debug-file directory prepende
NULL,
show_debug_file_directory,
&setlist, &showlist);
@ -950,10 +968,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
+
+ observer_attach_executable_changed (debug_print_executable_changed);
}
Index: gdb-6.8.50.20090909/gdb/symfile.h
Index: gdb-6.8.91.20090925/gdb/symfile.h
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/symfile.h 2009-09-09 19:05:56.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/symfile.h 2009-09-09 19:09:35.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/symfile.h 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.h 2009-09-25 09:29:58.000000000 +0200
@@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
void free_symfile_segment_data (struct symfile_segment_data *data);
@ -968,10 +986,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile.h
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp
Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/gdb.exp 2009-09-09 19:05:56.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp 2009-09-09 19:09:35.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:58.000000000 +0200
@@ -1248,6 +1248,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
@ -989,10 +1007,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp
return 0;
}
Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp
Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/mi-support.exp 2009-09-09 19:05:56.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp 2009-09-09 19:09:35.000000000 +0200
--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp 2009-09-25 09:29:58.000000000 +0200
@@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
}
}
@ -1010,3 +1028,18 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp
detect_async
Index: gdb-6.8.91.20090925/gdb/objfiles.h
===================================================================
--- gdb-6.8.91.20090925.orig/gdb/objfiles.h 2009-09-25 09:29:57.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/objfiles.h 2009-09-25 09:38:27.000000000 +0200
@@ -428,6 +428,10 @@ struct objfile
#define OBJF_MAIN (1 << 7)
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
+
+#define OBJF_BUILD_ID_CORE_LOADED (1 << 12)
+
/* The object file that the main symbol table was loaded from (e.g. the
argument to the "symbol-file" or "file" command). */

View File

@ -102,17 +102,3 @@ frames-invalid can happen asynchronously.
set timeout $oldtimeout
return 0
--- sources/gdb/testsuite/gdb.base/dump.exp-orig 2008-08-28 11:44:40.000000000 +0200
+++ sources/gdb/testsuite/gdb.base/dump.exp 2008-08-28 11:44:49.000000000 +0200
@@ -493,8 +493,10 @@ if ![string compare $is64bitonly "no"] t
gdb_test "print zero_all ()" "" ""
# restore with expressions
+ # Address may fit in int32 but its negative result would be 0xffffxxxx for
+ # 64-bit LONGEST addresses.
test_restore_saved_value \
- "intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
+ "intarr3.srec (long)${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
"array partial with expressions" 4 "intarray2\[3\]"
gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"

View File

@ -1,965 +0,0 @@
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.10874.2.11
retrieving revision 1.10874.2.12
diff -u -r1.10874.2.11 -r1.10874.2.12
--- src/gdb/ChangeLog 2009/09/19 16:36:08 1.10874.2.11
+++ src/gdb/ChangeLog 2009/09/21 06:57:02 1.10874.2.12
@@ -1,3 +1,47 @@
+2009-09-21 Hui Zhu <teawater@gmail.com>
+ Michael Snyder <msnyder@vmware.com>
+
+ * amd64-linux-tdep.c (amd64_all_but_ip_registers_record): New
+ function.
+ (amd64_linux_syscall_record): Call
+ amd64_all_but_ip_registers_record if syscall is
+ sys_rt_sigreturn.
+ (AMD64_LINUX_redzone, AMD64_LINUX_xstate,
+ AMD64_LINUX_frame_size): New macros.
+ (amd64_linux_record_signal): New function.
+ (amd64_linux_init_abi): Call set_gdbarch_process_record_signal.
+
+2009-09-21 Hui Zhu <teawater@gmail.com>
+ Michael Snyder <msnyder@vmware.com>
+
+ * i386-linux-tdep.c (i386_all_but_ip_registers_record): New
+ function.
+ (i386_linux_intx80_sysenter_record): Call
+ i386_all_but_ip_registers_record if syscall is sys_sigreturn
+ or sys_rt_sigreturn.
+ (I386_LINUX_xstate, I386_LINUX_frame_size): New macros.
+ (i386_linux_record_signal): New function.
+ (i386_linux_init_abi): Call set_gdbarch_process_record_signal.
+
+2009-09-21 Hui Zhu <teawater@gmail.com>
+ Michael Snyder <msnyder@vmware.com>
+
+ * record.c (record_end_entry): New struct.
+ (record_type): Add end.
+ (record_arch_list_add_end): Set rec->u.end.sigval to
+ TARGET_SIGNAL_0.
+ (record_message_args): New struct.
+ (record_message): Call gdbarch_process_record_signal.
+ (do_record_message): Add argument "signal".
+ (record_resume): Ditto.
+ (record_wait): Ditto. Check record_list->u.end.sigval
+ in replay mode.
+
+2009-09-21 Hui Zhu <teawater@gmail.com>
+ Michael Snyder <msnyder@vmware.com>
+
+ * gdbarch.sh (process_record_signal): New interface.
+
2009-09-19 Maxim Grigoriev <maxim2405@gmail.com>
* xtensa-tdep.c (call0_analyze_prologue): Replace INT_MAX by UNIT_MAX.
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.496
retrieving revision 1.496.2.1
diff -u -r1.496 -r1.496.2.1
--- src/gdb/gdbarch.sh 2009/09/15 03:30:05 1.496
+++ src/gdb/gdbarch.sh 2009/09/21 06:57:02 1.496.2.1
@@ -709,6 +709,10 @@
# Return -1 if something goes wrong, 0 otherwise.
M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr
+# Save process state after a signal.
+# Return -1 if something goes wrong, 0 otherwise.
+M:int:process_record_signal:struct regcache *regcache, enum target_signal signal:regcache, signal
+
# Signal translation: translate inferior's signal (host's) number into
# GDB's representation.
m:enum target_signal:target_signal_from_host:int signo:signo::default_target_signal_from_host::0
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.453
retrieving revision 1.453.2.1
diff -u -r1.453 -r1.453.2.1
--- src/gdb/gdbarch.c 2009/09/15 03:30:05 1.453
+++ src/gdb/gdbarch.c 2009/09/21 06:57:02 1.453.2.1
@@ -240,6 +240,7 @@
gdbarch_static_transform_name_ftype *static_transform_name;
int sofun_address_maybe_missing;
gdbarch_process_record_ftype *process_record;
+ gdbarch_process_record_signal_ftype *process_record_signal;
gdbarch_target_signal_from_host_ftype *target_signal_from_host;
gdbarch_target_signal_to_host_ftype *target_signal_to_host;
gdbarch_get_siginfo_type_ftype *get_siginfo_type;
@@ -378,6 +379,7 @@
0, /* static_transform_name */
0, /* sofun_address_maybe_missing */
0, /* process_record */
+ 0, /* process_record_signal */
default_target_signal_from_host, /* target_signal_from_host */
default_target_signal_to_host, /* target_signal_to_host */
0, /* get_siginfo_type */
@@ -635,6 +637,7 @@
/* Skip verify of static_transform_name, has predicate */
/* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */
/* Skip verify of process_record, has predicate */
+ /* Skip verify of process_record_signal, has predicate */
/* Skip verify of target_signal_from_host, invalid_p == 0 */
/* Skip verify of target_signal_to_host, invalid_p == 0 */
/* Skip verify of get_siginfo_type, has predicate */
@@ -971,6 +974,12 @@
"gdbarch_dump: process_record = <%s>\n",
host_address_to_string (gdbarch->process_record));
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
+ gdbarch_process_record_signal_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: process_record_signal = <%s>\n",
+ host_address_to_string (gdbarch->process_record_signal));
+ fprintf_unfiltered (file,
"gdbarch_dump: ps_regnum = %s\n",
plongest (gdbarch->ps_regnum));
fprintf_unfiltered (file,
@@ -3307,6 +3316,30 @@
gdbarch->process_record = process_record;
}
+int
+gdbarch_process_record_signal_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->process_record_signal != NULL;
+}
+
+int
+gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->process_record_signal != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record_signal called\n");
+ return gdbarch->process_record_signal (gdbarch, regcache, signal);
+}
+
+void
+set_gdbarch_process_record_signal (struct gdbarch *gdbarch,
+ gdbarch_process_record_signal_ftype process_record_signal)
+{
+ gdbarch->process_record_signal = process_record_signal;
+}
+
enum target_signal
gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo)
{
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.403
retrieving revision 1.403.2.1
diff -u -r1.403 -r1.403.2.1
--- src/gdb/gdbarch.h 2009/09/15 03:30:05 1.403
+++ src/gdb/gdbarch.h 2009/09/21 06:57:02 1.403.2.1
@@ -822,6 +822,15 @@
extern int gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record);
+/* Save process state after a signal.
+ Return -1 if something goes wrong, 0 otherwise. */
+
+extern int gdbarch_process_record_signal_p (struct gdbarch *gdbarch);
+
+typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal);
+extern int gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal);
+extern void set_gdbarch_process_record_signal (struct gdbarch *gdbarch, gdbarch_process_record_signal_ftype *process_record_signal);
+
/* Signal translation: translate inferior's signal (host's) number into
GDB's representation. */
===================================================================
RCS file: /cvs/src/src/gdb/record.c,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -r1.17 -r1.17.2.1
--- src/gdb/record.c 2009/09/08 00:50:42 1.17
+++ src/gdb/record.c 2009/09/21 06:57:03 1.17.2.1
@@ -59,6 +59,11 @@
gdb_byte *val;
};
+struct record_end_entry
+{
+ enum target_signal sigval;
+};
+
enum record_type
{
record_end = 0,
@@ -77,6 +82,8 @@
struct record_reg_entry reg;
/* mem */
struct record_mem_entry mem;
+ /* end */
+ struct record_end_entry end;
} u;
};
@@ -314,6 +321,7 @@
rec->prev = NULL;
rec->next = NULL;
rec->type = record_end;
+ rec->u.end.sigval = TARGET_SIGNAL_0;
record_arch_list_add (rec);
@@ -360,11 +368,17 @@
record_list_release (record_arch_list_tail);
}
+struct record_message_args {
+ struct regcache *regcache;
+ enum target_signal signal;
+};
+
static int
record_message (void *args)
{
int ret;
- struct regcache *regcache = args;
+ struct record_message_args *myargs = args;
+ struct gdbarch *gdbarch = get_regcache_arch (myargs->regcache);
struct cleanup *old_cleanups = make_cleanup (record_message_cleanups, 0);
record_arch_list_head = NULL;
@@ -373,9 +387,44 @@
/* Check record_insn_num. */
record_check_insn_num (1);
- ret = gdbarch_process_record (get_regcache_arch (regcache),
- regcache,
- regcache_read_pc (regcache));
+ /* If gdb sends a signal value to target_resume,
+ save it in the 'end' field of the previous instruction.
+
+ Maybe process record should record what really happened,
+ rather than what gdb pretends has happened.
+
+ So if Linux delivered the signal to the child process during
+ the record mode, we will record it and deliver it again in
+ the replay mode.
+
+ If user says "ignore this signal" during the record mode, then
+ it will be ignored again during the replay mode (no matter if
+ the user says something different, like "deliver this signal"
+ during the replay mode).
+
+ User should understand that nothing he does during the replay
+ mode will change the behavior of the child. If he tries,
+ then that is a user error.
+
+ But we should still deliver the signal to gdb during the replay,
+ if we delivered it during the recording. Therefore we should
+ record the signal during record_wait, not record_resume. */
+ if (record_list != &record_first) /* FIXME better way to check */
+ {
+ gdb_assert (record_list->type == record_end);
+ record_list->u.end.sigval = myargs->signal;
+ }
+
+ if (myargs->signal == TARGET_SIGNAL_0
+ || !gdbarch_process_record_signal_p (gdbarch))
+ ret = gdbarch_process_record (gdbarch,
+ myargs->regcache,
+ regcache_read_pc (myargs->regcache));
+ else
+ ret = gdbarch_process_record_signal (gdbarch,
+ myargs->regcache,
+ myargs->signal);
+
if (ret > 0)
error (_("Process record: inferior program stopped."));
if (ret < 0)
@@ -396,9 +445,14 @@
}
static int
-do_record_message (struct regcache *regcache)
+do_record_message (struct regcache *regcache,
+ enum target_signal signal)
{
- return catch_errors (record_message, regcache, NULL, RETURN_MASK_ALL);
+ struct record_message_args args;
+
+ args.regcache = regcache;
+ args.signal = signal;
+ return catch_errors (record_message, &args, NULL, RETURN_MASK_ALL);
}
/* Set to 1 if record_store_registers and record_xfer_partial
@@ -520,13 +574,13 @@
static void
record_resume (struct target_ops *ops, ptid_t ptid, int step,
- enum target_signal siggnal)
+ enum target_signal signal)
{
record_resume_step = step;
if (!RECORD_IS_REPLAY)
{
- if (do_record_message (get_current_regcache ()))
+ if (do_record_message (get_current_regcache (), signal))
{
record_resume_error = 0;
}
@@ -536,7 +590,7 @@
return;
}
record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1,
- siggnal);
+ signal);
}
}
@@ -611,15 +665,16 @@
ret = record_beneath_to_wait (record_beneath_to_wait_ops,
ptid, status, options);
+ /* Is this a SIGTRAP? */
if (status->kind == TARGET_WAITKIND_STOPPED
&& status->value.sig == TARGET_SIGNAL_TRAP)
{
- /* Check if there is a breakpoint. */
+ /* Yes -- check if there is a breakpoint. */
registers_changed ();
tmp_pc = regcache_read_pc (get_current_regcache ());
if (breakpoint_inserted_here_p (tmp_pc))
{
- /* There is a breakpoint. */
+ /* There is a breakpoint. GDB will want to stop. */
CORE_ADDR decr_pc_after_break =
gdbarch_decr_pc_after_break
(get_regcache_arch (get_current_regcache ()));
@@ -631,8 +686,12 @@
}
else
{
- /* There is not a breakpoint. */
- if (!do_record_message (get_current_regcache ()))
+ /* There is not a breakpoint, and gdb is not
+ stepping, therefore gdb will not stop.
+ Therefore we will not return to gdb.
+ Record the insn and resume. */
+ if (!do_record_message (get_current_regcache (),
+ TARGET_SIGNAL_0))
{
break;
}
@@ -827,6 +886,10 @@
gdbarch_decr_pc_after_break (gdbarch));
continue_flag = 0;
}
+ /* Check target signal */
+ if (record_list->u.end.sigval != TARGET_SIGNAL_0)
+ /* FIXME: better way to check */
+ continue_flag = 0;
}
}
@@ -851,6 +914,9 @@
replay_out:
if (record_get_sig)
status->value.sig = TARGET_SIGNAL_INT;
+ else if (record_list->u.end.sigval != TARGET_SIGNAL_0)
+ /* FIXME: better way to check */
+ status->value.sig = record_list->u.end.sigval;
else
status->value.sig = TARGET_SIGNAL_TRAP;
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.68
retrieving revision 1.68.2.1
diff -u -r1.68 -r1.68.2.1
--- src/gdb/i386-linux-tdep.c 2009/09/15 03:30:06 1.68
+++ src/gdb/i386-linux-tdep.c 2009/09/21 06:57:03 1.68.2.1
@@ -358,7 +358,32 @@
regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1);
}
-static struct linux_record_tdep i386_linux_record_tdep;
+/* Record all registers but IP register for process-record. */
+
+static int
+i386_all_but_ip_registers_record (struct regcache *regcache)
+{
+ if (record_arch_list_add_reg (regcache, I386_EAX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_ECX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_EDX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_EBX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_ESP_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_EBP_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_ESI_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_EDI_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, I386_EFLAGS_REGNUM))
+ return -1;
+
+ return 0;
+}
/* i386_canonicalize_syscall maps from the native i386 Linux set
of syscall ids into a canonical set of syscall ids used by
@@ -383,6 +408,8 @@
Return -1 if something wrong. */
+static struct linux_record_tdep i386_linux_record_tdep;
+
static int
i386_linux_intx80_sysenter_record (struct regcache *regcache)
{
@@ -402,6 +429,14 @@
return -1;
}
+ if (syscall_gdb == gdb_sys_sigreturn
+ || syscall_gdb == gdb_sys_rt_sigreturn)
+ {
+ if (i386_all_but_ip_registers_record (regcache))
+ return -1;
+ return 0;
+ }
+
ret = record_linux_system_call (syscall_gdb, regcache,
&i386_linux_record_tdep);
if (ret)
@@ -413,6 +448,40 @@
return 0;
}
+
+#define I386_LINUX_xstate 270
+#define I386_LINUX_frame_size 732
+
+int
+i386_linux_record_signal (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ enum target_signal signal)
+{
+ ULONGEST esp;
+
+ if (i386_all_but_ip_registers_record (regcache))
+ return -1;
+
+ if (record_arch_list_add_reg (regcache, I386_EIP_REGNUM))
+ return -1;
+
+ /* Record the change in the stack. */
+ regcache_raw_read_unsigned (regcache, I386_ESP_REGNUM, &esp);
+ /* This is for xstate.
+ sp -= sizeof (struct _fpstate); */
+ esp -= I386_LINUX_xstate;
+ /* This is for frame_size.
+ sp -= sizeof (struct rt_sigframe); */
+ esp -= I386_LINUX_frame_size;
+ if (record_arch_list_add_mem (esp,
+ I386_LINUX_xstate + I386_LINUX_frame_size))
+ return -1;
+
+ if (record_arch_list_add_end ())
+ return -1;
+
+ return 0;
+}
static LONGEST
@@ -529,6 +598,7 @@
tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset);
set_gdbarch_process_record (gdbarch, i386_process_record);
+ set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal);
/* Initialize the i386_linux_record_tdep. */
/* These values are the size of the type that will be used in a system
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-tdep.c,v
retrieving revision 1.29
retrieving revision 1.29.2.1
diff -u -r1.29 -r1.29.2.1
--- src/gdb/amd64-linux-tdep.c 2009/09/15 03:30:04 1.29
+++ src/gdb/amd64-linux-tdep.c 2009/09/21 06:57:03 1.29.2.1
@@ -289,16 +289,48 @@
regcache_cooked_write_unsigned (regcache, AMD64_LINUX_ORIG_RAX_REGNUM, -1);
}
-/* Parse the arguments of current system call instruction and record
- the values of the registers and memory that will be changed into
- "record_arch_list". This instruction is "syscall".
-
- Return -1 if something wrong. */
+/* Record all registers but IP register for process-record. */
-static struct linux_record_tdep amd64_linux_record_tdep;
+static int
+amd64_all_but_ip_registers_record (struct regcache *regcache)
+{
+ if (record_arch_list_add_reg (regcache, AMD64_RAX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_RCX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_RDX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_RBX_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_RSP_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_RBP_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_RSI_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_RDI_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R8_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R9_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R10_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R11_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R12_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R13_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R14_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_R15_REGNUM))
+ return -1;
+ if (record_arch_list_add_reg (regcache, AMD64_EFLAGS_REGNUM))
+ return -1;
-#define RECORD_ARCH_GET_FS 0x1003
-#define RECORD_ARCH_GET_GS 0x1004
+ return 0;
+}
/* amd64_canonicalize_syscall maps from the native amd64 Linux set
of syscall ids into a canonical set of syscall ids used by
@@ -1111,6 +1143,17 @@
}
}
+/* Parse the arguments of current system call instruction and record
+ the values of the registers and memory that will be changed into
+ "record_arch_list". This instruction is "syscall".
+
+ Return -1 if something wrong. */
+
+static struct linux_record_tdep amd64_linux_record_tdep;
+
+#define RECORD_ARCH_GET_FS 0x1003
+#define RECORD_ARCH_GET_GS 0x1004
+
static int
amd64_linux_syscall_record (struct regcache *regcache)
{
@@ -1120,27 +1163,39 @@
regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &syscall_native);
- syscall_gdb = amd64_canonicalize_syscall (syscall_native);
-
- if (syscall_native == amd64_sys_arch_prctl)
+ switch (syscall_native)
{
- ULONGEST arg3;
-
- regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg3,
- &arg3);
- if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS)
- {
- CORE_ADDR addr;
-
- regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg2,
- &addr);
- if (record_arch_list_add_mem (addr,
- amd64_linux_record_tdep.size_ulong))
- return -1;
- }
- goto record_regs;
+ case amd64_sys_rt_sigreturn:
+ if (amd64_all_but_ip_registers_record (regcache))
+ return -1;
+ return 0;
+ break;
+
+ case amd64_sys_arch_prctl:
+ if (syscall_native == amd64_sys_arch_prctl)
+ {
+ ULONGEST arg3;
+
+ regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg3,
+ &arg3);
+ if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS)
+ {
+ CORE_ADDR addr;
+
+ regcache_raw_read_unsigned (regcache,
+ amd64_linux_record_tdep.arg2,
+ &addr);
+ if (record_arch_list_add_mem (addr,
+ amd64_linux_record_tdep.size_ulong))
+ return -1;
+ }
+ goto record_regs;
+ }
+ break;
}
+ syscall_gdb = amd64_canonicalize_syscall (syscall_native);
+
if (syscall_gdb < 0)
{
printf_unfiltered (_("Process record and replay target doesn't "
@@ -1163,6 +1218,44 @@
if (record_arch_list_add_reg (regcache, AMD64_R11_REGNUM))
return -1;
+ return 0;
+}
+
+#define AMD64_LINUX_redzone 128
+#define AMD64_LINUX_xstate 512
+#define AMD64_LINUX_frame_size 560
+
+int
+amd64_linux_record_signal (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ enum target_signal signal)
+{
+ ULONGEST rsp;
+
+ if (amd64_all_but_ip_registers_record (regcache))
+ return -1;
+
+ if (record_arch_list_add_reg (regcache, AMD64_RIP_REGNUM))
+ return -1;
+
+ /* Record the change in the stack. */
+ regcache_raw_read_unsigned (regcache, AMD64_RSP_REGNUM, &rsp);
+ /* redzone
+ sp -= 128; */
+ rsp -= AMD64_LINUX_redzone;
+ /* This is for xstate.
+ sp -= sizeof (struct _fpstate); */
+ rsp -= AMD64_LINUX_xstate;
+ /* This is for frame_size.
+ sp -= sizeof (struct rt_sigframe); */
+ rsp -= AMD64_LINUX_frame_size;
+ if (record_arch_list_add_mem (rsp, AMD64_LINUX_redzone
+ + AMD64_LINUX_xstate
+ + AMD64_LINUX_frame_size))
+ return -1;
+
+ if (record_arch_list_add_end ())
+ return -1;
return 0;
}
@@ -1218,6 +1311,7 @@
set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
set_gdbarch_process_record (gdbarch, i386_process_record);
+ set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal);
/* Initialize the amd64_linux_record_tdep. */
/* These values are the size of the type that will be used in a system
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.10874.2.12
retrieving revision 1.10874.2.13
diff -u -r1.10874.2.12 -r1.10874.2.13
--- src/gdb/ChangeLog 2009/09/21 06:57:02 1.10874.2.12
+++ src/gdb/ChangeLog 2009/09/21 10:19:59 1.10874.2.13
@@ -1,3 +1,8 @@
+2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+
+ * python/py-value.c (valpy_getitem): Test value before allowing
+ subscript operation.
+
2009-09-21 Hui Zhu <teawater@gmail.com>
Michael Snyder <msnyder@vmware.com>
===================================================================
RCS file: /cvs/src/src/gdb/python/py-value.c,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- src/gdb/python/py-value.c 2009/09/09 17:45:40 1.1
+++ src/gdb/python/py-value.c 2009/09/21 10:20:00 1.1.2.1
@@ -324,7 +324,18 @@
type. */
struct value *idx = convert_value_from_python (key);
if (idx != NULL)
- res_val = value_subscript (tmp, value_as_long (idx));
+ {
+ /* Check the value's type is something that can be accessed via
+ a subscript. */
+ struct type *type;
+ tmp = coerce_ref (tmp);
+ type = check_typedef (value_type (tmp));
+ if (TYPE_CODE (type) != TYPE_CODE_ARRAY
+ && TYPE_CODE (type) != TYPE_CODE_PTR)
+ error( _("Cannot subscript requested type"));
+ else
+ res_val = value_subscript (tmp, value_as_long (idx));
+ }
}
}
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1960
retrieving revision 1.1960.2.1
diff -u -r1.1960 -r1.1960.2.1
--- src/gdb/testsuite/ChangeLog 2009/09/15 18:51:25 1.1960
+++ src/gdb/testsuite/ChangeLog 2009/09/21 10:20:00 1.1960.2.1
@@ -1,3 +1,10 @@
+2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+
+ * gdb.python/py-value.exp (test_subscript_regression): New
+ function. Test for invalid subscripts.
+ * gdb.python/py-value.c (main): Add test array, and pointer to it.
+ (ptr_ref): New function.
+
2009-09-15 Tom Tromey <tromey@redhat.com>
* lib/mi-support.exp (mi_create_varobj): Update.
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-value.c,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- src/gdb/testsuite/gdb.python/py-value.c 2009/09/09 17:45:42 1.1
+++ src/gdb/testsuite/gdb.python/py-value.c 2009/09/21 10:20:00 1.1.2.1
@@ -37,6 +37,13 @@
enum e evalue = TWO;
+#ifdef __cplusplus
+void ptr_ref(int*& rptr_int)
+{
+ return; /* break to inspect pointer by reference. */
+}
+#endif
+
int
main (int argc, char *argv[])
{
@@ -46,10 +53,18 @@
PTR x = &s;
char st[17] = "divide et impera";
char nullst[17] = "divide\0et\0impera";
+ int a[3] = {1,2,3};
+ int *p = a;
+ int i = 2;
+ int *ptr_i = &i;
s.a = 3;
s.b = 5;
u.a = 7;
+#ifdef __cplusplus
+ ptr_ref(ptr_i);
+#endif
+
return 0; /* break to inspect struct and union */
}
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-value.exp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- src/gdb/testsuite/gdb.python/py-value.exp 2009/09/09 17:45:42 1.1
+++ src/gdb/testsuite/gdb.python/py-value.exp 2009/09/21 10:20:00 1.1.2.1
@@ -292,6 +292,75 @@
"print value's type"
}
+# Regression test for invalid subscript operations. The bug was that
+# the type of the value was not being checked before allowing a
+# subscript operation to proceed.
+
+proc test_subscript_regression {lang} {
+
+ global srcdir subdir srcfile binfile testfile hex
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug $lang"] != "" } {
+ untested "Couldn't compile ${srcfile} in $lang mode"
+ return -1
+ }
+
+ # Start with a fresh gdb.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ if ![runto_main ] then {
+ perror "couldn't run to breakpoint"
+ return
+ }
+
+ if {$lang == "c++"} {
+ gdb_breakpoint [gdb_get_line_number "break to inspect pointer by reference"]
+ gdb_continue_to_breakpoint "break to inspect pointer by reference"
+
+ gdb_py_test_silent_cmd "print rptr_int" \
+ "Obtain address" 1
+ gdb_py_test_silent_cmd "python rptr = gdb.history(0)" \
+ "Obtains value from GDB" 1
+ gdb_test "python print rptr\[0\]" "2" "Check pointer passed as reference"
+ }
+
+ gdb_breakpoint [gdb_get_line_number "break to inspect struct and union"]
+ gdb_continue_to_breakpoint "break to inspect struct and union"
+
+ gdb_py_test_silent_cmd "python intv = gdb.Value(1)" \
+ "Create a value for subscript test" 1
+ gdb_py_test_silent_cmd "python stringv = gdb.Value(\"foo\")" \
+ "Create a value for subscript test" 1
+
+ # Try to access an int with a subscript. This should fail.
+ gdb_test "python print intv" "1" "Baseline print of a Python value"
+ gdb_test "python print intv\[0\]" "RuntimeError: Cannot subscript requested type.*" \
+ "Attempt to access an integer with a subscript"
+
+ # Try to access a string with a subscript. This should pass.
+ gdb_test "python print stringv" "foo." "Baseline print of a Python value"
+ gdb_test "python print stringv\[0\]" "f." "Attempt to access a string with a subscript"
+
+ # Try to access an int array via a pointer with a subscript. This should pass.
+ gdb_py_test_silent_cmd "print p" "Build pointer to array" 1
+ gdb_py_test_silent_cmd "python pointer = gdb.history(0)" "" 1
+ gdb_test "python print pointer\[0\]" "1" "Access array via pointer with int subscript"
+ gdb_test "python print pointer\[intv\]" "2" "Access array via pointer with value subscript"
+
+ # Try to access a single dimension array with a subscript to the
+ # result. This should fail.
+ gdb_test "python print pointer\[intv\]\[0\]" "RuntimeError: Cannot subscript requested type.*" \
+ "Attempt to access an integer with a subscript"
+
+ # Lastly, test subscript access to an array with multiple
+ # dimensions. This should pass.
+ gdb_py_test_silent_cmd "print {\"fu \",\"foo\",\"bar\"}" "Build array" 1
+ gdb_py_test_silent_cmd "python marray = gdb.history(0)" "" 1
+ gdb_test "python print marray\[1\]\[2\]" "o." "Test multiple subscript"
+}
+
# Start with a fresh gdb.
gdb_exit
@@ -322,3 +391,8 @@
test_value_in_inferior
test_value_after_death
+
+# The following test recompiles the binary to test either C or C++
+# values.
+test_subscript_regression "c++"
+test_subscript_regression "c"
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.10874.2.13
retrieving revision 1.10874.2.14
diff -u -r1.10874.2.13 -r1.10874.2.14
--- src/gdb/ChangeLog 2009/09/21 10:19:59 1.10874.2.13
+++ src/gdb/ChangeLog 2009/09/21 10:25:29 1.10874.2.14
@@ -1,5 +1,12 @@
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+ PR python/10633
+
+ * c-lang.c (c_printstr): Do not loop past options->print_max when
+ iterating with wchar_iterate.
+
+2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+
* python/py-value.c (valpy_getitem): Test value before allowing
subscript operation.
===================================================================
RCS file: /cvs/src/src/gdb/c-lang.c,v
retrieving revision 1.75
retrieving revision 1.75.4.1
diff -u -r1.75 -r1.75.4.1
--- src/gdb/c-lang.c 2009/07/10 10:35:16 1.75
+++ src/gdb/c-lang.c 2009/09/21 10:25:29 1.75.4.1
@@ -459,7 +459,7 @@
single character in isolation. This makes the code simpler
and probably does the sensible thing in the majority of
cases. */
- while (num_chars == 1)
+ while (num_chars == 1 && things_printed < options->print_max)
{
/* Count the number of repetitions. */
unsigned int reps = 0;
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.1960.2.1
retrieving revision 1.1960.2.2
diff -u -r1.1960.2.1 -r1.1960.2.2
--- src/gdb/testsuite/ChangeLog 2009/09/21 10:20:00 1.1960.2.1
+++ src/gdb/testsuite/ChangeLog 2009/09/21 10:25:29 1.1960.2.2
@@ -1,5 +1,13 @@
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+ PR python/10633
+
+ * gdb.python/py-prettyprint.exp (gdb_py_test_silent_cmd): New
+ Function.
+ (run_lang_tests): Add print elements test.
+
+2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+
* gdb.python/py-value.exp (test_subscript_regression): New
function. Test for invalid subscripts.
* gdb.python/py-value.c (main): Add test array, and pointer to it.
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-prettyprint.exp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- src/gdb/testsuite/gdb.python/py-prettyprint.exp 2009/09/09 17:45:42 1.1
+++ src/gdb/testsuite/gdb.python/py-prettyprint.exp 2009/09/21 10:25:30 1.1.2.1
@@ -35,6 +35,17 @@
-re "$gdb_prompt $" {}
}
+# Run a command in GDB, and report a failure if a Python exception is thrown.
+# If report_pass is true, report a pass if no exception is thrown.
+proc gdb_py_test_silent_cmd {cmd name report_pass} {
+ global gdb_prompt
+
+ gdb_test_multiple $cmd $name {
+ -re "Traceback.*$gdb_prompt $" { fail $name }
+ -re "$gdb_prompt $" { if $report_pass { pass $name } }
+ }
+}
+
proc run_lang_tests {lang} {
global srcdir subdir srcfile binfile testfile hex
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug $lang"] != "" } {
@@ -79,6 +90,11 @@
gdb_test "print derived" \
" = \{.*<Vbase1> = pp class name: Vbase1.*<Vbase2> = \{.*<VirtualTest> = pp value variable is: 1,.*members of Vbase2:.*_vptr.Vbase2 = $hex.*<Vbase3> = \{.*members of Vbase3.*members of Derived:.*value = 2.*"
gdb_test "print ns " "\"embedded\\\\000null\\\\000string\""
+ gdb_py_test_silent_cmd "set print elements 3" "" 1
+ gdb_test "print ns" "emb\.\.\.."
+ gdb_py_test_silent_cmd "set print elements 10" "" 1
+ gdb_test "print ns" "embedded\\\\000n\.\.\.."
+ gdb_py_test_silent_cmd "set print elements 200" "" 1
}
gdb_test "print x" " = $hex \"this is x\""

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e4584a07edf7b86c65a0a4a435455aff464d20611dbc388de95b3fc2faaa8c7c
size 18453563

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5c2383b52371f01e8d580deab466155094a12b8284d0133ece44ed7faf926b9
size 18453837

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,150 @@
--- /dev/null 2009-09-25 12:44:54.497650251 +0200
+++ ./gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp 2009-09-25 17:27:12.000000000 +0200
@@ -0,0 +1,65 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+# Test multiple threads stepping into a .debug_line-less function with
+# a breakpoint placed on its return-to-caller point.
+
+set testfile simultaneous-step-resume-breakpoint
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+# Ensure we have no debuginfo for the `sleep' call itself (=for libc).
+gdb_test "set debug-file-directory /DoesNotExist"
+
+gdb_load ${binfile}
+if ![runto_main] {
+ return -1
+}
+
+# Red Hat vendor patch does set it to "step" by default.
+gdb_test "set scheduler-locking off"
+
+gdb_breakpoint [gdb_get_line_number "final-exit"]
+
+gdb_breakpoint [gdb_get_line_number "sleep-call"]
+gdb_continue_to_breakpoint "sleep-call"
+
+gdb_test "step" "sleep-call.*" "step thread 1"
+gdb_test "step" "sleep-call.*" "step thread 2"
+gdb_test "step" "sleep-after.*" "step thread 3"
+
+set test "first continue"
+gdb_test_multiple "continue" $test {
+ -re "final-exit.*$gdb_prompt $" {
+ # gdb-7.0.
+ pass $test
+ return
+ }
+ -re "sleep-after.*$gdb_prompt $" {
+ # Fedora/RHEL branch.
+ pass $test
+ }
+}
+
+gdb_test "continue" "sleep-after.*" "second continue"
+gdb_test "continue" "final-exit.*" "third continue"
--- /dev/null 2009-09-25 12:44:54.497650251 +0200
+++ ./gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c 2009-09-25 17:29:42.000000000 +0200
@@ -0,0 +1,79 @@
+/* Copyright 2009 Free Software Foundation, Inc.
+
+ Written by Fred Fish of Cygnus Support
+ Contributed by Cygnus Support
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Test multiple threads stepping into a .debug_line-less function with
+ a breakpoint placed on its return-to-caller point. */
+
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+
+#define THREADS 3
+
+static void *
+func (void *unused)
+{
+ int i;
+
+ errno = 0;
+ i = 0xdeadf00d;
+ i = sleep (THREADS); /* sleep-call */
+ if (errno != 0) /* sleep-after */
+ perror ("sleep");
+
+ /* The GDB bug with forgotten step-resume breakpoint could leave stale
+ breakpoint on the I assignment making it a nop. */
+ if (i == 0xdeadf00d)
+ assert (0);
+
+ assert (i == 0);
+
+ pthread_exit (NULL);
+}
+
+int
+main (void)
+{
+ pthread_t threads[THREADS];
+ int threadi;
+
+ for (threadi = 0; threadi < THREADS; threadi++)
+ {
+ int i;
+
+ i = pthread_create (&threads[threadi], NULL, func, NULL);
+ assert (i == 0);
+
+ i = sleep (1);
+ assert (i == 0);
+ }
+
+ for (threadi = 0; threadi < THREADS; threadi++)
+ {
+ int i;
+
+ i = pthread_join (threads[threadi], NULL);
+ assert (i == 0);
+ }
+
+ return 0; /* final-exit */
+}

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Mon Oct 12 10:22:38 CEST 2009 - rguenther@suse.de
- Fix python dependency.
-------------------------------------------------------------------
Wed Oct 7 15:11:51 UTC 2009 - crrodriguez@opensuse.org
- fix info files (un)installation.
-------------------------------------------------------------------
Mon Oct 5 14:23:33 CEST 2009 - rguenther@suse.de
- Merge from gdb-6.8.91.20090930-2.fc12.src.rpm.
-------------------------------------------------------------------
Thu Sep 24 11:40:44 CEST 2009 - rguenther@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package gdb (Version 6.8.91.20090921)
# spec file for package gdb (Version 6.8.91.20090930)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -22,7 +22,7 @@ Name: gdb
# Set version to contents of gdb/version.in.
# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
Version: 6.8.91.20090921
Version: 6.8.91.20090930
Release: 1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
@ -154,6 +154,7 @@ Patch213: gdb-6.5-readline-long-line-crash-test.patch
# Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
Patch214: gdb-6.5-bz216711-clone-is-outermost.patch
# Try to reduce sideeffects of skipping ppc .so libs trampolines (BZ 218379).
Patch215: gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
Patch216: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
Patch217: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
@ -164,7 +165,7 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch
# Testcase for exec() from threaded program (BZ 202689).
Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
# Backported post gdb-6.8.50.20090991 snapshot fixups.
Patch232: gdb-6.8.50.20090921-upstream.patch
#Patch232: gdb-6.8.50.20090921-upstream.patch
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
# Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832)
@ -262,6 +263,8 @@ Patch360: gdb-6.8-bz457187-largefile-test.patch
Patch375: gdb-readline-6.0.patch
# Fix python pretty printers lookup on x86_64.
Patch376: libstdc++-v3-python-common-prefix.patch
# New test for step-resume breakpoint placed in multiple threads at once.
Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch
# Fix readline 5.1 warnings
Patch1000: readline-5.1-random.patch
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
@ -277,7 +280,6 @@ BuildRequires: readline-devel
#Requires: rpm-libs
BuildRequires: rpm-devel
%if 0%{!?_without_python:1}
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
BuildRequires: python-devel
# Temporarily before it gets moved to libstdc++.rpm
BuildRequires: libstdc++
@ -306,8 +308,7 @@ BuildRequires: %{_exec_prefix}/lib/libgcj.so.10 %{_exec_prefix}/lib64/libgcj.so
BuildRequires: libunwind-devel
Requires: libunwind
%endif
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
PreReq: %install_info_prereq
%description
GDB, the GNU debugger, allows you to debug programs written in C, C++,
@ -339,7 +340,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
# Match the Fedora's version info.
%patch2 -p1
%if 0%{!?_with_upstream:1}
%patch232 -p1
#patch232 -p1
%patch349 -p1
%patch1 -p1
%patch3 -p1
@ -386,6 +387,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch211 -p1
%patch213 -p1
%patch214 -p1
%patch215 -p1
%patch216 -p1
%patch217 -p1
%patch225 -p1
@ -441,6 +443,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch360 -p1
%patch375 -p1
%patch376 -p1
%patch381 -p1
%patch124 -p1
%patch1000
%patch1002 -p1
@ -485,7 +488,7 @@ CFLAGS="$CFLAGS -O0 -ggdb2"
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--with-gdb-datadir=%{_datadir}/gdb \
--with-pythondir=%{python_sitelib} \
--with-pythondir=%{_datadir}/gdb/python \
--enable-gdb-build-warnings=,-Wno-unused \
%ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64 sparcv9 sparc64
--disable-werror \
@ -626,14 +629,14 @@ for LIB in lib lib64;do
LIBPATH="$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_prefix}/$LIB"
mkdir -p $LIBPATH
# basename is being run only for the native (non-biarch) file.
sed -e 's,@pythondir@,%{python_sitelib}/gdb,' \
sed -e 's,@pythondir@,%{_datadir}/gdb/python,' \
-e 's,@toolexeclibdir@,%{_prefix}/'"$LIB," \
< $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/hook.in \
> $LIBPATH/$(basename %{_prefix}/%{_lib}/libstdc++.so.6.*)-gdb.py
done
test ! -e $RPM_BUILD_ROOT%{python_sitelib}/gdb/libstdcxx
test ! -e $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx
cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/libstdcxx \
$RPM_BUILD_ROOT%{python_sitelib}/gdb/libstdcxx
$RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx
%endif # 0%{!?_without_python:1}
# Remove the files that are part of a gdb build but that are owned and
# provided by other packages.
@ -659,18 +662,14 @@ rm -rf $RPM_BUILD_ROOT
%post
# This step is part of the installation of the RPM. Not to be confused
# with the 'make install ' of the build (rpmbuild) process.
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || :
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || :
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/gdbint.info.gz || :
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/stabs.info.gz || :
for infoname in annotate gdb gdbint stabs;do
%install_info --info-dir=%{_infodir} %_{infodir}/$infoname.info.gz
done
%preun
if [ $1 = 0 ]; then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || :
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || :
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gdbint.info.gz || :
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/stabs.info.gz || :
fi
%postun
for infoname in annotate gdb gdbint stabs;do
%install_info_delete --info-dir=%{_infodir} %_{infodir}/$infoname.info.gz
done
%files
%defattr(-,root,root)
@ -683,9 +682,6 @@ fi
%if 0%{!?_with_upstream:1}
%{_bindir}/gstack
%{_mandir}/*/gstack.1*
%if 0%{!?_without_python:1}
%{python_sitelib}/gdb
%endif # 0%{!?_without_python:1}
%endif # 0%{!?_with_upstream:1}
%{_datadir}/gdb
%{_infodir}/annotate.info*