diff --git a/.gitignore b/.gitignore index 59f7709..967a59b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /libstdc++-v3-python-r155978.tar.bz2 -/gdb-7.3.50.20110722.tar.bz2 +/gdb-7.4.50.20120103.tar.bz2 diff --git a/gdb-6.3-bz231832-obstack-2gb.patch b/gdb-6.3-bz231832-obstack-2gb.patch index 38742cd..0b08cee 100644 --- a/gdb-6.3-bz231832-obstack-2gb.patch +++ b/gdb-6.3-bz231832-obstack-2gb.patch @@ -1,11 +1,11 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231832 -Index: gdb-7.2.50.20101116/gdb/symmisc.c +Index: gdb-7.4.50.20111218/gdb/symmisc.c =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/symmisc.c 2010-11-16 07:53:59.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/symmisc.c 2010-11-16 08:03:08.000000000 +0100 -@@ -186,8 +186,8 @@ print_objfile_statistics (void) +--- gdb-7.4.50.20111218.orig/gdb/symmisc.c 2011-04-04 17:19:59.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/symmisc.c 2011-12-19 00:28:18.189232014 +0100 +@@ -147,8 +147,8 @@ print_objfile_statistics (void) if (OBJSTAT (objfile, sz_strtab) > 0) printf_filtered (_(" Space used by a.out string tables: %d\n"), OBJSTAT (objfile, sz_strtab)); @@ -16,10 +16,10 @@ Index: gdb-7.2.50.20101116/gdb/symmisc.c printf_filtered (_(" Total memory used for psymbol cache: %d\n"), bcache_memory_used (psymbol_bcache_get_bcache (objfile->psymbol_cache))); -Index: gdb-7.2.50.20101116/include/obstack.h +Index: gdb-7.4.50.20111218/include/obstack.h =================================================================== ---- gdb-7.2.50.20101116.orig/include/obstack.h 2008-10-21 01:03:31.000000000 +0200 -+++ gdb-7.2.50.20101116/include/obstack.h 2010-11-16 08:02:37.000000000 +0100 +--- gdb-7.4.50.20111218.orig/include/obstack.h 2011-10-22 03:35:29.000000000 +0200 ++++ gdb-7.4.50.20111218/include/obstack.h 2011-12-19 00:28:18.189232014 +0100 @@ -188,31 +188,31 @@ struct obstack /* control current objec /* Declare the external functions we use; they are in obstack.c. */ @@ -125,19 +125,10 @@ Index: gdb-7.2.50.20101116/include/obstack.h if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ obstack_blank_fast (__o, __len); \ -@@ -532,7 +532,7 @@ __extension__ \ - # define obstack_free(h,obj) \ - ( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ - (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ -- ? (int) ((h)->next_free = (h)->object_base \ -+ ? (PTR_INT_TYPE) ((h)->next_free = (h)->object_base \ - = (h)->temp + (char *) (h)->chunk) \ - : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) - -Index: gdb-7.2.50.20101116/libiberty/obstack.c +Index: gdb-7.4.50.20111218/libiberty/obstack.c =================================================================== ---- gdb-7.2.50.20101116.orig/libiberty/obstack.c 2005-05-10 17:33:33.000000000 +0200 -+++ gdb-7.2.50.20101116/libiberty/obstack.c 2010-11-16 08:02:37.000000000 +0100 +--- gdb-7.4.50.20111218.orig/libiberty/obstack.c 2005-05-10 17:33:33.000000000 +0200 ++++ gdb-7.4.50.20111218/libiberty/obstack.c 2011-12-19 00:28:18.191232006 +0100 @@ -44,9 +44,11 @@ #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 #include diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 98d5bb0..960889a 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -4,11 +4,11 @@ to install and uninstall. * gstack.sh, gstack.1: New files. -Index: gdb-7.2.50.20101116/gdb/Makefile.in +Index: gdb-7.4.50.20120103/gdb/Makefile.in =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/Makefile.in 2010-11-05 15:31:25.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/Makefile.in 2010-11-16 07:56:10.000000000 +0100 -@@ -972,7 +972,7 @@ gdb.z:gdb.1 +--- gdb-7.4.50.20120103.orig/gdb/Makefile.in 2012-01-03 05:52:15.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/Makefile.in 2012-01-03 05:53:25.974210230 +0100 +@@ -1017,7 +1017,7 @@ gdb.z:gdb.1 install: all @$(MAKE) $(FLAGS_TO_PASS) install-only @@ -17,7 +17,7 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1008,7 +1008,25 @@ install-tui: +@@ -1039,7 +1039,25 @@ install-only: $(CONFIG_INSTALL) install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -44,10 +44,10 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e $$t` ; \ if test "x$$transformed_name" = x; then \ -@@ -1030,6 +1048,17 @@ uninstall-tui: - fi ; \ - rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ +@@ -1051,6 +1069,18 @@ uninstall: force $(CONFIG_UNINSTALL) $(DESTDIR)$(man1dir)/$$transformed_name.1 + @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do + +.PHONY: uninstall-gstack +uninstall-gstack: + transformed_name=`t='$(program_transform_name)'; \ @@ -59,13 +59,14 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in + fi ; \ + rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ + $(DESTDIR)$(man1dir)/$$transformed_name.1 - ++ # The C++ name parser can be built standalone for testing. test-cp-name-parser.o: cp-name-parser.c -Index: gdb-7.2.50.20101116/gdb/gstack.sh + $(COMPILE) -DTEST_CPNAMES cp-name-parser.c +Index: gdb-7.4.50.20120103/gdb/gstack.sh =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20101116/gdb/gstack.sh 2010-11-16 07:55:47.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/gstack.sh 2012-01-03 05:52:37.278385632 +0100 @@ -0,0 +1,48 @@ +#!/bin/sh + @@ -115,10 +116,10 @@ Index: gdb-7.2.50.20101116/gdb/gstack.sh + -e 's/^\((gdb) \)*//' \ + -e '/^#/p' \ + -e '/^Thread/p' -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp +Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp 2010-11-16 07:55:47.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp 2012-01-03 05:52:37.279385629 +0100 @@ -0,0 +1,71 @@ +# Copyright (C) 2010 Free Software Foundation, Inc. + @@ -191,10 +192,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp +gdb_exit + +remote_exec host "kill -9 $pid" -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.c +Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.c 2010-11-16 07:55:47.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.c 2012-01-03 05:52:37.279385629 +0100 @@ -0,0 +1,43 @@ +/* This testcase is part of GDB, the GNU debugger. + diff --git a/gdb-6.3-ppcdotsolib-20041022.patch b/gdb-6.3-ppcdotsolib-20041022.patch deleted file mode 100644 index 7226c0d..0000000 --- a/gdb-6.3-ppcdotsolib-20041022.patch +++ /dev/null @@ -1,31 +0,0 @@ -2004-10-22 Andrew Cagney - - * solib-svr4.c (enable_break): Convert a symbol descriptor into - the corresponding function entry point. - (solib_break_names): Delete "._dl_debug_state", no longer needed. - -2007-10-12 Jan Kratochvil - - Port to GDB-6.7. - -Index: gdb-6.8.50.20090802/gdb/solib-svr4.c -=================================================================== ---- gdb-6.8.50.20090802.orig/gdb/solib-svr4.c 2009-08-03 10:03:36.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/solib-svr4.c 2009-08-03 10:51:15.000000000 +0200 -@@ -1431,7 +1431,15 @@ enable_break (struct svr4_info *info) - { - sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep); - if (sym_addr != 0) -- break; -+ { -+ /* The symbol might be a descriptor, convert to into the -+ corresponding code address. */ -+ sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, -+ sym_addr, -+ tmp_bfd_target); -+ if (sym_addr != 0) -+ break; -+ } - } - - if (sym_addr != 0) diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index f327051..9f712a7 100644 --- a/gdb-6.3-readnever-20050907.patch +++ b/gdb-6.3-readnever-20050907.patch @@ -11,10 +11,10 @@ * gdb.texinfo (File Options): Document --readnever. -Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo +Index: gdb-7.4.50.20111218/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/doc/gdb.texinfo 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/doc/gdb.texinfo 2011-07-22 19:15:13.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/doc/gdb.texinfo 2011-12-19 02:52:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/doc/gdb.texinfo 2011-12-19 02:52:25.765407434 +0100 @@ -1005,6 +1005,12 @@ Read each symbol file's entire symbol ta the default, which is to read it incrementally as it is needed. This makes startup slower, but makes future operations faster. @@ -28,11 +28,11 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo @end table @node Mode Options -Index: gdb-7.3.50.20110722/gdb/main.c +Index: gdb-7.4.50.20111218/gdb/main.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/main.c 2011-07-22 19:14:25.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/main.c 2011-07-22 19:15:13.000000000 +0200 -@@ -399,6 +399,7 @@ captured_main (void *data) +--- gdb-7.4.50.20111218.orig/gdb/main.c 2011-12-19 02:52:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/main.c 2011-12-19 02:52:36.925364438 +0100 +@@ -406,6 +406,7 @@ captured_main (void *data) {"xdb", no_argument, &xdb_commands, 1}, {"dbx", no_argument, &dbx_commands, 1}, {"readnow", no_argument, &readnow_symbol_files, 1}, @@ -40,7 +40,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c {"r", no_argument, &readnow_symbol_files, 1}, {"quiet", no_argument, &quiet, 1}, {"q", no_argument, &quiet, 1}, -@@ -1065,6 +1066,7 @@ Options:\n\n\ +@@ -1072,6 +1073,7 @@ Options:\n\n\ fputs_unfiltered (_("\ --quiet Do not print version number on startup.\n\ --readnow Fully read symbol files on first access.\n\ @@ -48,11 +48,11 @@ Index: gdb-7.3.50.20110722/gdb/main.c "), stream); fputs_unfiltered (_("\ --se=FILE Use FILE as symbol file and executable file.\n\ -Index: gdb-7.3.50.20110722/gdb/symfile.c +Index: gdb-7.4.50.20111218/gdb/symfile.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/symfile.c 2011-05-11 06:56:07.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/symfile.c 2011-07-22 19:15:13.000000000 +0200 -@@ -81,6 +81,7 @@ static void clear_symtab_users_cleanup ( +--- gdb-7.4.50.20111218.orig/gdb/symfile.c 2011-12-15 16:36:55.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/symfile.c 2011-12-19 02:52:25.767407426 +0100 +@@ -82,6 +82,7 @@ static void clear_symtab_users_cleanup ( /* Global variables owned by this file. */ int readnow_symbol_files; /* Read full symbols immediately. */ @@ -60,11 +60,11 @@ Index: gdb-7.3.50.20110722/gdb/symfile.c /* External variables and functions referenced. */ -Index: gdb-7.3.50.20110722/gdb/dwarf2read.c +Index: gdb-7.4.50.20111218/gdb/dwarf2read.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2read.c 2011-07-22 19:15:41.000000000 +0200 -@@ -58,6 +58,7 @@ +--- gdb-7.4.50.20111218.orig/gdb/dwarf2read.c 2011-12-19 02:52:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/dwarf2read.c 2011-12-19 02:52:25.769407418 +0100 +@@ -59,6 +59,7 @@ #include "c-lang.h" #include "valprint.h" #include @@ -72,7 +72,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c #include #include "gdb_string.h" -@@ -1388,8 +1389,9 @@ dwarf2_has_info (struct objfile *objfile +@@ -1405,8 +1406,9 @@ dwarf2_has_info (struct objfile *objfile (void *) names); dwarf2_per_objfile->objfile = objfile; } @@ -84,11 +84,11 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c } /* When loading sections, we look either for uncompressed section or for -Index: gdb-7.3.50.20110722/gdb/top.h +Index: gdb-7.4.50.20111218/gdb/top.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/top.h 2011-07-21 13:03:45.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/top.h 2011-07-22 19:15:13.000000000 +0200 -@@ -59,6 +59,7 @@ extern void set_prompt (const char *); +--- gdb-7.4.50.20111218.orig/gdb/top.h 2011-12-16 21:29:28.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/top.h 2011-12-19 02:52:25.769407418 +0100 +@@ -61,6 +61,7 @@ extern void set_prompt (const char *s); /* From random places. */ extern int readnow_symbol_files; diff --git a/gdb-6.3-security-errata-20050610.patch b/gdb-6.3-security-errata-20050610.patch index 3763332..8e048d8 100644 --- a/gdb-6.3-security-errata-20050610.patch +++ b/gdb-6.3-security-errata-20050610.patch @@ -19,11 +19,11 @@ Proposed upstream but never committed upstream. (source_command): Update documentation. Check permissions if FROM_TTY is -1. -Index: gdb-7.3.50.20110722/gdb/cli/cli-cmds.c +Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/cli/cli-cmds.c 2011-06-07 19:26:46.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/cli/cli-cmds.c 2011-07-22 19:14:25.000000000 +0200 -@@ -39,6 +39,7 @@ +--- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.c 2011-12-16 22:17:42.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.c 2011-12-19 00:27:16.572468926 +0100 +@@ -40,6 +40,7 @@ #include "source.h" #include "disasm.h" #include "tracepoint.h" @@ -31,7 +31,7 @@ Index: gdb-7.3.50.20110722/gdb/cli/cli-cmds.c #include "ui-out.h" -@@ -489,7 +490,7 @@ show_script_ext_mode (struct ui_file *fi +@@ -485,7 +486,7 @@ show_script_ext_mode (struct ui_file *fi int find_and_open_script (const char *script_file, int search_path, @@ -40,7 +40,7 @@ Index: gdb-7.3.50.20110722/gdb/cli/cli-cmds.c { char *file; int fd; -@@ -515,6 +516,32 @@ find_and_open_script (const char *script +@@ -511,6 +512,32 @@ find_and_open_script (const char *script return 0; } @@ -73,7 +73,7 @@ Index: gdb-7.3.50.20110722/gdb/cli/cli-cmds.c do_cleanups (old_cleanups); *streamp = fdopen (fd, FOPEN_RT); -@@ -574,13 +601,14 @@ source_script_with_search (const char *f +@@ -572,13 +599,14 @@ source_script_with_search (const char *f if (file == NULL || *file == 0) error (_("source command requires file name of file to source.")); @@ -81,7 +81,7 @@ Index: gdb-7.3.50.20110722/gdb/cli/cli-cmds.c + if (!find_and_open_script (file, search_path, &stream, &full_path, + from_tty)) { - /* The script wasn't found, or was otherwise inaccessible. + /* The script wasn't found, or was otherwise inaccessible. If the source command was invoked interactively, throw an error. Otherwise (e.g. if it was invoked by a script), silently ignore the error. */ @@ -90,10 +90,10 @@ Index: gdb-7.3.50.20110722/gdb/cli/cli-cmds.c perror_with_name (file); else return; -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/gdbinit.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/gdbinit.exp 2011-07-22 19:14:25.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp 2011-12-19 00:25:26.079891954 +0100 @@ -0,0 +1,91 @@ +# Copyright 2005 +# Free Software Foundation, Inc. @@ -186,17 +186,17 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/gdbinit.exp +} + +remote_exec build "rm .gdbinit" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/gdbinit.sample +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/gdbinit.sample 2011-07-22 19:14:25.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample 2011-12-19 00:25:26.079891954 +0100 @@ -0,0 +1 @@ +echo "\nin gdbinit" -Index: gdb-7.3.50.20110722/gdb/main.c +Index: gdb-7.4.50.20111218/gdb/main.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/main.c 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/main.c 2011-07-22 19:14:25.000000000 +0200 -@@ -849,7 +849,7 @@ captured_main (void *data) +--- gdb-7.4.50.20111218.orig/gdb/main.c 2011-11-05 18:08:30.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/main.c 2011-12-19 00:25:26.080891950 +0100 +@@ -822,7 +822,7 @@ captured_main (void *data) debugging or what directory you are in. */ if (home_gdbinit && !inhibit_gdbinit) @@ -205,7 +205,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c /* Now perform all the actions indicated by the arguments. */ if (cdarg != NULL) -@@ -928,7 +928,7 @@ captured_main (void *data) +@@ -901,7 +901,7 @@ captured_main (void *data) /* Read the .gdbinit file in the current directory, *if* it isn't the same as the $HOME/.gdbinit file (it should exist, also). */ if (local_gdbinit && !inhibit_gdbinit) @@ -214,10 +214,10 @@ Index: gdb-7.3.50.20110722/gdb/main.c /* Now that all .gdbinit's have been read and all -d options have been processed, we can read any scripts mentioned in SYMARG. -Index: gdb-7.3.50.20110722/gdb/python/py-auto-load.c +Index: gdb-7.4.50.20111218/gdb/python/py-auto-load.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/python/py-auto-load.c 2011-05-16 18:33:57.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/python/py-auto-load.c 2011-07-22 19:14:54.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/python/py-auto-load.c 2011-12-10 23:51:47.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/python/py-auto-load.c 2011-12-19 00:25:26.080891950 +0100 @@ -284,7 +284,7 @@ source_section_scripts (struct objfile * } @@ -227,11 +227,11 @@ Index: gdb-7.3.50.20110722/gdb/python/py-auto-load.c /* If one script isn't found it's not uncommon for more to not be found either. We don't want to print an error message for each -Index: gdb-7.3.50.20110722/gdb/cli/cli-cmds.h +Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/cli/cli-cmds.h 2011-01-01 16:33:20.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/cli/cli-cmds.h 2011-07-22 19:14:25.000000000 +0200 -@@ -127,7 +127,8 @@ extern void source_script (char *, int); +--- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.h 2011-11-01 15:51:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.h 2011-12-19 00:25:26.080891950 +0100 +@@ -129,7 +129,8 @@ extern void source_script (char *, int); /* Exported to objfiles.c. */ extern int find_and_open_script (const char *file, int search_path, diff --git a/gdb-6.3-step-thread-exit-20050211-test.patch b/gdb-6.3-step-thread-exit-20050211-test.patch deleted file mode 100644 index 11c2a44..0000000 --- a/gdb-6.3-step-thread-exit-20050211-test.patch +++ /dev/null @@ -1,188 +0,0 @@ -2005-02-11 Jeff Johnston - - * testsuite/gdb.threads/step-thread-exit.c: New testcase. - * testsuite/gdb.threads/step-thread-exit.exp: Ditto. - -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.c 2008-12-08 22:21:26.000000000 +0100 -@@ -0,0 +1,50 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2005 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 2 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, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, -+ Boston, MA 02111-1307, USA. */ -+ -+#include -+#include -+#include -+#include -+ -+void *thread_function (void *ptr) -+{ -+ int *x = (int *)ptr; -+ printf("In thread_function, *x is %d\n", *x); -+} /* thread_function_end */ -+ -+volatile int repeat = 0; -+ -+main() -+{ -+ int ret; -+ pthread_t th; -+ int i = 3; -+ -+ ret = pthread_create (&th, NULL, thread_function, &i); -+ do -+ { -+ repeat = 0; -+ sleep (3); /* sleep */ -+ } -+ while (repeat); -+ pthread_join (th, NULL); -+ return 0; -+} -+ -+ -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.exp 2008-12-08 22:22:14.000000000 +0100 -@@ -0,0 +1,123 @@ -+# This testcase is part of GDB, the GNU debugger. -+ -+# Copyright 2005 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 2 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, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Check that GDB can step over a thread exit. -+ -+set testfile "step-thread-exit" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# Reset the debug file directory so we can't debug within the C library -+gdb_test "set debug-file-directory ." "" "" -+ -+# -+# Run to `main' where we begin our tests. -+# -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+# FIXME: Currently the main thread will escape/exit before our thread finishes -+# without this setting. -+gdb_test "set scheduler-locking step" -+gdb_test "show scheduler-locking" "Mode for locking scheduler during execution is \"step\"." "check scheduler-locking first" -+ -+set sleep_line [expr [gdb_get_line_number "sleep"]] -+set end_line [expr [gdb_get_line_number "thread_function_end"]] -+ -+gdb_breakpoint "$end_line" -+gdb_test "continue" "Break.*thread_function.*" "continue to thread_function 1" -+ -+# Keep nexting until we cause the thread to exit. We expect the main -+# thread to be stopped and a message printed to tell us we have stepped -+# over the thread exit. -+set test "step over thread exit 1" -+gdb_test_multiple "next" "$test" { -+ -re "\}.*$gdb_prompt $" { -+ send_gdb "next\n" -+ exp_continue -+ } -+ -re "\[Thread .* exited\].*Program received signal SIGSTOP.*$gdb_prompt $" { -+ pass "$test" -+ } -+ -re "start_thread.*$gdb_prompt $" { -+ send_gdb "next\n" -+ exp_continue -+ } -+} -+ -+# Without this fixup we could end up in: -+# #0 0x00110416 in __kernel_vsyscall () -+# #1 0x0011de26 in __lll_unlock_wake_private () from /lib/libpthread.so.0 -+# #2 0x001179f4 in _L_unlock_3164 () from /lib/libpthread.so.0 -+# #3 0x00116f01 in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0 -+# #4 0x08048531 in main () at ../.././gdb/testsuite/gdb.threads/step-thread-exit.c:39 -+gdb_breakpoint "$sleep_line" -+gdb_test "set repeat=1" "" "Get to the sleep function prepare 1" -+gdb_test "continue" "Break.*$sleep_line.*" "Get to the sleep function 1" -+ -+gdb_test "bt" "main.*$sleep_line.*" "backtrace after step 1" -+ -+runto_main -+gdb_test "show scheduler-locking" "Mode for locking scheduler during execution is \"step\"." "check scheduler-locking second" -+ -+gdb_breakpoint "$sleep_line" -+gdb_breakpoint "$end_line" -+set test "continue to thread_function 2" -+gdb_test_multiple "continue" "$test" { -+ -re "Break.*thread_function.*$gdb_prompt $" { -+ pass $test -+ } -+ -re "Break.*$sleep_line.*$gdb_prompt $" { -+ gdb_test "set repeat=1" "" "" -+ send_gdb "continue\n" -+ exp_continue -+ } -+} -+ -+# Keep nexting until we cause the thread to exit. In this case, we -+# expect the breakpoint in the main thread to have already triggered -+# and so we should stop there with a message that we stepped over -+# the thread exit. -+set test "step over thread exit 2" -+gdb_test_multiple "next" "$test" { -+ -re "\}.*$gdb_prompt $" { -+ send_gdb "next\n" -+ exp_continue -+ } -+ -re "\[Thread .* exited\].*Break.*$sleep_line.*$gdb_prompt $" { -+ pass "$test (breakpoint hit)" -+ } -+ -re "\[Thread .* exited\].*$gdb_prompt $" { -+ pass "$test (breakpoint not hit)" -+ } -+ -re "start_thread.*$gdb_prompt $" { -+ send_gdb "next\n" -+ exp_continue -+ } -+} -+ diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch index 51308bc..a8a0266 100644 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ b/gdb-6.3-test-dtorfix-20050121.patch @@ -1,32 +1,7 @@ -Index: gdb/testsuite/ChangeLog -2005-01-21 Jeff Johnston - - * gdb.cp/constructortest.exp: New test. - * gdb.cp/constructortest.cc: Ditto. - * gdb.cp/templates.exp: Change break of dtor to be fully quoted. - -2007-09-22 Jan Kratochvil - - * gdb.cp/constructortest.exp, gdb.cp/constructortest.cc: Test also the - `$delete' destructor variant. - -2007-09-25 Jan Kratochvil - - * gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting - the whole GDB. - -2007-10-05 Jan Kratochvil - - * gdb.cp/constructortest.exp: Test BREAKPOINT_RE_SET for multiple PCs - by PIE. - * gdb.cp/constructortest.exp: Handle the change of settings breakpoints - always at all the ctor/dtor variants. - -[ Removed the `gdb.cp/templates.exp' patch. ] -[ Updated the patch for "(X location") of GDB-6.8+. ] - ---- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005 -+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005 +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.cc +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.cc 2011-12-19 22:05:02.825431735 +0100 @@ -0,0 +1,99 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -127,8 +102,10 @@ Index: gdb/testsuite/ChangeLog +{ + y = 2; /* First line D */ +} ---- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005 -+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005 +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.exp 2011-12-19 23:07:24.148290893 +0100 @@ -0,0 +1,130 @@ +# This testcase is part of GDB, the GNU debugger. + @@ -232,7 +209,7 @@ Index: gdb/testsuite/ChangeLog +set define_line_dtor [gdb_get_line_number "Destructor C"] +# Break on the various forms of the C::~C destructor +# " ([23] locations)" is displayed depending on G++ version. -+gdb_test "break C\:\:~C" "Breakpoint .*, line ($define_line_dtor|$define_line_dtor)\\..*" "breaking on C::~C" ++gdb_test "break C\:\:~C" "Breakpoint .*: C::~C\\. \\(2 locations\\)" "breaking on C::~C" +gdb_continue_to_breakpoint "First line ~C" + +# Verify that we can break by line number in a destructor and find diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch index 0b4a2db..6111541 100644 --- a/gdb-6.3-test-pie-20050107.patch +++ b/gdb-6.3-test-pie-20050107.patch @@ -1,29 +1,29 @@ -Index: gdb-7.2.50.20110320/gdb/testsuite/configure.ac +Index: gdb-7.4.50.20111219/gdb/testsuite/configure.ac =================================================================== ---- gdb-7.2.50.20110320.orig/gdb/testsuite/configure.ac 2011-03-03 17:57:55.000000000 +0100 -+++ gdb-7.2.50.20110320/gdb/testsuite/configure.ac 2011-03-20 20:21:43.000000000 +0100 +--- gdb-7.4.50.20111219.orig/gdb/testsuite/configure.ac 2011-12-19 21:07:02.178472157 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/configure.ac 2011-12-19 22:05:02.704432213 +0100 @@ -97,6 +97,6 @@ AC_OUTPUT([Makefile \ gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \ - gdb.hp/gdb.defects/Makefile \ + gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \ gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \ - gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ + gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \ gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \ gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile]) -Index: gdb-7.2.50.20110320/gdb/testsuite/configure +Index: gdb-7.4.50.20111219/gdb/testsuite/configure =================================================================== ---- gdb-7.2.50.20110320.orig/gdb/testsuite/configure 2011-03-03 17:57:55.000000000 +0100 -+++ gdb-7.2.50.20110320/gdb/testsuite/configure 2011-03-20 20:21:43.000000000 +0100 +--- gdb-7.4.50.20111219.orig/gdb/testsuite/configure 2011-12-19 21:07:02.179472153 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/configure 2011-12-19 22:05:02.735432090 +0100 @@ -3448,7 +3448,7 @@ done --ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" -+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" +-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" ++ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure -@@ -4173,6 +4173,7 @@ do +@@ -4174,6 +4174,7 @@ do "gdb.opencl/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opencl/Makefile" ;; "gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;; "gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;; @@ -31,10 +31,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/configure "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;; "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;; "gdb.stabs/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.stabs/Makefile" ;; -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.c +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.c 2011-03-20 20:21:43.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c 2011-12-19 22:05:02.782431905 +0100 @@ -0,0 +1,20 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -56,10 +56,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.c + } + return 0; +} -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach2.c +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach2.c 2011-03-20 20:21:43.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c 2011-12-19 22:05:02.786431889 +0100 @@ -0,0 +1,24 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -85,10 +85,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach2.c + } + return (0); +} -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.c +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.c 2011-03-20 20:21:43.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c 2011-12-19 22:05:02.787431885 +0100 @@ -0,0 +1,146 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -236,10 +236,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.c + } + return 0; +} -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break1.c +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break1.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break1.c 2011-03-20 20:21:43.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break1.c 2011-12-19 22:05:02.787431885 +0100 @@ -0,0 +1,44 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -285,10 +285,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break1.c +void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ +void marker4 (d) long d; {} /* set breakpoint 13 here */ +#endif -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/coremaker.c +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/coremaker.c 2011-03-20 20:21:43.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c 2011-12-19 22:05:02.787431885 +0100 @@ -0,0 +1,142 @@ +/* Copyright 1992, 1993, 1994, 1995, 1996, 1999 + Free Software Foundation, Inc. @@ -432,10 +432,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/coremaker.c + return 0; +} + -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.exp +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.exp 2011-03-20 20:25:53.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp 2011-12-19 22:05:02.787431885 +0100 @@ -0,0 +1,417 @@ +# Copyright 1997, 1999, 2002 Free Software Foundation, Inc. + @@ -854,11 +854,11 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.exp +do_call_attach_tests + +return 0 -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp 2011-03-20 20:21:43.000000000 +0100 -@@ -0,0 +1,966 @@ ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp 2011-12-19 23:11:51.092333080 +0100 +@@ -0,0 +1,962 @@ +# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2002, 2003, 2004 +# Free Software Foundation, Inc. @@ -1246,14 +1246,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp +# Verify that GDB responds gracefully when asked to set a breakpoint +# on a nonexistent source line. +# -+send_gdb "break 999\n" -+gdb_expect { -+ -re "No line 999 in file .*$gdb_prompt $"\ -+ {pass "break on non-existent source line"} -+ -re "$gdb_prompt $"\ -+ {fail "break on non-existent source line"} -+ timeout {fail "(timeout) break on non-existent source line"} -+} ++gdb_test_no_output "set breakpoint pending off" ++gdb_test "break 999" \ ++ "No line 999 in the current file." \ ++ "break on non-existent source line" + +# Run to the desired default location. If not positioned here, the +# tests below don't work. @@ -1825,10 +1821,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp + send_gdb "set args main\n" + gdb_expect -re ".*$gdb_prompt $" {} +} -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/corefile.exp +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/corefile.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/corefile.exp 2011-03-20 20:21:43.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/corefile.exp 2011-12-19 22:05:02.788431881 +0100 @@ -0,0 +1,233 @@ +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. @@ -2063,10 +2059,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/corefile.exp +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)" + +gdb_test "core" "No core file now." -Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/Makefile.in +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/Makefile.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/Makefile.in 2011-03-20 20:21:43.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/Makefile.in 2011-12-19 22:05:02.788431881 +0100 @@ -0,0 +1,19 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ diff --git a/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch index 187a33e..a24c448 100644 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ b/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -32,17 +32,20 @@ (amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto. (amd64_linux_new_thread): Ditto. (_initialize_amd64_linux_nat): Register linux new thread observer. - * testsuite/gdb.threads/watchthreads2.c: New test case. - * testsuite/gdb.threads/watchthreads2.exp: Ditto. + * testsuite/gdb.threads/watchthreads-threaded.c: New test case. + * testsuite/gdb.threads/watchthreads-threaded.exp: Ditto. [ With recent upstream GDB (6.8) reduced only to the testcase. ] +[ It was called watchthreads2.{exp,c} before but it conflicted with FSF GDB new + testcase of the same name. ] + FIXME: The testcase does not expects multiple watchpoints hits per one stop. -Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads-threaded.c 2006-07-12 01:54:29.000000000 -0300 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.c 2011-12-19 22:05:02.867431570 +0100 @@ -0,0 +1,66 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -110,10 +113,10 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c + pthread_exit(NULL); +} + -Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads-threaded.exp 2006-07-12 01:54:29.000000000 -0300 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.exp 2011-12-19 22:28:33.294911982 +0100 @@ -0,0 +1,126 @@ +# This testcase is part of GDB, the GNU debugger. + @@ -141,7 +144,7 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp + return 0; +} + -+set testfile "watchthreads2" ++set testfile "watchthreads-threaded" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } { @@ -198,13 +201,13 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp +for {set i 0} {$i < 30} {incr i} { + set test_flag 0 + gdb_test_multiple "continue" "threaded watch loop" { -+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $" ++ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $" + { set args_2 1; set test_flag 1 } -+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $" ++ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $" + { set args_3 1; set test_flag 1 } -+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $" ++ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" + { set args_2 [expr $args_2+1]; set test_flag 1 } -+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $" ++ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $" + { set args_3 [expr $args_3+1]; set test_flag 1 } + } + # If we fail above, don't bother continuing loop diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch index b9d1134..de1ccad 100644 --- a/gdb-6.6-buildid-locate-core-as-arg.patch +++ b/gdb-6.6-buildid-locate-core-as-arg.patch @@ -58,13 +58,13 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html * exec.c (exec_file_attach): Print a more useful error message if the user did "gdb core". -Index: gdb-7.2.50.20110218/gdb/exceptions.h +Index: gdb-7.4.50.20111218/gdb/exceptions.h =================================================================== ---- gdb-7.2.50.20110218.orig/gdb/exceptions.h 2011-02-14 12:35:44.000000000 +0100 -+++ gdb-7.2.50.20110218/gdb/exceptions.h 2011-02-18 10:45:31.000000000 +0100 -@@ -85,6 +85,9 @@ enum errors { - traceframe. */ - NOT_AVAILABLE_ERROR, +--- gdb-7.4.50.20111218.orig/gdb/exceptions.h 2011-10-09 21:21:38.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/exceptions.h 2011-12-19 01:41:20.900509347 +0100 +@@ -88,6 +88,9 @@ enum errors { + /* DW_OP_GNU_entry_value resolving failed. */ + NO_ENTRY_VALUE_ERROR, + /* Attempt to load a core file as executable. */ + IS_CORE_ERROR, @@ -72,11 +72,11 @@ Index: gdb-7.2.50.20110218/gdb/exceptions.h /* Add more errors here. */ NR_ERRORS }; -Index: gdb-7.2.50.20110218/gdb/exec.c +Index: gdb-7.4.50.20111218/gdb/exec.c =================================================================== ---- gdb-7.2.50.20110218.orig/gdb/exec.c 2011-02-14 23:08:48.000000000 +0100 -+++ gdb-7.2.50.20110218/gdb/exec.c 2011-02-18 10:45:16.000000000 +0100 -@@ -34,6 +34,7 @@ +--- gdb-7.4.50.20111218.orig/gdb/exec.c 2011-03-23 19:23:54.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/exec.c 2011-12-19 01:41:04.863568846 +0100 +@@ -35,6 +35,7 @@ #include "arch-utils.h" #include "gdbthread.h" #include "progspace.h" @@ -84,7 +84,7 @@ Index: gdb-7.2.50.20110218/gdb/exec.c #include #include "readline/readline.h" -@@ -253,12 +254,27 @@ exec_file_attach (char *filename, int fr +@@ -254,12 +255,27 @@ exec_file_attach (char *filename, int fr if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) { @@ -115,11 +115,11 @@ Index: gdb-7.2.50.20110218/gdb/exec.c } /* FIXME - This should only be run for RS6000, but the ifdef is a poor -Index: gdb-7.2.50.20110218/gdb/main.c +Index: gdb-7.4.50.20111218/gdb/main.c =================================================================== ---- gdb-7.2.50.20110218.orig/gdb/main.c 2011-02-18 10:44:17.000000000 +0100 -+++ gdb-7.2.50.20110218/gdb/main.c 2011-02-18 10:45:16.000000000 +0100 -@@ -243,6 +243,36 @@ captured_command_loop (void *data) +--- gdb-7.4.50.20111218.orig/gdb/main.c 2011-12-19 00:28:01.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/main.c 2011-12-19 01:41:04.863568846 +0100 +@@ -248,6 +248,36 @@ captured_command_loop (void *data) return 1; } @@ -156,7 +156,7 @@ Index: gdb-7.2.50.20110218/gdb/main.c static int captured_main (void *data) { -@@ -727,6 +757,8 @@ captured_main (void *data) +@@ -704,6 +734,8 @@ captured_main (void *data) { symarg = argv[optind]; execarg = argv[optind]; @@ -165,7 +165,7 @@ Index: gdb-7.2.50.20110218/gdb/main.c optind++; } -@@ -868,11 +900,25 @@ captured_main (void *data) +@@ -845,11 +877,25 @@ captured_main (void *data) && symarg != NULL && strcmp (execarg, symarg) == 0) { diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index 8210d18..4490df3 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,7 +1,7 @@ -Index: gdb-7.3.50.20110722/gdb/event-top.c +Index: gdb-7.4.50.20111218/gdb/event-top.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/event-top.c 2011-07-21 13:03:45.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/event-top.c 2011-07-22 19:28:49.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/event-top.c 2011-09-21 17:21:28.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/event-top.c 2011-12-19 01:18:56.087539251 +0100 @@ -36,6 +36,7 @@ #include "observer.h" #include "continuations.h" @@ -10,16 +10,16 @@ Index: gdb-7.3.50.20110722/gdb/event-top.c /* readline include files. */ #include "readline/readline.h" -@@ -193,6 +194,8 @@ cli_command_loop (void) - char *a_prompt; - char *gdb_prompt = get_prompt (); - -+ debug_flush_missing (); +@@ -176,6 +177,8 @@ rl_callback_read_char_wrapper (gdb_clien + void + cli_command_loop (void) + { ++ debug_flush_missing (); + - /* Tell readline what the prompt to display is and what function - it will need to call after a whole line is read. This also - displays the first prompt. */ -@@ -264,6 +267,8 @@ display_gdb_prompt (char *new_prompt) + display_gdb_prompt (0); + + /* Now it's time to start the event loop. */ +@@ -241,6 +244,8 @@ display_gdb_prompt (char *new_prompt) /* Reset the nesting depth used when trace-commands is set. */ reset_command_nest_depth (); @@ -28,11 +28,11 @@ Index: gdb-7.3.50.20110722/gdb/event-top.c /* Each interpreter has its own rules on displaying the command prompt. */ if (!current_interp_display_prompt_p ()) -Index: gdb-7.3.50.20110722/gdb/elfread.c +Index: gdb-7.4.50.20111218/gdb/elfread.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/elfread.c 2011-07-22 19:26:46.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/elfread.c 2011-07-22 19:28:34.000000000 +0200 -@@ -49,6 +49,7 @@ +--- gdb-7.4.50.20111218.orig/gdb/elfread.c 2011-12-19 00:54:09.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/elfread.c 2011-12-19 01:16:15.248455897 +0100 +@@ -47,6 +47,7 @@ #include "gdbcore.h" #include "gdbcmd.h" #include "observer.h" @@ -40,7 +40,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c #include extern void _initialize_elfread (void); -@@ -1652,8 +1653,361 @@ build_id_to_filename (struct build_id *b +@@ -1622,8 +1623,361 @@ build_id_to_filename (struct build_id *b return retval; } @@ -403,7 +403,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c avoidance. */ struct missing_filepair -@@ -1707,11 +2061,17 @@ missing_filepair_change (void) +@@ -1677,11 +2031,17 @@ missing_filepair_change (void) /* All their memory came just from missing_filepair_OBSTACK. */ missing_filepair_hash = NULL; } @@ -421,7 +421,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c missing_filepair_change (); } -@@ -1778,14 +2138,35 @@ debug_print_missing (const char *binary, +@@ -1748,14 +2108,35 @@ debug_print_missing (const char *binary, *slot = missing_filepair; @@ -464,11 +464,11 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c } static char * -Index: gdb-7.3.50.20110722/gdb/symfile.h +Index: gdb-7.4.50.20111218/gdb/symfile.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/symfile.h 2011-07-22 19:27:06.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/symfile.h 2011-07-22 19:28:34.000000000 +0200 -@@ -615,6 +615,8 @@ extern struct build_id *build_id_addr_ge +--- gdb-7.4.50.20111218.orig/gdb/symfile.h 2011-12-19 00:54:09.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/symfile.h 2011-12-19 01:16:15.249455893 +0100 +@@ -568,6 +568,8 @@ extern struct build_id *build_id_addr_ge extern char *build_id_to_filename (struct build_id *build_id, char **link_return, int add_debug_suffix); extern void debug_print_missing (const char *binary, const char *debug); @@ -477,11 +477,11 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h /* From dwarf2read.c */ -Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/gdb.exp 2011-07-22 19:26:46.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp 2011-07-22 19:28:34.000000000 +0200 -@@ -1390,7 +1390,7 @@ proc default_gdb_start { } { +--- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/gdb.exp 2011-12-19 00:54:09.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp 2011-12-19 01:16:15.250455889 +0100 +@@ -1387,7 +1387,7 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } } @@ -490,23 +490,23 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp send_gdb "set build-id-verbose 0\n" gdb_expect 10 { -re "$gdb_prompt $" { -Index: gdb-7.3.50.20110722/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/mi-support.exp 2011-07-22 19:26:46.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/lib/mi-support.exp 2011-07-22 19:28:34.000000000 +0200 -@@ -222,7 +222,7 @@ proc default_mi_gdb_start { args } { - } - } +--- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/mi-support.exp 2011-12-19 00:54:49.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/lib/mi-support.exp 2011-12-19 01:20:34.921163977 +0100 +@@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } { + warning "Couldn't set the width to 0." + } } - # Turn off the missing warnings as the testsuite does not expect it. + # Turn off the missing RPMs warnings as the testsuite does not expect it. send_gdb "190-gdb-set build-id-verbose 0\n" gdb_expect 10 { -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { -Index: gdb-7.3.50.20110722/gdb/tui/tui-interp.c +Index: gdb-7.4.50.20111218/gdb/tui/tui-interp.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/tui/tui-interp.c 2011-01-01 16:33:52.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/tui/tui-interp.c 2011-07-22 19:28:34.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/tui/tui-interp.c 2011-09-12 23:24:51.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/tui/tui-interp.c 2011-12-19 01:16:15.252455883 +0100 @@ -31,6 +31,7 @@ #include "tui/tui.h" #include "tui/tui-io.h" @@ -515,19 +515,10 @@ Index: gdb-7.3.50.20110722/gdb/tui/tui-interp.c /* Set to 1 when the TUI mode must be activated when we first start gdb. */ -@@ -147,6 +148,8 @@ tui_command_loop (void *data) - char *a_prompt; - char *gdb_prompt = get_prompt (); - -+ debug_flush_missing (); -+ - /* Tell readline what the prompt to display is and what function - it will need to call after a whole line is read. This also - displays the first prompt. */ -Index: gdb-7.3.50.20110722/gdb/aclocal.m4 +Index: gdb-7.4.50.20111218/gdb/aclocal.m4 =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/aclocal.m4 2011-02-15 22:05:53.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/aclocal.m4 2011-07-22 19:28:34.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/aclocal.m4 2011-02-15 22:05:53.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/aclocal.m4 2011-12-19 01:16:15.252455883 +0100 @@ -19,6 +19,162 @@ You have another version of autoconf. I If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -691,10 +682,10 @@ Index: gdb-7.3.50.20110722/gdb/aclocal.m4 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation -Index: gdb-7.3.50.20110722/gdb/config.in +Index: gdb-7.4.50.20111218/gdb/config.in =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/config.in 2011-05-12 01:38:38.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/config.in 2011-07-22 19:28:34.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/config.in 2011-11-20 09:59:56.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/config.in 2011-12-19 01:16:15.253455879 +0100 @@ -46,6 +46,9 @@ /* Define to BFD's default target vector. */ #undef DEFAULT_BFD_VEC @@ -715,11 +706,11 @@ Index: gdb-7.3.50.20110722/gdb/config.in /* Define if libunwind library is being used. */ #undef HAVE_LIBUNWIND -Index: gdb-7.3.50.20110722/gdb/configure +Index: gdb-7.4.50.20111218/gdb/configure =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/configure 2011-05-12 01:38:38.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/configure 2011-07-22 19:28:34.000000000 +0200 -@@ -682,6 +682,9 @@ REPORT_BUGS_TO +--- gdb-7.4.50.20111218.orig/gdb/configure 2011-11-20 09:59:56.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/configure 2011-12-19 01:16:15.256455867 +0100 +@@ -684,6 +684,9 @@ REPORT_BUGS_TO PKGVERSION TARGET_OBS subdirs @@ -729,7 +720,7 @@ Index: gdb-7.3.50.20110722/gdb/configure GDB_DATADIR DEBUGDIR am__fastdepCC_FALSE -@@ -948,6 +951,7 @@ enable_dependency_tracking +@@ -952,6 +955,7 @@ enable_dependency_tracking with_separate_debug_dir with_gdb_datadir with_relocated_sources @@ -737,7 +728,7 @@ Index: gdb-7.3.50.20110722/gdb/configure enable_targets enable_64_bit_bfd enable_gdbcli -@@ -990,6 +994,9 @@ LDFLAGS +@@ -995,6 +999,9 @@ LDFLAGS LIBS CPPFLAGS CPP @@ -747,7 +738,7 @@ Index: gdb-7.3.50.20110722/gdb/configure YACC YFLAGS XMKMF' -@@ -1653,6 +1660,8 @@ Optional Packages: +@@ -1658,6 +1665,8 @@ Optional Packages: [DATADIR/gdb] --with-relocated-sources=PATH automatically relocate this path for source files @@ -756,7 +747,7 @@ Index: gdb-7.3.50.20110722/gdb/configure --with-libunwind use libunwind frame unwinding support --with-curses use the curses library instead of the termcap library -@@ -1689,6 +1698,9 @@ Some influential environment variables: +@@ -1696,6 +1705,9 @@ Some influential environment variables: CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -766,7 +757,7 @@ Index: gdb-7.3.50.20110722/gdb/configure YACC The `Yet Another C Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. -@@ -7886,6 +7898,486 @@ _ACEOF +@@ -7968,6 +7980,486 @@ _ACEOF fi @@ -1253,11 +1244,11 @@ Index: gdb-7.3.50.20110722/gdb/configure subdirs="$subdirs testsuite" -Index: gdb-7.3.50.20110722/gdb/configure.ac +Index: gdb-7.4.50.20111218/gdb/configure.ac =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/configure.ac 2011-05-12 01:38:38.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/configure.ac 2011-07-22 19:28:34.000000000 +0200 -@@ -108,6 +108,199 @@ AS_HELP_STRING([--with-relocated-sources +--- gdb-7.4.50.20111218.orig/gdb/configure.ac 2011-11-20 09:59:56.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/configure.ac 2011-12-19 01:16:15.257455863 +0100 +@@ -140,6 +140,199 @@ AS_HELP_STRING([--with-relocated-sources [Relocated directory for source files. ]) ]) @@ -1457,10 +1448,10 @@ Index: gdb-7.3.50.20110722/gdb/configure.ac AC_CONFIG_SUBDIRS(testsuite) # Check whether to support alternative target configurations -Index: gdb-7.3.50.20110722/gdb/acinclude.m4 +Index: gdb-7.4.50.20111218/gdb/acinclude.m4 =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/acinclude.m4 2011-07-22 19:28:34.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/acinclude.m4 2011-12-19 01:16:15.257455863 +0100 @@ -1,3 +1,5 @@ +# serial 1 + @@ -1476,10 +1467,10 @@ Index: gdb-7.3.50.20110722/gdb/acinclude.m4 # @defmac AC_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC -Index: gdb-7.3.50.20110722/gdb/corelow.c +Index: gdb-7.4.50.20111218/gdb/corelow.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/corelow.c 2011-07-22 19:27:26.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/corelow.c 2011-07-22 19:28:34.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/corelow.c 2011-12-19 00:54:09.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/corelow.c 2011-12-19 01:16:15.258455859 +0100 @@ -321,7 +321,7 @@ build_id_locate_exec (int from_tty) symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; } diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 022d0ca..7a72d86 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,7 +1,7 @@ -Index: gdb-7.3.50.20110722/gdb/corelow.c +Index: gdb-7.4.50.20120103/gdb/corelow.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/corelow.c 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/corelow.c 2011-07-22 20:13:00.000000000 +0200 +--- gdb-7.4.50.20120103.orig/gdb/corelow.c 2011-04-17 21:12:20.000000000 +0200 ++++ gdb-7.4.50.20120103/gdb/corelow.c 2012-01-03 15:20:54.905851456 +0100 @@ -48,6 +48,9 @@ #include "progspace.h" #include "objfiles.h" @@ -12,7 +12,7 @@ Index: gdb-7.3.50.20110722/gdb/corelow.c #ifndef O_LARGEFILE -@@ -279,6 +282,52 @@ add_to_thread_list (bfd *abfd, asection +@@ -279,6 +282,52 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current. */ } @@ -90,11 +90,11 @@ Index: gdb-7.3.50.20110722/gdb/corelow.c + NULL, NULL, NULL, + &setlist, &showlist); } -Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo +Index: gdb-7.4.50.20120103/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/doc/gdb.texinfo 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/doc/gdb.texinfo 2011-07-22 20:13:00.000000000 +0200 -@@ -15402,6 +15402,27 @@ information files. +--- gdb-7.4.50.20120103.orig/gdb/doc/gdb.texinfo 2012-01-03 05:53:41.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/doc/gdb.texinfo 2012-01-03 15:20:54.910851436 +0100 +@@ -15971,6 +15971,27 @@ information files. @end table @@ -122,71 +122,74 @@ Index: gdb-7.3.50.20110722/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-7.3.50.20110722/gdb/solib-svr4.c +Index: gdb-7.4.50.20120103/gdb/solib-svr4.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/solib-svr4.c 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/solib-svr4.c 2011-07-22 20:16:10.000000000 +0200 -@@ -1201,9 +1201,49 @@ 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'; -- strcpy (new->so_original_name, new->so_name); -+ 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) -+ { -+ 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) -+ { -+ strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1); -+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; -+ xfree (name); -+ } -+ else -+ { -+ 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); -+ } - } - xfree (buffer); +--- gdb-7.4.50.20120103.orig/gdb/solib-svr4.c 2011-12-03 19:32:29.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/solib-svr4.c 2012-01-03 15:20:54.911851432 +0100 +@@ -1228,9 +1228,52 @@ svr4_read_so_list (CORE_ADDR lm, struct + continue; + } -Index: gdb-7.3.50.20110722/gdb/elfread.c +- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); +- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; +- strcpy (new->so_original_name, new->so_name); ++ { ++ 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 (new->lm_info->l_ld); ++ 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) ++ { ++ strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1); ++ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; ++ xfree (name); ++ } ++ else ++ { ++ 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); ++ } ++ } ++ + xfree (buffer); + + /* If this entry has no name, or its name matches the name +Index: gdb-7.4.50.20120103/gdb/elfread.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/elfread.c 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/elfread.c 2011-07-22 20:13:00.000000000 +0200 -@@ -45,6 +45,11 @@ - #include "infcall.h" +--- gdb-7.4.50.20120103.orig/gdb/elfread.c 2012-01-03 05:52:15.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/elfread.c 2012-01-03 15:21:09.933796168 +0100 +@@ -46,6 +46,11 @@ #include "gdbthread.h" #include "regcache.h" + #include "bcache.h" +#include "libbfd.h" +#include "gdbcore.h" +#include "gdbcmd.h" @@ -195,7 +198,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c extern void _initialize_elfread (void); -@@ -1074,16 +1079,65 @@ elf_gnu_ifunc_resolver_return_stop (stru +@@ -1078,16 +1083,65 @@ elf_gnu_ifunc_resolver_return_stop (stru update_breakpoint_locations (b, sals, sals_end); } @@ -263,7 +266,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c { struct build_id *retval; -@@ -1099,6 +1153,348 @@ build_id_bfd_get (bfd *abfd) +@@ -1103,6 +1157,348 @@ build_id_bfd_get (bfd *abfd) return retval; } @@ -612,7 +615,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ static int -@@ -1113,7 +1509,7 @@ build_id_verify (const char *filename, s +@@ -1117,7 +1513,7 @@ build_id_verify (const char *filename, s if (abfd == NULL) return 0; @@ -621,7 +624,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), filename); -@@ -1131,14 +1527,15 @@ build_id_verify (const char *filename, s +@@ -1135,14 +1531,15 @@ build_id_verify (const char *filename, s return retval; } @@ -641,7 +644,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will cause "/.build-id/..." lookups. */ -@@ -1149,6 +1546,8 @@ build_id_to_debug_filename (struct build +@@ -1153,6 +1550,8 @@ build_id_to_debug_filename (struct build char *s, *debugdir_end; gdb_byte *data = build_id->data; size_t size = build_id->size; @@ -650,7 +653,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c while (*debugdir == DIRNAME_SEPARATOR) debugdir++; -@@ -1169,39 +1568,242 @@ build_id_to_debug_filename (struct build +@@ -1173,39 +1572,242 @@ build_id_to_debug_filename (struct build *s++ = '/'; while (size-- > 0) s += sprintf (s, "%02x", (unsigned) *data++); @@ -905,7 +908,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c xfree (build_id); /* Prevent looping on a stripped .debug file. */ if (build_id_name != NULL -@@ -1212,7 +1814,7 @@ find_separate_debug_file_by_buildid (str +@@ -1216,7 +1818,7 @@ find_separate_debug_file_by_buildid (str xfree (build_id_name); } else if (build_id_name != NULL) @@ -914,7 +917,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c } return NULL; } -@@ -1432,9 +2034,10 @@ elf_symfile_read (struct objfile *objfil +@@ -1436,9 +2038,10 @@ elf_symfile_read (struct objfile *objfil `.note.gnu.build-id'. */ else if (!objfile_has_partial_symbols (objfile)) { @@ -927,7 +930,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c if (debugfile == NULL) debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1446,6 +2049,12 @@ elf_symfile_read (struct objfile *objfil +@@ -1450,6 +2053,12 @@ elf_symfile_read (struct objfile *objfil symbol_file_add_separate (abfd, symfile_flags, objfile); xfree (debugfile); } @@ -940,7 +943,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c } } -@@ -1925,4 +2534,16 @@ _initialize_elfread (void) +@@ -1933,4 +2542,16 @@ _initialize_elfread (void) elf_objfile_gnu_ifunc_cache_data = register_objfile_data (); gnu_ifunc_fns_p = &elf_gnu_ifunc_fns; @@ -957,11 +960,11 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c + + observer_attach_executable_changed (debug_print_executable_changed); } -Index: gdb-7.3.50.20110722/gdb/symfile.h +Index: gdb-7.4.50.20120103/gdb/symfile.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/symfile.h 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/symfile.h 2011-07-22 20:13:00.000000000 +0200 -@@ -609,6 +609,13 @@ void free_symfile_segment_data (struct s +--- gdb-7.4.50.20120103.orig/gdb/symfile.h 2012-01-03 05:52:15.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/symfile.h 2012-01-03 15:20:54.914851422 +0100 +@@ -616,6 +616,13 @@ void free_symfile_segment_data (struct s extern struct cleanup *increment_reading_symtab (void); @@ -975,11 +978,11 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h /* From dwarf2read.c */ /* Names for a dwarf2 debugging section. The field NORMAL is the normal -Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp +Index: gdb-7.4.50.20120103/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/gdb.exp 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp 2011-07-22 20:13:00.000000000 +0200 -@@ -1390,6 +1390,16 @@ proc default_gdb_start { } { +--- gdb-7.4.50.20120103.orig/gdb/testsuite/lib/gdb.exp 2012-01-03 05:52:15.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/testsuite/lib/gdb.exp 2012-01-03 15:20:54.914851422 +0100 +@@ -1387,6 +1387,16 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } } @@ -996,13 +999,13 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp return 0; } -Index: gdb-7.3.50.20110722/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.4.50.20120103/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/mi-support.exp 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/lib/mi-support.exp 2011-07-22 20:13:00.000000000 +0200 -@@ -222,6 +222,16 @@ proc default_mi_gdb_start { args } { - } - } +--- gdb-7.4.50.20120103.orig/gdb/testsuite/lib/mi-support.exp 2011-12-03 21:20:29.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/testsuite/lib/mi-support.exp 2012-01-03 15:20:54.915851419 +0100 +@@ -212,6 +212,16 @@ proc default_mi_gdb_start { args } { + warning "Couldn't set the width to 0." + } } + # Turn off the missing warnings as the testsuite does not expect it. + send_gdb "190-gdb-set build-id-verbose 0\n" @@ -1014,16 +1017,16 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/mi-support.exp + warning "Could not disable the missing debug infos warnings.." + } + } - - detect_async - -Index: gdb-7.3.50.20110722/gdb/objfiles.h + # If allowing the inferior to have its own PTY then assign the inferior + # its own terminal device here. + if { $separate_inferior_pty } { +Index: gdb-7.4.50.20120103/gdb/objfiles.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/objfiles.h 2011-07-22 20:12:40.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/objfiles.h 2011-07-22 20:13:00.000000000 +0200 -@@ -434,6 +434,10 @@ struct objfile +--- gdb-7.4.50.20120103.orig/gdb/objfiles.h 2011-12-08 19:08:12.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/objfiles.h 2012-01-03 15:20:54.915851419 +0100 +@@ -435,6 +435,10 @@ struct objfile - #define OBJF_PSYMTABS_READ (1 << 4) + #define OBJF_MAINLINE (1 << 5) +/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ + diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch index 671b457..c7f0d33 100644 --- a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +++ b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -21,11 +21,11 @@ Port to GDB-6.8pre. -Index: gdb-7.3.50.20110722/gdb/inferior.h +Index: gdb-7.4.50.20111218/gdb/inferior.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/inferior.h 2011-07-22 01:46:08.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/inferior.h 2011-07-22 19:13:30.000000000 +0200 -@@ -158,7 +158,15 @@ extern void reopen_exec_file (void); +--- gdb-7.4.50.20111218.orig/gdb/inferior.h 2011-10-07 14:06:46.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/inferior.h 2011-12-18 23:40:59.257300451 +0100 +@@ -162,7 +162,15 @@ extern void reopen_exec_file (void); /* The `resume' routine should only be called in special circumstances. Normally, use `proceed', which handles a lot of bookkeeping. */ @@ -42,10 +42,10 @@ Index: gdb-7.3.50.20110722/gdb/inferior.h extern ptid_t user_visible_resume_ptid (int step); -Index: gdb-7.3.50.20110722/gdb/infrun.c +Index: gdb-7.4.50.20111218/gdb/infrun.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/infrun.c 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/infrun.c 2011-07-22 19:12:56.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/infrun.c 2011-11-22 22:25:17.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/infrun.c 2011-12-19 00:12:34.470854218 +0100 @@ -79,7 +79,7 @@ static int follow_fork (void); static void set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c); @@ -55,7 +55,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c static int currently_stepping_or_nexting_callback (struct thread_info *tp, void *data); -@@ -1630,7 +1630,8 @@ user_visible_resume_ptid (int step) +@@ -1668,7 +1668,8 @@ user_visible_resume_ptid (int step) } else if ((scheduler_mode == schedlock_on) || (scheduler_mode == schedlock_step @@ -65,7 +65,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c { /* User-settable 'scheduler' mode requires solo thread resume. */ resume_ptid = inferior_ptid; -@@ -1648,7 +1649,7 @@ user_visible_resume_ptid (int step) +@@ -1686,7 +1687,7 @@ user_visible_resume_ptid (int step) STEP nonzero if we should step (zero to continue instead). SIG is the signal to give the inferior (zero for none). */ void @@ -74,7 +74,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c { int should_resume = 1; struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); -@@ -1681,9 +1682,13 @@ resume (int step, enum target_signal sig +@@ -1719,9 +1720,13 @@ resume (int step, enum target_signal sig if (debug_infrun) fprintf_unfiltered (gdb_stdlog, @@ -90,7 +90,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c target_pid_to_str (inferior_ptid), paddress (gdbarch, pc)); -@@ -2056,7 +2061,7 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -2094,7 +2099,7 @@ proceed (CORE_ADDR addr, enum target_sig struct thread_info *tp; CORE_ADDR pc; struct address_space *aspace; @@ -99,7 +99,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c /* If we're stopped at a fork/vfork, follow the branch set by the "set follow-fork-mode" command; otherwise, we'll just proceed -@@ -2096,13 +2101,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -2134,13 +2139,13 @@ proceed (CORE_ADDR addr, enum target_sig actually be executing the breakpoint insn anyway. We'll be (un-)executing the previous instruction. */ @@ -115,7 +115,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c } else { -@@ -2133,13 +2138,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -2171,13 +2176,13 @@ proceed (CORE_ADDR addr, enum target_sig is required it returns TRUE and sets the current thread to the old thread. */ if (prepare_to_proceed (step)) @@ -131,7 +131,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c { tp->control.trap_expected = 1; /* If displaced stepping is enabled, we can step over the -@@ -2226,8 +2231,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -2264,8 +2269,13 @@ proceed (CORE_ADDR addr, enum target_sig /* Reset to normal state. */ init_infwait_state (); @@ -146,7 +146,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c /* Wait for it to stop (if not standalone) and in any case decode why it stopped, and act accordingly. */ -@@ -5123,14 +5133,19 @@ process_event_stop_test: +@@ -5223,13 +5233,18 @@ process_event_stop_test: /* Is thread TP in the middle of single-stepping? */ @@ -157,12 +157,10 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c - return ((tp->control.step_range_end - && tp->control.step_resume_breakpoint == NULL) - || tp->control.trap_expected -- || tp->stepping_through_solib_after_catch - || bpstat_should_step ()); + if ((tp->control.step_range_end + && tp->control.step_resume_breakpoint == NULL) -+ || tp->control.trap_expected -+ || tp->stepping_through_solib_after_catch) ++ || tp->control.trap_expected) + return RESUME_STEP_USER; + + if (bpstat_should_step ()) @@ -172,27 +170,28 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c } /* Returns true if any thread *but* the one passed in "data" is in the -Index: gdb-7.3.50.20110722/gdb/linux-nat.c +Index: gdb-7.4.50.20111218/gdb/linux-nat.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/linux-nat.c 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/linux-nat.c 2011-07-22 19:10:24.000000000 +0200 -@@ -2986,7 +2986,10 @@ count_events_callback (struct lwp_info * - static int +--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 00:08:41.824855353 +0100 +@@ -3036,7 +3036,11 @@ static int select_singlestep_lwp_callback (struct lwp_info *lp, void *data) { -- if (lp->step && lp->status != 0) -+ /* We do not focus on software watchpoints as we would not catch -+ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread -+ as they would remain pending due to `Push back breakpoint for %s'. */ -+ if (lp->step == RESUME_STEP_USER && lp->status != 0) + if (lp->last_resume_kind == resume_step +- && lp->status != 0) ++ && lp->status != 0 ++ /* We do not focus on software watchpoints as we would not catch ++ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread ++ as they would remain pending due to `Push back breakpoint for %s'. */ ++ && lp->step == RESUME_STEP_USER) return 1; else return 0; -Index: gdb-7.3.50.20110722/gdb/linux-nat.h +Index: gdb-7.4.50.20111218/gdb/linux-nat.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/linux-nat.h 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/linux-nat.h 2011-07-22 19:10:24.000000000 +0200 -@@ -55,8 +55,8 @@ struct lwp_info +--- gdb-7.4.50.20111218.orig/gdb/linux-nat.h 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-18 23:40:59.262300431 +0100 +@@ -74,8 +74,8 @@ struct lwp_info /* If non-zero, a pending wait status. */ int status; diff --git a/gdb-6.6-step-thread-exit.patch b/gdb-6.6-step-thread-exit.patch deleted file mode 100644 index 22afbea..0000000 --- a/gdb-6.6-step-thread-exit.patch +++ /dev/null @@ -1,60 +0,0 @@ -Index: gdb-7.2.50.20101116/gdb/linux-nat.c -=================================================================== ---- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 07:58:15.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 07:59:06.000000000 +0100 -@@ -1863,16 +1863,18 @@ resume_set_callback (struct lwp_info *lp - - static void - linux_nat_resume (struct target_ops *ops, -- ptid_t ptid, int step, enum target_signal signo) -+ ptid_t ptid, int step_int, enum target_signal signo) - { - sigset_t prev_mask; - struct lwp_info *lp; - int resume_many; -+ enum resume_step step = step_int; - - if (debug_linux_nat) - fprintf_unfiltered (gdb_stdlog, - "LLR: Preparing to %s %s, %s, inferior_ptid %s\n", -- step ? "step" : "resume", -+ (step == RESUME_STEP_NEEDED -+ ? "needed" : (step ? "step" : "resume")), - target_pid_to_str (ptid), - (signo != TARGET_SIGNAL_0 - ? strsignal (target_signal_to_host (signo)) : "0"), -@@ -3171,10 +3173,34 @@ linux_nat_filter_event (int lwpid, int s - - if (num_lwps (GET_PID (lp->ptid)) > 1) - { -+ enum resume_step step = lp->step; -+ pid_t pid = GET_PID (lp->ptid); -+ - /* If there is at least one more LWP, then the exit signal - was not the end of the debugged application and should be - ignored. */ - exit_lwp (lp); -+ -+ if (step == RESUME_STEP_USER) -+ { -+ /* Now stop the closest LWP's ... */ -+ lp = find_lwp_pid (pid_to_ptid (pid)); -+ if (!lp) -+ lp = lwp_list; -+ gdb_assert (lp != NULL); -+ errno = 0; -+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, -+ (void *) (unsigned long) SIGSTOP); -+ if (debug_linux_nat) -+ fprintf_unfiltered (gdb_stdlog, -+ "PTRACE_CONT %s, 0, 0 (%s)\n", -+ target_pid_to_str (lp->ptid), -+ errno ? safe_strerror (errno) -+ : "OK"); -+ /* Avoid the silent `delayed SIGSTOP' handling. */ -+ lp->signalled = 0; -+ } -+ - return NULL; - } - } diff --git a/gdb-6.6-testsuite-timeouts.patch b/gdb-6.6-testsuite-timeouts.patch index 1166ef0..7e69740 100644 --- a/gdb-6.6-testsuite-timeouts.patch +++ b/gdb-6.6-testsuite-timeouts.patch @@ -1,42 +1,26 @@ ---- ./gdb/testsuite/gdb.base/annota1.exp 10 Jan 2007 03:23:04 -0000 1.23 -+++ ./gdb/testsuite/gdb.base/annota1.exp 10 May 2007 12:54:11 -0000 -@@ -57,6 +57,8 @@ if [target_info exists gdb_stub] { - gdb_step_for_stub; - } +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota1.exp +=================================================================== +--- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.base/annota1.exp 2011-12-13 18:22:08.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota1.exp 2011-12-20 00:01:36.518847033 +0100 +@@ -50,6 +50,8 @@ gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} +gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions" + # # the line at which break main will put the breakpoint # ---- ./gdb/testsuite/gdb.base/annota3.exp 9 Jan 2007 17:59:09 -0000 1.12 -+++ ./gdb/testsuite/gdb.base/annota3.exp 10 May 2007 12:54:11 -0000 -@@ -56,6 +56,8 @@ if [target_info exists gdb_stub] { - gdb_step_for_stub; - } +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota3.exp +=================================================================== +--- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.base/annota3.exp 2011-12-13 18:22:08.000000000 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota3.exp 2011-12-20 00:01:36.518847033 +0100 +@@ -50,6 +50,8 @@ gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load ${binfile} +gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions" + # # the line at which break main will put the breakpoint # ---- gdb-6.6/gdb/testsuite/gdb.threads/step-thread-exit.exp-orig 2007-05-10 15:03:15.000000000 +0200 -+++ gdb-6.6/gdb/testsuite/gdb.threads/step-thread-exit.exp 2007-05-10 15:04:24.000000000 +0200 -@@ -58,6 +58,9 @@ gdb_test "continue" "Break.*thread_funct - # thread to be stopped and a message printed to tell us we have stepped - # over the thread exit. - set test "step over thread exit 1" -+# ppc64 is currently failing: -+set timeout_old $timeout -+set timeout 60 - gdb_test_multiple "next" "$test" { - -re "\}.*$gdb_prompt $" { - send_gdb "next\n" -@@ -71,6 +74,7 @@ gdb_test_multiple "next" "$test" { - exp_continue - } - } -+set timeout $timeout_old - - # Without this fixup we could end up in: - # #0 0x00110416 in __kernel_vsyscall () diff --git a/gdb-6.6-threads-static-test.patch b/gdb-6.6-threads-static-test.patch index 2bac722..3f8d16e 100644 --- a/gdb-6.6-threads-static-test.patch +++ b/gdb-6.6-threads-static-test.patch @@ -1,8 +1,8 @@ -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp +Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/staticthreads.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.threads/staticthreads.exp 2010-06-02 23:53:28.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp 2010-07-12 11:43:26.000000000 +0200 -@@ -44,6 +44,18 @@ gdb_test_no_output "set print sevenbit-s +--- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.threads/staticthreads.exp 2011-12-19 21:07:01.436475201 +0100 ++++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/staticthreads.exp 2011-12-19 22:08:55.444514127 +0100 +@@ -45,6 +45,13 @@ gdb_test_no_output "set print sevenbit-s # See if the static multi-threaded program runs. runto_main @@ -11,12 +11,7 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp +# * 2 Thread 135661664 (LWP 3856) main () at threadloop.c:41 +# 1 process 3856 main () at threadloop.c:41 + -+set test "info threads on start" -+gdb_test_multiple "info threads" "$test" { -+ -re "^info threads\r?\n\[^\r\n\]* Thread \[^\r\n\]*\r?\n$gdb_prompt" { -+ pass "$test" -+ } -+} ++gdb_test "info threads" "^info threads\r\n\[ \t\]*Id\[ \t\]+Target Id\[ \t\]+Frame\[ \t\]*\r\n\[^\r\n\]* Thread \[^\r\n\]*" "info threads on start" + gdb_test "break sem_post" set test "Continue to main's call of sem_post" diff --git a/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch index a4c195c..7e2fb39 100644 --- a/gdb-6.7-testsuite-stable-results.patch +++ b/gdb-6.7-testsuite-stable-results.patch @@ -20,10 +20,10 @@ random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp: frames-invalid can happen asynchronously. -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c +Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c 2010-07-12 11:41:43.000000000 +0200 +--- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200 ++++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c 2012-01-03 15:21:28.122729249 +0100 @@ -58,6 +58,8 @@ system (const char * string); 1) Invalid string/command. - returns 127. */ static const char *strerrno (int err); @@ -71,10 +71,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c /* Don't change the order of the calls. They partly depend on each other */ test_open (); test_write (); -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp +Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/fileio.exp 2010-06-09 00:58:03.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp 2010-07-12 11:42:07.000000000 +0200 +--- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.exp 2011-12-26 12:24:55.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp 2012-01-03 15:22:02.716601956 +0100 @@ -42,8 +42,8 @@ if [get_compiler_info ${binfile}] { return -1; } @@ -95,9 +95,9 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp gdb_test continue \ "Continuing\\..*open 5:.*EACCES$stop_msg" \ -@@ -250,8 +250,8 @@ gdb_test continue \ - send_gdb "quit\n" - send_gdb "y\n" +@@ -251,8 +251,8 @@ gdb_exit + # Wait till GDB really exits. + sleep 1 -remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test} -remote_exec build {sh -xc rm\ -rf\ *.fileio.test} diff --git a/gdb-6.8-attach-signalled-detach-stopped.patch b/gdb-6.8-attach-signalled-detach-stopped.patch deleted file mode 100644 index a518122..0000000 --- a/gdb-6.8-attach-signalled-detach-stopped.patch +++ /dev/null @@ -1,183 +0,0 @@ -Index: gdb-7.0.50.20100115/gdb/linux-nat.c -=================================================================== ---- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 11:53:34.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 12:13:53.000000000 +0100 -@@ -208,6 +208,9 @@ blocked. */ - static struct target_ops *linux_ops; - static struct target_ops linux_ops_saved; - -+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */ -+static pid_t pid_was_stopped; -+ - /* The method to call, if any, when a new thread is attached. */ - static void (*linux_nat_new_thread) (ptid_t); - -@@ -933,7 +936,14 @@ Attaching after process %d fork to child - parent_inf->waiting_for_vfork_done = 0; - } - else if (detach_fork) -- target_detach (NULL, 0); -+ { -+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly. -+ In this point of code it cannot be 1 as we would not get FORK -+ executed without CONTINUE first which resets PID_WAS_STOPPED. -+ We would have to first TARGET_STOP and WAITPID it as with running -+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */ -+ target_detach (NULL, 0); -+ } - - /* Note that the detach above makes PARENT_INF dangling. */ - -@@ -1427,6 +1437,7 @@ linux_nat_post_attach_wait (ptid_t ptid, - if (debug_linux_nat) - fprintf_unfiltered (gdb_stdlog, - "LNPAW: Attaching to a stopped process\n"); -+ pid_was_stopped = GET_PID (ptid); - - /* The process is definitely stopped. It is in a job control - stop, unless the kernel predates the TASK_STOPPED / -@@ -1757,6 +1768,9 @@ GPT: lwp %s had signal %s, but it is in - target_signal_to_string (signo)); - } - -+ if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped) -+ *status = W_STOPCODE (SIGSTOP); -+ - return 0; - } - -@@ -1866,6 +1880,8 @@ linux_nat_detach (struct target_ops *ops - } - else - linux_ops->to_detach (ops, args, from_tty); -+ -+ pid_was_stopped = 0; - } - - /* Resume LP. */ -@@ -2031,6 +2047,14 @@ linux_nat_resume (struct target_ops *ops - resume_callback. */ - lp->stopped = 0; - -+ /* At this point, we are going to resume the inferior and if we -+ have attached to a stopped process, we no longer should leave -+ it as stopped if the user detaches. PTID variable has PID set to LWP -+ while we need to check the real PID here. */ -+ -+ if (!step && lp && pid_was_stopped == GET_PID (lp->ptid)) -+ pid_was_stopped = 0; -+ - if (resume_many) - iterate_over_lwps (ptid, resume_callback, NULL); - -@@ -3923,6 +3947,8 @@ linux_nat_mourn_inferior (struct target_ - there are other viable forks to debug. Delete the exiting - one and context-switch to the first available. */ - linux_fork_mourn_inferior (); -+ -+ pid_was_stopped = 0; - } - - /* Convert a native/host siginfo object, into/from the siginfo in the -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp -=================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-01 08:32:06.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-15 11:54:57.000000000 +0100 -@@ -62,7 +62,65 @@ proc corefunc { threadtype } { - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - -- # Verify that we can attach to the stopped process. -+ # Verify that we can attach to the process by first giving its -+ # executable name via the file command, and using attach with the -+ # process ID. -+ -+ set test "$threadtype: set file, before attach1 to stopped process" -+ gdb_test_multiple "file $binfile" "$test" { -+ -re "Load new symbol table from.*y or n. $" { -+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \ -+ "$test (re-read)" -+ } -+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ set test "$threadtype: attach1 to stopped, after setting file" -+ gdb_test_multiple "attach $testpid" "$test" { -+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" { -+ pass "$test" -+ } -+ } -+ -+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there. -+ if {[string equal $threadtype threaded]} { -+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt" -+ } else { -+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt" -+ } -+ -+ # Exit and detach the process. -+ -+ gdb_exit -+ -+ # Avoid some race: -+ sleep 2 -+ -+ if [catch {open /proc/${testpid}/status r} fileid] { -+ set line2 "NOTFOUND" -+ } else { -+ gets $fileid line1; -+ gets $fileid line2; -+ close $fileid; -+ } -+ -+ set test "$threadtype: attach1, exit leaves process stopped" -+ if {[string match "*(stopped)*" $line2]} { -+ pass $test -+ } else { -+ fail $test -+ } -+ -+ # At this point, the process should still be stopped -+ -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ gdb_load ${binfile} -+ -+ # Verify that we can attach to the process just by giving the -+ # process ID. - - set test "$threadtype: attach2 to stopped, after setting file" - gdb_test_multiple "attach $testpid" "$test" { -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attachstop-mt.exp -=================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/attachstop-mt.exp 2010-01-01 08:32:06.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attachstop-mt.exp 2010-01-15 11:54:57.000000000 +0100 -@@ -176,12 +176,23 @@ gdb_test "bt" ".*sleep.*(func|main).*" " - # Exit and detach the process. - gdb_exit - --# Stop the program --remote_exec build "kill -s STOP ${testpid}" -- - # No race - sleep 2 - -+set fileid3 [open $status2 r]; -+gets $fileid3 line1; -+gets $fileid3 line2; -+close $fileid3; -+ -+set test "attach3, exit leaves process stopped" -+if {[string match "*(stopped)*" $line2]} { -+ pass $test -+} else { -+ fail $test -+} -+ -+# At this point, the process should still be stopped -+ - # Continue the test as we would hit another expected bug regarding - # Program received signal SIGSTOP, Stopped (signal). - # across NPTL threads. diff --git a/gdb-6.8-sparc64-silence-memcpy-check.patch b/gdb-6.8-sparc64-silence-memcpy-check.patch index a9d30ce..6df8c9a 100644 --- a/gdb-6.8-sparc64-silence-memcpy-check.patch +++ b/gdb-6.8-sparc64-silence-memcpy-check.patch @@ -1,8 +1,9 @@ -diff -up gdb-6.8/gdb/sparc-tdep.c.BAD gdb-6.8/gdb/sparc-tdep.c ---- gdb-6.8/gdb/sparc-tdep.c.BAD 2008-05-15 16:12:58.000000000 -0500 -+++ gdb-6.8/gdb/sparc-tdep.c 2008-05-15 16:13:41.000000000 -0500 -@@ -1122,6 +1122,7 @@ sparc32_store_return_value (struct type - if (sparc_floating_p (type)) +Index: gdb-7.4.50.20111218/gdb/sparc-tdep.c +=================================================================== +--- gdb-7.4.50.20111218.orig/gdb/sparc-tdep.c 2011-09-28 19:59:42.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/sparc-tdep.c 2011-12-19 01:25:29.294046199 +0100 +@@ -1316,6 +1316,7 @@ sparc32_store_return_value (struct type + if (sparc_floating_p (type) || sparc_complex_floating_p (type)) { /* Floating return values. */ + len = (len <= 8) ? len : 8; diff --git a/gdb-6.8-tui-singlebinary.patch b/gdb-6.8-tui-singlebinary.patch deleted file mode 100644 index cb0be45..0000000 --- a/gdb-6.8-tui-singlebinary.patch +++ /dev/null @@ -1,24 +0,0 @@ -Provide `gdb --tui' functionality for the hardlink `gdbtui'. - ---- ./gdb/gdb.c 1 Jan 2008 22:53:09 -0000 1.6 -+++ ./gdb/gdb.c 20 Jun 2008 08:02:57 -0000 -@@ -30,5 +30,19 @@ main (int argc, char **argv) - args.argv = argv; - args.use_windows = 0; - args.interpreter_p = INTERP_CONSOLE; -+ -+ if (argv[0]) -+ { -+ char *s; -+ -+ s = strrchr (argv[0], '/'); -+ if (s) -+ s++; -+ else -+ s = argv[0]; -+ if (strcmp (s, "gdbtui") == 0) -+ args.interpreter_p = INTERP_TUI; -+ } -+ - return gdb_main (&args); - } diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index d2b6c71..83aa8da 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -1,13 +1,11 @@ -Index: gdb-7.3.50.20110722/gdb/breakpoint.c +Index: gdb-7.4.50.20120103/gdb/breakpoint.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/breakpoint.c 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/breakpoint.c 2011-07-22 19:32:04.000000000 +0200 -@@ -13195,6 +13195,50 @@ iterate_over_breakpoints (int (*callback - - return NULL; +--- gdb-7.4.50.20120103.orig/gdb/breakpoint.c 2012-01-03 05:52:15.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/breakpoint.c 2012-01-03 15:22:56.105405559 +0100 +@@ -13724,6 +13724,50 @@ initialize_breakpoint_ops (void) } -+ -+void + + void +breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta) +{ + struct bp_location *bl, **blp_tmp; @@ -50,14 +48,16 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c + qsort (bp_location, bp_location_count, sizeof (*bp_location), + bp_location_compare); +} - - void ++ ++void _initialize_breakpoint (void) -Index: gdb-7.3.50.20110722/gdb/breakpoint.h + { + struct cmd_list_element *c; +Index: gdb-7.4.50.20120103/gdb/breakpoint.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/breakpoint.h 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/breakpoint.h 2011-07-22 19:31:22.000000000 +0200 -@@ -1328,4 +1328,7 @@ extern int user_breakpoint_p (struct bre +--- gdb-7.4.50.20120103.orig/gdb/breakpoint.h 2012-01-03 05:52:15.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/breakpoint.h 2012-01-03 15:23:09.444356484 +0100 +@@ -1393,4 +1393,7 @@ extern struct gdbarch *get_sal_arch (str extern void modify_semaphore (struct bp_location *location, int set); @@ -65,11 +65,11 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.h + struct section_offsets *delta); + #endif /* !defined (BREAKPOINT_H) */ -Index: gdb-7.3.50.20110722/gdb/objfiles.c +Index: gdb-7.4.50.20120103/gdb/objfiles.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/objfiles.c 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/objfiles.c 2011-07-22 19:31:22.000000000 +0200 -@@ -847,6 +847,11 @@ objfile_relocate1 (struct objfile *objfi +--- gdb-7.4.50.20120103.orig/gdb/objfiles.c 2012-01-03 05:52:15.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/objfiles.c 2012-01-03 15:23:28.141287697 +0100 +@@ -818,6 +818,11 @@ objfile_relocate1 (struct objfile *objfi objfile->sf->sym_probe_fns->sym_relocate_probe (objfile, new_offsets, delta); diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index 36dc81a..b18a060 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -1,8 +1,8 @@ -Index: gdb-7.3.50.20110722/gdb/dwarf2read.c +Index: gdb-7.4.50.20111218/gdb/dwarf2read.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c 2011-07-22 19:30:11.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2read.c 2011-07-22 19:30:44.000000000 +0200 -@@ -7979,7 +7979,12 @@ read_common_block (struct die_info *die, +--- gdb-7.4.50.20111218.orig/gdb/dwarf2read.c 2011-12-19 01:31:24.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/dwarf2read.c 2011-12-19 01:33:25.263238972 +0100 +@@ -8347,7 +8347,12 @@ read_common_block (struct die_info *die, { struct attribute *attr; struct symbol *sym; @@ -16,7 +16,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) -@@ -7988,6 +7993,7 @@ read_common_block (struct die_info *die, +@@ -8356,6 +8361,7 @@ read_common_block (struct die_info *die, if (attr_form_is_block (attr)) { base = decode_locdesc (DW_BLOCK (attr), cu); @@ -24,7 +24,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c } else if (attr_form_is_section_offset (attr)) { -@@ -8040,12 +8046,15 @@ read_common_block (struct die_info *die, +@@ -8408,12 +8414,15 @@ read_common_block (struct die_info *die, if (sym != NULL && handle_data_member_location (child_die, cu, &offset)) { @@ -42,7 +42,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c else SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym)); FIELD_TYPE (*field) = SYMBOL_TYPE (sym); -@@ -8059,7 +8068,7 @@ read_common_block (struct die_info *die, +@@ -8427,7 +8436,7 @@ read_common_block (struct die_info *die, sym = new_symbol (die, type, cu); /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */ @@ -51,35 +51,35 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c set_die_type (die, type, cu); } -Index: gdb-7.3.50.20110722/gdb/gdbtypes.h +Index: gdb-7.4.50.20111218/gdb/gdbtypes.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/gdbtypes.h 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/gdbtypes.h 2011-07-22 19:31:08.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/gdbtypes.h 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/gdbtypes.h 2011-12-19 01:34:21.448025620 +0100 @@ -396,6 +396,7 @@ enum type_instance_flag_value enum field_loc_kind { FIELD_LOC_KIND_BITPOS, /* bitpos */ + /* This address is unrelocated by the objfile's ANOFFSET. */ FIELD_LOC_KIND_PHYSADDR, /* physaddr */ - FIELD_LOC_KIND_PHYSNAME /* physname */ - }; -@@ -580,6 +581,7 @@ struct main_type + FIELD_LOC_KIND_PHYSNAME, /* physname */ + FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */ +@@ -581,6 +582,7 @@ struct main_type is the location (in the target) of the static field. Otherwise, physname is the mangled label of the static field. */ + /* This address is unrelocated by the objfile's ANOFFSET. */ CORE_ADDR physaddr; const char *physname; - } -@@ -1110,6 +1112,7 @@ extern void allocate_gnat_aux_type (stru + +@@ -1194,6 +1196,7 @@ extern void allocate_gnat_aux_type (stru #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind) #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) +/* This address is unrelocated by the objfile's ANOFFSET. */ #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) + #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) #define SET_FIELD_BITPOS(thisfld, bitpos) \ - (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \ -@@ -1117,6 +1120,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1202,6 +1205,7 @@ extern void allocate_gnat_aux_type (stru #define SET_FIELD_PHYSNAME(thisfld, name) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ FIELD_STATIC_PHYSNAME (thisfld) = (name)) @@ -87,18 +87,18 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h #define SET_FIELD_PHYSADDR(thisfld, addr) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -@@ -1129,6 +1133,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1217,6 +1221,7 @@ extern void allocate_gnat_aux_type (stru #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) +/* This address is unrelocated by the objfile's ANOFFSET. */ #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) + #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) - #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n)) -Index: gdb-7.3.50.20110722/gdb/jv-lang.c +Index: gdb-7.4.50.20111218/gdb/jv-lang.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/jv-lang.c 2011-07-01 20:28:52.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/jv-lang.c 2011-07-22 19:30:44.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/jv-lang.c 2011-12-06 19:54:39.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/jv-lang.c 2011-12-19 01:33:25.280238908 +0100 @@ -430,7 +430,8 @@ java_link_class_type (struct gdbarch *gd fields = NULL; @@ -119,11 +119,11 @@ Index: gdb-7.3.50.20110722/gdb/jv-lang.c else TYPE_FIELD_BITPOS (type, i) = 8 * boffset; if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ -Index: gdb-7.3.50.20110722/gdb/value.c +Index: gdb-7.4.50.20111218/gdb/value.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/value.c 2011-07-22 19:08:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/value.c 2011-07-22 19:30:44.000000000 +0200 -@@ -2507,7 +2507,8 @@ value_static_field (struct type *type, i +--- gdb-7.4.50.20111218.orig/gdb/value.c 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/value.c 2011-12-19 01:33:25.283238896 +0100 +@@ -2481,7 +2481,8 @@ value_static_field (struct type *type, i { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), diff --git a/gdb-archer.patch b/gdb-archer.patch index 5d346d5..fb84742 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,22 +2,22 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit 069aac3325764793a2d57f8b2f0933a326c6b7a3 +commit 1b94a2db24f76efe871f633ebe2c70e37f071f9d branch `archer' - the merge of branches: archer-jankratochvil-vla archer-jankratochvil-watchpoint3 archer-tromey-python -archer-sergiodj-stap-patch-split +archer-sergiodj-stap -Index: gdb-7.3.50.20110722/gdb/Makefile.in -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/Makefile.in 2011-07-22 01:46:08.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/Makefile.in 2011-07-29 22:52:02.000000000 +0200 -@@ -720,8 +720,8 @@ SFILES = ada-exp.y ada-lang.c ada-typepr +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index 89776b9..a444c98 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -727,8 +727,8 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ sentinel-frame.c \ - serial.c ser-base.c ser-unix.c \ + serial.c ser-base.c ser-unix.c skip.c \ solib.c solib-target.c source.c \ - stabsread.c stack.c std-regs.c symfile.c symfile-mem.c symmisc.c \ - symtab.c \ @@ -26,25 +26,25 @@ Index: gdb-7.3.50.20110722/gdb/Makefile.in target.c target-descriptions.c target-memory.c \ thread.c top.c tracepoint.c \ trad-frame.c \ -@@ -818,7 +818,7 @@ osdata.h procfs.h python/py-event.h pyth +@@ -825,7 +825,7 @@ osdata.h procfs.h python/py-event.h python/py-events.h python/py-stopevent.h \ python/python-internal.h python/python.h ravenscar-thread.h record.h \ solib-darwin.h solib-ia64-hpux.h solib-spu.h windows-nat.h xcoffread.h \ gnulib/extra/arg-nonnull.h gnulib/extra/c++defs.h gnulib/extra/warn-on-use.h \ --gnulib/stddef.in.h inline-frame.h \ -+gnulib/stddef.in.h inline-frame.h stap-probe.h \ +-gnulib/stddef.in.h inline-frame.h skip.h \ ++gnulib/stddef.in.h inline-frame.h skip.h stap-probe.h \ common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \ - common/linux-osdata.h + common/linux-osdata.h gdb-dlfcn.h -@@ -906,7 +906,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $ +@@ -913,7 +913,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ xml-support.o xml-syscall.o xml-utils.o \ target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o \ inferior.o osdata.o gdb_usleep.o record.o gcore.o \ -- jit.o progspace.o \ -+ jit.o progspace.o stap-probe.o \ - common-utils.o buffer.o ptid.o +- jit.o progspace.o skip.o \ ++ jit.o progspace.o skip.o stap-probe.o \ + common-utils.o buffer.o ptid.o gdb-dlfcn.o TSOBS = inflow.o -@@ -1328,6 +1328,12 @@ stamp-h: $(srcdir)/config.in config.stat +@@ -1301,6 +1301,12 @@ stamp-h: $(srcdir)/config.in config.status CONFIG_LINKS= \ $(SHELL) config.status @@ -57,11 +57,11 @@ Index: gdb-7.3.50.20110722/gdb/Makefile.in config.status: $(srcdir)/configure configure.tgt configure.host $(SHELL) config.status --recheck -Index: gdb-7.3.50.20110722/gdb/NEWS -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/NEWS 2011-07-21 19:23:55.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/NEWS 2011-07-29 22:52:02.000000000 +0200 -@@ -109,6 +109,10 @@ QTDisable +diff --git a/gdb/NEWS b/gdb/NEWS +index a9a7859..75dc964 100644 +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -305,6 +305,10 @@ Renesas RL78 rl78-*-elf Initial support for the OpenCL C language (http://www.khronos.org/opencl) has been integrated into GDB. @@ -72,11 +72,11 @@ Index: gdb-7.3.50.20110722/gdb/NEWS * Python scripting ** The function gdb.Write now accepts an optional keyword 'stream'. -Index: gdb-7.3.50.20110722/gdb/ada-lang.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/ada-lang.c 2011-07-05 06:34:55.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/ada-lang.c 2011-07-29 22:52:02.000000000 +0200 -@@ -11862,6 +11862,7 @@ ada_operator_length (const struct expres +diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c +index c4bf6e9..8c3af14 100644 +--- a/gdb/ada-lang.c ++++ b/gdb/ada-lang.c +@@ -11904,6 +11904,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, static int ada_operator_check (struct expression *exp, int pos, @@ -84,7 +84,7 @@ Index: gdb-7.3.50.20110722/gdb/ada-lang.c int (*objfile_func) (struct objfile *objfile, void *data), void *data) { -@@ -11876,12 +11877,15 @@ ada_operator_check (struct expression *e +@@ -11918,12 +11919,15 @@ ada_operator_check (struct expression *exp, int pos, break; default: @@ -102,233 +102,272 @@ Index: gdb-7.3.50.20110722/gdb/ada-lang.c && (*objfile_func) (TYPE_OBJFILE (type), data)) return 1; -Index: gdb-7.3.50.20110722/gdb/amd64-linux-nat.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/amd64-linux-nat.c 2011-01-07 20:36:15.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/amd64-linux-nat.c 2011-07-29 22:52:02.000000000 +0200 -@@ -265,18 +265,11 @@ amd64_linux_store_inferior_registers (st - - /* Support for debug registers. */ - --static unsigned long amd64_linux_dr[DR_CONTROL + 1]; -- - static unsigned long --amd64_linux_dr_get (ptid_t ptid, int regnum) -+amd64_linux_dr_get (int tid, int regnum) - { -- int tid; - unsigned long value; +diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c +index d598389..6bf794b 100644 +--- a/gdb/amd64-linux-nat.c ++++ b/gdb/amd64-linux-nat.c +@@ -337,8 +337,8 @@ amd64_linux_dr_get_status (void) + return amd64_linux_dr_get (inferior_ptid, DR_STATUS); + } -- tid = TIDGET (ptid); -- if (tid == 0) -- tid = PIDGET (ptid); -- - /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the - ptrace call fails breaks debugging remote targets. The correct - way to fix this is to add the hardware breakpoint and watchpoint -@@ -298,14 +291,8 @@ amd64_linux_dr_get (ptid_t ptid, int reg - /* Set debug register REGNUM to VALUE in only the one LWP of PTID. */ +-/* Callback for iterate_over_lwps. Update the debug registers of +- LWP. */ ++/* Callback for linux_nat_iterate_watchpoint_lwps. Update the debug registers ++ of LWP. */ + static int + update_debug_registers_callback (struct lwp_info *lwp, void *arg) +@@ -364,9 +364,7 @@ update_debug_registers_callback (struct lwp_info *lwp, void *arg) static void --amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) -+amd64_linux_dr_set (int tid, int regnum, unsigned long value) + amd64_linux_dr_set_control (unsigned long control) { -- int tid; -- -- tid = TIDGET (ptid); -- if (tid == 0) -- tid = PIDGET (ptid); +- ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); - - errno = 0; - ptrace (PTRACE_POKEUSER, tid, - offsetof (struct user, u_debugreg[regnum]), value); -@@ -313,35 +300,96 @@ amd64_linux_dr_set (ptid_t ptid, int reg - perror_with_name (_("Couldn't write debug register")); +- iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL); ++ linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL); + } + + /* Set address REGNUM (zero based) to ADDR in all LWPs of the current +@@ -379,7 +377,7 @@ amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr) + + gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); + +- iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL); ++ linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL); } --/* Set DR_CONTROL to ADDR in all LWPs of LWP_LIST. */ -+/* Helper for amd64_linux_dr_set_control. */ + /* Called when resuming a thread. +@@ -401,6 +399,13 @@ amd64_linux_prepare_to_resume (struct lwp_info *lwp) + struct i386_debug_reg_state *state = i386_debug_reg_state (); + int i; + ++ /* On Linux kernel before 2.6.33 commit ++ 72f674d203cd230426437cdcf7dd6f681dad8b0d ++ if you enable a breakpoint by the DR_CONTROL bits you need to have ++ already written the corresponding DR_FIRSTADDR...DR_LASTADDR registers. + -+static void -+amd64_linux_dr_set_control_callback (int tid, void *control_voidp) -+{ -+ unsigned long control = *(unsigned long *) control_voidp; ++ Ensure DR_CONTROL gets written as the very last register here. */ ++ + for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) + if (state->dr_ref_count[i] > 0) + { +diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c +index 84b58a0..62ed964 100644 +--- a/gdb/amd64-linux-tdep.c ++++ b/gdb/amd64-linux-tdep.c +@@ -1363,6 +1363,15 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) + set_gdbarch_process_record (gdbarch, i386_process_record); + set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal); + ++ /* SystemTap variables and functions. */ ++ set_gdbarch_stap_integer_prefix (gdbarch, "$"); ++ set_gdbarch_stap_register_prefix (gdbarch, "%"); ++ set_gdbarch_stap_register_indirection_prefix (gdbarch, "("); ++ set_gdbarch_stap_register_indirection_sufix (gdbarch, ")"); ++ set_gdbarch_stap_is_single_operand (gdbarch, i386_stap_is_single_operand); ++ set_gdbarch_stap_parse_special_token (gdbarch, ++ i386_stap_parse_special_token); ++ + /* Initialize the amd64_linux_record_tdep. */ + /* These values are the size of the type that will be used in a system + call. They are obtained from Linux Kernel source. */ +diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c +index bee33e4..4df6bfa 100644 +--- a/gdb/arm-linux-tdep.c ++++ b/gdb/arm-linux-tdep.c +@@ -44,6 +44,12 @@ + #include "gdbthread.h" + #include "symfile.h" + ++#include "cli/cli-utils.h" ++#include "stap-probe.h" ++#include "parser-defs.h" ++#include "user-regs.h" ++#include + -+ amd64_linux_dr_set (tid, DR_CONTROL, control); + #include "gdb_string.h" + + /* This is defined in on ARM GNU/Linux systems. */ +@@ -1054,6 +1060,122 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, + return dsc; + } + ++static int ++arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) ++{ ++ return (*s == '#' /* Literal number. */ ++ || *s == '[' /* Register indirection or ++ displacement. */ ++ || isalpha (*s)); /* Register value. */ +} + -+static void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr); ++/* This routine is used to parse a special token in ARM's assembly. + -+/* Set DR_CONTROL to ADDR in all LWPs of CURRENT_INFERIOR. */ - - static void - amd64_linux_dr_set_control (unsigned long control) - { -- struct lwp_info *lp; -- ptid_t ptid; -+ int inferior_pid = ptid_get_pid (inferior_ptid); -+ struct inferior *inf = current_inferior (); ++ The special tokens parsed by it are: + -+ /* Are we detaching breakpoints from a fork-ed child? -+ See linux_nat_iterate_watchpoint_lwps for the fork-ed child description. -+ The i386 counterpart is i386_linux_dr_set_control. */ -+ if (inf->pid != inferior_pid) -+ { -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); -+ int i; ++ - Register displacement (e.g, [fp, #-8]) + -+ /* There were two changes in Linux kernel 2.6.33 by the commit: -+ 72f674d203cd230426437cdcf7dd6f681dad8b0d ++ It returns one if the special token has been parsed successfully, ++ or zero if the current token is not considered special. */ ++ ++static int ++arm_stap_parse_special_token (struct gdbarch *gdbarch, ++ struct stap_parse_info *p) ++{ ++ if (*p->arg == '[') ++ { ++ /* Temporary holder for lookahead. */ ++ const char *tmp = p->arg; ++ /* Used to save the register name. */ ++ const char *start; ++ char *regname; ++ int len, offset; ++ int got_minus = 0; ++ long displacement; ++ struct stoken str; ++ ++ ++tmp; ++ start = tmp; ++ ++ /* Register name. */ ++ while (isalnum (*tmp)) ++ ++tmp; ++ ++ if (*tmp != ',') ++ return 0; ++ ++ len = tmp - start; ++ regname = alloca (len + 2); ++ ++ offset = 0; ++ if (isdigit (*start)) ++ { ++ /* If we are dealing with a register whose name begins with a ++ digit, it means we should prefix the name with the letter ++ `r', because GDB expects this name pattern. Otherwise (e.g., ++ we are dealing with the register `fp'), we don't need to ++ add such a prefix. */ ++ regname[0] = 'r'; ++ offset = 1; ++ } + -+ (1) After fork/vfork/clone the new task no longer inherits the debug -+ registers. It has them zeroed instead. Either case is OK for GDB as -+ GDB already registers a fix up by linux_nat_set_new_thread. ++ strncpy (regname + offset, start, len); ++ len += offset; ++ regname[len] = '\0'; + -+ (2) If you enable a breakpoint by the CONTROL bits you have already -+ written its ADDRESS. Otherwise Linux kernel will report EINVAL. -+ For this case the workaround here ensures that during resetting -+ (detaching) watchpoints for a fork-ed child we can set CONTROL -+ arbitrarily as the addresses get pre-set here just to be sure. ++ if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1) ++ error (_("Invalid register name `%s' on expression `%s'."), ++ regname, p->saved_arg); + -+ The second issue is hopefully going to be fixed in Linux kernel: -+ https://bugzilla.redhat.com/show_bug.cgi?id=660204 */ ++ ++tmp; ++ tmp = skip_spaces_const (tmp); ++ if (*tmp++ != '#') ++ return 0; + -+ if (!dr_mirror->addr_preset) ++ if (*tmp == '-') + { -+ dr_mirror->addr_preset = 1; -+ -+ for (i = 0; i < DR_LASTADDR - DR_FIRSTADDR; i++) -+ amd64_linux_dr_set_addr (i, dr_mirror->addr[i]); ++ ++tmp; ++ got_minus = 1; + } -+ } + -+ linux_nat_iterate_watchpoint_lwps (amd64_linux_dr_set_control_callback, -+ &control); -+} ++ displacement = strtol (tmp, (char **) &tmp, 10); + -+/* Helper for amd64_linux_dr_set_addr. */ ++ /* Skipping last `]'. */ ++ if (*tmp++ != ']') ++ return 0; + -+struct amd64_linux_dr_set_addr_data -+ { -+ int regnum; -+ CORE_ADDR addr; -+ }; ++ /* The displacement. */ ++ write_exp_elt_opcode (OP_LONG); ++ write_exp_elt_type (builtin_type (gdbarch)->builtin_long); ++ write_exp_elt_longcst (displacement); ++ write_exp_elt_opcode (OP_LONG); ++ if (got_minus) ++ write_exp_elt_opcode (UNOP_NEG); + -+static void -+amd64_linux_dr_set_addr_callback (int tid, void *datap_voidp) -+{ -+ const struct amd64_linux_dr_set_addr_data *datap = datap_voidp; - -- amd64_linux_dr[DR_CONTROL] = control; -- ALL_LWPS (lp, ptid) -- amd64_linux_dr_set (ptid, DR_CONTROL, control); -+ amd64_linux_dr_set (tid, DR_FIRSTADDR + datap->regnum, datap->addr); - } - --/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */ -+/* Set address REGNUM (zero based) to ADDR in all LWPs of CURRENT_INFERIOR. -+ */ - - static void - amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr) - { -- struct lwp_info *lp; -- ptid_t ptid; -+ struct amd64_linux_dr_set_addr_data data; - - gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); - -- amd64_linux_dr[DR_FIRSTADDR + regnum] = addr; -- ALL_LWPS (lp, ptid) -- amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); -+ data.regnum = regnum; -+ data.addr = addr; -+ linux_nat_iterate_watchpoint_lwps (amd64_linux_dr_set_addr_callback, &data); - } - --/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */ -+/* Set address REGNUM (zero based) to zero in all LWPs of CURRENT_INFERIOR. -+ */ - - static void - amd64_linux_dr_reset_addr (int regnum) -@@ -354,37 +402,54 @@ amd64_linux_dr_reset_addr (int regnum) - static unsigned long - amd64_linux_dr_get_status (void) - { -- return amd64_linux_dr_get (inferior_ptid, DR_STATUS); -+ int tid; ++ /* The register name. */ ++ write_exp_elt_opcode (OP_REGISTER); ++ str.ptr = regname; ++ str.length = len; ++ write_exp_string (str); ++ write_exp_elt_opcode (OP_REGISTER); + -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); ++ write_exp_elt_opcode (BINOP_ADD); + -+ return amd64_linux_dr_get (tid, DR_STATUS); - } - --/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST. */ -+/* Helper for amd64_linux_dr_unset_status. */ - - static void --amd64_linux_dr_unset_status (unsigned long mask) -+amd64_linux_dr_unset_status_callback (int tid, void *mask_voidp) - { -- struct lwp_info *lp; -- ptid_t ptid; -- -- ALL_LWPS (lp, ptid) -- { -- unsigned long value; -+ unsigned long mask = *(unsigned long *) mask_voidp; -+ unsigned long value; - -- value = amd64_linux_dr_get (ptid, DR_STATUS); -- value &= ~mask; -- amd64_linux_dr_set (ptid, DR_STATUS, value); -- } -+ value = amd64_linux_dr_get (tid, DR_STATUS); -+ value &= ~mask; -+ amd64_linux_dr_set (tid, DR_STATUS, value); - } - -+/* Unset MASK bits in DR_STATUS in all LWPs of CURRENT_INFERIOR. */ ++ /* Casting to the expected type. */ ++ write_exp_elt_opcode (UNOP_CAST); ++ write_exp_elt_type (lookup_pointer_type (p->arg_type)); ++ write_exp_elt_opcode (UNOP_CAST); + -+static void -+amd64_linux_dr_unset_status (unsigned long mask) -+{ -+ linux_nat_iterate_watchpoint_lwps (amd64_linux_dr_unset_status_callback, -+ &mask); -+} - - static void - amd64_linux_new_thread (ptid_t ptid) - { -- int i; -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); -+ int i, tid; ++ write_exp_elt_opcode (UNOP_IND); + -+ /* Verify DR_MIRROR is valid. */ -+ gdb_assert (PIDGET (ptid) == PIDGET (inferior_ptid)); ++ p->arg = tmp; ++ } ++ else ++ return 0; + -+ tid = TIDGET (ptid); -+ if (tid == 0) -+ tid = PIDGET (ptid); - -- for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) -- amd64_linux_dr_set (ptid, i, amd64_linux_dr[i]); -+ for (i = 0; i < DR_LASTADDR - DR_FIRSTADDR; i++) -+ amd64_linux_dr_set (tid, DR_FIRSTADDR + i, dr_mirror->addr[i]); - -- amd64_linux_dr_set (ptid, DR_CONTROL, amd64_linux_dr[DR_CONTROL]); -+ amd64_linux_dr_set (tid, DR_CONTROL, dr_mirror->control); ++ return 1; ++} ++ + static void + arm_linux_init_abi (struct gdbarch_info info, + struct gdbarch *gdbarch) +@@ -1153,6 +1275,15 @@ arm_linux_init_abi (struct gdbarch_info info, + simple_displaced_step_free_closure); + set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point); + ++ /* SystemTap functions. */ ++ set_gdbarch_stap_integer_prefix (gdbarch, "#"); ++ set_gdbarch_stap_register_prefix (gdbarch, "r"); ++ set_gdbarch_stap_register_indirection_prefix (gdbarch, "["); ++ set_gdbarch_stap_register_indirection_sufix (gdbarch, "]"); ++ set_gdbarch_stap_gdb_register_prefix (gdbarch, "r"); ++ set_gdbarch_stap_is_single_operand (gdbarch, arm_stap_is_single_operand); ++ set_gdbarch_stap_parse_special_token (gdbarch, ++ arm_stap_parse_special_token); + + tdep->syscall_next_pc = arm_linux_syscall_next_pc; } - +diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c +index e59c735..e1b0f85 100644 +--- a/gdb/ax-gdb.c ++++ b/gdb/ax-gdb.c +@@ -95,8 +95,6 @@ static void gen_int_literal (struct agent_expr *ax, + struct axs_value *value, + LONGEST k, struct type *type); -Index: gdb-7.3.50.20110722/gdb/ax-gdb.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/ax-gdb.c 2011-06-17 22:46:47.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/ax-gdb.c 2011-07-29 22:52:02.000000000 +0200 -@@ -2001,7 +2001,8 @@ gen_expr (struct expression *exp, union +- +-static void require_rvalue (struct agent_expr *ax, struct axs_value *value); + static void gen_usual_unary (struct expression *exp, struct agent_expr *ax, + struct axs_value *value); + static int type_wider_than (struct type *type1, struct type *type2); +@@ -157,8 +155,6 @@ static void gen_repeat (struct expression *exp, union exp_element **pc, + static void gen_sizeof (struct expression *exp, union exp_element **pc, + struct agent_expr *ax, struct axs_value *value, + struct type *size_type); +-static void gen_expr (struct expression *exp, union exp_element **pc, +- struct agent_expr *ax, struct axs_value *value); + static void gen_expr_binop_rest (struct expression *exp, + enum exp_opcode op, union exp_element **pc, + struct agent_expr *ax, +@@ -789,7 +785,7 @@ gen_int_literal (struct agent_expr *ax, struct axs_value *value, LONGEST k, + /* Take what's on the top of the stack (as described by VALUE), and + try to make an rvalue out of it. Signal an error if we can't do + that. */ +-static void ++void + require_rvalue (struct agent_expr *ax, struct axs_value *value) + { + /* Only deal with scalars, structs and such may be too large +@@ -1807,7 +1803,7 @@ gen_sizeof (struct expression *exp, union exp_element **pc, + /* XXX: i18n */ + /* A gen_expr function written by a Gen-X'er guy. + Append code for the subexpression of EXPR starting at *POS_P to AX. */ +-static void ++void + gen_expr (struct expression *exp, union exp_element **pc, + struct agent_expr *ax, struct axs_value *value) + { +@@ -2042,7 +2038,8 @@ gen_expr (struct expression *exp, union exp_element **pc, case OP_INTERNALVAR: { @@ -338,7 +377,7 @@ Index: gdb-7.3.50.20110722/gdb/ax-gdb.c struct trace_state_variable *tsv; (*pc) += 3; -@@ -2015,7 +2016,7 @@ gen_expr (struct expression *exp, union +@@ -2056,7 +2053,7 @@ gen_expr (struct expression *exp, union exp_element **pc, value->kind = axs_rvalue; value->type = builtin_type (exp->gdbarch)->builtin_long_long; } @@ -347,11 +386,27 @@ Index: gdb-7.3.50.20110722/gdb/ax-gdb.c error (_("$%s is not a trace state variable; GDB agent " "expressions cannot use convenience variables."), name); } -Index: gdb-7.3.50.20110722/gdb/block.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/block.c 2011-01-01 16:32:57.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/block.c 2011-07-29 22:52:02.000000000 +0200 -@@ -322,3 +322,21 @@ allocate_block (struct obstack *obstack) +diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h +index 951ec1f..6cdcda2 100644 +--- a/gdb/ax-gdb.h ++++ b/gdb/ax-gdb.h +@@ -111,6 +111,11 @@ extern struct agent_expr *gen_trace_for_return_address (CORE_ADDR, + + extern struct agent_expr *gen_eval_for_expr (CORE_ADDR, struct expression *); + ++extern void gen_expr (struct expression *exp, union exp_element **pc, ++ struct agent_expr *ax, struct axs_value *value); ++ ++extern void require_rvalue (struct agent_expr *ax, struct axs_value *value); ++ + extern int trace_kludge; + extern int trace_string_kludge; + +diff --git a/gdb/block.c b/gdb/block.c +index 1fa3688..76457ba 100644 +--- a/gdb/block.c ++++ b/gdb/block.c +@@ -370,3 +370,21 @@ allocate_block (struct obstack *obstack) return bl; } @@ -373,21 +428,21 @@ Index: gdb-7.3.50.20110722/gdb/block.c + + return SYMBOL_SYMTAB (func)->objfile; +} -Index: gdb-7.3.50.20110722/gdb/block.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/block.h 2011-04-04 16:10:12.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/block.h 2011-07-29 22:52:02.000000000 +0200 -@@ -163,4 +163,6 @@ extern const struct block *block_global_ +diff --git a/gdb/block.h b/gdb/block.h +index 63b18a6..808a19a 100644 +--- a/gdb/block.h ++++ b/gdb/block.h +@@ -168,4 +168,6 @@ extern const struct block *block_global_block (const struct block *block); extern struct block *allocate_block (struct obstack *obstack); +extern struct objfile *block_objfile (const struct block *block); + #endif /* BLOCK_H */ -Index: gdb-7.3.50.20110722/gdb/breakpoint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/breakpoint.c 2011-07-05 06:34:55.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/breakpoint.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c +index 172e419..74324c4 100644 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c @@ -63,6 +63,8 @@ #include "jit.h" #include "xml-syscall.h" @@ -396,19 +451,23 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c +#include "stap-probe.h" #include "cli/cli-utils.h" #include "continuations.h" + #include "stack.h" +@@ -1225,9 +1227,10 @@ is_watchpoint (const struct breakpoint *bpt) + static int + watchpoint_in_thread_scope (struct watchpoint *b) + { +- return (ptid_equal (b->watchpoint_thread, null_ptid) +- || (ptid_equal (inferior_ptid, b->watchpoint_thread) +- && !is_executing (inferior_ptid))); ++ return (b->base.pspace == current_program_space ++ && (ptid_equal (b->watchpoint_thread, null_ptid) ++ || (ptid_equal (inferior_ptid, b->watchpoint_thread) ++ && !is_executing (inferior_ptid)))); + } -@@ -1248,6 +1250,9 @@ update_watchpoint (struct breakpoint *b, - if (!watchpoint_in_thread_scope (b)) - return; - -+ if (b->pspace != current_program_space) -+ return; -+ - if (b->disposition == disp_del_at_next_stop) - return; - -@@ -1532,6 +1537,40 @@ should_be_inserted (struct bp_location * - return 1; + /* Set watchpoint B to disp_del_at_next_stop, even including its possible +@@ -1634,6 +1637,40 @@ unduplicated_should_be_inserted (struct bp_location *bl) + return result; } +/* See the comment in breakpoint.h. */ @@ -448,66 +507,16 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c /* Insert a low-level "breakpoint" of some type. BL is the breakpoint location. Any error messages are printed to TMP_ERROR_STREAM; and DISABLED_BREAKS, and HW_BREAKPOINT_ERROR are used to report problems. -@@ -1628,6 +1667,8 @@ insert_bp_location (struct bp_location * - else - val = target_insert_breakpoint (bl->gdbarch, - &bl->target_info); +@@ -1727,6 +1764,8 @@ insert_bp_location (struct bp_location *bl, + /* No overlay handling: just set the breakpoint. */ + + val = bl->owner->ops->insert_location (bl); + + modify_semaphore (bl, 1); } else { -@@ -1883,6 +1924,7 @@ insert_breakpoint_locations (void) - int val = 0; - int disabled_breaks = 0; - int hw_breakpoint_error = 0; -+ struct program_space *saved_current_program_space = current_program_space; - - struct ui_file *tmp_error_stream = mem_fileopen (); - struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_error_stream); -@@ -1910,9 +1952,13 @@ insert_breakpoint_locations (void) - /* For targets that support global breakpoints, there's no need - to select an inferior to insert breakpoint to. In fact, even - if we aren't attached to any process yet, we should still -- insert breakpoints. */ -+ insert breakpoints. -+ -+ Also inserting breakpoints into inappropriate inferior must be -+ prevented. */ - if (!gdbarch_has_global_breakpoints (target_gdbarch) -- && ptid_equal (inferior_ptid, null_ptid)) -+ && (ptid_equal (inferior_ptid, null_ptid) -+ || bl->pspace != saved_current_program_space)) - continue; - - val = insert_bp_location (bl, tmp_error_stream, &disabled_breaks, -@@ -1936,13 +1982,19 @@ insert_breakpoint_locations (void) - - if (bpt->disposition == disp_del_at_next_stop) - continue; -- -+ - for (loc = bpt->loc; loc; loc = loc->next) -- if (!loc->inserted && should_be_inserted (loc)) -- { -- some_failed = 1; -- break; -- } -+ { -+ /* Verify the first loop above really tried to insert this LOC. */ -+ if (!loc->inserted && should_be_inserted (loc) -+ && (gdbarch_has_global_breakpoints (target_gdbarch) -+ || (!ptid_equal (inferior_ptid, null_ptid) -+ && loc->pspace == saved_current_program_space))) -+ { -+ some_failed = 1; -+ break; -+ } -+ } - if (some_failed) - { - for (loc = bpt->loc; loc; loc = loc->next) -@@ -2110,11 +2162,23 @@ struct breakpoint_objfile_data +@@ -2210,11 +2249,23 @@ struct breakpoint_objfile_data /* Minimal symbol(s) for "longjmp", "siglongjmp", etc. (if any). */ struct minimal_symbol *longjmp_msym[NUM_LONGJMP_NAMES]; @@ -531,7 +540,7 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c }; static const struct objfile_data *breakpoint_objfile_key; -@@ -2151,6 +2215,15 @@ get_breakpoint_objfile_data (struct objf +@@ -2251,6 +2302,15 @@ get_breakpoint_objfile_data (struct objfile *objfile) } static void @@ -547,7 +556,7 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c create_overlay_event_breakpoint (void) { struct objfile *objfile; -@@ -2226,6 +2299,36 @@ create_longjmp_master_breakpoint (void) +@@ -2327,6 +2387,37 @@ create_longjmp_master_breakpoint (void) bp_objfile_data = get_breakpoint_objfile_data (objfile); @@ -561,7 +570,7 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c + if (bp_objfile_data->longjmp_probes != NULL) + { + int i; -+ const struct stap_probe *probe; ++ struct stap_probe *probe; + struct gdbarch *gdbarch = get_objfile_arch (objfile); + + for (i = 0; @@ -573,8 +582,9 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c + struct breakpoint *b; + + b = create_internal_breakpoint (gdbarch, probe->address, -+ bp_longjmp_master); -+ b->addr_string = xstrdup ("probe:libc:longjmp"); ++ bp_longjmp_master, ++ &internal_breakpoint_ops); ++ b->addr_string = xstrdup ("-p libc:longjmp"); + b->enable_state = bp_disabled; + } + @@ -584,7 +594,7 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c for (i = 0; i < NUM_LONGJMP_NAMES; i++) { struct breakpoint *b; -@@ -2334,6 +2437,39 @@ create_exception_master_breakpoint (void +@@ -2437,6 +2528,40 @@ create_exception_master_breakpoint (void) bp_objfile_data = get_breakpoint_objfile_data (objfile); @@ -600,7 +610,7 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c + { + struct gdbarch *gdbarch = get_objfile_arch (objfile); + int i; -+ const struct stap_probe *probe; ++ struct stap_probe *probe; + + for (i = 0; + VEC_iterate (stap_probe_p, @@ -611,8 +621,9 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c + struct breakpoint *b; + + b = create_internal_breakpoint (gdbarch, probe->address, -+ bp_exception_master); -+ b->addr_string = xstrdup ("probe:libgcc:unwind"); ++ bp_exception_master, ++ &internal_breakpoint_ops); ++ b->addr_string = xstrdup ("-p libgcc:unwind"); + b->enable_state = bp_disabled; + } + @@ -624,164 +635,32 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c if (msym_not_found_p (bp_objfile_data->exception_msym)) continue; -@@ -2552,6 +2688,8 @@ remove_breakpoint_1 (struct bp_location - val = target_remove_hw_breakpoint (bl->gdbarch, &bl->target_info); - else - val = target_remove_breakpoint (bl->gdbarch, &bl->target_info); +@@ -2652,6 +2777,8 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is) + { + /* No overlay handling: just remove the breakpoint. */ + val = bl->owner->ops->remove_location (bl); + + modify_semaphore (bl, 0); } else { -@@ -5957,6 +6095,7 @@ init_raw_breakpoint (struct breakpoint * - b->loc->requested_address = sal.pc; - b->loc->address = adjusted_address; - b->loc->pspace = sal.pspace; -+ b->loc->semaphore = sal.semaphore; - - /* Store the program space that was used to set the breakpoint, for - breakpoint resetting. */ -@@ -7226,6 +7365,7 @@ clone_momentary_breakpoint (struct break +@@ -7097,6 +7224,7 @@ momentary_breakpoint_from_master (struct breakpoint *orig, copy->loc->address = orig->loc->address; copy->loc->section = orig->loc->section; copy->loc->pspace = orig->loc->pspace; + copy->loc->semaphore = orig->loc->semaphore; - if (orig->source_file == NULL) - copy->source_file = NULL; -@@ -7444,6 +7584,7 @@ add_location_to_breakpoint (struct break - loc->address = adjust_breakpoint_address (loc->gdbarch, - loc->requested_address, b->type); + if (orig->loc->source_file != NULL) + copy->loc->source_file = xstrdup (orig->loc->source_file); +@@ -7182,6 +7310,7 @@ add_location_to_breakpoint (struct breakpoint *b, + loc->requested_address = sal->pc; + loc->address = adjusted_address; loc->pspace = sal->pspace; + loc->semaphore = sal->semaphore; gdb_assert (loc->pspace != NULL); loc->section = sal->section; - -@@ -7792,6 +7933,16 @@ create_breakpoints_sal (struct gdbarch * - { - int i; - -+ if (canonical->pre_expanded) -+ { -+ create_breakpoint_sal (gdbarch, sals, canonical->canonical[0], -+ cond_string, type, disposition, -+ thread, task, ignore_count, ops, -+ from_tty, enabled, internal, -+ canonical->special_display); -+ return; -+ } -+ - for (i = 0; i < sals.nelts; ++i) - { - struct symtabs_and_lines expanded = -@@ -8300,7 +8451,7 @@ create_breakpoint (struct gdbarch *gdbar - observer_notify_breakpoint_created (b); - } - -- if (sals.nelts > 1) -+ if (sals.nelts > 1 && !canonical.pre_expanded) - { - warning (_("Multiple breakpoints were set.\nUse the " - "\"delete\" command to delete unwanted breakpoints.")); -@@ -9394,6 +9545,7 @@ watch_command_1 (char *arg, int accessfl - /* Now set up the breakpoint. */ - b = set_raw_breakpoint_without_location (NULL, bp_type); - b->thread = thread; -+ b->pspace = current_program_space; - b->disposition = disp_donttouch; - b->exp = exp; - b->exp_valid_block = exp_valid_block; -@@ -10512,6 +10664,9 @@ update_global_location_list (int should_ - int keep_in_target = 0; - int removed = 0; - -+ if (old_loc->pspace != current_program_space) -+ continue; -+ - /* Skip LOCP entries which will definitely never be needed. - Stop either at or being the one matching OLD_LOC. */ - while (locp < bp_location + bp_location_count -@@ -11333,12 +11488,14 @@ update_breakpoint_locations (struct brea - On return, FOUND will be 1 if any SaL was found, zero otherwise. */ - - static struct symtabs_and_lines --addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found) -+addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found, -+ int *pre_expanded) - { - char *s; - int marker_spec; - struct symtabs_and_lines sals = {0}; - struct gdb_exception e; -+ int my_pre_expanded = 0; - - s = addr_string; - marker_spec = b->type == bp_static_tracepoint && is_marker_spec (s); -@@ -11357,7 +11514,27 @@ addr_string_to_sals (struct breakpoint * - error (_("marker %s not found"), b->static_trace_marker_id); - } - else -- sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, NULL); -+ { -+ struct linespec_result canonical; -+ -+ init_linespec_result (&canonical); -+ sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, -+ &canonical); -+ -+ /* We don't need the contents. */ -+ if (canonical.canonical) -+ { -+ int i; -+ -+ for (i = 0; i < sals.nelts; ++i) -+ xfree (canonical.canonical[i]); -+ xfree (canonical.canonical); -+ } -+ -+ my_pre_expanded = canonical.pre_expanded; -+ if (pre_expanded) -+ *pre_expanded = my_pre_expanded; -+ } - } - if (e.reason < 0) - { -@@ -11390,7 +11567,7 @@ addr_string_to_sals (struct breakpoint * - - if (e.reason == 0 || e.error != NOT_FOUND_ERROR) - { -- gdb_assert (sals.nelts == 1); -+ gdb_assert (my_pre_expanded || sals.nelts == 1); - - resolve_sal_pc (&sals.sals[0]); - if (b->condition_not_parsed && s && s[0]) -@@ -11426,17 +11603,22 @@ breakpoint_re_set_default (struct breakp - struct symtabs_and_lines sals, sals_end; - struct symtabs_and_lines expanded = {0}; - struct symtabs_and_lines expanded_end = {0}; -+ int pre_expanded = 0; - -- sals = addr_string_to_sals (b, b->addr_string, &found); -+ sals = addr_string_to_sals (b, b->addr_string, &found, &pre_expanded); - if (found) - { - make_cleanup (xfree, sals.sals); -- expanded = expand_line_sal_maybe (sals.sals[0]); -+ if (pre_expanded) -+ expanded = sals; -+ else -+ expanded = expand_line_sal_maybe (sals.sals[0]); - } - - if (b->addr_string_range_end) - { -- sals_end = addr_string_to_sals (b, b->addr_string_range_end, &found); -+ sals_end = addr_string_to_sals (b, b->addr_string_range_end, &found, -+ NULL); - if (found) - { - make_cleanup (xfree, sals_end.sals); -@@ -12913,6 +13095,24 @@ all_tracepoints (void) + loc->gdbarch = loc_gdbarch; +@@ -13306,6 +13435,24 @@ all_tracepoints (void) return tp_vec; } @@ -806,7 +685,7 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c /* This help string is used for the break, hbreak, tbreak and thbreak commands. It is defined as a macro to prevent duplication. -@@ -13005,7 +13205,8 @@ _initialize_breakpoint (void) +@@ -13587,7 +13734,8 @@ _initialize_breakpoint (void) observer_attach_inferior_exit (clear_syscall_counts); observer_attach_memory_changed (invalidate_bp_value_on_memory_change); @@ -816,7 +695,7 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c breakpoint_chain = 0; /* Don't bother to call set_breakpoint_count. $bpnum isn't useful -@@ -13532,4 +13733,7 @@ range (including START-LOCATION and END- +@@ -14114,4 +14262,7 @@ range (including START-LOCATION and END-LOCATION).")); automatic_hardware_breakpoints = 1; observer_attach_about_to_proceed (breakpoint_about_to_proceed); @@ -824,11 +703,11 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.c + observer_attach_mark_used (breakpoint_types_mark_used); +#endif } -Index: gdb-7.3.50.20110722/gdb/breakpoint.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/breakpoint.h 2011-06-22 19:53:44.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/breakpoint.h 2011-07-29 22:52:02.000000000 +0200 -@@ -383,6 +383,11 @@ struct bp_location +diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h +index d22e564..9ea66ce 100644 +--- a/gdb/breakpoint.h ++++ b/gdb/breakpoint.h +@@ -379,6 +379,11 @@ struct bp_location processor's architectual constraints. */ CORE_ADDR requested_address; @@ -840,9 +719,9 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.h char *function_name; /* Details of the placed breakpoint, when inserted. */ -@@ -1316,4 +1321,11 @@ extern struct breakpoint *iterate_over_b - - extern int user_breakpoint_p (struct breakpoint *); +@@ -1381,4 +1386,11 @@ extern int user_breakpoint_p (struct breakpoint *); + /* Attempt to determine architecture of location identified by SAL. */ + extern struct gdbarch *get_sal_arch (struct symtab_and_line sal); +/* Set or clear a SystemTap semaphore. LOC is the location which may + hold a semaphore. SET is non-zero if the semaphore should be set, @@ -852,11 +731,11 @@ Index: gdb-7.3.50.20110722/gdb/breakpoint.h +extern void modify_semaphore (struct bp_location *location, int set); + #endif /* !defined (BREAKPOINT_H) */ -Index: gdb-7.3.50.20110722/gdb/c-typeprint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/c-typeprint.c 2011-05-18 18:30:34.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/c-typeprint.c 2011-07-29 22:52:02.000000000 +0200 -@@ -625,9 +625,14 @@ c_type_print_varspec_suffix (struct type +diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c +index 0212232..d9ddff8 100644 +--- a/gdb/c-typeprint.c ++++ b/gdb/c-typeprint.c +@@ -625,9 +625,14 @@ c_type_print_varspec_suffix (struct type *type, fprintf_filtered (stream, ")"); fprintf_filtered (stream, "["); @@ -874,11 +753,30 @@ Index: gdb-7.3.50.20110722/gdb/c-typeprint.c fprintf_filtered (stream, "]"); c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, -Index: gdb-7.3.50.20110722/gdb/cli/cli-utils.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/cli/cli-utils.c 2011-03-16 22:12:12.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/cli/cli-utils.c 2011-07-29 22:52:02.000000000 +0200 -@@ -245,3 +245,32 @@ remove_trailing_whitespace (const char * +diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c +index 62a2f12..cd5fab5 100644 +--- a/gdb/cli/cli-utils.c ++++ b/gdb/cli/cli-utils.c +@@ -223,6 +223,18 @@ skip_spaces (char *chp) + return chp; + } + ++/* A const-correct version of the above. */ ++ ++const char * ++skip_spaces_const (const char *chp) ++{ ++ if (chp == NULL) ++ return NULL; ++ while (*chp && isspace (*chp)) ++ chp++; ++ return chp; ++} ++ + /* See documentation in cli-utils.h. */ + + char * +@@ -245,3 +257,32 @@ remove_trailing_whitespace (const char *start, char *s) return s; } @@ -911,11 +809,22 @@ Index: gdb-7.3.50.20110722/gdb/cli/cli-utils.c + + return copy; +} -Index: gdb-7.3.50.20110722/gdb/cli/cli-utils.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/cli/cli-utils.h 2011-03-16 22:12:12.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/cli/cli-utils.h 2011-07-29 22:52:02.000000000 +0200 -@@ -103,4 +103,11 @@ extern char *skip_to_space (char *inp); +diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h +index 8a6e5b3..6581151 100644 +--- a/gdb/cli/cli-utils.h ++++ b/gdb/cli/cli-utils.h +@@ -94,6 +94,10 @@ extern int number_is_in_list (char *list, int number); + + extern char *skip_spaces (char *inp); + ++/* A const-correct version of the above. */ ++ ++extern const char *skip_spaces_const (const char *inp); ++ + /* Skip leading non-whitespace characters in INP, returning an updated + pointer. If INP is NULL, return NULL. */ + +@@ -103,4 +107,11 @@ extern char *skip_to_space (char *inp); START. */ extern char *remove_trailing_whitespace (const char *start, char *s); @@ -927,11 +836,11 @@ Index: gdb-7.3.50.20110722/gdb/cli/cli-utils.h +extern char *extract_arg (char **arg); + #endif /* CLI_UTILS_H */ -Index: gdb-7.3.50.20110722/gdb/coffread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/coffread.c 2011-06-14 20:53:13.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/coffread.c 2011-07-29 22:52:02.000000000 +0200 -@@ -2197,6 +2197,7 @@ static const struct sym_fns coff_sym_fns +diff --git a/gdb/coffread.c b/gdb/coffread.c +index cf8fb54..f17ead9 100644 +--- a/gdb/coffread.c ++++ b/gdb/coffread.c +@@ -2197,6 +2197,7 @@ static const struct sym_fns coff_sym_fns = default_symfile_relocate, /* sym_relocate: Relocate a debug section. */ @@ -939,11 +848,11 @@ Index: gdb-7.3.50.20110722/gdb/coffread.c &psym_functions }; -Index: gdb-7.3.50.20110722/gdb/data-directory/Makefile.in -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/data-directory/Makefile.in 2011-02-04 19:34:41.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/data-directory/Makefile.in 2011-07-29 22:52:02.000000000 +0200 -@@ -52,11 +52,23 @@ SYSCALLS_FILES = \ +diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in +index c04aea4..f06b6da 100644 +--- a/gdb/data-directory/Makefile.in ++++ b/gdb/data-directory/Makefile.in +@@ -52,13 +52,24 @@ SYSCALLS_FILES = \ PYTHON_DIR = python PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) PYTHON_FILES = \ @@ -952,29 +861,31 @@ Index: gdb-7.3.50.20110722/gdb/data-directory/Makefile.in gdb/__init__.py \ - gdb/types.py \ - gdb/printing.py \ +- gdb/prompt.py \ + gdb/backtrace.py \ gdb/command/__init__.py \ -- gdb/command/pretty_printers.py -+ gdb/command/alias.py \ + gdb/command/backtrace.py \ + gdb/command/ignore_errors.py \ + gdb/command/pahole.py \ -+ gdb/command/pretty_printers.py \ + gdb/command/pretty_printers.py \ +- gdb/command/prompt.py ++ gdb/command/prompt.py \ + gdb/command/require.py \ + gdb/command/upto.py \ + gdb/function/__init__.py \ + gdb/function/caller_is.py \ + gdb/function/in_scope.py \ + gdb/printing.py \ ++ gdb/prompt.py \ + gdb/types.py FLAGS_TO_PASS = \ "prefix=$(prefix)" \ -Index: gdb-7.3.50.20110722/gdb/dbxread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dbxread.c 2011-06-27 21:21:50.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dbxread.c 2011-07-29 22:52:02.000000000 +0200 -@@ -3590,6 +3590,7 @@ static const struct sym_fns aout_sym_fns +diff --git a/gdb/dbxread.c b/gdb/dbxread.c +index 2210af2..5de3078 100644 +--- a/gdb/dbxread.c ++++ b/gdb/dbxread.c +@@ -3590,6 +3590,7 @@ static const struct sym_fns aout_sym_fns = default_symfile_segments, /* Get segment information from a file. */ NULL, default_symfile_relocate, /* Relocate a debug section. */ @@ -982,11 +893,11 @@ Index: gdb-7.3.50.20110722/gdb/dbxread.c &psym_functions }; -Index: gdb-7.3.50.20110722/gdb/defs.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/defs.h 2011-07-22 01:46:08.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/defs.h 2011-07-29 22:52:02.000000000 +0200 -@@ -406,6 +406,8 @@ extern struct cleanup *make_cleanup_rest +diff --git a/gdb/defs.h b/gdb/defs.h +index 7f8a330..8b7a946 100644 +--- a/gdb/defs.h ++++ b/gdb/defs.h +@@ -412,6 +412,8 @@ extern struct cleanup *make_cleanup_restore_page_info (void); extern struct cleanup * set_batch_flag_and_make_cleanup_restore_page_info (void); @@ -995,10 +906,10 @@ Index: gdb-7.3.50.20110722/gdb/defs.h extern char *gdb_realpath (const char *); extern char *xfullpath (const char *); -Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/doc/gdb.texinfo 2011-07-21 17:13:29.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/doc/gdb.texinfo 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +index d60a87b..b0618f6 100644 +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo @@ -1175,6 +1175,16 @@ for remote debugging. Run using @var{device} for your program's standard input and output. @c FIXME: kingdon thinks there is more to -tty. Investigate. @@ -1016,7 +927,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo @c resolve the situation of these eventually @item -tui @cindex @code{--tui} -@@ -3295,6 +3305,7 @@ all breakpoints in that range are operat +@@ -3303,6 +3313,7 @@ all breakpoints in that range are operated on. * Conditions:: Break conditions * Break Commands:: Breakpoint command lists * Save Breakpoints:: How to save breakpoints in a file @@ -1024,7 +935,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo * Error in Breakpoints:: ``Cannot insert breakpoints'' * Breakpoint-related Warnings:: ``Breakpoint address adjusted...'' @end menu -@@ -4525,6 +4536,50 @@ and remove the breakpoint definitions yo +@@ -4532,6 +4543,50 @@ and remove the breakpoint definitions you're not interested in, or that can no longer be recreated. @end table @@ -1062,7 +973,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo +point at which the probe is defined---that is, when the current PC is +at the probe's location. The arguments are available using the +convenience variables (@pxref{Convenience Vars}) -+@code{$_probe_arg0}@dots{}@code{$_probe_arg9}. Each probe argument is ++@code{$_probe_arg0}@dots{}@code{$_probe_arg11}. Each probe argument is +an integer of the appropriate size; types are not preserved. The +convenience variable @code{$_probe_argc} holds the number of arguments +at the current probe point. @@ -1075,12 +986,12 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo @c @ifclear BARETARGET @node Error in Breakpoints @subsection ``Cannot insert breakpoints'' -@@ -6440,6 +6495,29 @@ specify the function unambiguously, e.g. +@@ -6552,6 +6607,29 @@ specify the function unambiguously, e.g., if there are several functions with identical names in different source files. @end table +@cindex SystemTap static probe point -+@item probe:@r{[}@var{objfile}:@r{]}@r{[}@var{provider}:@r{]}@var{name} ++@item -p @r{[}@var{objfile}:@r{]}@r{[}@var{provider}:@r{]}@var{name} +The @sc{gnu}/Linux tool @code{SystemTap} provides a way for +applications to embed static probes. This form of linespec specifies +the location of such a static probe. See @@ -1098,42 +1009,42 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo +happens automatically if you defined your probe using a DTrace-style +@file{.d} file. If your probe has a semaphore, @value{GDBN} will +automatically enable it when you specify a breakpoint using the -+@samp{probe:} notation. But, if you put a breakpoint at a probe's ++@samp{-p} notation. But, if you put a breakpoint at a probe's +location by some other method (e.g., @code{break file:line}), then +@value{GDBN} will not automatically set the semaphore. + @end table -@@ -8526,6 +8604,10 @@ to match the format in which the data wa +@@ -8767,6 +8845,10 @@ to match the format in which the data was printed. The variable @code{$_exitcode} is automatically set to the exit code when the program being debugged terminates. +@item $_probe_argc -+@itemx $_probe_arg0@dots{}$_probe_arg9 ++@itemx $_probe_arg0@dots{}$_probe_arg11 +Arguments to a SystemTap static probe. @xref{Static Probe Points}. + @item $_sdata @vindex $_sdata@r{, inspect, convenience variable} The variable @code{$_sdata} contains extra collected static tracepoint -@@ -10264,6 +10346,16 @@ Collect all function arguments. - @item $locals - Collect all local variables. +@@ -10719,6 +10801,16 @@ Collect all local variables. + Collect the return address. This is helpful if you want to see more + of a backtrace. +@item $_probe_argc +Collects the number of arguments from the @code{SystemTap} probe at +which the tracepoint is located. -+@xref{Static Probe Points,,Static Probe Points} ++@xref{Static Probe Points,,Static Probe Points}. + +@item $_probe_arg@var{N} -+Where @var{N} varies from 0 to 9. Collects the @var{N}th argument ++Where @var{N} varies from 0 to 11. Collects the @var{N}th argument +from the @code{SystemTap} probe at which the tracepoint is located. -+@xref{Static Probe Points,,Static Probe Points} ++@xref{Static Probe Points,,Static Probe Points}. + @item $_sdata @vindex $_sdata@r{, collect} Collect static tracepoint marker specific data. Only available for -@@ -20805,8 +20897,6 @@ containing @code{end}. For example: +@@ -21458,8 +21550,6 @@ containing @code{end}. For example: @smallexample (@value{GDBP}) python @@ -1142,10 +1053,10 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo >print 23 >end 23 -@@ -20824,6 +20914,14 @@ occurs in a Python script. This can be - python print-stack}: if @code{on}, then Python stack printing is - enabled; if @code{off}, the default, then Python stack printing is - disabled. +@@ -21473,6 +21563,14 @@ controlled using @code{set python print-stack}: if @code{full}, then + full Python stack printing is enabled; if @code{none}, then Python stack + and message printing is disabled; if @code{message}, the default, only + the message component of the error is printed. + +@kindex maint set python auto-load +@item maint set python auto-load @@ -1157,7 +1068,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo @end table It is also possible to execute a Python script from the @value{GDBN} -@@ -20845,6 +20943,14 @@ and thus is always available. +@@ -21494,6 +21592,14 @@ and thus is always available. @cindex python api @cindex programming in python @@ -1172,11 +1083,11 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdb.texinfo @cindex python stdout @cindex python pagination At startup, @value{GDBN} overrides Python's @code{sys.stdout} and -Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/doc/gdbint.texinfo 2011-04-19 20:04:08.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo 2011-07-29 22:52:02.000000000 +0200 -@@ -2104,6 +2104,18 @@ time, and so we attempt to handle symbol +diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo +index 34eee91..06a7ada 100644 +--- a/gdb/doc/gdbint.texinfo ++++ b/gdb/doc/gdbint.texinfo +@@ -2104,6 +2104,18 @@ time, and so we attempt to handle symbols incrementally. For instance, we create @dfn{partial symbol tables} consisting of only selected symbols, and only expand them to full symbol tables when necessary. @@ -1195,7 +1106,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @section Symbol Reading @cindex symbol reading -@@ -2196,6 +2208,7 @@ symtab. Upon return, @code{pst->readin} +@@ -2196,6 +2208,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and zero if there were no symbols in that part of the symbol file. @end table @@ -1203,7 +1114,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @section Partial Symbol Tables @value{GDBN} has three types of symbol tables: -@@ -2297,6 +2310,7 @@ and partial symbol tables behind a set o +@@ -2297,6 +2310,7 @@ and partial symbol tables behind a set of function pointers known as the @dfn{quick symbol functions}. These are documented in @file{symfile.h}. @@ -1211,7 +1122,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @section Types @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}). -@@ -2319,6 +2333,7 @@ types map to one @code{TYPE_CODE_*} type +@@ -2319,6 +2333,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by other members of the type struct, such as whether the type is signed or unsigned, and how many bits it uses. @@ -1219,7 +1130,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}). These are instances of type structs that roughly correspond to -@@ -2333,6 +2348,7 @@ only one instance exists, while @file{c- +@@ -2333,6 +2348,7 @@ only one instance exists, while @file{c-lang.c} builds as many @code{TYPE_CODE_INT} types as needed, with each one associated with some particular objfile. @@ -1235,7 +1146,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @section Debugging File Formats This section describes characteristics of debugging information that -@@ -2489,6 +2506,7 @@ DWARF 3 is an improved version of DWARF +@@ -2489,6 +2506,7 @@ DWARF 3 is an improved version of DWARF 2. @cindex SOM debugging info Like COFF, the SOM definition includes debugging information. @@ -1243,7 +1154,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @section Adding a New Symbol Reader to @value{GDBN} @cindex adding debugging info reader -@@ -2511,6 +2529,7 @@ will only ever be implemented by one obj +@@ -2511,6 +2529,7 @@ will only ever be implemented by one object file format may be called directly. This interface should be described in a file @file{bfd/lib@var{xyz}.h}, which is included by @value{GDBN}. @@ -1251,7 +1162,7 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @section Memory Management for Symbol Files Most memory associated with a loaded symbol file is stored on -@@ -2522,10 +2541,45 @@ released when the objfile is unloaded or +@@ -2522,10 +2541,45 @@ released when the objfile is unloaded or reloaded. Therefore one objfile must not reference symbol or type data from another objfile; they could be unloaded at different times. @@ -1301,11 +1212,11 @@ Index: gdb-7.3.50.20110722/gdb/doc/gdbint.texinfo @node Language Support -Index: gdb-7.3.50.20110722/gdb/doc/observer.texi -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/doc/observer.texi 2011-07-21 13:03:47.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/doc/observer.texi 2011-07-29 22:52:02.000000000 +0200 -@@ -227,6 +227,11 @@ Called before a top-level prompt is disp +diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi +index 689b303..2f46b93 100644 +--- a/gdb/doc/observer.texi ++++ b/gdb/doc/observer.texi +@@ -227,6 +227,11 @@ Called before a top-level prompt is displayed. @var{current_prompt} is the current top-level prompt. @end deftypefun @@ -1317,11 +1228,11 @@ Index: gdb-7.3.50.20110722/gdb/doc/observer.texi @deftypefun void test_notification (int @var{somearg}) This observer is used for internal testing. Do not use. See testsuite/gdb.gdb/observer.exp. -Index: gdb-7.3.50.20110722/gdb/dwarf2expr.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2expr.c 2011-07-15 22:54:32.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2expr.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1258,6 +1258,14 @@ execute_stack_op (struct dwarf_expr_cont +diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c +index 04779a8..c6a64e5 100644 +--- a/gdb/dwarf2expr.c ++++ b/gdb/dwarf2expr.c +@@ -1449,6 +1449,14 @@ execute_stack_op (struct dwarf_expr_context *ctx, } break; @@ -1336,13 +1247,13 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2expr.c default: error (_("Unhandled dwarf expression opcode 0x%x"), op); } -Index: gdb-7.3.50.20110722/gdb/dwarf2expr.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2expr.h 2011-07-15 22:54:32.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2expr.h 2011-07-29 22:52:02.000000000 +0200 -@@ -62,12 +62,10 @@ struct dwarf_expr_context_funcs - meaningful to substitute a stub type of the correct size. */ - struct type *(*get_base_type) (struct dwarf_expr_context *ctx, size_t die); +diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h +index 2c1da26..deafbe8 100644 +--- a/gdb/dwarf2expr.h ++++ b/gdb/dwarf2expr.h +@@ -73,12 +73,10 @@ struct dwarf_expr_context_funcs + int dwarf_reg, CORE_ADDR fb_offset, + int deref_size); -#if 0 /* Not yet implemented. */ @@ -1353,11 +1264,11 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2expr.h }; /* The location of a value. */ -Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2loc.c 2011-07-19 22:28:52.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2loc.c 2011-07-29 22:52:02.000000000 +0200 -@@ -134,6 +134,9 @@ struct dwarf_expr_baton +diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c +index 7547a40..bc8015c 100644 +--- a/gdb/dwarf2loc.c ++++ b/gdb/dwarf2loc.c +@@ -158,6 +158,9 @@ struct dwarf_expr_baton { struct frame_info *frame; struct dwarf2_per_cu_data *per_cu; @@ -1367,7 +1278,17 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -202,23 +205,33 @@ dwarf_expr_frame_base_1 (struct symbol * +@@ -217,16 +220,14 @@ static void + dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, + const gdb_byte **start, size_t *length) + { +- if (SYMBOL_LOCATION_BATON (framefunc) == NULL) +- *length = 0; +- else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs) ++ if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs) + { + struct dwarf2_loclist_baton *symbaton; + symbaton = SYMBOL_LOCATION_BATON (framefunc); *start = dwarf2_find_location_expression (symbaton, length, pc); } @@ -1376,17 +1297,9 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c { struct dwarf2_locexpr_baton *symbaton; - symbaton = SYMBOL_LOCATION_BATON (framefunc); -- if (symbaton != NULL) -- { -- *length = symbaton->size; -- *start = symbaton->data; -- } -- else -- *start = NULL; -+ gdb_assert (symbaton != NULL); -+ *start = symbaton->data; -+ *length = symbaton->size; +@@ -239,10 +240,23 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, + else + *length = 0; } + else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_missing_funcs) + { @@ -1394,8 +1307,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c + + symbaton = SYMBOL_LOCATION_BATON (framefunc); + gdb_assert (symbaton == NULL); -+ *start = NULL; -+ *length = 0; /* unused */ ++ *length = 0; + } + else + internal_error (__FILE__, __LINE__, @@ -1403,14 +1315,14 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c + SYMBOL_COMPUTED_OPS (framefunc), + SYMBOL_PRINT_NAME (framefunc)); - if (*start == NULL) + if (*length == 0) error (_("Could not find the frame base for \"%s\"."), - SYMBOL_NATURAL_NAME (framefunc)); + SYMBOL_PRINT_NAME (framefunc)); } /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for -@@ -291,6 +304,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr +@@ -310,6 +324,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset) ctx->funcs->get_frame_pc, ctx->baton); } @@ -1496,8 +1408,26 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c /* Callback function for dwarf2_evaluate_loc_desc. */ static struct type * -@@ -301,6 +393,85 @@ dwarf_expr_get_base_type (struct dwarf_e - return dwarf2_get_die_type (die_offset, debaton->per_cu); +@@ -991,10 +1084,12 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, + + saved_ctx.gdbarch = ctx->gdbarch; + saved_ctx.addr_size = ctx->addr_size; ++ saved_ctx.ref_addr_size = ctx->ref_addr_size; + saved_ctx.offset = ctx->offset; + saved_ctx.baton = ctx->baton; + ctx->gdbarch = get_objfile_arch (dwarf2_per_cu_objfile (baton_local.per_cu)); + ctx->addr_size = dwarf2_per_cu_addr_size (baton_local.per_cu); ++ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (baton_local.per_cu); + ctx->offset = dwarf2_per_cu_text_offset (baton_local.per_cu); + ctx->baton = &baton_local; + +@@ -1002,10 +1097,92 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, + + ctx->gdbarch = saved_ctx.gdbarch; + ctx->addr_size = saved_ctx.addr_size; ++ ctx->ref_addr_size = saved_ctx.ref_addr_size; + ctx->offset = saved_ctx.offset; + ctx->baton = saved_ctx.baton; } +/* Virtual method table for dwarf2_evaluate_loc_desc_full below. */ @@ -1512,6 +1442,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c + dwarf_expr_tls_address, + dwarf_expr_dwarf_call, + dwarf_expr_get_base_type, ++ dwarf_expr_push_dwarf_reg_entry_value, + dwarf_expr_object_address +}; + @@ -1535,6 +1466,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c + + ctx->gdbarch = get_objfile_arch (objfile); + ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); ++ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); + ctx->offset = dwarf2_per_cu_text_offset (per_cu); + ctx->baton = &baton; + ctx->funcs = &dwarf_expr_ctx_funcs; @@ -1579,10 +1511,10 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c + return retval; +} + - struct piece_closure - { - /* Reference count. */ -@@ -1082,20 +1253,6 @@ invalid_synthetic_pointer (void) + /* VALUE must be of type lval_computed with entry_data_value_funcs. Perform + the indirect method on it, that is use its stored target value, the sole + purpose of entry_data_value_funcs.. */ +@@ -1928,21 +2105,6 @@ invalid_synthetic_pointer (void) "referenced via synthetic pointer")); } @@ -1597,24 +1529,22 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c - dwarf_expr_frame_pc, - dwarf_expr_tls_address, - dwarf_expr_dwarf_call, -- dwarf_expr_get_base_type +- dwarf_expr_get_base_type, +- dwarf_expr_push_dwarf_reg_entry_value -}; - /* Evaluate a location description, starting at DATA and with length SIZE, to find the current location of variable of TYPE in the context of FRAME. BYTE_OFFSET is applied after the contents are -@@ -1108,10 +1265,8 @@ dwarf2_evaluate_loc_desc_full (struct ty +@@ -1955,7 +2117,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, LONGEST byte_offset) { struct value *retval; - struct dwarf_expr_baton baton; struct dwarf_expr_context *ctx; struct cleanup *old_chain, *value_chain; -- struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); - volatile struct gdb_exception ex; - - if (byte_offset < 0) -@@ -1120,28 +1275,18 @@ dwarf2_evaluate_loc_desc_full (struct ty + struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); +@@ -1967,29 +2128,18 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, if (size == 0) return allocate_optimized_out_value (type); @@ -1627,6 +1557,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c - ctx->gdbarch = get_objfile_arch (objfile); - ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); +- ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); - ctx->offset = dwarf2_per_cu_text_offset (per_cu); - ctx->baton = &baton; - ctx->funcs = &dwarf_expr_ctx_funcs; @@ -1644,7 +1575,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c retval = allocate_value (type); mark_value_bytes_unavailable (retval, 0, TYPE_LENGTH (type)); return retval; -@@ -1198,6 +1343,16 @@ dwarf2_evaluate_loc_desc_full (struct ty +@@ -2053,6 +2203,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); do_cleanups (value_chain); @@ -1661,7 +1592,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c retval = allocate_value_lazy (type); VALUE_LVAL (retval) = lval_memory; if (in_stack_memory) -@@ -2974,11 +3129,51 @@ loclist_tracepoint_var_ref (struct symbo +@@ -3897,8 +4057,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, dlbaton->per_cu); } @@ -1670,11 +1601,11 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c +/* The set of location functions used with the DWARF-2 location lists. */ const struct symbol_computed_ops dwarf2_loclist_funcs = { loclist_read_variable, - loclist_read_needs_frame, - loclist_describe_location, + loclist_read_variable_at_entry, +@@ -3907,6 +4066,48 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = { loclist_tracepoint_var_ref }; -+ + +static struct value * +missing_read_variable (struct symbol *symbol, struct frame_info *frame) +{ @@ -1711,15 +1642,20 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.c + unable to resolve the symbols. */ +const struct symbol_computed_ops dwarf2_missing_funcs = { + missing_read_variable, ++ missing_read_variable, /* read_variable_at_entry */ + missing_read_needs_frame, + missing_describe_location, + missing_tracepoint_var_ref +}; -Index: gdb-7.3.50.20110722/gdb/dwarf2loc.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2loc.h 2011-05-12 19:40:54.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2loc.h 2011-07-29 22:52:02.000000000 +0200 -@@ -110,6 +110,15 @@ struct dwarf2_loclist_baton ++ + void + _initialize_dwarf2loc (void) + { +diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h +index 8196791..df2570d 100644 +--- a/gdb/dwarf2loc.h ++++ b/gdb/dwarf2loc.h +@@ -119,6 +119,15 @@ struct dwarf2_loclist_baton extern const struct symbol_computed_ops dwarf2_locexpr_funcs; extern const struct symbol_computed_ops dwarf2_loclist_funcs; @@ -1735,11 +1671,11 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2loc.h /* Compile a DWARF location expression to an agent expression. -Index: gdb-7.3.50.20110722/gdb/dwarf2read.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c 2011-07-29 22:52:00.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2read.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1251,6 +1251,9 @@ static void fill_in_loclist_baton (struc +diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c +index 8072859..9ada5c5 100644 +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -1250,6 +1250,9 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, struct attribute *attr); @@ -1749,7 +1685,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu); -@@ -1285,6 +1288,9 @@ static void age_cached_comp_units (void) +@@ -1284,6 +1287,9 @@ static void age_cached_comp_units (void); static void free_one_cached_comp_unit (void *); @@ -1759,7 +1695,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); -@@ -1309,6 +1315,9 @@ static struct type *get_die_type_at_offs +@@ -1307,6 +1313,9 @@ static struct type *get_die_type_at_offset (unsigned int, static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); @@ -1768,8 +1704,8 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + static void dwarf2_release_queue (void *dummy); - static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, -@@ -7785,6 +7794,29 @@ process_enumeration_scope (struct die_in + static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu); +@@ -8083,6 +8092,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) new_symbol (die, this_type, cu); } @@ -1799,7 +1735,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c /* Extract all information from a DW_TAG_array_type DIE and put it in the DIE's type field. For now, this only handles one dimensional arrays. */ -@@ -7798,7 +7830,7 @@ read_array_type (struct die_info *die, s +@@ -8096,7 +8128,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) struct type *element_type, *range_type, *index_type; struct type **range_types = NULL; struct attribute *attr; @@ -1808,7 +1744,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c struct cleanup *back_to; char *name; -@@ -7851,17 +7883,19 @@ read_array_type (struct die_info *die, s +@@ -8149,17 +8181,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) type = element_type; if (read_array_order (die, cu) == DW_ORD_col_major) @@ -1839,7 +1775,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -8345,29 +8379,114 @@ read_tag_string_type (struct die_info *d +@@ -8643,29 +8677,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -1967,7 +1903,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -8658,8 +8777,7 @@ read_subrange_type (struct die_info *die +@@ -8969,8 +9088,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; @@ -1977,7 +1913,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c char *name; LONGEST negative_mask; -@@ -8672,53 +8790,126 @@ read_subrange_type (struct die_info *die +@@ -8983,53 +9101,126 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) if (range_type) return range_type; @@ -1989,43 +1925,23 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + /* LOW_BOUND and HIGH_BOUND are set for real below. */ + range_type = create_range_type (NULL, base_type, 0, -1); + TYPE_UNSIGNED (range_type) = 0; - -- /* FIXME: For variable sized arrays either of these could be -- a variable rather than a constant value. We'll allow it, -- but we don't know how to handle it. */ -- attr = dwarf2_attr (die, DW_AT_lower_bound, cu); -- if (attr) -- low = dwarf2_get_attr_constant_value (attr, 0); ++ + negative_mask = + (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); - -- attr = dwarf2_attr (die, DW_AT_upper_bound, cu); -- if (attr) ++ + /* Exclude language_ada from any TYPE_DYNAMIC constructs below. GDB Ada + supports implements the dynamic bounds in a non-DWARF way and the + existing DWARF dynamic bounds are invalid, leading to memory access + errors. */ -+ -+ attr = dwarf2_attr (die, DW_AT_lower_bound, cu); + +- /* FIXME: For variable sized arrays either of these could be +- a variable rather than a constant value. We'll allow it, +- but we don't know how to handle it. */ + attr = dwarf2_attr (die, DW_AT_lower_bound, cu); +- if (attr) +- low = dwarf2_get_attr_constant_value (attr, 0); + if (attr && attr_form_is_block (attr) && cu->language != language_ada) - { -- if (attr_form_is_block (attr) || is_ref_attr (attr)) -- { -- /* GCC encodes arrays with unspecified or dynamic length -- with a DW_FORM_block1 attribute or a reference attribute. -- FIXME: GDB does not yet know how to handle dynamic -- arrays properly, treat them as arrays with unspecified -- length for now. -- -- FIXME: jimb/2003-09-22: GDB does not really know -- how to handle arrays of unspecified length -- either; we just represent them as zero-length -- arrays. Choose an appropriate upper bound given -- the lower bound we've computed above. */ -- high = low - 1; -- } -- else -- high = dwarf2_get_attr_constant_value (attr, 1); ++ { + TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_BLOCK; + TYPE_RANGE_DATA (range_type)->low.u.dwarf_block = + dwarf2_attr_to_locexpr_baton (attr, cu); @@ -2038,7 +1954,9 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + struct die_info *target_die; + struct dwarf2_cu *target_cu = cu; + struct attribute *target_loc_attr; -+ + +- attr = dwarf2_attr (die, DW_AT_upper_bound, cu); +- if (attr) + target_die = follow_die_ref_or_sig (die, attr, &target_cu); + gdb_assert (target_cu->objfile == cu->objfile); + target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); @@ -2051,17 +1969,29 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + TYPE_DYNAMIC (range_type) = 1; + /* For setting a default if DW_AT_UPPER_BOUND would be missing. */ + low = 0; - } - else ++ } ++ else { -- attr = dwarf2_attr (die, DW_AT_count, cu); -- if (attr) -+ if (attr && attr_form_is_constant (attr)) -+ low = dwarf2_get_attr_constant_value (attr, 0); -+ else - { -- int count = dwarf2_get_attr_constant_value (attr, 1); -- high = low + count - 1; +- if (attr_form_is_block (attr) || is_ref_attr (attr)) +- { +- /* GCC encodes arrays with unspecified or dynamic length +- with a DW_FORM_block1 attribute or a reference attribute. +- FIXME: GDB does not yet know how to handle dynamic +- arrays properly, treat them as arrays with unspecified +- length for now. +- +- FIXME: jimb/2003-09-22: GDB does not really know +- how to handle arrays of unspecified length +- either; we just represent them as zero-length +- arrays. Choose an appropriate upper bound given +- the lower bound we've computed above. */ +- high = low - 1; +- } ++ if (attr && attr_form_is_constant (attr)) ++ low = dwarf2_get_attr_constant_value (attr, 0); + else +- high = dwarf2_get_attr_constant_value (attr, 1); ++ { + if (cu->language == language_fortran) + { + /* FORTRAN implies a lower bound of 1, if not given. */ @@ -2073,25 +2003,30 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + LANGUAGE_C and LANGUAGE_CPLUS. */ + low = 0; + } - } ++ } + if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) + low |= negative_mask; + TYPE_LOW_BOUND (range_type) = low; + if (low >= 0) + TYPE_UNSIGNED (range_type) = 1; -+ } + } +- else + + attr = dwarf2_attr (die, DW_AT_upper_bound, cu); + if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr) + && !is_ref_attr (attr))) -+ { -+ attr = dwarf2_attr (die, DW_AT_count, cu); + { + attr = dwarf2_attr (die, DW_AT_count, cu); +- if (attr) +- { +- int count = dwarf2_get_attr_constant_value (attr, 1); +- high = low + count - 1; + /* It does not hurt but it is needlessly ineffective in check_typedef. */ + if (attr && (attr_form_is_block (attr) || attr_form_is_constant (attr))) + { + TYPE_RANGE_HIGH_BOUND_IS_COUNT (range_type) = 1; + TYPE_DYNAMIC (range_type) = 1; -+ } + } + /* Pass it now as the regular DW_AT_upper_bound. */ + } + @@ -2139,7 +2074,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c } /* Dwarf-2 specifications explicitly allows to create subrange types -@@ -8759,24 +8950,41 @@ read_subrange_type (struct die_info *die +@@ -9070,24 +9261,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) } } @@ -2151,16 +2086,6 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c - high |= negative_mask; - - range_type = create_range_type (NULL, base_type, low, high); -- -- /* Mark arrays with dynamic length at least as an array of unspecified -- length. GDB could check the boundary but before it gets implemented at -- least allow accessing the array elements. */ -- if (attr && attr_form_is_block (attr)) -- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -- -- /* Ada expects an empty array on no boundary attributes. */ -- if (attr == NULL && cu->language != language_ada) -- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + /* DW_AT_bit_stride is currently unsupported as we count in bytes. */ + attr = dwarf2_attr (die, DW_AT_byte_stride, cu); + if (attr && attr_form_is_block (attr) && cu->language != language_ada) @@ -2176,11 +2101,19 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + struct die_info *target_die; + struct dwarf2_cu *target_cu = cu; + struct attribute *target_loc_attr; -+ + +- /* Mark arrays with dynamic length at least as an array of unspecified +- length. GDB could check the boundary but before it gets implemented at +- least allow accessing the array elements. */ +- if (attr && attr_form_is_block (attr)) +- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + target_die = follow_die_ref_or_sig (die, attr, &target_cu); + gdb_assert (target_cu->objfile == cu->objfile); + target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ + +- /* Ada expects an empty array on no boundary attributes. */ +- if (attr == NULL && cu->language != language_ada) +- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + TYPE_RANGE_DATA (range_type)->byte_stride.kind + = RANGE_BOUND_KIND_DWARF_LOCLIST; + TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.loclist @@ -2199,7 +2132,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c name = dwarf2_name (die, cu); if (name) -@@ -11333,10 +11541,12 @@ var_decode_location (struct attribute *a +@@ -11610,10 +11818,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, (i.e. when the value of a register or memory location is referenced, or a thread-local block, etc.). Then again, it might not be worthwhile. I'm assuming that it isn't unless performance @@ -2214,7 +2147,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c if (SYMBOL_COMPUTED_OPS (sym) == &dwarf2_loclist_funcs) cu->has_loclist = 1; -@@ -11377,6 +11587,8 @@ new_symbol_full (struct die_info *die, s +@@ -11654,6 +11864,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, else sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol); OBJSTAT (objfile, n_syms++); @@ -2223,7 +2156,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c /* Cache this symbol's name and the name's demangled form (if any). */ SYMBOL_SET_LANGUAGE (sym, cu->language); -@@ -12149,6 +12361,9 @@ read_type_die_1 (struct die_info *die, s +@@ -12419,6 +12631,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) break; } @@ -2233,7 +2166,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c return this_type; } -@@ -15324,61 +15539,99 @@ fill_in_loclist_baton (struct dwarf2_cu +@@ -15653,62 +15868,100 @@ fill_in_loclist_baton (struct dwarf2_cu *cu, baton->base_address = cu->base_address; } @@ -2246,29 +2179,25 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c +static struct dwarf2_locexpr_baton * +dwarf2_attr_to_locexpr_baton (struct attribute *attr, struct dwarf2_cu *cu) { + struct objfile *objfile = dwarf2_per_objfile->objfile; ++ struct dwarf2_locexpr_baton *baton; + - if (attr_form_is_section_offset (attr) - /* ".debug_loc" may not exist at all, or the offset may be outside - the section. If so, fall through to the complaint in the - other branch. */ -- && DW_UNSND (attr) < dwarf2_section_size (dwarf2_per_objfile->objfile, +- && DW_UNSND (attr) < dwarf2_section_size (objfile, - &dwarf2_per_objfile->loc)) - { - struct dwarf2_loclist_baton *baton; -+ struct dwarf2_locexpr_baton *baton; - -- baton = obstack_alloc (&cu->objfile->objfile_obstack, -- sizeof (struct dwarf2_loclist_baton)); + gdb_assert (attr_form_is_block (attr)); - -- fill_in_loclist_baton (cu, baton, attr); -+ baton = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (*baton)); ++ ++ baton = obstack_alloc (&objfile->objfile_obstack, sizeof (*baton)); + baton->per_cu = cu->per_cu; + gdb_assert (baton->per_cu); -- if (cu->base_known == 0) -- complaint (&symfile_complaints, -- _("Location list used without " -- "specifying the CU base address.")); +- baton = obstack_alloc (&objfile->objfile_obstack, +- sizeof (struct dwarf2_loclist_baton)); + /* Note that we're just copying the block's data pointer + here, not the actual data. We're still pointing into the + info_buffer for SYM's objfile; right now we never release @@ -2278,9 +2207,14 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + baton->data = DW_BLOCK (attr)->data; + gdb_assert (baton->size == 0 || baton->data != NULL); +- fill_in_loclist_baton (cu, baton, attr); + return baton; +} -+ + +- if (cu->base_known == 0) +- complaint (&symfile_complaints, +- _("Location list used without " +- "specifying the CU base address.")); +static struct dwarf2_loclist_baton * +dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu) +{ @@ -2311,7 +2245,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + complaint (&symfile_complaints, + _("Location list used without " + "specifying the CU base address.")); -+ + + return baton; +} + @@ -2341,7 +2275,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c + dwarf2_invalid_attrib_class_complaint ("location description", + SYMBOL_NATURAL_NAME (sym)); -- baton = obstack_alloc (&cu->objfile->objfile_obstack, +- baton = obstack_alloc (&objfile->objfile_obstack, - sizeof (struct dwarf2_locexpr_baton)); - baton->per_cu = cu->per_cu; - gdb_assert (baton->per_cu); @@ -2362,7 +2296,6 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c - dwarf2_invalid_attrib_class_complaint ("location description", - SYMBOL_NATURAL_NAME (sym)); - baton->size = 0; -- baton->data = NULL; - } + SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs; + SYMBOL_LOCATION_BATON (sym) = NULL; @@ -2376,7 +2309,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c } } -@@ -15727,6 +15980,25 @@ offset_and_type_eq (const void *item_lhs +@@ -16080,6 +16333,25 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) return ofs_lhs->offset == ofs_rhs->offset; } @@ -2402,7 +2335,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c /* Set the type associated with DIE to TYPE. Save it in CU's hash table if necessary. For convenience, return TYPE. -@@ -15752,6 +16024,8 @@ set_die_type (struct die_info *die, stru +@@ -16105,6 +16377,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) struct objfile *objfile = cu->objfile; htab_t *type_hash_ptr; @@ -2411,10 +2344,10 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c /* For Ada types, make sure that the gnat-specific data is always initialized (if not already set). There are a few types where we should not be doing so, because the type-specific area is -Index: gdb-7.3.50.20110722/gdb/elfread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/elfread.c 2011-05-26 09:47:10.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/elfread.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/elfread.c b/gdb/elfread.c +index 4ceb31b..bfd6ac2 100644 +--- a/gdb/elfread.c ++++ b/gdb/elfread.c @@ -38,6 +38,8 @@ #include "demangle.h" #include "psympriv.h" @@ -2424,7 +2357,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c #include "gdbtypes.h" #include "value.h" #include "infcall.h" -@@ -61,6 +63,21 @@ struct elfinfo +@@ -62,6 +64,21 @@ struct elfinfo asection *mdebugsect; /* Section pointer for .mdebug section */ }; @@ -2446,7 +2379,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c static void free_elfinfo (void *); /* Minimal symbols located at the GOT entries for .plt - that is the real -@@ -1574,7 +1591,266 @@ elfstab_offset_sections (struct objfile +@@ -1578,7 +1595,270 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst) complaint (&symfile_complaints, _("elf/stab section information missing for %s"), filename); } @@ -2472,6 +2405,8 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c + struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; + CORE_ADDR base_ref; + ++ ret->gdbarch = gdbarch; ++ + /* Provider and the name of the probe. */ + ret->provider = (const char *) &el->data[3 * size]; + ret->name = memchr (ret->provider, '\0', @@ -2510,10 +2445,12 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c + (unsigned long *) el->data + + el->size - (unsigned long *) ret->name); + -+ if (ret->args++ != NULL -+ || memchr (ret->args, '\0', (unsigned long *) el->data -+ + el->size - (unsigned long *) ret->name) -+ != el->data + el->size - 1) ++ if (ret->args != NULL) ++ ++ret->args; ++ if (ret->args == NULL ++ || (memchr (ret->args, '\0', (unsigned long *) el->data ++ + el->size - (unsigned long *) ret->name) ++ != el->data + el->size - 1)) + complaint (&symfile_complaints, _("corrupt probe when reading `%s'"), + objfile->name); + } @@ -2556,7 +2493,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c + +/* Implementation of `sym_get_probes', as documented in symfile.h. */ + -+static const struct stap_probe * ++static struct stap_probe * +elf_get_probes (struct objfile *objfile, int *num_probes) +{ + struct stap_probe *ret = NULL; @@ -2623,7 +2560,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c + +static int +elf_get_probe_argument_count (struct objfile *objfile, -+ const struct stap_probe *probe) ++ struct stap_probe *probe) +{ + const char *pargs = probe->args; + @@ -2639,7 +2576,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c + +static struct value * +elf_evaluate_probe_argument (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct frame_info *frame, + int n) +{ @@ -2650,7 +2587,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c + +static void +elf_compile_to_ax (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct agent_expr *expr, + struct axs_value *value, + int n) @@ -2713,7 +2650,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c /* Register that we are able to handle ELF object file formats. */ static const struct sym_fns elf_sym_fns = -@@ -1589,6 +1865,7 @@ static const struct sym_fns elf_sym_fns +@@ -1593,6 +1873,7 @@ static const struct sym_fns elf_sym_fns = elf_symfile_segments, /* Get segment information from a file. */ NULL, default_symfile_relocate, /* Relocate a debug section. */ @@ -2721,7 +2658,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c &psym_functions }; -@@ -1607,6 +1884,7 @@ static const struct sym_fns elf_sym_fns_ +@@ -1611,6 +1892,7 @@ static const struct sym_fns elf_sym_fns_lazy_psyms = elf_symfile_segments, /* Get segment information from a file. */ NULL, default_symfile_relocate, /* Relocate a debug section. */ @@ -2729,7 +2666,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c &psym_functions }; -@@ -1624,6 +1902,7 @@ static const struct sym_fns elf_sym_fns_ +@@ -1628,6 +1910,7 @@ static const struct sym_fns elf_sym_fns_gdb_index = elf_symfile_segments, /* Get segment information from a file. */ NULL, default_symfile_relocate, /* Relocate a debug section. */ @@ -2737,7 +2674,7 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c &dwarf2_gdb_index_functions }; -@@ -1640,6 +1919,8 @@ static const struct gnu_ifunc_fns elf_gn +@@ -1644,6 +1927,8 @@ static const struct gnu_ifunc_fns elf_gnu_ifunc_fns = void _initialize_elfread (void) { @@ -2746,10 +2683,10 @@ Index: gdb-7.3.50.20110722/gdb/elfread.c add_symtab_fns (&elf_sym_fns); elf_objfile_gnu_ifunc_cache_data = register_objfile_data (); -Index: gdb-7.3.50.20110722/gdb/eval.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/eval.c 2011-06-17 22:35:09.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/eval.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/eval.c b/gdb/eval.c +index 5d758d1..b4c1799 100644 +--- a/gdb/eval.c ++++ b/gdb/eval.c @@ -44,6 +44,7 @@ #include "objfiles.h" #include "python/python.h" @@ -2758,7 +2695,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c #include "gdb_assert.h" -@@ -489,27 +490,217 @@ init_array_element (struct value *array, +@@ -489,27 +490,217 @@ init_array_element (struct value *array, struct value *element, } static struct value * @@ -2773,11 +2710,12 @@ Index: gdb-7.3.50.20110722/gdb/eval.c - enum f90_range_type range_type = longest_to_int (exp->elts[pc].longconst); - - *pos += 3; -+ /* Type to use for the newly allocated value ARRAY. */ -+ struct type *new_array_type; - +- - if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) - low_bound = TYPE_LOW_BOUND (range); ++ /* Type to use for the newly allocated value ARRAY. */ ++ struct type *new_array_type; ++ + /* Type being iterated for each dimension. */ + struct type *type, *type_last_target; + @@ -2974,13 +2912,13 @@ Index: gdb-7.3.50.20110722/gdb/eval.c + VALUE_FRAME_ID (array) = VALUE_FRAME_ID (saved_array); + if (VALUE_LVAL (array) != lval_internalvar) + set_value_address (array, value_byte_address + value_byte_offset); - -- return value_slice (array, low_bound, high_bound - low_bound + 1); ++ + if (!value_lazy (saved_array)) + { + allocate_value_contents (array); + set_value_lazy (array, 0); -+ + +- return value_slice (array, low_bound, high_bound - low_bound + 1); + memcpy (value_contents_writeable (array), + value_contents (saved_array) + value_byte_offset, + TYPE_LENGTH (new_array_type)); @@ -2991,7 +2929,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c } -@@ -790,6 +981,7 @@ evaluate_subexp_standard (struct type *e +@@ -790,6 +981,7 @@ evaluate_subexp_standard (struct type *expect_type, int save_pos1; struct symbol *function = NULL; char *function_name = NULL; @@ -2999,7 +2937,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c pc = (*pos)++; op = exp->elts[pc].opcode; -@@ -1862,6 +2054,8 @@ evaluate_subexp_standard (struct type *e +@@ -1865,6 +2057,8 @@ evaluate_subexp_standard (struct type *expect_type, /* First determine the type code we are dealing with. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); @@ -3008,7 +2946,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c type = check_typedef (value_type (arg1)); code = TYPE_CODE (type); -@@ -1882,23 +2076,13 @@ evaluate_subexp_standard (struct type *e +@@ -1885,23 +2079,13 @@ evaluate_subexp_standard (struct type *expect_type, code = TYPE_CODE (type); } } @@ -3034,7 +2972,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c case TYPE_CODE_PTR: case TYPE_CODE_FUNC: -@@ -2337,49 +2521,6 @@ evaluate_subexp_standard (struct type *e +@@ -2340,49 +2524,6 @@ evaluate_subexp_standard (struct type *expect_type, } return (arg1); @@ -3084,7 +3022,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c case BINOP_LOGICAL_AND: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) -@@ -2611,15 +2752,23 @@ evaluate_subexp_standard (struct type *e +@@ -2614,15 +2755,23 @@ evaluate_subexp_standard (struct type *expect_type, if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); arg1 = evaluate_subexp (expect_type, exp, pos, noside); @@ -3110,7 +3048,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c else if (noside == EVAL_AVOID_SIDE_EFFECTS) { type = check_typedef (value_type (arg1)); -@@ -2628,12 +2777,18 @@ evaluate_subexp_standard (struct type *e +@@ -2631,12 +2780,18 @@ evaluate_subexp_standard (struct type *expect_type, /* In C you can dereference an array to get the 1st elt. */ || TYPE_CODE (type) == TYPE_CODE_ARRAY ) @@ -3134,7 +3072,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c else error (_("Attempt to take contents of a non-pointer value.")); } -@@ -2643,9 +2798,14 @@ evaluate_subexp_standard (struct type *e +@@ -2646,9 +2801,14 @@ evaluate_subexp_standard (struct type *expect_type, do. "long long" variables are rare enough that BUILTIN_TYPE_LONGEST would seem to be a mistake. */ if (TYPE_CODE (type) == TYPE_CODE_INT) @@ -3152,7 +3090,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c case UNOP_ADDR: /* C++: check for and handle pointer to members. */ -@@ -2987,7 +3147,7 @@ evaluate_subexp_with_coercion (struct ex +@@ -2990,7 +3150,7 @@ evaluate_subexp_with_coercion (struct expression *exp, { enum exp_opcode op; int pc; @@ -3161,7 +3099,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c struct symbol *var; struct type *type; -@@ -2998,13 +3158,18 @@ evaluate_subexp_with_coercion (struct ex +@@ -3001,13 +3161,18 @@ evaluate_subexp_with_coercion (struct expression *exp, { case OP_VAR_VALUE: var = exp->elts[pc + 2].symbol; @@ -3181,7 +3119,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val); } -@@ -3056,9 +3221,13 @@ evaluate_subexp_for_sizeof (struct expre +@@ -3059,9 +3224,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) case OP_VAR_VALUE: (*pos) += 4; @@ -3198,7 +3136,7 @@ Index: gdb-7.3.50.20110722/gdb/eval.c default: val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); -@@ -3089,18 +3258,25 @@ parse_and_eval_type (char *p, int length +@@ -3092,18 +3261,25 @@ parse_and_eval_type (char *p, int length) int calc_f77_array_dims (struct type *array_type) { @@ -3234,10 +3172,10 @@ Index: gdb-7.3.50.20110722/gdb/eval.c - return ndimen; + } -Index: gdb-7.3.50.20110722/gdb/f-exp.y -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/f-exp.y 2011-04-19 20:04:07.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/f-exp.y 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/f-exp.y b/gdb/f-exp.y +index 74937d7..093ffe0 100644 +--- a/gdb/f-exp.y ++++ b/gdb/f-exp.y @@ -293,7 +293,9 @@ arglist : subrange { arglist_len = 1; } ; @@ -3249,11 +3187,11 @@ Index: gdb-7.3.50.20110722/gdb/f-exp.y { arglist_len++; } ; -Index: gdb-7.3.50.20110722/gdb/f-lang.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/f-lang.h 2011-01-07 20:36:16.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/f-lang.h 2011-07-29 22:52:02.000000000 +0200 -@@ -28,6 +28,10 @@ extern void f_error (char *); /* Defined +diff --git a/gdb/f-lang.h b/gdb/f-lang.h +index 8043577..94a5f31 100644 +--- a/gdb/f-lang.h ++++ b/gdb/f-lang.h +@@ -28,6 +28,10 @@ extern void f_error (char *); /* Defined in f-exp.y */ extern void f_print_type (struct type *, const char *, struct ui_file *, int, int); @@ -3264,10 +3202,10 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.h extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, struct ui_file *, int, const struct value *, -Index: gdb-7.3.50.20110722/gdb/f-typeprint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/f-typeprint.c 2011-06-29 17:32:39.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/f-typeprint.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c +index 6d9e6ec..cc4c02a 100644 +--- a/gdb/f-typeprint.c ++++ b/gdb/f-typeprint.c @@ -32,7 +32,7 @@ #include "gdbcore.h" #include "target.h" @@ -3277,7 +3215,7 @@ Index: gdb-7.3.50.20110722/gdb/f-typeprint.c #include "gdb_string.h" #include -@@ -49,6 +49,34 @@ void f_type_print_varspec_prefix (struct +@@ -49,6 +49,34 @@ void f_type_print_varspec_prefix (struct type *, struct ui_file *, void f_type_print_base (struct type *, struct ui_file *, int, int); @@ -3312,7 +3250,7 @@ Index: gdb-7.3.50.20110722/gdb/f-typeprint.c /* LEVEL is the depth to indent lines by. */ void -@@ -58,6 +86,9 @@ f_print_type (struct type *type, const c +@@ -58,6 +86,9 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, enum type_code code; int demangled_args; @@ -3322,7 +3260,7 @@ Index: gdb-7.3.50.20110722/gdb/f-typeprint.c f_type_print_base (type, stream, show, level); code = TYPE_CODE (type); if ((varstring != NULL && *varstring != '\0') -@@ -165,6 +196,9 @@ f_type_print_varspec_suffix (struct type +@@ -165,6 +196,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, QUIT; @@ -3332,11 +3270,11 @@ Index: gdb-7.3.50.20110722/gdb/f-typeprint.c switch (TYPE_CODE (type)) { case TYPE_CODE_ARRAY: -Index: gdb-7.3.50.20110722/gdb/f-valprint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/f-valprint.c 2011-06-29 17:32:39.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/f-valprint.c 2011-07-29 22:52:02.000000000 +0200 -@@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM +diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c +index b800d89..0f616e0 100644 +--- a/gdb/f-valprint.c ++++ b/gdb/f-valprint.c +@@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; /* The following macro gives us the size of the nth dimension, Where n is 1 based. */ @@ -3380,7 +3318,7 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c } return TYPE_ARRAY_UPPER_BOUND_VALUE (type); -@@ -135,24 +140,29 @@ f77_create_arrayprint_offset_tbl (struct +@@ -135,24 +140,29 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) upper = f77_get_upperbound (tmp_type); lower = f77_get_lowerbound (tmp_type); @@ -3416,7 +3354,7 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c } } -@@ -174,37 +184,35 @@ f77_print_array_1 (int nss, int ndimensi +@@ -174,37 +184,35 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, if (nss != ndimensions) { @@ -3461,7 +3399,7 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c fprintf_filtered (stream, "..."); } } -@@ -260,6 +268,9 @@ f_val_print (struct type *type, const gd +@@ -260,6 +268,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR addr; int index; @@ -3471,10 +3409,10 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { -Index: gdb-7.3.50.20110722/gdb/findvar.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/findvar.c 2011-07-12 23:16:48.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/findvar.c 2011-07-29 22:52:44.000000000 +0200 +diff --git a/gdb/findvar.c b/gdb/findvar.c +index 33332c6..d8da34a 100644 +--- a/gdb/findvar.c ++++ b/gdb/findvar.c @@ -35,6 +35,7 @@ #include "user-regs.h" #include "block.h" @@ -3483,21 +3421,21 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c /* Basic byte-swapping routines. All 'extract' functions return a host-format integer from a target-format integer at ADDR which is -@@ -408,8 +409,11 @@ symbol_read_needs_frame (struct symbol * +@@ -408,8 +409,11 @@ symbol_read_needs_frame (struct symbol *sym) /* Given a struct symbol for a variable, and a stack frame id, read the value of the variable - and return a (pointer to a) struct value containing the value. -- If the variable cannot be found, return a zero pointer. */ +- If the variable cannot be found, throw error. */ + and return a (pointer to a) struct value containing the value. -+ If the variable cannot be found, return a zero pointer. ++ If the variable cannot be found, throw error. + We have to first find the address of the variable before allocating struct -+ value to return as its size may depend on DW_OP_PUSH_OBJECT_ADDRESS possibly ++ value to return as its size may depend on DW_OP_PUSH_OBJECT_ADDRESS possibly + used by its type. */ struct value * read_var_value (struct symbol *var, struct frame_info *frame) -@@ -417,16 +421,6 @@ read_var_value (struct symbol *var, stru +@@ -417,16 +421,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) struct value *v; struct type *type = SYMBOL_TYPE (var); CORE_ADDR addr; @@ -3514,7 +3452,7 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c if (symbol_read_needs_frame (var)) gdb_assert (frame); -@@ -436,7 +430,7 @@ read_var_value (struct symbol *var, stru +@@ -436,7 +430,7 @@ read_var_value (struct symbol *var, struct frame_info *frame) case LOC_CONST: /* Put the constant back in target format. */ v = allocate_value (type); @@ -3523,7 +3461,7 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c gdbarch_byte_order (get_type_arch (type)), (LONGEST) SYMBOL_VALUE (var)); VALUE_LVAL (v) = not_lval; -@@ -461,12 +455,12 @@ read_var_value (struct symbol *var, stru +@@ -461,12 +455,12 @@ read_var_value (struct symbol *var, struct frame_info *frame) case LOC_CONST_BYTES: v = allocate_value (type); @@ -3538,15 +3476,15 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c if (overlay_debugging) addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), SYMBOL_OBJ_SECTION (var)); -@@ -479,7 +473,6 @@ read_var_value (struct symbol *var, stru - if (!addr) - return 0; +@@ -480,7 +474,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) + error (_("Unknown argument list address for `%s'."), + SYMBOL_PRINT_NAME (var)); addr += SYMBOL_VALUE (var); - v = allocate_value_lazy (type); break; case LOC_REF_ARG: -@@ -493,14 +486,12 @@ read_var_value (struct symbol *var, stru +@@ -495,14 +488,12 @@ read_var_value (struct symbol *var, struct frame_info *frame) argref += SYMBOL_VALUE (var); ref = value_at (lookup_pointer_type (type), argref); addr = value_as_address (ref); @@ -3561,7 +3499,7 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c break; case LOC_TYPEDEF: -@@ -508,7 +499,6 @@ read_var_value (struct symbol *var, stru +@@ -511,7 +502,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) break; case LOC_BLOCK: @@ -3569,15 +3507,15 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c if (overlay_debugging) addr = symbol_overlayed_address (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var)); -@@ -533,7 +523,6 @@ read_var_value (struct symbol *var, stru - error (_("Value of register variable not available.")); +@@ -537,7 +527,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) + SYMBOL_PRINT_NAME (var)); addr = value_as_address (regval); - v = allocate_value_lazy (type); } else { -@@ -572,7 +561,6 @@ read_var_value (struct symbol *var, stru +@@ -577,7 +566,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) if (obj_section && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) addr = target_translate_tls_address (obj_section->objfile, addr); @@ -3585,7 +3523,7 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c } break; -@@ -584,6 +572,10 @@ read_var_value (struct symbol *var, stru +@@ -590,6 +578,10 @@ read_var_value (struct symbol *var, struct frame_info *frame) break; } @@ -3596,22 +3534,21 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c VALUE_LVAL (v) = lval_memory; set_value_address (v, addr); return v; -@@ -623,11 +615,12 @@ struct value * +@@ -672,10 +664,11 @@ struct value * value_from_register (struct type *type, int regnum, struct frame_info *frame) { struct gdbarch *gdbarch = get_frame_arch (frame); - struct type *type1 = check_typedef (type); struct value *v; - int optim, unavail, ok; - if (gdbarch_convert_register_p (gdbarch, regnum, type1)) + type = check_typedef (type); + + if (gdbarch_convert_register_p (gdbarch, regnum, type)) { - /* The ISA/ABI need to something weird when obtaining the - specified value from this register. It might need to -@@ -640,7 +633,7 @@ value_from_register (struct type *type, + int optim, unavail, ok; + +@@ -690,7 +683,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) VALUE_LVAL (v) = lval_register; VALUE_FRAME_ID (v) = get_frame_id (frame); VALUE_REGNUM (v) = regnum; @@ -3619,121 +3556,662 @@ Index: gdb-7.3.50.20110722/gdb/findvar.c + ok = gdbarch_register_to_value (gdbarch, frame, regnum, type, value_contents_raw (v), &optim, &unavail); - } -Index: gdb-7.3.50.20110722/gdb/gdbinit.in -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/gdbinit.in 2009-10-05 15:46:52.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/gdbinit.in 2011-07-29 22:52:02.000000000 +0200 -@@ -1,5 +1,15 @@ - echo Setting up the environment for debugging gdb.\n - -+# Set up the Python library and "require" command. -+python -+from os.path import abspath -+gdb.datadir = abspath ('@srcdir@/python/lib') -+gdb.pythonlibdir = gdb.datadir -+gdb.__path__ = [gdb.datadir + '/gdb'] -+sys.path.insert(0, gdb.datadir) -+end -+source @srcdir@/python/lib/gdb/__init__.py -+ - set complaints 1 - - b internal_error -Index: gdb-7.3.50.20110722/gdb/gdbtypes.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/gdbtypes.c 2011-06-24 21:47:37.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/gdbtypes.c 2011-07-29 22:52:02.000000000 +0200 -@@ -39,6 +39,9 @@ - #include "cp-abi.h" - #include "gdb_assert.h" - #include "hashtab.h" -+#include "observer.h" -+#include "dwarf2expr.h" -+#include "dwarf2loc.h" - - - /* Initialize BADNESS constants. */ -@@ -144,7 +147,16 @@ static void print_bit_vector (B_TYPE *, - static void print_arg_types (struct field *, int, int); - static void dump_fn_fieldlists (struct type *, int); - static void print_cplus_stuff (struct type *, int); -+static LONGEST type_length_get (struct type *type, struct type *target_type, -+ int full_span); - -+#if 0 -+/* The hash table holding all discardable `struct type *' references. */ -+static htab_t type_discardable_table; -+ -+/* Current type_discardable_check pass used for TYPE_DISCARDABLE_AGE. */ -+static int type_discardable_age_current; -+#endif - /* Allocate a new OBJFILE-associated type structure and fill it - with some defaults. Space for the type structure is allocated -@@ -175,6 +187,43 @@ alloc_type (struct objfile *objfile) - return type; +diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c +index 1ada504..ec1ef46 100644 +--- a/gdb/gdbarch.c ++++ b/gdb/gdbarch.c +@@ -263,6 +263,16 @@ struct gdbarch + gdbarch_get_siginfo_type_ftype *get_siginfo_type; + gdbarch_record_special_symbol_ftype *record_special_symbol; + gdbarch_get_syscall_number_ftype *get_syscall_number; ++ const char * stap_integer_prefix; ++ const char * stap_integer_sufix; ++ const char * stap_register_prefix; ++ const char * stap_register_sufix; ++ const char * stap_register_indirection_prefix; ++ const char * stap_register_indirection_sufix; ++ const char * stap_gdb_register_prefix; ++ const char * stap_gdb_register_sufix; ++ gdbarch_stap_is_single_operand_ftype *stap_is_single_operand; ++ gdbarch_stap_parse_special_token_ftype *stap_parse_special_token; + int has_global_solist; + int has_global_breakpoints; + gdbarch_has_shared_address_space_ftype *has_shared_address_space; +@@ -418,6 +428,16 @@ struct gdbarch startup_gdbarch = + 0, /* get_siginfo_type */ + 0, /* record_special_symbol */ + 0, /* get_syscall_number */ ++ 0, /* stap_integer_prefix */ ++ 0, /* stap_integer_sufix */ ++ 0, /* stap_register_prefix */ ++ 0, /* stap_register_sufix */ ++ 0, /* stap_register_indirection_prefix */ ++ 0, /* stap_register_indirection_sufix */ ++ 0, /* stap_gdb_register_prefix */ ++ 0, /* stap_gdb_register_sufix */ ++ 0, /* stap_is_single_operand */ ++ 0, /* stap_parse_special_token */ + 0, /* has_global_solist */ + 0, /* has_global_breakpoints */ + default_has_shared_address_space, /* has_shared_address_space */ +@@ -707,6 +727,16 @@ verify_gdbarch (struct gdbarch *gdbarch) + /* Skip verify of get_siginfo_type, has predicate. */ + /* Skip verify of record_special_symbol, has predicate. */ + /* Skip verify of get_syscall_number, has predicate. */ ++ /* Skip verify of stap_integer_prefix, invalid_p == 0 */ ++ /* Skip verify of stap_integer_sufix, invalid_p == 0 */ ++ /* Skip verify of stap_register_prefix, invalid_p == 0 */ ++ /* Skip verify of stap_register_sufix, invalid_p == 0 */ ++ /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */ ++ /* Skip verify of stap_register_indirection_sufix, invalid_p == 0 */ ++ /* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */ ++ /* Skip verify of stap_gdb_register_sufix, invalid_p == 0 */ ++ /* Skip verify of stap_is_single_operand, has predicate. */ ++ /* Skip verify of stap_parse_special_token, has predicate. */ + /* Skip verify of has_global_solist, invalid_p == 0 */ + /* Skip verify of has_global_breakpoints, invalid_p == 0 */ + /* Skip verify of has_shared_address_space, invalid_p == 0 */ +@@ -1240,6 +1270,42 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) + "gdbarch_dump: stabs_argument_has_addr = <%s>\n", + host_address_to_string (gdbarch->stabs_argument_has_addr)); + fprintf_unfiltered (file, ++ "gdbarch_dump: stap_gdb_register_prefix = %s\n", ++ gdbarch->stap_gdb_register_prefix); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_gdb_register_sufix = %s\n", ++ gdbarch->stap_gdb_register_sufix); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_integer_prefix = %s\n", ++ gdbarch->stap_integer_prefix); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_integer_sufix = %s\n", ++ gdbarch->stap_integer_sufix); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n", ++ gdbarch_stap_is_single_operand_p (gdbarch)); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_is_single_operand = <%s>\n", ++ host_address_to_string (gdbarch->stap_is_single_operand)); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: gdbarch_stap_parse_special_token_p() = %d\n", ++ gdbarch_stap_parse_special_token_p (gdbarch)); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_parse_special_token = <%s>\n", ++ host_address_to_string (gdbarch->stap_parse_special_token)); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_register_indirection_prefix = %s\n", ++ gdbarch->stap_register_indirection_prefix); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_register_indirection_sufix = %s\n", ++ gdbarch->stap_register_indirection_sufix); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_register_prefix = %s\n", ++ gdbarch->stap_register_prefix); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: stap_register_sufix = %s\n", ++ gdbarch->stap_register_sufix); ++ fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_static_transform_name_p() = %d\n", + gdbarch_static_transform_name_p (gdbarch)); + fprintf_unfiltered (file, +@@ -3759,6 +3825,190 @@ set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, + gdbarch->get_syscall_number = get_syscall_number; } -+#if 0 -+/* Declare TYPE as discardable on next garbage collection by free_all_types. -+ You must call type_mark_used during each free_all_types to protect TYPE from -+ being deallocated. */ ++const char * ++gdbarch_stap_integer_prefix (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_integer_prefix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_prefix called\n"); ++ return gdbarch->stap_integer_prefix; ++} + -+static void -+set_type_as_discardable (struct type *type) ++void ++set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch, ++ const char * stap_integer_prefix) +{ -+ void **slot; ++ gdbarch->stap_integer_prefix = stap_integer_prefix; ++} + -+ gdb_assert (!TYPE_DISCARDABLE (type)); ++const char * ++gdbarch_stap_integer_sufix (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_integer_sufix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_sufix called\n"); ++ return gdbarch->stap_integer_sufix; ++} + -+ TYPE_DISCARDABLE (type) = 1; -+ TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current; ++void ++set_gdbarch_stap_integer_sufix (struct gdbarch *gdbarch, ++ const char * stap_integer_sufix) ++{ ++ gdbarch->stap_integer_sufix = stap_integer_sufix; ++} + -+ slot = htab_find_slot (type_discardable_table, type, INSERT); -+ gdb_assert (!*slot); -+ *slot = type; ++const char * ++gdbarch_stap_register_prefix (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_register_prefix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_prefix called\n"); ++ return gdbarch->stap_register_prefix; +} -+#endif + -+/* Allocate a new type like alloc_type but preserve for it the discardability -+ state of PARENT_TYPE. */ ++void ++set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch, ++ const char * stap_register_prefix) ++{ ++ gdbarch->stap_register_prefix = stap_register_prefix; ++} + -+static struct type * -+alloc_type_as_parent (struct type *parent_type) ++const char * ++gdbarch_stap_register_sufix (struct gdbarch *gdbarch) +{ -+ struct type *new_type = alloc_type_copy (parent_type); ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_register_sufix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_sufix called\n"); ++ return gdbarch->stap_register_sufix; ++} + -+#if 0 -+ if (TYPE_DISCARDABLE (parent_type)) -+ set_type_as_discardable (new_type); -+#endif ++void ++set_gdbarch_stap_register_sufix (struct gdbarch *gdbarch, ++ const char * stap_register_sufix) ++{ ++ gdbarch->stap_register_sufix = stap_register_sufix; ++} + -+ return new_type; ++const char * ++gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_prefix called\n"); ++ return gdbarch->stap_register_indirection_prefix; +} + - /* Allocate a new GDBARCH-associated type structure and fill it - with some defaults. Space for the type structure is allocated - on the heap. */ -@@ -300,7 +349,7 @@ make_pointer_type (struct type *type, st - - if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ - { -- ntype = alloc_type_copy (type); -+ ntype = alloc_type_as_parent (type); - if (typeptr) - *typeptr = ntype; - } -@@ -377,7 +426,7 @@ make_reference_type (struct type *type, ++void ++set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch, ++ const char * stap_register_indirection_prefix) ++{ ++ gdbarch->stap_register_indirection_prefix = stap_register_indirection_prefix; ++} ++ ++const char * ++gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_register_indirection_sufix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_sufix called\n"); ++ return gdbarch->stap_register_indirection_sufix; ++} ++ ++void ++set_gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch, ++ const char * stap_register_indirection_sufix) ++{ ++ gdbarch->stap_register_indirection_sufix = stap_register_indirection_sufix; ++} ++ ++const char * ++gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_prefix called\n"); ++ return gdbarch->stap_gdb_register_prefix; ++} ++ ++void ++set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch, ++ const char * stap_gdb_register_prefix) ++{ ++ gdbarch->stap_gdb_register_prefix = stap_gdb_register_prefix; ++} ++ ++const char * ++gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ /* Skip verify of stap_gdb_register_sufix, invalid_p == 0 */ ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_sufix called\n"); ++ return gdbarch->stap_gdb_register_sufix; ++} ++ ++void ++set_gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch, ++ const char * stap_gdb_register_sufix) ++{ ++ gdbarch->stap_gdb_register_sufix = stap_gdb_register_sufix; ++} ++ ++int ++gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ return gdbarch->stap_is_single_operand != NULL; ++} ++ ++int ++gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) ++{ ++ gdb_assert (gdbarch != NULL); ++ gdb_assert (gdbarch->stap_is_single_operand != NULL); ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_is_single_operand called\n"); ++ return gdbarch->stap_is_single_operand (gdbarch, s); ++} ++ ++void ++set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, ++ gdbarch_stap_is_single_operand_ftype stap_is_single_operand) ++{ ++ gdbarch->stap_is_single_operand = stap_is_single_operand; ++} ++ ++int ++gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ return gdbarch->stap_parse_special_token != NULL; ++} ++ ++int ++gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p) ++{ ++ gdb_assert (gdbarch != NULL); ++ gdb_assert (gdbarch->stap_parse_special_token != NULL); ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_parse_special_token called\n"); ++ return gdbarch->stap_parse_special_token (gdbarch, p); ++} ++ ++void ++set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, ++ gdbarch_stap_parse_special_token_ftype stap_parse_special_token) ++{ ++ gdbarch->stap_parse_special_token = stap_parse_special_token; ++} ++ + int + gdbarch_has_global_solist (struct gdbarch *gdbarch) + { +diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h +index c257c63..eeb8e62 100644 +--- a/gdb/gdbarch.h ++++ b/gdb/gdbarch.h +@@ -55,6 +55,7 @@ struct core_regset_section; + struct syscall; + struct agent_expr; + struct axs_value; ++struct stap_parse_info; + + /* The architecture associated with the connection to the target. + +@@ -963,6 +964,125 @@ typedef LONGEST (gdbarch_get_syscall_number_ftype) (struct gdbarch *gdbarch, pti + extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch, ptid_t ptid); + extern void set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number); - if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ - { -- ntype = alloc_type_copy (type); -+ ntype = alloc_type_as_parent (type); ++/* SystemTap related fields and functions. ++ Prefix used to mark an integer constant on the architecture's assembly ++ For example, on x86 integer constants are written as: ++ ++ $10 ;; integer constant 10 ++ ++ in this case, this prefix would be the character `$'. */ ++ ++extern const char * gdbarch_stap_integer_prefix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch, const char * stap_integer_prefix); ++ ++/* Sufix used to mark an integer constant on the architecture's assembly. */ ++ ++extern const char * gdbarch_stap_integer_sufix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_integer_sufix (struct gdbarch *gdbarch, const char * stap_integer_sufix); ++ ++/* Prefix used to mark a register name on the architecture's assembly. ++ For example, on x86 the register name is written as: ++ ++ %eax ;; register eax ++ ++ in this case, this prefix would be the character `%'. */ ++ ++extern const char * gdbarch_stap_register_prefix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch, const char * stap_register_prefix); ++ ++/* Sufix used to mark a register name on the architecture's assembly */ ++ ++extern const char * gdbarch_stap_register_sufix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_register_sufix (struct gdbarch *gdbarch, const char * stap_register_sufix); ++ ++/* Prefix used to mark a register indirection on the architecture's assembly. ++ For example, on x86 the register indirection is written as: ++ ++ (%eax) ;; indirecting eax ++ ++ in this case, this prefix would be the charater `('. ++ ++ Please note that we use the indirection prefix also for register ++ displacement, e.g., `4(%eax)' on x86. */ ++ ++extern const char * gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch, const char * stap_register_indirection_prefix); ++ ++/* Sufix used to mark a register indirection on the architecture's assembly. ++ For example, on x86 the register indirection is written as: ++ ++ (%eax) ;; indirecting eax ++ ++ in this case, this prefix would be the charater `)'. ++ ++ Please note that we use the indirection sufix also for register ++ displacement, e.g., `4(%eax)' on x86. */ ++ ++extern const char * gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch, const char * stap_register_indirection_sufix); ++ ++/* Prefix used to name a register using GDB's nomenclature. ++ ++ For example, on PPC a register is represented by a number in the assembly ++ language (e.g., `10' is the 10th general-purpose register). However, ++ inside GDB this same register has an `r' appended to its name, so the 10th ++ register would be represented as `r10' internally. */ ++ ++extern const char * gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch, const char * stap_gdb_register_prefix); ++ ++/* Sufix used to name a register using GDB's nomenclature. */ ++ ++extern const char * gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch); ++extern void set_gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch, const char * stap_gdb_register_sufix); ++ ++/* Check if S is a single operand. ++ ++ Single operands can be: ++ - Literal integers, e.g. `$10' on x86 ++ - Register access, e.g. `%eax' on x86 ++ - Register indirection, e.g. `(%eax)' on x86 ++ - Register displacement, e.g. `4(%eax)' on x86 ++ ++ This function should check for these patterns on the string ++ and return 1 if some were found, or zero otherwise. Please try to match ++ as much info as you can from the string, i.e., if you have to match ++ something like `(%', do not match just the `('. */ ++ ++extern int gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch); ++ ++typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s); ++extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s); ++extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand); ++ ++/* Function used to handle a "special case" in the parser. ++ ++ A "special case" is considered to be an unknown token, i.e., a token ++ that the parser does not know how to parse. A good example of special ++ case would be ARM's register displacement syntax: ++ ++ [R0, #4] ;; displacing R0 by 4 ++ ++ Since the parser assumes that a register displacement is of the form: ++ ++ ++ ++ it means that it will not be able to recognize and parse this odd syntax. ++ Therefore, we should add a special case function that will handle this token. ++ ++ This function should generate the proper expression form of the expression ++ using GDB's internal expression mechanism (e.g., `write_exp_elt_opcode' ++ and so on). It should also return 1 if the parsing was successful, or zero ++ if the token was not recognized as a special token (in this case, returning ++ zero means that the special parser is deferring the parsing to the generic ++ parser), and should advance the buffer pointer (p->arg). */ ++ ++extern int gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch); ++ ++typedef int (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p); ++extern int gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p); ++extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token); ++ + /* True if the list of shared libraries is one and only for all + processes, as opposed to a list of shared libraries per inferior. + This usually means that all processes, although may or may not share +diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh +index 0c3344f..5343ace 100755 +--- a/gdb/gdbarch.sh ++++ b/gdb/gdbarch.sh +@@ -787,6 +787,101 @@ M:void:record_special_symbol:struct objfile *objfile, asymbol *sym:objfile, sym + # Get architecture-specific system calls information from registers. + M:LONGEST:get_syscall_number:ptid_t ptid:ptid + ++# SystemTap related fields and functions. ++ ++# Prefix used to mark an integer constant on the architecture's assembly ++# For example, on x86 integer constants are written as: ++# ++# \$10 ;; integer constant 10 ++# ++# in this case, this prefix would be the character \`\$\'. ++v:const char *:stap_integer_prefix:::0:0::0:gdbarch->stap_integer_prefix ++ ++# Sufix used to mark an integer constant on the architecture's assembly. ++v:const char *:stap_integer_sufix:::0:0::0:gdbarch->stap_integer_sufix ++ ++# Prefix used to mark a register name on the architecture's assembly. ++# For example, on x86 the register name is written as: ++# ++# \%eax ;; register eax ++# ++# in this case, this prefix would be the character \`\%\'. ++v:const char *:stap_register_prefix:::0:0::0:gdbarch->stap_register_prefix ++ ++# Sufix used to mark a register name on the architecture's assembly ++v:const char *:stap_register_sufix:::0:0::0:gdbarch->stap_register_sufix ++ ++# Prefix used to mark a register indirection on the architecture's assembly. ++# For example, on x86 the register indirection is written as: ++# ++# \(\%eax\) ;; indirecting eax ++# ++# in this case, this prefix would be the charater \`\(\'. ++# ++# Please note that we use the indirection prefix also for register ++# displacement, e.g., \`4\(\%eax\)\' on x86. ++v:const char *:stap_register_indirection_prefix:::0:0::0:gdbarch->stap_register_indirection_prefix ++ ++# Sufix used to mark a register indirection on the architecture's assembly. ++# For example, on x86 the register indirection is written as: ++# ++# \(\%eax\) ;; indirecting eax ++# ++# in this case, this prefix would be the charater \`\)\'. ++# ++# Please note that we use the indirection sufix also for register ++# displacement, e.g., \`4\(\%eax\)\' on x86. ++v:const char *:stap_register_indirection_sufix:::0:0::0:gdbarch->stap_register_indirection_sufix ++ ++# Prefix used to name a register using GDB's nomenclature. ++# ++# For example, on PPC a register is represented by a number in the assembly ++# language (e.g., \`10\' is the 10th general-purpose register). However, ++# inside GDB this same register has an \`r\' appended to its name, so the 10th ++# register would be represented as \`r10\' internally. ++v:const char *:stap_gdb_register_prefix:::0:0::0:gdbarch->stap_gdb_register_prefix ++ ++# Sufix used to name a register using GDB's nomenclature. ++v:const char *:stap_gdb_register_sufix:::0:0::0:gdbarch->stap_gdb_register_sufix ++ ++# Check if S is a single operand. ++# ++# Single operands can be: ++# \- Literal integers, e.g. \`\$10\' on x86 ++# \- Register access, e.g. \`\%eax\' on x86 ++# \- Register indirection, e.g. \`\(\%eax\)\' on x86 ++# \- Register displacement, e.g. \`4\(\%eax\)\' on x86 ++# ++# This function should check for these patterns on the string ++# and return 1 if some were found, or zero otherwise. Please try to match ++# as much info as you can from the string, i.e., if you have to match ++# something like \`\(\%\', do not match just the \`\(\'. ++M:int:stap_is_single_operand:const char *s:s ++ ++# Function used to handle a "special case" in the parser. ++# ++# A "special case" is considered to be an unknown token, i.e., a token ++# that the parser does not know how to parse. A good example of special ++# case would be ARM's register displacement syntax: ++# ++# [R0, #4] ;; displacing R0 by 4 ++# ++# Since the parser assumes that a register displacement is of the form: ++# ++# ++# ++# it means that it will not be able to recognize and parse this odd syntax. ++# Therefore, we should add a special case function that will handle this token. ++# ++# This function should generate the proper expression form of the expression ++# using GDB\'s internal expression mechanism (e.g., \`write_exp_elt_opcode\' ++# and so on). It should also return 1 if the parsing was successful, or zero ++# if the token was not recognized as a special token (in this case, returning ++# zero means that the special parser is deferring the parsing to the generic ++# parser), and should advance the buffer pointer (p->arg). ++M:int:stap_parse_special_token:struct stap_parse_info *p:p ++ ++ + # True if the list of shared libraries is one and only for all + # processes, as opposed to a list of shared libraries per inferior. + # This usually means that all processes, although may or may not share +@@ -946,6 +1041,7 @@ struct core_regset_section; + struct syscall; + struct agent_expr; + struct axs_value; ++struct stap_parse_info; + + /* The architecture associated with the connection to the target. + +diff --git a/gdb/gdbinit.in b/gdb/gdbinit.in +index ffb7f53..a2e7e94 100644 +--- a/gdb/gdbinit.in ++++ b/gdb/gdbinit.in +@@ -1,5 +1,15 @@ + echo Setting up the environment for debugging gdb.\n + ++# Set up the Python library and "require" command. ++python ++from os.path import abspath ++gdb.datadir = abspath ('@srcdir@/python/lib') ++gdb.pythonlibdir = gdb.datadir ++gdb.__path__ = [gdb.datadir + '/gdb'] ++sys.path.insert(0, gdb.datadir) ++end ++source @srcdir@/python/lib/gdb/__init__.py ++ + set complaints 1 + + b internal_error +diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c +index d0cb678..8b8b03d 100644 +--- a/gdb/gdbtypes.c ++++ b/gdb/gdbtypes.c +@@ -39,6 +39,9 @@ + #include "cp-abi.h" + #include "gdb_assert.h" + #include "hashtab.h" ++#include "observer.h" ++#include "dwarf2expr.h" ++#include "dwarf2loc.h" + + + /* Initialize BADNESS constants. */ +@@ -144,7 +147,16 @@ static void print_bit_vector (B_TYPE *, int); + static void print_arg_types (struct field *, int, int); + static void dump_fn_fieldlists (struct type *, int); + static void print_cplus_stuff (struct type *, int); ++static LONGEST type_length_get (struct type *type, struct type *target_type, ++ int full_span); + ++#if 0 ++/* The hash table holding all discardable `struct type *' references. */ ++static htab_t type_discardable_table; ++ ++/* Current type_discardable_check pass used for TYPE_DISCARDABLE_AGE. */ ++static int type_discardable_age_current; ++#endif + + /* Allocate a new OBJFILE-associated type structure and fill it + with some defaults. Space for the type structure is allocated +@@ -175,6 +187,43 @@ alloc_type (struct objfile *objfile) + return type; + } + ++#if 0 ++/* Declare TYPE as discardable on next garbage collection by free_all_types. ++ You must call type_mark_used during each free_all_types to protect TYPE from ++ being deallocated. */ ++ ++static void ++set_type_as_discardable (struct type *type) ++{ ++ void **slot; ++ ++ gdb_assert (!TYPE_DISCARDABLE (type)); ++ ++ TYPE_DISCARDABLE (type) = 1; ++ TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current; ++ ++ slot = htab_find_slot (type_discardable_table, type, INSERT); ++ gdb_assert (!*slot); ++ *slot = type; ++} ++#endif ++ ++/* Allocate a new type like alloc_type but preserve for it the discardability ++ state of PARENT_TYPE. */ ++ ++static struct type * ++alloc_type_as_parent (struct type *parent_type) ++{ ++ struct type *new_type = alloc_type_copy (parent_type); ++ ++#if 0 ++ if (TYPE_DISCARDABLE (parent_type)) ++ set_type_as_discardable (new_type); ++#endif ++ ++ return new_type; ++} ++ + /* Allocate a new GDBARCH-associated type structure and fill it + with some defaults. Space for the type structure is allocated + on the heap. */ +@@ -300,7 +349,7 @@ make_pointer_type (struct type *type, struct type **typeptr) + + if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ + { +- ntype = alloc_type_copy (type); ++ ntype = alloc_type_as_parent (type); + if (typeptr) + *typeptr = ntype; + } +@@ -377,7 +426,7 @@ make_reference_type (struct type *type, struct type **typeptr) + + if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ + { +- ntype = alloc_type_copy (type); ++ ntype = alloc_type_as_parent (type); if (typeptr) *typeptr = ntype; } -@@ -748,6 +797,7 @@ create_range_type (struct type *result_t +@@ -750,6 +799,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_LOW_BOUND (result_type) = low_bound; TYPE_HIGH_BOUND (result_type) = high_bound; @@ -3741,7 +4219,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c if (low_bound >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -891,26 +941,31 @@ create_array_type (struct type *result_t +@@ -893,26 +943,31 @@ create_array_type (struct type *result_type, TYPE_CODE (result_type) = TYPE_CODE_ARRAY; TYPE_TARGET_TYPE (result_type) = element_type; @@ -3786,7 +4264,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c return result_type; } -@@ -1439,6 +1494,105 @@ stub_noname_complaint (void) +@@ -1441,6 +1496,105 @@ stub_noname_complaint (void) complaint (&symfile_complaints, _("stub type has NULL name")); } @@ -3823,7 +4301,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c + /* It may happen for wrong DWARF annotations returning garbage data. */ + if (count < 0) + warning (_("Range for type %s has invalid bounds %s..%s"), -+ TYPE_NAME (type), plongest (TYPE_LOW_BOUND (range_type)), ++ TYPE_ERROR_NAME (type), plongest (TYPE_LOW_BOUND (range_type)), + plongest (TYPE_HIGH_BOUND (range_type))); + /* The code below does not handle count == 0 right. */ + if (count <= 0) @@ -3892,7 +4370,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c /* Find the real type of TYPE. This function returns the real type, after removing all layers of typedefs, and completing opaque or stub types. Completion changes the TYPE argument, but stripping of -@@ -1601,52 +1755,37 @@ check_typedef (struct type *type) +@@ -1607,52 +1761,37 @@ check_typedef (struct type *type) } } @@ -3966,7 +4444,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c TYPE_TARGET_STUB (type) = 0; } else if (TYPE_CODE (type) == TYPE_CODE_RANGE) -@@ -1654,6 +1793,7 @@ check_typedef (struct type *type) +@@ -1660,6 +1799,7 @@ check_typedef (struct type *type) TYPE_LENGTH (type) = TYPE_LENGTH (target_type); TYPE_TARGET_STUB (type) = 0; } @@ -3974,7 +4452,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c } type = make_qualified_type (type, instance_flags, NULL); -@@ -3292,33 +3432,42 @@ type_pair_eq (const void *item_lhs, cons +@@ -3309,33 +3449,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) } /* Allocate the hash table used by copy_type_recursive to walk @@ -4032,7 +4510,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c return type; /* This type shouldn't be pointing to any types in other objfiles; -@@ -3333,9 +3482,10 @@ copy_type_recursive (struct objfile *obj +@@ -3350,9 +3499,10 @@ copy_type_recursive (struct objfile *objfile, new_type = alloc_type_arch (get_type_arch (type)); /* We must add the new type to the hash table immediately, in case @@ -4046,7 +4524,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c stored->old = type; stored->new = new_type; *slot = stored; -@@ -3346,6 +3496,21 @@ copy_type_recursive (struct objfile *obj +@@ -3363,6 +3513,21 @@ copy_type_recursive (struct objfile *objfile, TYPE_OBJFILE_OWNED (new_type) = 0; TYPE_OWNER (new_type).gdbarch = get_type_arch (type); @@ -4068,7 +4546,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c if (TYPE_NAME (type)) TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); if (TYPE_TAG_NAME (type)) -@@ -3354,12 +3519,48 @@ copy_type_recursive (struct objfile *obj +@@ -3371,12 +3536,48 @@ copy_type_recursive (struct objfile *objfile, TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); @@ -4117,7 +4595,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); for (i = 0; i < nfields; i++) { -@@ -3368,8 +3569,8 @@ copy_type_recursive (struct objfile *obj +@@ -3385,8 +3586,8 @@ copy_type_recursive (struct objfile *objfile, TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); if (TYPE_FIELD_TYPE (type, i)) TYPE_FIELD_TYPE (new_type, i) @@ -4128,7 +4606,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c if (TYPE_FIELD_NAME (type, i)) TYPE_FIELD_NAME (new_type, i) = xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -3396,24 +3597,184 @@ copy_type_recursive (struct objfile *obj +@@ -3413,24 +3614,184 @@ copy_type_recursive (struct objfile *objfile, } } @@ -4320,7 +4798,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c /* Maybe copy the type_specific bits. NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -3430,6 +3791,17 @@ copy_type_recursive (struct objfile *obj +@@ -3447,6 +3808,17 @@ copy_type_recursive (struct objfile *objfile, return new_type; } @@ -4338,7 +4816,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c /* Make a copy of the given TYPE, except that the pointer & reference types are not preserved. -@@ -3452,6 +3824,201 @@ copy_type (const struct type *type) +@@ -3469,6 +3841,201 @@ copy_type (const struct type *type) return new_type; } @@ -4540,7 +5018,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c /* Helper functions to initialize architecture-specific types. */ -@@ -3984,6 +4551,13 @@ void +@@ -4001,6 +4568,13 @@ void _initialize_gdbtypes (void) { gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); @@ -4554,10 +5032,10 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.c objfile_type_data = register_objfile_data (); add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, -Index: gdb-7.3.50.20110722/gdb/gdbtypes.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/gdbtypes.h 2011-07-05 15:36:41.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/gdbtypes.h 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h +index 69f6b46..889d39e 100644 +--- a/gdb/gdbtypes.h ++++ b/gdb/gdbtypes.h @@ -215,6 +215,11 @@ enum type_instance_flag_value #define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) @@ -4621,7 +5099,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h /* Constant type. If this is set, the corresponding type has a const modifier. */ -@@ -400,6 +449,15 @@ struct main_type +@@ -401,6 +450,15 @@ struct main_type /* True if this type was declared with "class" rather than "struct". */ unsigned int flag_declared_class : 1; @@ -4637,7 +5115,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h /* A discriminant telling us which field of the type_specific union is being used for this type, if any. */ -@@ -473,6 +531,20 @@ struct main_type +@@ -474,6 +532,20 @@ struct main_type struct type *target_type; @@ -4658,7 +5136,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h /* For structure and union types, a description of each field. For set and pascal array types, there is one "field", whose type is the domain type of the set or array. -@@ -547,13 +619,34 @@ struct main_type +@@ -554,13 +626,34 @@ struct main_type struct range_bounds { @@ -4698,7 +5176,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h /* Flags indicating whether the values of low and high are valid. When true, the respective range value is -@@ -929,9 +1022,9 @@ extern void allocate_gnat_aux_type (stru +@@ -1012,9 +1105,9 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_CHAIN(thistype) (thistype)->chain @@ -4711,7 +5189,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ #define TYPE_LENGTH(thistype) (thistype)->length /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real -@@ -939,11 +1032,16 @@ extern void allocate_gnat_aux_type (stru +@@ -1022,11 +1115,16 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields @@ -4730,7 +5208,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h #define TYPE_LOW_BOUND_UNDEFINED(range_type) \ TYPE_RANGE_DATA(range_type)->low_undefined #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \ -@@ -960,7 +1058,14 @@ extern void allocate_gnat_aux_type (stru +@@ -1043,7 +1141,14 @@ extern void allocate_gnat_aux_type (struct type *); (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ @@ -4746,7 +5224,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h /* C++ */ -@@ -1385,6 +1490,18 @@ extern struct type *create_array_type (s +@@ -1479,6 +1584,18 @@ extern struct type *create_array_type (struct type *, struct type *, struct type *); extern struct type *lookup_array_range_type (struct type *, int, int); @@ -4765,7 +5243,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h extern struct type *create_string_type (struct type *, struct type *, struct type *); extern struct type *lookup_string_range_type (struct type *, int, int); -@@ -1430,6 +1547,10 @@ extern int is_public_ancestor (struct ty +@@ -1524,6 +1641,10 @@ extern int is_public_ancestor (struct type *, struct type *); extern int is_unique_ancestor (struct type *, struct value *); @@ -4776,7 +5254,7 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h /* Overload resolution */ #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1502,10 +1623,13 @@ extern void maintenance_print_type (char +@@ -1599,10 +1720,13 @@ extern void maintenance_print_type (char *, int); extern htab_t create_copied_types_hash (struct objfile *objfile); @@ -4792,559 +5270,384 @@ Index: gdb-7.3.50.20110722/gdb/gdbtypes.h +#endif + #endif /* GDBTYPES_H */ -Index: gdb-7.3.50.20110722/gdb/i386-linux-nat.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/i386-linux-nat.c 2011-02-27 17:25:37.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/i386-linux-nat.c 2011-07-29 22:52:02.000000000 +0200 -@@ -649,22 +649,13 @@ i386_linux_store_inferior_registers (str +diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c +index a48e58e..9e60ff4 100644 +--- a/gdb/i386-linux-nat.c ++++ b/gdb/i386-linux-nat.c +@@ -709,8 +709,8 @@ i386_linux_dr_get_status (void) + return i386_linux_dr_get (inferior_ptid, DR_STATUS); } - --/* Support for debug registers. */ -- --static unsigned long i386_linux_dr[DR_CONTROL + 1]; -- - /* Get debug register REGNUM value from only the one LWP of PTID. */ - - static unsigned long --i386_linux_dr_get (ptid_t ptid, int regnum) -+i386_linux_dr_get (int tid, int regnum) - { -- int tid; - unsigned long value; - -- tid = TIDGET (ptid); -- if (tid == 0) -- tid = PIDGET (ptid); -- - /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the - ptrace call fails breaks debugging remote targets. The correct - way to fix this is to add the hardware breakpoint and watchpoint -@@ -686,14 +677,8 @@ i386_linux_dr_get (ptid_t ptid, int regn - /* Set debug register REGNUM to VALUE in only the one LWP of PTID. */ +-/* Callback for iterate_over_lwps. Update the debug registers of +- LWP. */ ++/* Callback for linux_nat_iterate_watchpoint_lwps. Update the debug registers ++ of LWP. */ + static int + update_debug_registers_callback (struct lwp_info *lwp, void *arg) +@@ -736,9 +736,7 @@ update_debug_registers_callback (struct lwp_info *lwp, void *arg) static void --i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) -+i386_linux_dr_set (int tid, int regnum, unsigned long value) + i386_linux_dr_set_control (unsigned long control) { -- int tid; -- -- tid = TIDGET (ptid); -- if (tid == 0) -- tid = PIDGET (ptid); +- ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid)); - - errno = 0; - ptrace (PTRACE_POKEUSER, tid, - offsetof (struct user, u_debugreg[regnum]), value); -@@ -701,35 +686,78 @@ i386_linux_dr_set (ptid_t ptid, int regn - perror_with_name (_("Couldn't write debug register")); +- iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL); ++ linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL); + } + + /* Set address REGNUM (zero based) to ADDR in all LWPs of the current +@@ -751,7 +749,7 @@ i386_linux_dr_set_addr (int regnum, CORE_ADDR addr) + + gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); + +- iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL); ++ linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL); + } + + /* Called when resuming a thread. +@@ -773,6 +771,9 @@ i386_linux_prepare_to_resume (struct lwp_info *lwp) + struct i386_debug_reg_state *state = i386_debug_reg_state (); + int i; + ++ /* See amd64_linux_prepare_to_resume for Linux kernel note on ++ i386_linux_dr_set calls ordering. */ ++ + for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) + if (state->dr_ref_count[i] > 0) + { +diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c +index 7c3962e..33f6dc6 100644 +--- a/gdb/i386-linux-tdep.c ++++ b/gdb/i386-linux-tdep.c +@@ -904,6 +904,15 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) + i386_linux_get_syscall_number); + + set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type); ++ ++ /* SystemTap variables and functions. */ ++ set_gdbarch_stap_integer_prefix (gdbarch, "$"); ++ set_gdbarch_stap_register_prefix (gdbarch, "%"); ++ set_gdbarch_stap_register_indirection_prefix (gdbarch, "("); ++ set_gdbarch_stap_register_indirection_sufix (gdbarch, ")"); ++ set_gdbarch_stap_is_single_operand (gdbarch, i386_stap_is_single_operand); ++ set_gdbarch_stap_parse_special_token (gdbarch, ++ i386_stap_parse_special_token); + } + + /* Provide a prototype to silence -Wmissing-prototypes. */ +diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c +index 593401b..bb31d9e 100644 +--- a/gdb/i386-nat.c ++++ b/gdb/i386-nat.c +@@ -25,6 +25,7 @@ + #include "gdbcmd.h" + #include "target.h" + #include "gdb_assert.h" ++#include "inferior.h" + + /* Support for hardware watchpoints and breakpoints using the i386 + debug registers. +@@ -170,14 +171,88 @@ i386_init_dregs (struct i386_debug_reg_state *state) + state->dr_status_mirror = 0; } --/* Set DR_CONTROL to ADDR in all LWPs of LWP_LIST. */ -+/* Helper for i386_linux_dr_set_control. */ +-/* The local mirror of the inferior's debug registers. Currently this +- is a global, but it should really be per-inferior. */ +-static struct i386_debug_reg_state dr_mirror; ++/* Per-inferior data key. */ ++static const struct inferior_data *i386_inferior_data; ++ ++/* Per-inferior data. */ ++struct i386_inferior_data ++ { ++ /* Copy of i386 hardware debug registers for performance reasons. */ ++ struct i386_debug_reg_state state; ++ }; ++ ++/* Per-inferior hook for register_inferior_data_with_cleanup. */ + +static void -+i386_linux_dr_set_control_callback (int tid, void *control_voidp) ++i386_inferior_data_cleanup (struct inferior *inf, void *arg) +{ -+ unsigned long control = *(unsigned long *) control_voidp; ++ struct i386_inferior_data *inf_data = arg; + -+ i386_linux_dr_set (tid, DR_CONTROL, control); ++ xfree (inf_data); +} + -+static void i386_linux_dr_set_addr (int regnum, CORE_ADDR addr); ++/* Get data specific for INFERIOR_PTID LWP. Return special data area ++ for processes being detached. */ + -+/* Set DR_CONTROL to ADDR in all LWPs of CURRENT_INFERIOR. */ - - static void - i386_linux_dr_set_control (unsigned long control) - { -- struct lwp_info *lp; -- ptid_t ptid; -+ int inferior_pid = ptid_get_pid (inferior_ptid); ++static struct i386_inferior_data * ++i386_inferior_data_get (void) ++{ + struct inferior *inf = current_inferior (); - -- i386_linux_dr[DR_CONTROL] = control; -- ALL_LWPS (lp, ptid) -- i386_linux_dr_set (ptid, DR_CONTROL, control); -+ /* The amd64 counterpart and description is amd64_linux_dr_set_control. */ -+ if (inf->pid != inferior_pid) ++ struct i386_inferior_data *inf_data; ++ ++ inf_data = inferior_data (inf, i386_inferior_data); ++ if (inf_data == NULL) + { -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); -+ int i; ++ inf_data = xzalloc (sizeof (*inf_data)); ++ set_inferior_data (current_inferior (), i386_inferior_data, inf_data); ++ } ++ ++ if (inf->pid != ptid_get_pid (inferior_ptid)) ++ { ++ /* INFERIOR_PTID is being detached from the inferior INF. ++ Provide local cache specific for the detached LWP. */ ++ ++ static struct i386_inferior_data detached_inf_data_local; ++ static int detached_inf_pid = -1; + -+ if (!dr_mirror->addr_preset) ++ if (detached_inf_pid != ptid_get_pid (inferior_ptid)) + { -+ dr_mirror->addr_preset = 1; ++ /* Reinitialize the local cache if INFERIOR_PTID is ++ different from the LWP last detached. ++ ++ Linux kernel before 2.6.33 commit ++ 72f674d203cd230426437cdcf7dd6f681dad8b0d ++ will inherit hardware debug registers from parent ++ on fork/vfork/clone. Newer Linux kernels create such tasks with ++ zeroed debug registers. + -+ for (i = 0; i < DR_LASTADDR - DR_FIRSTADDR; i++) -+ i386_linux_dr_set_addr (i, dr_mirror->addr[i]); -+ } -+ } ++ GDB will remove all breakpoints (and watchpoints) from the forked ++ off process. We also need to reset the debug registers in that ++ process to be compatible with the older Linux kernels. + -+ linux_nat_iterate_watchpoint_lwps (i386_linux_dr_set_control_callback, -+ &control); - } - --/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */ -+/* Helper for i386_linux_dr_set_addr. */ ++ Copy the debug registers mirrors into the new process so that all ++ breakpoints and watchpoints can be removed together. The debug ++ registers mirror will become zeroed in the end before detaching ++ the forked off process. */ + -+struct i386_linux_dr_set_addr_data -+ { -+ int regnum; -+ CORE_ADDR addr; -+ }; ++ detached_inf_pid = ptid_get_pid (inferior_ptid); ++ memcpy (&detached_inf_data_local, inf_data, ++ sizeof (detached_inf_data_local)); ++ } + -+static void -+i386_linux_dr_set_addr_callback (int tid, void *datap_voidp) -+{ -+ const struct i386_linux_dr_set_addr_data *datap = datap_voidp; ++ return &detached_inf_data_local; ++ } + -+ i386_linux_dr_set (tid, DR_FIRSTADDR + datap->regnum, datap->addr); ++ return inf_data; +} + -+/* Set address REGNUM (zero based) to ADDR in all LWPs of CURRENT_INFERIOR. -+ */ ++/* Get debug registers state for INFERIOR_PTID, see ++ i386_inferior_data_get. */ - static void - i386_linux_dr_set_addr (int regnum, CORE_ADDR addr) + struct i386_debug_reg_state * + i386_debug_reg_state (void) { -- struct lwp_info *lp; -- ptid_t ptid; -+ struct i386_linux_dr_set_addr_data data; +- return &dr_mirror; ++ return &i386_inferior_data_get ()->state; + } - gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); - -- i386_linux_dr[DR_FIRSTADDR + regnum] = addr; -- ALL_LWPS (lp, ptid) -- i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); -+ data.regnum = regnum; -+ data.addr = addr; -+ linux_nat_iterate_watchpoint_lwps (i386_linux_dr_set_addr_callback, &data); - } - --/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */ -+/* Set address REGNUM (zero based) to zero in all LWPs of CURRENT_INFERIOR. -+ */ - - static void - i386_linux_dr_reset_addr (int regnum) -@@ -742,36 +770,54 @@ i386_linux_dr_reset_addr (int regnum) - static unsigned long - i386_linux_dr_get_status (void) - { -- return i386_linux_dr_get (inferior_ptid, DR_STATUS); -+ int tid; -+ -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); -+ -+ return i386_linux_dr_get (tid, DR_STATUS); - } - --/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST. */ -+/* Helper for i386_linux_dr_unset_status. */ - - static void --i386_linux_dr_unset_status (unsigned long mask) -+i386_linux_dr_unset_status_callback (int tid, void *mask_voidp) + /* Whether or not to print the mirrored debug registers. */ +@@ -230,7 +305,9 @@ static int i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state + void + i386_cleanup_dregs (void) { -- struct lwp_info *lp; -- ptid_t ptid; -- -- ALL_LWPS (lp, ptid) -- { -- unsigned long value; -+ unsigned long mask = *(unsigned long *) mask_voidp; -+ unsigned long value; - -- value = i386_linux_dr_get (ptid, DR_STATUS); -- value &= ~mask; -- i386_linux_dr_set (ptid, DR_STATUS, value); -- } -+ value = i386_linux_dr_get (tid, DR_STATUS); -+ value &= ~mask; -+ i386_linux_dr_set (tid, DR_STATUS, value); -+} +- i386_init_dregs (&dr_mirror); ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); + -+/* Unset MASK bits in DR_STATUS in all LWPs of CURRENT_INFERIOR. */ -+ -+static void -+i386_linux_dr_unset_status (unsigned long mask) -+{ -+ linux_nat_iterate_watchpoint_lwps (i386_linux_dr_unset_status_callback, -+ &mask); ++ i386_init_dregs (state); } + /* Print the values of the mirrored debug registers. This is called +@@ -494,20 +571,21 @@ Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n"), static void - i386_linux_new_thread (ptid_t ptid) - { -- int i; -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); -+ int i, tid; -+ -+ /* Verify DR_MIRROR is valid. */ -+ gdb_assert (PIDGET (ptid) == PIDGET (inferior_ptid)); -+ -+ tid = TIDGET (ptid); -+ if (tid == 0) -+ tid = PIDGET (ptid); - -- for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) -- i386_linux_dr_set (ptid, i, i386_linux_dr[i]); -+ for (i = 0; i < DR_LASTADDR - DR_FIRSTADDR; i++) -+ i386_linux_dr_set (tid, DR_FIRSTADDR + i, dr_mirror->addr[i]); - -- i386_linux_dr_set (ptid, DR_CONTROL, i386_linux_dr[DR_CONTROL]); -+ i386_linux_dr_set (tid, DR_CONTROL, dr_mirror->control); - } - - -Index: gdb-7.3.50.20110722/gdb/i386-nat.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/i386-nat.c 2011-02-26 23:04:51.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/i386-nat.c 2011-07-29 22:52:02.000000000 +0200 -@@ -25,6 +25,7 @@ - #include "gdbcmd.h" - #include "target.h" - #include "gdb_assert.h" -+#include "inferior.h" - - /* Support for hardware watchpoints and breakpoints using the i386 - debug registers. -@@ -44,7 +45,6 @@ struct i386_dr_low_type i386_dr_low; - #define TARGET_HAS_DR_LEN_8 (i386_dr_low.debug_register_length == 8) - - /* Debug registers' indices. */ --#define DR_NADDR 4 /* The number of debug address registers. */ - #define DR_STATUS 6 /* Index of debug status register (DR6). */ - #define DR_CONTROL 7 /* Index of debug control register (DR7). */ - -@@ -111,49 +111,60 @@ struct i386_dr_low_type i386_dr_low; - - /* The I'th debug register is vacant if its Local and Global Enable - bits are reset in the Debug Control register. */ --#define I386_DR_VACANT(i) \ -- ((dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0) -+ -+static inline int -+i386_dr_vacant (struct i386_dr_mirror *dr_mirror, int i) -+{ -+ return (dr_mirror->control & (3 << (DR_ENABLE_SIZE * i))) == 0; -+} - - /* Locally enable the break/watchpoint in the I'th debug register. */ --#define I386_DR_LOCAL_ENABLE(i) \ -- dr_control_mirror |= (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))) - --/* Globally enable the break/watchpoint in the I'th debug register. */ --#define I386_DR_GLOBAL_ENABLE(i) \ -- dr_control_mirror |= (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))) -+static inline void -+i386_dr_local_enable (struct i386_dr_mirror *dr_mirror, int i) -+{ -+ dr_mirror->control |= 1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * i); -+} - - /* Disable the break/watchpoint in the I'th debug register. */ --#define I386_DR_DISABLE(i) \ -- dr_control_mirror &= ~(3 << (DR_ENABLE_SIZE * (i))) -+ -+static inline void -+i386_dr_disable (struct i386_dr_mirror *dr_mirror, int i) -+{ -+ dr_mirror->control &= ~(3 << (DR_ENABLE_SIZE * i)); -+} - - /* Set in DR7 the RW and LEN fields for the I'th debug register. */ --#define I386_DR_SET_RW_LEN(i,rwlen) \ -- do { \ -- dr_control_mirror &= ~(0x0f << (DR_CONTROL_SHIFT+DR_CONTROL_SIZE*(i))); \ -- dr_control_mirror |= ((rwlen) << (DR_CONTROL_SHIFT+DR_CONTROL_SIZE*(i))); \ -- } while (0) -+ -+static inline void -+i386_dr_set_rw_len (struct i386_dr_mirror *dr_mirror, int i, unsigned rwlen) -+{ -+ dr_mirror->control &= ~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * i)); -+ dr_mirror->control |= rwlen << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * i); -+} - - /* Get from DR7 the RW and LEN fields for the I'th debug register. */ --#define I386_DR_GET_RW_LEN(i) \ -- ((dr_control_mirror >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f) -+ -+static inline unsigned -+i386_dr_get_rw_len (struct i386_dr_mirror *dr_mirror, int i) -+{ -+ return ((dr_mirror->control >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * i)) -+ & 0x0f); -+} - - /* Mask that this I'th watchpoint has triggered. */ - #define I386_DR_WATCH_MASK(i) (1 << (i)) - - /* Did the watchpoint whose address is in the I'th register break? */ --#define I386_DR_WATCH_HIT(i) (dr_status_mirror & I386_DR_WATCH_MASK (i)) -+static inline int -+i386_dr_watch_hit (struct i386_dr_mirror *dr_mirror, int i) -+{ -+ return (dr_mirror->status & I386_DR_WATCH_MASK (i)) != 0; -+} - - /* A macro to loop over all debug registers. */ - #define ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++) - --/* Mirror the inferior's DRi registers. We keep the status and -- control registers separated because they don't hold addresses. */ --static CORE_ADDR dr_mirror[DR_NADDR]; --static unsigned long dr_status_mirror, dr_control_mirror; -- --/* Reference counts for each debug register. */ --static int dr_ref_count[DR_NADDR]; -- - /* Whether or not to print the mirrored debug registers. */ - static int maint_show_dr; - -@@ -195,21 +206,80 @@ static int i386_handle_nonaligned_watchp - - /* Implementation. */ - -+/* Per-inferior data key. */ -+static const struct inferior_data *i386_inferior_data; -+ -+struct i386_inferior_data -+ { -+ /* Copy of i386 hardware debug registers for performance reasons. */ -+ struct i386_dr_mirror dr_mirror; -+ }; -+ -+static void -+i386_inferior_data_cleanup (struct inferior *inf, void *arg) -+{ -+ struct i386_inferior_data *inf_data = arg; -+ -+ xfree (inf_data); -+} -+ -+static struct i386_inferior_data * -+i386_inferior_data_get (void) -+{ -+ struct inferior *inf = current_inferior (); -+ struct i386_inferior_data *inf_data; -+ -+ inf_data = inferior_data (inf, i386_inferior_data); -+ if (inf_data == NULL) -+ { -+ inf_data = xzalloc (sizeof (*inf_data)); -+ set_inferior_data (current_inferior (), i386_inferior_data, inf_data); -+ } -+ -+ if (inf->pid != ptid_get_pid (inferior_ptid)) -+ { -+ static struct i386_inferior_data detached_inf_data_local; -+ static int detached_inf_pid = -1; -+ -+ if (detached_inf_pid != ptid_get_pid (inferior_ptid)) -+ { -+ detached_inf_pid = ptid_get_pid (inferior_ptid); -+ -+ /* Forked processes get a copy of the debug registers. */ -+ memcpy (&detached_inf_data_local, inf_data, -+ sizeof (detached_inf_data_local)); -+ detached_inf_data_local.dr_mirror.addr_preset = 0; -+ } -+ -+ return &detached_inf_data_local; -+ } -+ -+ return inf_data; -+} -+ - /* Clear the reference counts and forget everything we knew about the - debug registers. */ - -+struct i386_dr_mirror * -+i386_dr_mirror_get (void) -+{ -+ return &i386_inferior_data_get ()->dr_mirror; -+} -+ - void - i386_cleanup_dregs (void) + i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state) { -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); int i; - ALL_DEBUG_REGISTERS(i) + ALL_DEBUG_REGISTERS (i) { -- dr_mirror[i] = 0; -- dr_ref_count[i] = 0; -+ dr_mirror->addr[i] = 0; -+ dr_mirror->ref_count[i] = 0; +- if (I386_DR_VACANT (new_state, i) != I386_DR_VACANT (&dr_mirror, i)) ++ if (I386_DR_VACANT (new_state, i) != I386_DR_VACANT (state, i)) + i386_dr_low.set_addr (i, new_state->dr_mirror[i]); + else +- gdb_assert (new_state->dr_mirror[i] == dr_mirror.dr_mirror[i]); ++ gdb_assert (new_state->dr_mirror[i] == state->dr_mirror[i]); } -- dr_control_mirror = 0; -- dr_status_mirror = 0; -+ dr_mirror->addr_preset = 0; -+ dr_mirror->control = 0; -+ dr_mirror->status = 0; + +- if (new_state->dr_control_mirror != dr_mirror.dr_control_mirror) ++ if (new_state->dr_control_mirror != state->dr_control_mirror) + i386_dr_low.set_control (new_state->dr_control_mirror); + +- dr_mirror = *new_state; ++ *state = *new_state; } - /* Print the values of the mirrored debug registers. This is called -@@ -220,6 +290,7 @@ static void - i386_show_dr (const char *func, CORE_ADDR addr, - int len, enum target_hw_bp_type type) + /* Insert a watchpoint to watch a memory region which starts at +@@ -518,10 +596,11 @@ static int + i386_insert_watchpoint (CORE_ADDR addr, int len, int type, + struct expression *cond) { -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); - int addr_size = gdbarch_addr_bit (target_gdbarch) / 8; - int i; - -@@ -239,13 +310,16 @@ i386_show_dr (const char *func, CORE_ADD - : "??unknown??")))); - puts_unfiltered (":\n"); - printf_unfiltered ("\tCONTROL (DR7): %s STATUS (DR6): %s\n", -- phex (dr_control_mirror, 8), phex (dr_status_mirror, 8)); -+ phex (dr_mirror->control, 8), -+ phex (dr_mirror->status, 8)); - ALL_DEBUG_REGISTERS(i) - { - printf_unfiltered ("\ - \tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n", -- i, phex (dr_mirror[i], addr_size), dr_ref_count[i], -- i+1, phex (dr_mirror[i+1], addr_size), dr_ref_count[i+1]); -+ i, phex (dr_mirror->addr[i], addr_size), -+ dr_mirror->ref_count[i], i + 1, -+ phex (dr_mirror->addr[i + 1], addr_size), -+ dr_mirror->ref_count[i + 1]); - i++; - } ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); + int retval; + /* Work on a local copy of the debug registers, and on success, + commit the change back to the inferior. */ +- struct i386_debug_reg_state local_state = dr_mirror; ++ struct i386_debug_reg_state local_state = *state; + + if (type == hw_read) + return 1; /* unsupported */ +@@ -542,7 +621,7 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type, + i386_update_inferior_debug_regs (&local_state); + + if (maint_show_dr) +- i386_show_dr (&dr_mirror, "insert_watchpoint", addr, len, type); ++ i386_show_dr (state, "insert_watchpoint", addr, len, type); + + return retval; } -@@ -313,6 +387,7 @@ Invalid hardware breakpoint length %d in - static int - i386_insert_aligned_watchpoint (CORE_ADDR addr, unsigned len_rw_bits) +@@ -554,10 +633,11 @@ static int + i386_remove_watchpoint (CORE_ADDR addr, int len, int type, + struct expression *cond) { -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); - int i; - - if (!i386_dr_low.set_addr || !i386_dr_low.set_control) -@@ -323,11 +398,10 @@ i386_insert_aligned_watchpoint (CORE_ADD - reuse it for this watchpoint as well (and save a register). */ - ALL_DEBUG_REGISTERS(i) - { -- if (!I386_DR_VACANT (i) -- && dr_mirror[i] == addr -- && I386_DR_GET_RW_LEN (i) == len_rw_bits) -+ if (!i386_dr_vacant (dr_mirror, i) && dr_mirror->addr[i] == addr -+ && i386_dr_get_rw_len (dr_mirror, i) == len_rw_bits) - { -- dr_ref_count[i]++; -+ dr_mirror->ref_count[i]++; - return 0; - } - } -@@ -335,7 +409,7 @@ i386_insert_aligned_watchpoint (CORE_ADD - /* Next, look for a vacant debug register. */ - ALL_DEBUG_REGISTERS(i) - { -- if (I386_DR_VACANT (i)) -+ if (i386_dr_vacant (dr_mirror, i)) - break; - } - -@@ -346,9 +420,9 @@ i386_insert_aligned_watchpoint (CORE_ADD - /* Now set up the register I to watch our region. */ - - /* Record the info in our local mirrored array. */ -- dr_mirror[i] = addr; -- dr_ref_count[i] = 1; -- I386_DR_SET_RW_LEN (i, len_rw_bits); -+ dr_mirror->addr[i] = addr; -+ dr_mirror->ref_count[i] = 1; -+ i386_dr_set_rw_len (dr_mirror, i, len_rw_bits); - /* Note: we only enable the watchpoint locally, i.e. in the current - task. Currently, no i386 target allows or supports global - watchpoints; however, if any target would want that in the -@@ -356,13 +430,13 @@ i386_insert_aligned_watchpoint (CORE_ADD - to enable watchpoints globally or locally, and the code below - should use global or local enable and slow-down flags as - appropriate. */ -- I386_DR_LOCAL_ENABLE (i); -- dr_control_mirror |= DR_LOCAL_SLOWDOWN; -- dr_control_mirror &= I386_DR_CONTROL_MASK; -+ i386_dr_local_enable (dr_mirror, i); -+ dr_mirror->control |= DR_LOCAL_SLOWDOWN; -+ dr_mirror->control &= I386_DR_CONTROL_MASK; - - /* Finally, actually pass the info to the inferior. */ - i386_dr_low.set_addr (i, addr); -- i386_dr_low.set_control (dr_control_mirror); -+ i386_dr_low.set_control (dr_mirror->control); - - /* Only a sanity check for leftover bits (set possibly only by inferior). */ - if (i386_dr_low.unset_status) -@@ -380,21 +454,21 @@ i386_insert_aligned_watchpoint (CORE_ADD ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); + int retval; + /* Work on a local copy of the debug registers, and on success, + commit the change back to the inferior. */ +- struct i386_debug_reg_state local_state = dr_mirror; ++ struct i386_debug_reg_state local_state = *state; + + if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8)) + || addr % len != 0) +@@ -575,7 +655,7 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type, + i386_update_inferior_debug_regs (&local_state); + + if (maint_show_dr) +- i386_show_dr (&dr_mirror, "remove_watchpoint", addr, len, type); ++ i386_show_dr (state, "remove_watchpoint", addr, len, type); + + return retval; + } +@@ -586,11 +666,12 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type, static int - i386_remove_aligned_watchpoint (CORE_ADDR addr, unsigned len_rw_bits) + i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) { -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); - int i, retval = -1; - - ALL_DEBUG_REGISTERS(i) - { -- if (!I386_DR_VACANT (i) -- && dr_mirror[i] == addr -- && I386_DR_GET_RW_LEN (i) == len_rw_bits) -+ if (!i386_dr_vacant (dr_mirror, i) && dr_mirror->addr[i] == addr -+ && i386_dr_get_rw_len (dr_mirror, i) == len_rw_bits) - { -- if (--dr_ref_count[i] == 0) /* no longer in use? */ -+ if (--dr_mirror->ref_count[i] == 0) /* no longer in use? */ - { - /* Reset our mirror. */ -- dr_mirror[i] = 0; -- I386_DR_DISABLE (i); -+ dr_mirror->addr[i] = 0; -+ i386_dr_disable (dr_mirror, i); - /* Reset it in the inferior. */ -- i386_dr_low.set_control (dr_control_mirror); -+ i386_dr_low.set_control (dr_mirror->control); - if (i386_dr_low.reset_addr) - i386_dr_low.reset_addr (i); - } -@@ -556,26 +630,27 @@ i386_region_ok_for_watchpoint (CORE_ADDR ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); + int nregs; + + /* Compute how many aligned watchpoints we would need to cover this + region. */ +- nregs = i386_handle_nonaligned_watchpoint (&dr_mirror, ++ nregs = i386_handle_nonaligned_watchpoint (state, + WP_COUNT, addr, len, hw_write); + return nregs <= DR_NADDR ? 1 : 0; + } +@@ -602,6 +683,7 @@ i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) static int i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) { -+ struct i386_dr_mirror *dr_mirror = i386_dr_mirror_get (); ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); CORE_ADDR addr = 0; int i; int rc = 0; - -- dr_status_mirror = i386_dr_low.get_status (); -+ dr_mirror->status = i386_dr_low.get_status (); - - ALL_DEBUG_REGISTERS(i) - { -- if (I386_DR_WATCH_HIT (i) -+ if (i386_dr_watch_hit (dr_mirror, i) - /* This second condition makes sure DRi is set up for a data - watchpoint, not a hardware breakpoint. The reason is - that GDB doesn't call the target_stopped_data_address - method except for data watchpoints. In other words, I'm - being paranoiac. */ -- && I386_DR_GET_RW_LEN (i) != 0 -+ && i386_dr_get_rw_len (dr_mirror, i) != 0 - /* This third condition makes sure DRi is not vacant, this - avoids false positives in windows-nat.c. */ -- && !I386_DR_VACANT (i)) -+ && !i386_dr_vacant (dr_mirror, i)) - { -- addr = dr_mirror[i]; -+ addr = dr_mirror->addr[i]; +@@ -615,25 +697,24 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) + unsigned control = 0; + + /* In non-stop/async, threads can be running while we change the +- global dr_mirror (and friends). Say, we set a watchpoint, and +- let threads resume. Now, say you delete the watchpoint, or +- add/remove watchpoints such that dr_mirror changes while threads +- are running. On targets that support non-stop, +- inserting/deleting watchpoints updates the global dr_mirror only. +- It does not update the real thread's debug registers; that's only +- done prior to resume. Instead, if threads are running when the +- mirror changes, a temporary and transparent stop on all threads +- is forced so they can get their copy of the debug registers +- updated on re-resume. Now, say, a thread hit a watchpoint before +- having been updated with the new dr_mirror contents, and we +- haven't yet handled the corresponding SIGTRAP. If we trusted +- dr_mirror below, we'd mistake the real trapped address (from the +- last time we had updated debug registers in the thread) with +- whatever was currently in dr_mirror. So to fix this, dr_mirror +- always represents intention, what we _want_ threads to have in +- debug registers. To get at the address and cause of the trap, we +- need to read the state the thread still has in its debug +- registers. ++ STATE (and friends). Say, we set a watchpoint, and let threads ++ resume. Now, say you delete the watchpoint, or add/remove ++ watchpoints such that STATE changes while threads are running. ++ On targets that support non-stop, inserting/deleting watchpoints ++ updates the STATE only. It does not update the real thread's ++ debug registers; that's only done prior to resume. Instead, if ++ threads are running when the mirror changes, a temporary and ++ transparent stop on all threads is forced so they can get their ++ copy of the debug registers updated on re-resume. Now, say, ++ a thread hit a watchpoint before having been updated with the new ++ STATE contents, and we haven't yet handled the corresponding ++ SIGTRAP. If we trusted STATE below, we'd mistake the real ++ trapped address (from the last time we had updated debug ++ registers in the thread) with whatever was currently in STATE. ++ So to fix this, STATE always represents intention, what we _want_ ++ threads to have in debug registers. To get at the address and ++ cause of the trap, we need to read the state the thread still has ++ in its debug registers. + + In sum, always get the current debug register values the current + thread has, instead of trusting the global mirror. If the thread +@@ -663,11 +744,11 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) + addr = i386_dr_low.get_addr (i); rc = 1; if (maint_show_dr) - i386_show_dr ("watchpoint_hit", addr, -1, hw_write); -@@ -689,6 +764,10 @@ i386_use_watchpoints (struct target_ops +- i386_show_dr (&dr_mirror, "watchpoint_hit", addr, -1, hw_write); ++ i386_show_dr (state, "watchpoint_hit", addr, -1, hw_write); + } + } + if (maint_show_dr && addr == 0) +- i386_show_dr (&dr_mirror, "stopped_data_addr", 0, 0, hw_write); ++ i386_show_dr (state, "stopped_data_addr", 0, 0, hw_write); + + if (rc) + *addr_p = addr; +@@ -687,11 +768,12 @@ static int + i386_insert_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) + { ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); + unsigned len_rw = i386_length_and_rw_bits (1, hw_execute); + CORE_ADDR addr = bp_tgt->placed_address; + /* Work on a local copy of the debug registers, and on success, + commit the change back to the inferior. */ +- struct i386_debug_reg_state local_state = dr_mirror; ++ struct i386_debug_reg_state local_state = *state; + int retval = i386_insert_aligned_watchpoint (&local_state, + addr, len_rw) ? EBUSY : 0; + +@@ -699,7 +781,7 @@ i386_insert_hw_breakpoint (struct gdbarch *gdbarch, + i386_update_inferior_debug_regs (&local_state); + + if (maint_show_dr) +- i386_show_dr (&dr_mirror, "insert_hwbp", addr, 1, hw_execute); ++ i386_show_dr (state, "insert_hwbp", addr, 1, hw_execute); + + return retval; + } +@@ -711,11 +793,12 @@ static int + i386_remove_hw_breakpoint (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt) + { ++ struct i386_debug_reg_state *state = i386_debug_reg_state (); + unsigned len_rw = i386_length_and_rw_bits (1, hw_execute); + CORE_ADDR addr = bp_tgt->placed_address; + /* Work on a local copy of the debug registers, and on success, + commit the change back to the inferior. */ +- struct i386_debug_reg_state local_state = dr_mirror; ++ struct i386_debug_reg_state local_state = *state; + int retval = i386_remove_aligned_watchpoint (&local_state, + addr, len_rw); + +@@ -723,7 +806,7 @@ i386_remove_hw_breakpoint (struct gdbarch *gdbarch, + i386_update_inferior_debug_regs (&local_state); + + if (maint_show_dr) +- i386_show_dr (&dr_mirror, "remove_hwbp", addr, 1, hw_execute); ++ i386_show_dr (state, "remove_hwbp", addr, 1, hw_execute); + + return retval; + } +@@ -788,6 +871,10 @@ i386_use_watchpoints (struct target_ops *t) t->to_remove_watchpoint = i386_remove_watchpoint; t->to_insert_hw_breakpoint = i386_insert_hw_breakpoint; t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint; @@ -5355,53 +5658,372 @@ Index: gdb-7.3.50.20110722/gdb/i386-nat.c } void -Index: gdb-7.3.50.20110722/gdb/i386-nat.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/i386-nat.h 2011-01-09 04:08:56.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/i386-nat.h 2011-07-29 22:52:02.000000000 +0200 -@@ -78,6 +78,28 @@ struct i386_dr_low_type +diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c +index a4e3a22..1e3e29b 100644 +--- a/gdb/i386-tdep.c ++++ b/gdb/i386-tdep.c +@@ -60,8 +60,14 @@ + #include "features/i386/i386-avx.c" + #include "features/i386/i386-mmx.c" - extern struct i386_dr_low_type i386_dr_low; ++#include "stap-probe.h" + #include "ax.h" + #include "ax-gdb.h" ++#include "user-regs.h" ++#include "cli/cli-utils.h" ++#include "expression.h" ++#include "parser-defs.h" ++#include + + /* Register names. */ -+/* The number of debug address registers. */ -+#define DR_NADDR 4 +@@ -7245,6 +7251,312 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep, + return valid_p; + } + ++int ++i386_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) ++{ ++ return (*s == '$' /* Literal number. */ ++ || (isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement. */ ++ || (*s == '(' && s[1] == '%') /* Register indirection. */ ++ || (*s == '%' && isalpha (s[1]))); /* Register access. */ ++} + -+/* Copy of hardware debug registers for performance reasons. */ ++int ++i386_stap_parse_special_token (struct gdbarch *gdbarch, ++ struct stap_parse_info *p) ++{ ++ const char *s = p->arg; + -+struct i386_dr_mirror -+ { -+ /* Mirror the inferior's DRi registers. We keep the status and -+ control registers separated because they don't hold addresses. */ -+ CORE_ADDR addr[DR_NADDR]; ++ /* In order to parse special tokens, we use a state-machine that go ++ through every known token and try to get a match. */ ++ enum ++ { ++ TRIPLET, ++ THREE_ARG_DISPLACEMENT, ++ DONE ++ } current_state; + -+ /* All the ADDR hardware registers have been written at least once. */ -+ unsigned addr_preset : 1; ++ current_state = TRIPLET; + -+ /* Reference counts for each debug register. */ -+ int ref_count[DR_NADDR]; ++ /* The special tokens to be parsed here are: + -+ unsigned long status, control; -+ }; ++ - `register base + (register index * size) + offset', as represented ++ in `(%rcx,%rax,8)', or `[OFFSET](BASE_REG,INDEX_REG[,SIZE])'. + -+extern struct i386_dr_mirror *i386_dr_mirror_get (void); ++ - Operands of the form `-8+3+1(%rbp)', which must be interpreted as ++ `*(-8 + 3 - 1 + (void *) $eax)'. */ + - /* Use this function to set i386_dr_low debug_register_length field - rather than setting it directly to check that the length is only - set once. It also enables the 'maint set/show show-debug-regs' -Index: gdb-7.3.50.20110722/gdb/infrun.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/infrun.c 2011-07-22 01:46:09.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/infrun.c 2011-07-29 22:52:02.000000000 +0200 -@@ -55,6 +55,8 @@ - #include "jit.h" - #include "tracepoint.h" ++ while (current_state != DONE) ++ { ++ const char *s = p->arg; ++ ++ switch (current_state) ++ { ++ case TRIPLET: ++ { ++ if (isdigit (*s) || *s == '-' || *s == '+') ++ { ++ int got_minus[3]; ++ int i; ++ long displacements[3]; ++ const char *start; ++ char *regname; ++ int len; ++ struct stoken str; ++ ++ got_minus[0] = 0; ++ if (*s == '+') ++ ++s; ++ else if (*s == '-') ++ { ++ ++s; ++ got_minus[0] = 1; ++ } ++ ++ displacements[0] = strtol (s, (char **) &s, 10); ++ ++ if (*s != '+' && *s != '-') ++ /* We are not dealing with a triplet. */ ++ break; ++ ++ got_minus[1] = 0; ++ if (*s == '+') ++ ++s; ++ else ++ { ++ ++s; ++ got_minus[1] = 1; ++ } ++ ++ displacements[1] = strtol (s, (char **) &s, 10); ++ ++ if (*s != '+' && *s != '-') ++ /* We are not dealing with a triplet. */ ++ break; ++ ++ got_minus[2] = 0; ++ if (*s == '+') ++ ++s; ++ else ++ { ++ ++s; ++ got_minus[2] = 1; ++ } ++ ++ displacements[2] = strtol (s, (char **) &s, 10); ++ ++ if (*s != '(' || s[1] != '%') ++ break; ++ ++ s += 2; ++ start = s; ++ ++ while (isalnum (*s)) ++ ++s; ++ ++ if (*s++ != ')') ++ break; ++ ++ len = s - start; ++ regname = alloca (len + 1); ++ ++ strncpy (regname, start, len); ++ regname[len] = '\0'; ++ ++ if (user_reg_map_name_to_regnum (gdbarch, ++ regname, len) == -1) ++ error (_("Invalid register name `%s' " ++ "on expression `%s'."), ++ regname, p->saved_arg); ++ ++ for (i = 0; i < 3; i++) ++ { ++ write_exp_elt_opcode (OP_LONG); ++ write_exp_elt_type ++ (builtin_type (gdbarch)->builtin_long); ++ write_exp_elt_longcst (displacements[i]); ++ write_exp_elt_opcode (OP_LONG); ++ if (got_minus[i]) ++ write_exp_elt_opcode (UNOP_NEG); ++ } ++ ++ write_exp_elt_opcode (OP_REGISTER); ++ str.ptr = regname; ++ str.length = len; ++ write_exp_string (str); ++ write_exp_elt_opcode (OP_REGISTER); ++ ++ write_exp_elt_opcode (UNOP_CAST); ++ write_exp_elt_type (builtin_type (gdbarch)->builtin_data_ptr); ++ write_exp_elt_opcode (UNOP_CAST); ++ ++ write_exp_elt_opcode (BINOP_ADD); ++ write_exp_elt_opcode (BINOP_ADD); ++ write_exp_elt_opcode (BINOP_ADD); ++ ++ write_exp_elt_opcode (UNOP_CAST); ++ write_exp_elt_type (lookup_pointer_type (p->arg_type)); ++ write_exp_elt_opcode (UNOP_CAST); ++ ++ write_exp_elt_opcode (UNOP_IND); ++ ++ p->arg = s; ++ ++ return 1; ++ } ++ break; ++ } ++ case THREE_ARG_DISPLACEMENT: ++ { ++ if (isdigit (*s) || *s == '(' || *s == '-' || *s == '+') ++ { ++ int offset_minus = 0; ++ long offset = 0; ++ int size_minus = 0; ++ long size = 0; ++ const char *start; ++ char *base; ++ int len_base; ++ char *index; ++ int len_index; ++ struct stoken base_token, index_token; ++ ++ if (*s == '+') ++ ++s; ++ else if (*s == '-') ++ { ++ ++s; ++ offset_minus = 1; ++ } ++ ++ if (offset_minus && !isdigit (*s)) ++ break; ++ ++ if (isdigit (*s)) ++ offset = strtol (s, (char **) &s, 10); ++ ++ if (*s != '(' || s[1] != '%') ++ break; ++ ++ s += 2; ++ start = s; ++ ++ while (isalnum (*s)) ++ ++s; ++ ++ if (*s != ',' || s[1] != '%') ++ break; ++ ++ len_base = s - start; ++ base = alloca (len_base + 1); ++ strncpy (base, start, len_base); ++ base[len_base] = '\0'; ++ ++ if (user_reg_map_name_to_regnum (gdbarch, ++ base, len_base) == -1) ++ error (_("Invalid register name `%s' " ++ "on expression `%s'."), ++ base, p->saved_arg); ++ ++ s += 2; ++ start = s; ++ ++ while (isalnum (*s)) ++ ++s; ++ ++ len_index = s - start; ++ index = alloca (len_index + 1); ++ strncpy (index, start, len_index); ++ index[len_index] = '\0'; ++ ++ if (user_reg_map_name_to_regnum (gdbarch, ++ index, len_index) == -1) ++ error (_("Invalid register name `%s' " ++ "on expression `%s'."), ++ index, p->saved_arg); ++ ++ if (*s != ',' && *s != ')') ++ break; ++ ++ if (*s == ',') ++ { ++ ++s; ++ if (*s == '+') ++ ++s; ++ else if (*s == '-') ++ { ++ ++s; ++ size_minus = 1; ++ } ++ ++ size = strtol (s, (char **) &s, 10); ++ ++ if (*s != ')') ++ break; ++ } ++ ++ ++s; ++ ++ if (offset) ++ { ++ write_exp_elt_opcode (OP_LONG); ++ write_exp_elt_type ++ (builtin_type (gdbarch)->builtin_long); ++ write_exp_elt_longcst (offset); ++ write_exp_elt_opcode (OP_LONG); ++ if (offset_minus) ++ write_exp_elt_opcode (UNOP_NEG); ++ } ++ ++ write_exp_elt_opcode (OP_REGISTER); ++ base_token.ptr = base; ++ base_token.length = len_base; ++ write_exp_string (base_token); ++ write_exp_elt_opcode (OP_REGISTER); ++ ++ if (offset) ++ write_exp_elt_opcode (BINOP_ADD); ++ ++ write_exp_elt_opcode (OP_REGISTER); ++ index_token.ptr = index; ++ index_token.length = len_index; ++ write_exp_string (index_token); ++ write_exp_elt_opcode (OP_REGISTER); ++ ++ if (size) ++ { ++ write_exp_elt_opcode (OP_LONG); ++ write_exp_elt_type ++ (builtin_type (gdbarch)->builtin_long); ++ write_exp_elt_longcst (size); ++ write_exp_elt_opcode (OP_LONG); ++ if (size_minus) ++ write_exp_elt_opcode (UNOP_NEG); ++ write_exp_elt_opcode (BINOP_MUL); ++ } ++ ++ write_exp_elt_opcode (BINOP_ADD); ++ ++ write_exp_elt_opcode (UNOP_CAST); ++ write_exp_elt_type (lookup_pointer_type (p->arg_type)); ++ write_exp_elt_opcode (UNOP_CAST); ++ ++ write_exp_elt_opcode (UNOP_IND); ++ ++ p->arg = s; ++ ++ return 1; ++ } ++ break; ++ } ++ } ++ ++ /* Advancing to the next state. */ ++ ++current_state; ++ } ++ ++ return 0; ++} ++ + + static struct gdbarch * + i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h +index de11f68..2a84adc 100644 +--- a/gdb/i386-tdep.h ++++ b/gdb/i386-tdep.h +@@ -380,6 +380,15 @@ extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *); + + extern int i386_process_record (struct gdbarch *gdbarch, + struct regcache *regcache, CORE_ADDR addr); ++ ++/* SystemTap related functions. */ ++ ++extern int i386_stap_is_single_operand (struct gdbarch *gdbarch, ++ const char *s); ++ ++extern int i386_stap_parse_special_token (struct gdbarch *gdbarch, ++ struct stap_parse_info *p); ++ + + + /* Functions and variables exported from i386bsd-tdep.c. */ +diff --git a/gdb/infrun.c b/gdb/infrun.c +index 5a0f1d2..b2d350d 100644 +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -57,6 +57,8 @@ #include "continuations.h" + #include "interps.h" + #include "skip.h" +#include "stap-probe.h" +#include "objfiles.h" /* Prototypes for local functions */ -@@ -2341,7 +2343,7 @@ static void handle_step_into_function (s +@@ -2381,7 +2383,7 @@ static void handle_step_into_function (struct gdbarch *gdbarch, static void handle_step_into_function_backward (struct gdbarch *gdbarch, struct execution_control_state *ecs); static void check_exception_resume (struct execution_control_state *, @@ -5410,7 +6032,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c static void stop_stepping (struct execution_control_state *ecs); static void prepare_to_wait (struct execution_control_state *ecs); -@@ -4285,9 +4287,17 @@ process_event_stop_test: +@@ -4419,9 +4421,17 @@ process_event_stop_test: if (what.is_longjmp) { @@ -5431,7 +6053,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c { if (debug_infrun) fprintf_unfiltered (gdb_stdlog, -@@ -4305,12 +4315,7 @@ process_event_stop_test: +@@ -4439,12 +4449,7 @@ process_event_stop_test: insert_longjmp_resume_breakpoint (gdbarch, jmp_buf_pc); } else @@ -5445,7 +6067,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c keep_going (ecs); return; -@@ -5423,15 +5428,65 @@ insert_exception_resume_breakpoint (stru +@@ -5526,15 +5531,65 @@ insert_exception_resume_breakpoint (struct thread_info *tp, } } @@ -5512,7 +6134,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c TRY_CATCH (e, RETURN_MASK_ERROR) { -@@ -6434,7 +6489,8 @@ static const struct lval_funcs siginfo_v +@@ -6565,7 +6620,8 @@ static const struct lval_funcs siginfo_value_funcs = if there's no object available. */ static struct value * @@ -5522,7 +6144,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c { if (target_has_stack && !ptid_equal (inferior_ptid, null_ptid) -@@ -6929,6 +6985,15 @@ show_schedule_multiple (struct ui_file * +@@ -7060,6 +7116,15 @@ show_schedule_multiple (struct ui_file *file, int from_tty, "of all processes is %s.\n"), value); } @@ -5538,7 +6160,7 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c void _initialize_infrun (void) { -@@ -7204,7 +7269,7 @@ Tells gdb whether to detach the child of +@@ -7348,7 +7413,7 @@ enabled by default on some platforms."), value with a void typed value, and when we get here, gdbarch isn't initialized yet. At this point, we're quite sure there isn't another convenience variable of the same name. */ @@ -5547,129 +6169,217 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c add_setshow_boolean_cmd ("observer", no_class, &observer_mode_1, _("\ -Index: gdb-7.3.50.20110722/gdb/linespec.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/linespec.c 2011-07-05 22:30:19.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/linespec.c 2011-07-29 22:52:02.000000000 +0200 -@@ -43,6 +43,7 @@ - #include "arch-utils.h" - #include +diff --git a/gdb/linespec.c b/gdb/linespec.c +index 8521851..56a837c 100644 +--- a/gdb/linespec.c ++++ b/gdb/linespec.c +@@ -45,6 +45,7 @@ #include "cli/cli-utils.h" + #include "filenames.h" + #include "ada-lang.h" +#include "stap-probe.h" - /* Prototypes for local functions. */ - -@@ -783,6 +784,7 @@ keep_name_info (char *p, int on_boundary + typedef struct symtab *symtab_p; + DEF_VEC_P (symtab_p); +@@ -804,6 +805,7 @@ keep_name_info (char *p, int on_boundary) PC returned is 0. FILE:FUNCTION -- likewise, but prefer functions in that file. *EXPR -- line in which address EXPR appears. -+ probe:[OBJFILE:][PROVIDER:]NAME -- a systemtap static probe ++ -p [OBJFILE:][PROVIDER:]NAME -- a systemtap static probe This may all be followed by an "if EXPR", which we ignore. -@@ -851,6 +853,9 @@ decode_line_1 (char **argptr, int funfir - if (**argptr == '*') - return decode_indirect (argptr); +@@ -874,6 +876,9 @@ decode_line_internal (struct linespec_state *self, char **argptr) + return decode_indirect (self, argptr); + } -+ if (strncmp (*argptr, "probe:", 6) == 0) -+ return parse_stap_probe (argptr, canonical); ++ if (strncmp (*argptr, "-p", 2) == 0 && isspace ((*argptr)[2])) ++ return parse_stap_probe (argptr, self->canonical); + is_quoted = (strchr (get_gdb_completer_quote_characters (), **argptr) != NULL); -Index: gdb-7.3.50.20110722/gdb/linespec.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/linespec.h 2011-04-04 19:41:07.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/linespec.h 2011-07-29 22:52:02.000000000 +0200 -@@ -30,6 +30,10 @@ struct linespec_result - display mechanism would do the wrong thing. */ - int special_display; - -+ /* If non-zero, the linespec result should be considered to be a -+ "pre-expanded" multi-location linespec. */ -+ int pre_expanded; -+ - /* If non-NULL, an array of canonical names for returned - symtab_and_line objects. The array has as many elements as the - `nelts' field in the symtabs_and_line returned by decode_line_1. -Index: gdb-7.3.50.20110722/gdb/linux-nat.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/linux-nat.c 2011-07-22 01:46:09.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/linux-nat.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1241,6 +1241,64 @@ iterate_over_lwps (ptid_t filter, - return NULL; +diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c +index e5f7c3e..09d7c1e 100644 +--- a/gdb/linux-nat.c ++++ b/gdb/linux-nat.c +@@ -289,6 +289,7 @@ static void restore_child_signals_mask (sigset_t *prev_mask); + struct lwp_info; + static struct lwp_info *add_lwp (ptid_t ptid); + static void purge_lwp_list (int pid); ++static void delete_lwp (ptid_t ptid); + static struct lwp_info *find_lwp_pid (ptid_t ptid); + + +@@ -585,6 +586,31 @@ linux_child_post_startup_inferior (ptid_t ptid) + linux_enable_tracesysgood (ptid); } -+/* Helper for linux_nat_iterate_watchpoint_lwps. */ -+ -+struct iterate_watchpoint_lwps_data -+ { -+ linux_nat_iterate_watchpoint_lwps_ftype callback; -+ void *callback_data; -+ }; ++/* Return the number of known LWPs in the tgid given by PID. */ + +static int -+iterate_watchpoint_lwps_callback (struct lwp_info *lp, void *datap_voidp) ++num_lwps (int pid) +{ -+ struct iterate_watchpoint_lwps_data *datap = datap_voidp; -+ int tid; ++ int count = 0; ++ struct lwp_info *lp; + -+ tid = TIDGET (lp->ptid); -+ if (tid == 0) -+ tid = PIDGET (lp->ptid); ++ for (lp = lwp_list; lp; lp = lp->next) ++ if (ptid_get_pid (lp->ptid) == pid) ++ count++; ++ ++ return count; ++} + -+ datap->callback (tid, datap->callback_data); ++/* Call delete_lwp with prototype compatible for make_cleanup. */ + -+ /* Continue the traversal. */ -+ return 0; ++static void ++delete_lwp_cleanup (void *lp_voidp) ++{ ++ struct lwp_info *lp = lp_voidp; ++ ++ delete_lwp (lp->ptid); +} + -+/* Iterate like iterate_over_lwps does except when forking-off a child call -+ CALLBACK with CALLBACK_DATA specifically only for that new child PID. + static int + linux_child_follow_fork (struct target_ops *ops, int follow_child) + { +@@ -631,6 +657,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + /* Detach new forked process? */ + if (detach_fork) + { ++ struct cleanup *old_chain; ++ + /* Before detaching from the child, remove all breakpoints + from it. If we forked, then this has already been taken + care of by infrun.c. If we vforked however, any +@@ -653,7 +681,28 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + child_pid); + } + ++ old_chain = save_inferior_ptid (); ++ inferior_ptid = ptid_build (child_pid, child_pid, 0); ++ ++ child_lp = add_lwp (inferior_ptid); ++ child_lp->stopped = 1; ++ child_lp->last_resume_kind = resume_stop; ++ make_cleanup (delete_lwp_cleanup, child_lp); + -+ During `set follow-fork-mode child' the call is also made for the new child -+ PID; parent watchpoints get detached elsewhere (during target_detach). */ ++ /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it. ++ See i386_inferior_data_get for the Linux kernel specifics. ++ Ensure linux_nat_prepare_to_resume will reset the hardware debug ++ registers. It is done by the linux_nat_new_thread call, which is ++ being skipped in add_lwp above for the first lwp of a pid. */ ++ gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1); ++ if (linux_nat_new_thread != NULL) ++ linux_nat_new_thread (child_lp); ++ ++ if (linux_nat_prepare_to_resume != NULL) ++ linux_nat_prepare_to_resume (child_lp); + ptrace (PTRACE_DETACH, child_pid, 0, 0); ++ ++ do_cleanups (old_chain); + } + else + { +@@ -671,6 +720,9 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + save_current_program_space (); + + inferior_ptid = ptid_build (child_pid, child_pid, 0); ++ reinit_frame_cache (); ++ registers_changed (); ++ + add_thread (inferior_ptid); + child_lp = add_lwp (inferior_ptid); + child_lp->stopped = 1; +@@ -862,6 +914,9 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + informing the solib layer about this new process. */ + + inferior_ptid = ptid_build (child_pid, child_pid, 0); ++ reinit_frame_cache (); ++ registers_changed (); ++ + add_thread (inferior_ptid); + child_lp = add_lwp (inferior_ptid); + child_lp->stopped = 1; +@@ -1112,21 +1167,6 @@ purge_lwp_list (int pid) + } + } + +-/* Return the number of known LWPs in the tgid given by PID. */ +- +-static int +-num_lwps (int pid) +-{ +- int count = 0; +- struct lwp_info *lp; +- +- for (lp = lwp_list; lp; lp = lp->next) +- if (ptid_get_pid (lp->ptid) == pid) +- count++; +- +- return count; +-} +- + /* Add the LWP specified by PID to the list. Return a pointer to the + structure describing the new LWP. The LWP should already be stopped + (with an exception for the very first LWP). */ +@@ -1236,6 +1276,46 @@ iterate_over_lwps (ptid_t filter, + return NULL; + } + ++/* Iterate like iterate_over_lwps does except when forking-off a child call ++ CALLBACK with CALLBACK_DATA specifically only for that new child PID. */ + +void +linux_nat_iterate_watchpoint_lwps + (linux_nat_iterate_watchpoint_lwps_ftype callback, void *callback_data) +{ -+ struct iterate_watchpoint_lwps_data data; + int inferior_pid = ptid_get_pid (inferior_ptid); + struct inferior *inf = current_inferior (); + -+ data.callback = callback; -+ data.callback_data = callback_data; -+ + if (inf->pid == inferior_pid) + { -+ /* Standard mode. Iterate all the threads of the current inferior. -+ Without specifying INFERIOR_PID it would iterate all the threads of -+ all the inferiors, which is inappropriate for watchpoints. */ ++ /* Iterate all the threads of the current inferior. Without specifying ++ INFERIOR_PID it would iterate all threads of all inferiors, which is ++ inappropriate for watchpoints. */ + -+ iterate_over_lwps (pid_to_ptid (inferior_pid), -+ iterate_watchpoint_lwps_callback, &data); ++ iterate_over_lwps (pid_to_ptid (inferior_pid), callback, callback_data); + } + else + { + /* Detaching a new child PID temporarily present in INFERIOR_PID. */ + -+ callback (inferior_pid, callback_data); ++ struct lwp_info *child_lp; ++ struct cleanup *old_chain; ++ pid_t child_pid = GET_PID (inferior_ptid); ++ ptid_t child_ptid = ptid_build (child_pid, child_pid, 0); ++ ++ gdb_assert (!is_lwp (inferior_ptid)); ++ gdb_assert (find_lwp_pid (child_ptid) == NULL); ++ child_lp = add_lwp (child_ptid); ++ child_lp->stopped = 1; ++ child_lp->last_resume_kind = resume_stop; ++ old_chain = make_cleanup (delete_lwp_cleanup, child_lp); ++ ++ callback (child_lp, callback_data); ++ ++ do_cleanups (old_chain); + } +} + /* Update our internal state when changing from one checkpoint to another indicated by NEW_PTID. We can only switch single-threaded applications, so we only create one new LWP, and the previous list -Index: gdb-7.3.50.20110722/gdb/linux-nat.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/linux-nat.h 2011-01-05 23:22:49.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/linux-nat.h 2011-07-29 22:52:02.000000000 +0200 -@@ -140,6 +140,11 @@ struct lwp_info *iterate_over_lwps (ptid +diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h +index 33727d6..9915f2f 100644 +--- a/gdb/linux-nat.h ++++ b/gdb/linux-nat.h +@@ -159,6 +159,12 @@ struct lwp_info *iterate_over_lwps (ptid_t filter, void *), void *data); -+typedef void (*linux_nat_iterate_watchpoint_lwps_ftype) (int tid, void *data); ++typedef int (*linux_nat_iterate_watchpoint_lwps_ftype) (struct lwp_info *lwp, ++ void *arg); + +extern void linux_nat_iterate_watchpoint_lwps + (linux_nat_iterate_watchpoint_lwps_ftype callback, void *callback_data); @@ -5677,11 +6387,11 @@ Index: gdb-7.3.50.20110722/gdb/linux-nat.h /* Create a prototype generic GNU/Linux target. The client can override it with local methods. */ struct target_ops * linux_target (void); -Index: gdb-7.3.50.20110722/gdb/machoread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/machoread.c 2011-07-01 20:36:45.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/machoread.c 2011-07-29 22:52:02.000000000 +0200 -@@ -842,6 +842,7 @@ static const struct sym_fns macho_sym_fn +diff --git a/gdb/machoread.c b/gdb/machoread.c +index 46b8842..68aae46 100644 +--- a/gdb/machoread.c ++++ b/gdb/machoread.c +@@ -1032,6 +1032,7 @@ static const struct sym_fns macho_sym_fns = { default_symfile_segments, /* Get segment information from a file. */ NULL, macho_symfile_relocate, /* Relocate a debug section. */ @@ -5689,10 +6399,10 @@ Index: gdb-7.3.50.20110722/gdb/machoread.c &psym_functions }; -Index: gdb-7.3.50.20110722/gdb/main.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/main.c 2011-06-13 12:55:26.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/main.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/main.c b/gdb/main.c +index 288ec4b..38b7699 100644 +--- a/gdb/main.c ++++ b/gdb/main.c @@ -39,6 +39,7 @@ #include "interps.h" @@ -5701,7 +6411,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c #include "source.h" #include "cli/cli-cmds.h" #include "python/python.h" -@@ -262,6 +263,8 @@ captured_main (void *data) +@@ -266,6 +267,8 @@ captured_main (void *data) char *cdarg = NULL; char *ttyarg = NULL; @@ -5710,7 +6420,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c /* These are static so that we can take their address in an initializer. */ static int print_help; -@@ -452,10 +455,14 @@ captured_main (void *data) +@@ -459,10 +462,14 @@ captured_main (void *data) {"args", no_argument, &set_args, 1}, {"l", required_argument, 0, 'l'}, {"return-child-result", no_argument, &return_child_result, 1}, @@ -5726,7 +6436,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c { int option_index; -@@ -473,6 +480,9 @@ captured_main (void *data) +@@ -480,6 +487,9 @@ captured_main (void *data) case 0: /* Long option that just sets a flag. */ break; @@ -5736,7 +6446,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c case OPT_SE: symarg = optarg; execarg = optarg; -@@ -668,7 +678,31 @@ captured_main (void *data) +@@ -675,7 +685,31 @@ captured_main (void *data) /* Now that gdb_init has created the initial inferior, we're in position to set args for that inferior. */ @@ -5769,7 +6479,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c { /* The remaining options are the command-line options for the inferior. The first one is the sym/exec file, and the rest -@@ -917,7 +951,8 @@ captured_main (void *data) +@@ -924,7 +958,8 @@ captured_main (void *data) /* Read in the old history after all the command files have been read. */ @@ -5779,7 +6489,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c if (batch_flag) { -@@ -928,13 +963,25 @@ captured_main (void *data) +@@ -935,13 +970,25 @@ captured_main (void *data) /* Show time and/or space usage. */ do_cleanups (pre_stat_chain); @@ -5790,7 +6500,8 @@ Index: gdb-7.3.50.20110722/gdb/main.c - while (1) +#if HAVE_PYTHON + if (python_script) -+ { + { +- catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); + extern int pagination_enabled; + pagination_enabled = 0; + run_python_script (argc - optind, &argv[optind]); @@ -5798,8 +6509,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c + } + else +#endif - { -- catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); ++ { + /* NOTE: cagney/1999-11-07: There is probably no reason for not + moving this loop and the code found in captured_command_loop() + into the command_loop() proper. The main thing holding back that @@ -5811,7 +6521,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c } /* No exit -- exit is through quit_command. */ } -@@ -966,7 +1013,12 @@ print_gdb_help (struct ui_file *stream) +@@ -973,7 +1020,12 @@ print_gdb_help (struct ui_file *stream) fputs_unfiltered (_("\ This is the GNU debugger. Usage:\n\n\ gdb [options] [executable-file [core-file or process-id]]\n\ @@ -5825,7 +6535,7 @@ Index: gdb-7.3.50.20110722/gdb/main.c Options:\n\n\ "), stream); fputs_unfiltered (_("\ -@@ -1004,7 +1056,13 @@ Options:\n\n\ +@@ -1011,7 +1063,13 @@ Options:\n\n\ --nw Do not use a window interface.\n\ --nx Do not read "), stream); fputs_unfiltered (gdbinit, stream); @@ -5840,11 +6550,11 @@ Index: gdb-7.3.50.20110722/gdb/main.c --quiet Do not print version number on startup.\n\ --readnow Fully read symbol files on first access.\n\ "), stream); -Index: gdb-7.3.50.20110722/gdb/mi/mi-cmd-var.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/mi/mi-cmd-var.c 2011-06-27 21:21:51.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/mi/mi-cmd-var.c 2011-07-29 22:52:02.000000000 +0200 -@@ -707,7 +707,6 @@ mi_cmd_var_update (char *command, char * +diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c +index 48f8a7d..e9a4db7 100644 +--- a/gdb/mi/mi-cmd-var.c ++++ b/gdb/mi/mi-cmd-var.c +@@ -721,7 +721,6 @@ mi_cmd_var_update (char *command, char **argv, int argc) } else { @@ -5852,11 +6562,11 @@ Index: gdb-7.3.50.20110722/gdb/mi/mi-cmd-var.c struct varobj *var = varobj_get_handle (name); varobj_update_one (var, print_values, 1 /* explicit */); -Index: gdb-7.3.50.20110722/gdb/mipsread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/mipsread.c 2011-04-19 20:04:07.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/mipsread.c 2011-07-29 22:52:02.000000000 +0200 -@@ -402,6 +402,7 @@ static const struct sym_fns ecoff_sym_fn +diff --git a/gdb/mipsread.c b/gdb/mipsread.c +index 1cd3299..46de097 100644 +--- a/gdb/mipsread.c ++++ b/gdb/mipsread.c +@@ -402,6 +402,7 @@ static const struct sym_fns ecoff_sym_fns = default_symfile_segments, /* Get segment information from a file. */ NULL, default_symfile_relocate, /* Relocate a debug section. */ @@ -5864,11 +6574,11 @@ Index: gdb-7.3.50.20110722/gdb/mipsread.c &psym_functions }; -Index: gdb-7.3.50.20110722/gdb/objfiles.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/objfiles.c 2011-06-14 18:49:41.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/objfiles.c 2011-07-29 22:52:02.000000000 +0200 -@@ -842,6 +842,11 @@ objfile_relocate1 (struct objfile *objfi +diff --git a/gdb/objfiles.c b/gdb/objfiles.c +index 229e641..56b8a31 100644 +--- a/gdb/objfiles.c ++++ b/gdb/objfiles.c +@@ -813,6 +813,11 @@ objfile_relocate1 (struct objfile *objfile, obj_section_addr (s)); } @@ -5880,10 +6590,10 @@ Index: gdb-7.3.50.20110722/gdb/objfiles.c /* Data changed. */ return 1; } -Index: gdb-7.3.50.20110722/gdb/p-valprint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/p-valprint.c 2011-03-15 17:00:56.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/p-valprint.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c +index e55b122..6b4adfb 100644 +--- a/gdb/p-valprint.c ++++ b/gdb/p-valprint.c @@ -39,6 +39,7 @@ #include "cp-abi.h" #include "cp-support.h" @@ -5892,7 +6602,7 @@ Index: gdb-7.3.50.20110722/gdb/p-valprint.c /* See val_print for a description of the various parameters of this -@@ -63,8 +64,31 @@ pascal_val_print (struct type *type, con +@@ -63,8 +64,31 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, struct type *char_type; LONGEST val; CORE_ADDR addr; @@ -5925,7 +6635,7 @@ Index: gdb-7.3.50.20110722/gdb/p-valprint.c switch (TYPE_CODE (type)) { case TYPE_CODE_ARRAY: -@@ -120,8 +144,8 @@ pascal_val_print (struct type *type, con +@@ -120,8 +144,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, { i = 0; } @@ -5936,7 +6646,7 @@ Index: gdb-7.3.50.20110722/gdb/p-valprint.c original_value, options, i); fprintf_filtered (stream, "}"); } -@@ -160,6 +184,7 @@ pascal_val_print (struct type *type, con +@@ -160,6 +184,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, /* Try to print what function it points to. */ print_address_demangle (gdbarch, addr, stream, demangle); /* Return value is irrelevant except for string pointers. */ @@ -5944,27 +6654,107 @@ Index: gdb-7.3.50.20110722/gdb/p-valprint.c return (0); } -@@ -251,6 +276,7 @@ pascal_val_print (struct type *type, con - /* Return number of characters printed, including the terminating - '\0' if we reached the end. val_print_string takes care including - the terminating '\0' if necessary. */ -+ do_cleanups (back_to); - return i; +@@ -251,6 +276,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + /* Return number of characters printed, including the terminating + '\0' if we reached the end. val_print_string takes care including + the terminating '\0' if necessary. */ ++ do_cleanups (back_to); + return i; + + break; +@@ -576,6 +602,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + TYPE_CODE (type)); + } + gdb_flush (stream); ++ do_cleanups (back_to); + return (0); + } + +diff --git a/gdb/parse.c b/gdb/parse.c +index 7d157fe..6ddaf86 100644 +--- a/gdb/parse.c ++++ b/gdb/parse.c +@@ -124,8 +124,6 @@ show_parserdebug (struct ui_file *file, int from_tty, + + static void free_funcalls (void *ignore); + +-static int prefixify_expression (struct expression *); +- + static int prefixify_subexp (struct expression *, struct expression *, int, + int); + +@@ -772,7 +770,7 @@ copy_name (struct stoken token) + return the index of the subexpression which is the left-hand-side + of the struct operation at EXPOUT_LAST_STRUCT. */ + +-static int ++int + prefixify_expression (struct expression *expr) + { + int len = sizeof (struct expression) + EXP_ELEM_TO_BYTES (expr->nelts); +@@ -1075,6 +1073,31 @@ parse_exp_1 (char **stringptr, struct block *block, int comma) + return parse_exp_in_context (stringptr, block, comma, 0, NULL); + } + ++void ++initialize_expout (int initial_size, const struct language_defn *lang, ++ struct gdbarch *gdbarch) ++{ ++ expout_size = initial_size; ++ expout_ptr = 0; ++ expout = (struct expression *) ++ xmalloc (sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size)); ++ expout->language_defn = lang; ++ expout->gdbarch = gdbarch; ++} ++ ++void ++reallocate_expout (void) ++{ ++ /* Record the actual number of expression elements, and then ++ reallocate the expression memory so that we free up any ++ excess elements. */ ++ ++ expout->nelts = expout_ptr; ++ expout = (struct expression *) ++ xrealloc ((char *) expout, ++ sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_ptr)); ++} ++ + /* As for parse_exp_1, except that if VOID_CONTEXT_P, then + no value is expected from the expression. + OUT_SUBEXP is set when attempting to complete a field name; in this +@@ -1152,12 +1175,7 @@ parse_exp_in_context (char **stringptr, struct block *block, int comma, + else + lang = current_language; + +- expout_size = 10; +- expout_ptr = 0; +- expout = (struct expression *) +- xmalloc (sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size)); +- expout->language_defn = lang; +- expout->gdbarch = get_current_arch (); ++ initialize_expout (10, lang, get_current_arch ()); - break; -@@ -567,6 +593,7 @@ pascal_val_print (struct type *type, con - TYPE_CODE (type)); - } - gdb_flush (stream); -+ do_cleanups (back_to); - return (0); - } - -Index: gdb-7.3.50.20110722/gdb/parse.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/parse.c 2011-06-17 22:24:22.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/parse.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1501,6 +1501,7 @@ parser_fprintf (FILE *x, const char *y, + TRY_CATCH (except, RETURN_MASK_ALL) + { +@@ -1175,14 +1193,7 @@ parse_exp_in_context (char **stringptr, struct block *block, int comma, + + discard_cleanups (old_chain); + +- /* Record the actual number of expression elements, and then +- reallocate the expression memory so that we free up any +- excess elements. */ +- +- expout->nelts = expout_ptr; +- expout = (struct expression *) +- xrealloc ((char *) expout, +- sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_ptr)); ++ reallocate_expout (); + + /* Convert expression from postfix form as generated by yacc + parser, to a prefix form. */ +@@ -1502,6 +1513,7 @@ parser_fprintf (FILE *x, const char *y, ...) int operator_check_standard (struct expression *exp, int pos, @@ -5972,7 +6762,7 @@ Index: gdb-7.3.50.20110722/gdb/parse.c int (*objfile_func) (struct objfile *objfile, void *data), void *data) -@@ -1542,7 +1543,7 @@ operator_check_standard (struct expressi +@@ -1543,7 +1555,7 @@ operator_check_standard (struct expression *exp, int pos, struct type *type = elts[pos + 2 + arg].type; struct objfile *objfile = TYPE_OBJFILE (type); @@ -5981,7 +6771,7 @@ Index: gdb-7.3.50.20110722/gdb/parse.c return 1; } } -@@ -1560,7 +1561,8 @@ operator_check_standard (struct expressi +@@ -1561,7 +1573,8 @@ operator_check_standard (struct expression *exp, int pos, /* Check objfile where the variable itself is placed. SYMBOL_OBJ_SECTION (symbol) may be NULL. */ @@ -5991,7 +6781,7 @@ Index: gdb-7.3.50.20110722/gdb/parse.c return 1; /* Check objfile where is placed the code touching the variable. */ -@@ -1573,24 +1575,27 @@ operator_check_standard (struct expressi +@@ -1574,24 +1587,27 @@ operator_check_standard (struct expression *exp, int pos, /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ @@ -6027,7 +6817,7 @@ Index: gdb-7.3.50.20110722/gdb/parse.c int (*objfile_func) (struct objfile *objfile, void *data), void *data) { -@@ -1605,7 +1610,9 @@ exp_iterate (struct expression *exp, +@@ -1606,7 +1622,9 @@ exp_iterate (struct expression *exp, pos = endpos - oplen; if (exp->language_defn->la_exp_desc->operator_check (exp, pos, @@ -6038,7 +6828,7 @@ Index: gdb-7.3.50.20110722/gdb/parse.c return 1; endpos = pos; -@@ -1636,8 +1643,29 @@ exp_uses_objfile (struct expression *exp +@@ -1637,8 +1655,29 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) { gdb_assert (objfile->separate_debug_objfile_backlink == NULL); @@ -6069,11 +6859,36 @@ Index: gdb-7.3.50.20110722/gdb/parse.c void _initialize_parse (void) -Index: gdb-7.3.50.20110722/gdb/parser-defs.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/parser-defs.h 2011-01-10 21:38:49.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/parser-defs.h 2011-07-29 22:52:02.000000000 +0200 -@@ -194,6 +194,8 @@ extern void operator_length_standard (co +diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h +index bca8014..ecc436e 100644 +--- a/gdb/parser-defs.h ++++ b/gdb/parser-defs.h +@@ -131,6 +131,24 @@ union type_stack_elt + extern union type_stack_elt *type_stack; + extern int type_stack_depth, type_stack_size; + ++/* Allocate and initialize `expout' and its related variables `expout_size' ++ and `expout_ptr'. ++ ++ The first argument is the initial size to be used for xmalloc. The second ++ argument is the language related to the expression. The third argument is ++ corresponding gdbarch. */ ++ ++extern void initialize_expout (int, const struct language_defn *, ++ struct gdbarch *); ++ ++/* Reallocate `expout' in order to free excessive elements that might have ++ been created during the parsing. Set the number of elements ++ accordingly. */ ++ ++extern void reallocate_expout (void); ++ ++extern int prefixify_expression (struct expression *expr); ++ + extern void write_exp_elt_opcode (enum exp_opcode); + + extern void write_exp_elt_sym (struct symbol *); +@@ -192,6 +210,8 @@ extern void operator_length_standard (const struct expression *, int, int *, int *); extern int operator_check_standard (struct expression *exp, int pos, @@ -6082,7 +6897,7 @@ Index: gdb-7.3.50.20110722/gdb/parser-defs.h int (*objfile_func) (struct objfile *objfile, void *data), void *data); -@@ -291,6 +293,7 @@ struct exp_descriptor +@@ -289,6 +309,7 @@ struct exp_descriptor value should be immediately returned to the caller. Otherwise zero should be returned. */ int (*operator_check) (struct expression *exp, int pos, @@ -6090,7 +6905,7 @@ Index: gdb-7.3.50.20110722/gdb/parser-defs.h int (*objfile_func) (struct objfile *objfile, void *data), void *data); -@@ -329,4 +332,10 @@ extern void parser_fprintf (FILE *, cons +@@ -327,4 +348,10 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); @@ -6101,113 +6916,249 @@ Index: gdb-7.3.50.20110722/gdb/parser-defs.h +#endif + #endif /* PARSER_DEFS_H */ -Index: gdb-7.3.50.20110722/gdb/ppc-linux-nat.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/ppc-linux-nat.c 2011-05-06 20:46:31.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/ppc-linux-nat.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1647,6 +1647,14 @@ ppc_linux_ranged_break_num_registers (st - 2 : -1); +diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c +index cc29ad8..94900c9 100644 +--- a/gdb/ppc-linux-nat.c ++++ b/gdb/ppc-linux-nat.c +@@ -1469,14 +1469,13 @@ ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot) + if (!have_ptrace_booke_interface ()) + { + int tid; +- ptid_t ptid = inferior_ptid; + + /* We need to know whether ptrace supports PTRACE_SET_DEBUGREG + and whether the target has DABR. If either answer is no, the + ptrace call will return -1. Fail in that case. */ +- tid = TIDGET (ptid); ++ tid = TIDGET (inferior_ptid); + if (tid == 0) +- tid = PIDGET (ptid); ++ tid = PIDGET (inferior_ptid); + + if (ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0) == -1) + return 0; +@@ -1567,8 +1566,9 @@ booke_find_thread_points_by_tid (int tid, int alloc_new) + /* This function is a generic wrapper that is responsible for inserting a + *point (i.e., calling `ptrace' in order to issue the request to the + kernel) and registering it internally in GDB. */ ++ + static void +-booke_insert_point (struct ppc_hw_breakpoint *b, int tid) ++booke_insert_point (struct lwp_info *lp, struct ppc_hw_breakpoint *b) + { + int i; + long slot; +@@ -1581,12 +1581,12 @@ booke_insert_point (struct ppc_hw_breakpoint *b, int tid) + memcpy (p, b, sizeof (struct ppc_hw_breakpoint)); + + errno = 0; +- slot = ptrace (PPC_PTRACE_SETHWDEBUG, tid, 0, p); ++ slot = ptrace (PPC_PTRACE_SETHWDEBUG, TIDGET (lp->ptid), 0, p); + if (slot < 0) + perror_with_name (_("Unexpected error setting breakpoint or watchpoint")); + + /* Everything went fine, so we have to register this *point. */ +- t = booke_find_thread_points_by_tid (tid, 1); ++ t = booke_find_thread_points_by_tid (TIDGET (lp->ptid), 1); + gdb_assert (t != NULL); + hw_breaks = t->hw_breaks; + +@@ -1604,17 +1604,33 @@ booke_insert_point (struct ppc_hw_breakpoint *b, int tid) + discard_cleanups (c); } -+static void -+booke_insert_point_callback (int tid, void *pp_voidp) -+{ -+ struct ppc_hw_breakpoint *pp = pp_voidp; +-/* This function is a generic wrapper that is responsible for removing a +- *point (i.e., calling `ptrace' in order to issue the request to the +- kernel), and unregistering it internally at GDB. */ +-static void +-booke_remove_point (struct ppc_hw_breakpoint *b, int tid) ++/* Callback for linux_nat_iterate_watchpoint_lwps ++ calling booke_insert_point. */ ++ ++static int ++booke_insert_point_callback (struct lwp_info *lp, void *b_voidp) + { ++ struct ppc_hw_breakpoint *b = b_voidp; + -+ booke_insert_point (pp, tid); ++ booke_insert_point (lp, b); ++ ++ /* Continue the traversal. */ ++ return 0; +} + - /* Insert the hardware breakpoint described by BP_TGT. Returns 0 for - success, 1 if hardware breakpoints are not supported or -1 for failure. */ ++/* This function is a callback for linux_nat_iterate_watchpoint_lwps that is ++ responsible for removing a *point (i.e., calling `ptrace' in order to issue ++ the request to the kernel), and unregistering it internally at GDB. */ ++ ++static int ++booke_remove_point_callback (struct lwp_info *lp, void *b_voidp) ++{ ++ struct ppc_hw_breakpoint *b = b_voidp; + int i; + struct hw_break_tuple *hw_breaks; + struct thread_points *t; + +- t = booke_find_thread_points_by_tid (tid, 0); ++ t = booke_find_thread_points_by_tid (TIDGET (lp->ptid), 0); + gdb_assert (t != NULL); + hw_breaks = t->hw_breaks; + +@@ -1628,13 +1644,17 @@ booke_remove_point (struct ppc_hw_breakpoint *b, int tid) + breakpoints/watchpoints as "one-shot", that is, they are automatically + deleted when hit. */ + errno = 0; +- if (ptrace (PPC_PTRACE_DELHWDEBUG, tid, 0, hw_breaks[i].slot) < 0) ++ if (ptrace (PPC_PTRACE_DELHWDEBUG, TIDGET (lp->ptid), 0, hw_breaks[i].slot) ++ < 0) + if (errno != ENOENT) + perror_with_name (_("Unexpected error deleting " + "breakpoint or watchpoint")); + + xfree (hw_breaks[i].hw_break); + hw_breaks[i].hw_break = NULL; ++ ++ /* Continue the traversal. */ ++ return 0; + } -@@ -1654,8 +1662,6 @@ static int + /* Return the number of registers needed for a ranged breakpoint. */ +@@ -1654,7 +1674,6 @@ static int ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { -- ptid_t ptid; - struct lwp_info *lp; struct ppc_hw_breakpoint p; if (!have_ptrace_booke_interface ()) -@@ -1681,18 +1687,23 @@ ppc_linux_insert_hw_breakpoint (struct g +@@ -1680,8 +1699,7 @@ ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch, p.addr2 = 0; } -- ALL_LWPS (lp, ptid) -- booke_insert_point (&p, TIDGET (ptid)); +- ALL_LWPS (lp) +- booke_insert_point (&p, TIDGET (lp->ptid)); + linux_nat_iterate_watchpoint_lwps (booke_insert_point_callback, &p); return 0; } - -+static void -+booke_remove_point_callback (int tid, void *pp_voidp) -+{ -+ struct ppc_hw_breakpoint *pp = pp_voidp; -+ -+ booke_remove_point (pp, tid); -+} -+ - static int +@@ -1690,7 +1708,6 @@ static int ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt) { -- ptid_t ptid; - struct lwp_info *lp; struct ppc_hw_breakpoint p; if (!have_ptrace_booke_interface ()) -@@ -1718,8 +1729,7 @@ ppc_linux_remove_hw_breakpoint (struct g +@@ -1716,8 +1733,7 @@ ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch, p.addr2 = 0; } -- ALL_LWPS (lp, ptid) -- booke_remove_point (&p, TIDGET (ptid)); +- ALL_LWPS (lp) +- booke_remove_point (&p, TIDGET (lp->ptid)); + linux_nat_iterate_watchpoint_lwps (booke_remove_point_callback, &p); return 0; } -@@ -2004,6 +2014,15 @@ ppc_linux_can_accel_watchpoint_condition +@@ -1746,7 +1762,6 @@ static int + ppc_linux_insert_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr, + CORE_ADDR mask, int rw) + { +- struct lwp_info *lp; + struct ppc_hw_breakpoint p; + + gdb_assert (have_ptrace_booke_interface ()); +@@ -1759,8 +1774,7 @@ ppc_linux_insert_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr, + p.addr2 = mask; + p.condition_value = 0; + +- ALL_LWPS (lp) +- booke_insert_point (&p, TIDGET (lp->ptid)); ++ linux_nat_iterate_watchpoint_lwps (booke_insert_point_callback, &p); + + return 0; + } +@@ -1774,7 +1788,6 @@ static int + ppc_linux_remove_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr, + CORE_ADDR mask, int rw) + { +- struct lwp_info *lp; + struct ppc_hw_breakpoint p; + + gdb_assert (have_ptrace_booke_interface ()); +@@ -1787,8 +1800,7 @@ ppc_linux_remove_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr, + p.addr2 = mask; + p.condition_value = 0; + +- ALL_LWPS (lp) +- booke_remove_point (&p, TIDGET (lp->ptid)); ++ linux_nat_iterate_watchpoint_lwps (booke_remove_point_callback, &p); + + return 0; + } +@@ -1798,10 +1810,16 @@ static int + can_use_watchpoint_cond_accel (void) + { + struct thread_points *p; +- int tid = TIDGET (inferior_ptid); + int cnt = booke_debug_info.num_condition_regs, i; + CORE_ADDR tmp_value; + ++ /* Overload thread id onto process id. */ ++ int tid = TIDGET (inferior_ptid); ++ ++ /* No thread id, just use process id. */ ++ if (tid == 0) ++ tid = PIDGET (inferior_ptid); ++ + if (!have_ptrace_booke_interface () || cnt == 0) + return 0; + +@@ -2000,6 +2018,22 @@ ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, && check_condition (addr, cond, &data_value, &len)); } -+static void -+set_saved_dabr_value_callback (int tid, void *retp_voidp) ++/* Callback for linux_nat_iterate_watchpoint_lwps setting RETP_VOIDP by ++ PTRACE_SET_DEBUGREG for LP. */ ++ ++static int ++set_saved_dabr_value_callback (struct lwp_info *lp, void *retp_voidp) +{ + int *retp = retp_voidp; + -+ if (ptrace (PTRACE_SET_DEBUGREG, tid, 0, saved_dabr_value) < 0) ++ if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0, saved_dabr_value) ++ < 0) + *retp = -1; ++ ++ /* Continue the traversal. */ ++ return 0; +} + /* Set up P with the parameters necessary to request a watchpoint covering LEN bytes starting at ADDR and if possible with condition expression COND evaluated by hardware. INSERT tells if we are creating a request for -@@ -2058,8 +2077,6 @@ static int +@@ -2055,7 +2089,6 @@ static int ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, struct expression *cond) { - struct lwp_info *lp; -- ptid_t ptid; int ret = -1; if (have_ptrace_booke_interface ()) -@@ -2068,8 +2085,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR a +@@ -2064,8 +2097,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, create_watchpoint_request (&p, addr, len, rw, cond, 1); -- ALL_LWPS (lp, ptid) -- booke_insert_point (&p, TIDGET (ptid)); +- ALL_LWPS (lp) +- booke_insert_point (&p, TIDGET (lp->ptid)); + linux_nat_iterate_watchpoint_lwps (booke_insert_point_callback, &p); ret = 0; } -@@ -2112,12 +2128,8 @@ ppc_linux_insert_watchpoint (CORE_ADDR a +@@ -2108,12 +2140,8 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, saved_dabr_value = dabr_value; -- ALL_LWPS (lp, ptid) -- if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, +- ALL_LWPS (lp) +- if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0, - saved_dabr_value) < 0) - return -1; - @@ -6216,21 +7167,20 @@ Index: gdb-7.3.50.20110722/gdb/ppc-linux-nat.c } return ret; -@@ -2127,8 +2139,6 @@ static int +@@ -2123,7 +2151,6 @@ static int ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, struct expression *cond) { - struct lwp_info *lp; -- ptid_t ptid; int ret = -1; if (have_ptrace_booke_interface ()) -@@ -2137,20 +2147,16 @@ ppc_linux_remove_watchpoint (CORE_ADDR a +@@ -2132,20 +2159,16 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, create_watchpoint_request (&p, addr, len, rw, cond, 0); -- ALL_LWPS (lp, ptid) -- booke_remove_point (&p, TIDGET (ptid)); +- ALL_LWPS (lp) +- booke_remove_point (&p, TIDGET (lp->ptid)); + linux_nat_iterate_watchpoint_lwps (booke_remove_point_callback, &p); ret = 0; @@ -6238,8 +7188,8 @@ Index: gdb-7.3.50.20110722/gdb/ppc-linux-nat.c else { saved_dabr_value = 0; -- ALL_LWPS (lp, ptid) -- if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, +- ALL_LWPS (lp) +- if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0, - saved_dabr_value) < 0) - return -1; @@ -6248,11 +7198,145 @@ Index: gdb-7.3.50.20110722/gdb/ppc-linux-nat.c } return ret; -Index: gdb-7.3.50.20110722/gdb/printcmd.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/printcmd.c 2011-03-22 15:39:40.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/printcmd.c 2011-07-29 22:52:02.000000000 +0200 -@@ -975,6 +975,11 @@ print_command_1 (char *exp, int inspect, +@@ -2172,7 +2195,7 @@ ppc_linux_new_thread (struct lwp_info *lp) + /* Copy that thread's breakpoints and watchpoints to the new thread. */ + for (i = 0; i < max_slots_number; i++) + if (hw_breaks[i].hw_break) +- booke_insert_point (hw_breaks[i].hw_break, tid); ++ booke_insert_point (lp, hw_breaks[i].hw_break); + } + else + ptrace (PTRACE_SET_DEBUGREG, tid, 0, saved_dabr_value); +@@ -2230,7 +2253,14 @@ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) + /* The index (or slot) of the *point is passed in the si_errno field. */ + int slot = siginfo_p->si_errno; + +- t = booke_find_thread_points_by_tid (TIDGET (inferior_ptid), 0); ++ /* Overload thread id onto process id. */ ++ int tid = TIDGET (inferior_ptid); ++ ++ /* No thread id, just use process id. */ ++ if (tid == 0) ++ tid = PIDGET (inferior_ptid); ++ ++ t = booke_find_thread_points_by_tid (tid, 0); + + /* Find out if this *point is a hardware breakpoint. + If so, we should return 0. */ +diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c +index 07dd990..1e8e6d6 100644 +--- a/gdb/ppc-linux-tdep.c ++++ b/gdb/ppc-linux-tdep.c +@@ -66,6 +66,14 @@ + #include "features/rs6000/powerpc-isa205-vsx64l.c" + #include "features/rs6000/powerpc-e500l.c" + ++#include "stap-probe.h" ++#include "ax.h" ++#include "ax-gdb.h" ++#include "cli/cli-utils.h" ++#include "parser-defs.h" ++#include "user-regs.h" ++#include ++ + /* The syscall's XML filename for PPC and PPC64. */ + #define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml" + #define XML_SYSCALL_FILENAME_PPC64 "syscalls/ppc64-linux.xml" +@@ -1193,6 +1201,65 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch, + } + } + ++static int ++ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) ++{ ++ return (*s == 'i' /* Literal number. */ ++ || (isdigit (*s) && s[1] == '(' ++ && isdigit (s[2])) /* Displacement. */ ++ || (*s == '(' && isdigit (s[1])) /* Register indirection. */ ++ || isdigit (*s)); /* Register value. */ ++} ++ ++static int ++ppc_stap_parse_special_token (struct gdbarch *gdbarch, ++ struct stap_parse_info *p) ++{ ++ if (isdigit (*p->arg)) ++ { ++ /* This temporary pointer is needed because we have to do a lookahead. ++ We could be dealing with a register displacement, and in such case ++ we would not need to do anything. */ ++ const char *s = p->arg; ++ char *regname; ++ int len; ++ struct stoken str; ++ ++ while (isdigit (*s)) ++ ++s; ++ ++ if (*s == '(') ++ /* It is a register displacement indeed. Returning 0 means we are ++ deferring the treatment of this case to the generic parser. */ ++ return 0; ++ ++ len = s - p->arg; ++ regname = alloca (len + 2); ++ regname[0] = 'r'; ++ ++ strncpy (regname + 1, p->arg, len); ++ ++len; ++ regname[len] = '\0'; ++ ++ if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1) ++ error (_("Invalid register name `%s' on expression `%s'."), ++ regname, p->saved_arg); ++ ++ write_exp_elt_opcode (OP_REGISTER); ++ str.ptr = regname; ++ str.length = len; ++ write_exp_string (str); ++ write_exp_elt_opcode (OP_REGISTER); ++ ++ p->arg = s; ++ } ++ else ++ /* All the other tokens should be handled correctly by the generic ++ parser. */ ++ return 0; ++ ++ return 1; ++} + + /* Cell/B.E. active SPE context tracking support. */ + +@@ -1510,6 +1577,15 @@ ppc_linux_init_abi (struct gdbarch_info info, + /* Get the syscall number from the arch's register. */ + set_gdbarch_get_syscall_number (gdbarch, ppc_linux_get_syscall_number); + ++ /* SystemTap functions. */ ++ set_gdbarch_stap_integer_prefix (gdbarch, "i"); ++ set_gdbarch_stap_register_indirection_prefix (gdbarch, "("); ++ set_gdbarch_stap_register_indirection_sufix (gdbarch, ")"); ++ set_gdbarch_stap_gdb_register_prefix (gdbarch, "r"); ++ set_gdbarch_stap_is_single_operand (gdbarch, ppc_stap_is_single_operand); ++ set_gdbarch_stap_parse_special_token (gdbarch, ++ ppc_stap_parse_special_token); ++ + if (tdep->wordsize == 4) + { + /* Until November 2001, gcc did not comply with the 32 bit SysV +diff --git a/gdb/printcmd.c b/gdb/printcmd.c +index 5a522f4..36b932d 100644 +--- a/gdb/printcmd.c ++++ b/gdb/printcmd.c +@@ -51,6 +51,7 @@ + #include "charset.h" + #include "arch-utils.h" + #include "cli/cli-utils.h" ++#include "dwarf2loc.h" + + #ifdef TUI + #include "tui/tui.h" /* For tui_active et al. */ +@@ -973,6 +974,11 @@ print_command_1 (char *exp, int inspect, int voidprint) else val = access_value_history (0); @@ -6264,7 +7348,17 @@ Index: gdb-7.3.50.20110722/gdb/printcmd.c if (voidprint || (val && value_type (val) && TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) { -@@ -1476,6 +1481,24 @@ x_command (char *exp, int from_tty) +@@ -1061,6 +1067,9 @@ output_command (char *exp, int from_tty) + + val = evaluate_expression (expr); + ++ if (VALUE_LVAL (val) == lval_memory) ++ object_address_set (value_raw_address (val)); ++ + annotate_value_begin (value_type (val)); + + get_formatted_print_options (&opts, format); +@@ -1474,6 +1483,24 @@ x_command (char *exp, int from_tty) set_internalvar (lookup_internalvar ("__"), last_examine_value); } } @@ -6289,7 +7383,18 @@ Index: gdb-7.3.50.20110722/gdb/printcmd.c /* Add an expression to the auto-display chain. -@@ -2870,4 +2893,8 @@ Show printing of source filename and lin +@@ -1973,6 +2000,10 @@ print_variable_and_value (const char *name, struct symbol *var, + struct value_print_options opts; + + val = read_var_value (var, frame); ++ ++ make_cleanup_restore_selected_frame (); ++ select_frame (frame); ++ + get_user_print_options (&opts); + opts.deref_ref = 1; + common_val_print (val, stream, indent, &opts, current_language); +@@ -2886,4 +2917,8 @@ Show printing of source filename and line number with ."), NULL, add_com ("eval", no_class, eval_command, _("\ Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\ a command line, and call it.")); @@ -6298,10 +7403,11 @@ Index: gdb-7.3.50.20110722/gdb/printcmd.c + observer_attach_mark_used (print_types_mark_used); +#endif } -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/FrameIterator.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/FrameIterator.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py +new file mode 100644 +index 0000000..5654546 +--- /dev/null ++++ b/gdb/python/lib/gdb/FrameIterator.py @@ -0,0 +1,33 @@ +# Iterator over frames. + @@ -6336,10 +7442,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/FrameIterator.py + raise StopIteration + self.frame = result.older () + return result -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/FrameWrapper.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/FrameWrapper.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py +new file mode 100644 +index 0000000..b790a54 +--- /dev/null ++++ b/gdb/python/lib/gdb/FrameWrapper.py @@ -0,0 +1,112 @@ +# Wrapper API for frames. + @@ -6453,10 +7560,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/FrameWrapper.py + + def __getattr__ (self, name): + return getattr (self.frame, name) -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/backtrace.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/backtrace.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py +new file mode 100644 +index 0000000..6bb4fb1 +--- /dev/null ++++ b/gdb/python/lib/gdb/backtrace.py @@ -0,0 +1,42 @@ +# Filtering backtrace. + @@ -6500,74 +7608,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/backtrace.py + return iter + return frame_filter (iter) + -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/alias.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/command/alias.py 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,59 @@ -+# Alias command. -+ -+# Copyright (C) 2008 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 . -+ -+import gdb -+ -+class AliasImplementation (gdb.Command): -+ def __init__ (self, name, real, doc): -+ # Have to set __doc__ before the super init call. -+ # It would be nice if gdb's help looked up __doc__ dynamically. -+ self.__doc__ = doc -+ # Note: no good way to complete :( -+ super (AliasImplementation, self).__init__ (name, gdb.COMMAND_NONE) -+ self.real = real -+ -+ def invoke(self, arg, from_tty): -+ gdb.execute (self.real + ' ' + arg, from_tty) -+ -+class AliasCommand (gdb.Command): -+ """Alias one command to another. -+In the simplest form, the first word is the name of the alias, and -+the remaining words are the the expansion. -+An '=' by itself can be used to define a multi-word alias; words -+before the '=' are the name of the new command.""" -+ -+ def __init__ (self): -+ # Completion is not quite right here. -+ super (AliasCommand, self).__init__ ("alias", gdb.COMMAND_NONE, -+ gdb.COMPLETE_COMMAND) -+ -+ def invoke (self, arg, from_tty): -+ self.dont_repeat () -+ # Without some form of quoting we can't alias a multi-word -+ # command to another command. -+ args = arg.split() -+ try: -+ start = args.index ('=') -+ end = start + 1 -+ except ValueError: -+ start = 1 -+ end = 1 -+ target = " ".join(args[end:]) -+ AliasImplementation (" ".join (args[0:start]), target, -+ "This command is an alias for '%s'." % target) -+ -+AliasCommand() -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/backtrace.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/command/backtrace.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py +new file mode 100644 +index 0000000..eeea909 +--- /dev/null ++++ b/gdb/python/lib/gdb/command/backtrace.py @@ -0,0 +1,106 @@ +# New backtrace command. + @@ -6675,10 +7720,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/backtrace.py + pair[1].describe (sys.stdout, full) + +FilteringBacktrace() -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/ignore_errors.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/command/ignore_errors.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py +new file mode 100644 +index 0000000..6fa48ff +--- /dev/null ++++ b/gdb/python/lib/gdb/command/ignore_errors.py @@ -0,0 +1,37 @@ +# Ignore errors in user commands. + @@ -6717,10 +7763,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/ignore_errors.py + pass + +IgnoreErrorsCommand () -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/pahole.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/command/pahole.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py +new file mode 100644 +index 0000000..21a0bf0 +--- /dev/null ++++ b/gdb/python/lib/gdb/command/pahole.py @@ -0,0 +1,75 @@ +# pahole command for gdb + @@ -6797,10 +7844,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/pahole.py + self.pahole (type, 0, '') + +Pahole() -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/require.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/command/require.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/command/require.py b/gdb/python/lib/gdb/command/require.py +new file mode 100644 +index 0000000..1fbc1e8 +--- /dev/null ++++ b/gdb/python/lib/gdb/command/require.py @@ -0,0 +1,57 @@ +# Demand-loading commands. + @@ -6859,10 +7907,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/require.py +RequireCommand() +RequireSubcommand("command") +RequireSubcommand("function") -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/upto.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/command/upto.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/command/upto.py b/gdb/python/lib/gdb/command/upto.py +new file mode 100644 +index 0000000..faf54ed +--- /dev/null ++++ b/gdb/python/lib/gdb/command/upto.py @@ -0,0 +1,129 @@ +# upto command. + @@ -6993,16 +8042,18 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/command/upto.py +UptoSourceCommand () +UptoObjectCommand () +UptoWhereCommand () -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/function/__init__.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/function/__init__.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/function/__init__.py b/gdb/python/lib/gdb/function/__init__.py +new file mode 100644 +index 0000000..8b13789 +--- /dev/null ++++ b/gdb/python/lib/gdb/function/__init__.py @@ -0,0 +1 @@ + -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/function/caller_is.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/function/caller_is.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py +new file mode 100644 +index 0000000..2b9c5c7 +--- /dev/null ++++ b/gdb/python/lib/gdb/function/caller_is.py @@ -0,0 +1,58 @@ +# Caller-is functions. + @@ -7062,10 +8113,11 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/function/caller_is.py + +CallerIs() +CallerMatches() -Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/function/in_scope.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/python/lib/gdb/function/in_scope.py 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py +new file mode 100644 +index 0000000..debb3bb +--- /dev/null ++++ b/gdb/python/lib/gdb/function/in_scope.py @@ -0,0 +1,47 @@ +# In-scope function. + @@ -7114,20 +8166,20 @@ Index: gdb-7.3.50.20110722/gdb/python/lib/gdb/function/in_scope.py + return wanted == found + +InScope () -Index: gdb-7.3.50.20110722/gdb/python/py-type.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/python/py-type.c 2011-06-24 21:47:37.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/python/py-type.c 2011-07-29 22:52:02.000000000 +0200 -@@ -29,6 +29,8 @@ - #include "language.h" +diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c +index 50f9b72..754d451 100644 +--- a/gdb/python/py-type.c ++++ b/gdb/python/py-type.c +@@ -30,6 +30,8 @@ #include "vec.h" #include "bcache.h" + #include "dwarf2loc.h" +#include "observer.h" +#include "gdb_assert.h" typedef struct pyty_type_object { -@@ -37,11 +39,19 @@ typedef struct pyty_type_object +@@ -38,11 +40,19 @@ typedef struct pyty_type_object /* If a Type object is associated with an objfile, it is kept on a doubly-linked list, rooted in the objfile. This lets us copy the @@ -7148,7 +8200,7 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c static PyTypeObject type_object_type; /* A Field object. */ -@@ -919,8 +929,63 @@ typy_richcompare (PyObject *self, PyObje +@@ -1150,8 +1160,63 @@ typy_richcompare (PyObject *self, PyObject *other, int op) @@ -7212,7 +8264,7 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c static void save_objfile_types (struct objfile *objfile, void *datum) { -@@ -938,12 +1003,13 @@ save_objfile_types (struct objfile *objf +@@ -1169,12 +1234,13 @@ save_objfile_types (struct objfile *objfile, void *datum) { type_object *next = obj->next; @@ -7230,7 +8282,7 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c obj = next; } -@@ -954,43 +1020,28 @@ save_objfile_types (struct objfile *objf +@@ -1185,43 +1251,28 @@ save_objfile_types (struct objfile *objfile, void *datum) } static void @@ -7242,7 +8294,8 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c - if (type && TYPE_OBJFILE (type)) - { - struct objfile *objfile = TYPE_OBJFILE (type); -- ++ type_object *type_obj = (type_object *) obj; + - obj->next = objfile_data (objfile, typy_objfile_data_key); - if (obj->next) - obj->next->prev = obj; @@ -7250,8 +8303,6 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c - } - else - obj->next = NULL; -+ type_object *type_obj = (type_object *) obj; -+ + typy_unlink (type_obj); + + type_obj->ob_type->tp_free (obj); @@ -7287,9 +8338,9 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c } +#endif - /* Create a new Type referring to TYPE. */ - PyObject * -@@ -1000,7 +1051,10 @@ type_to_type_object (struct type *type) + /* Return number of fields ("length" of the field dictionary). */ + +@@ -1444,7 +1495,10 @@ type_to_type_object (struct type *type) type_obj = PyObject_New (type_object, &type_object_type); if (type_obj) @@ -7301,7 +8352,7 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c return (PyObject *) type_obj; } -@@ -1074,6 +1128,10 @@ gdbpy_initialize_types (void) +@@ -1524,6 +1578,10 @@ gdbpy_initialize_types (void) Py_INCREF (&field_object_type); PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type); @@ -7312,10 +8363,10 @@ Index: gdb-7.3.50.20110722/gdb/python/py-type.c } -Index: gdb-7.3.50.20110722/gdb/python/py-value.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/python/py-value.c 2011-06-27 21:21:51.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/python/py-value.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c +index 04e355a..a7d592a 100644 +--- a/gdb/python/py-value.c ++++ b/gdb/python/py-value.c @@ -28,6 +28,7 @@ #include "infcall.h" #include "expression.h" @@ -7324,7 +8375,7 @@ Index: gdb-7.3.50.20110722/gdb/python/py-value.c #ifdef HAVE_PYTHON -@@ -1208,6 +1209,19 @@ gdbpy_is_value_object (PyObject *obj) +@@ -1281,6 +1282,19 @@ gdbpy_is_value_object (PyObject *obj) return PyObject_TypeCheck (obj, &value_object_type); } @@ -7344,7 +8395,7 @@ Index: gdb-7.3.50.20110722/gdb/python/py-value.c void gdbpy_initialize_values (void) { -@@ -1218,6 +1232,10 @@ gdbpy_initialize_values (void) +@@ -1291,6 +1305,10 @@ gdbpy_initialize_values (void) PyModule_AddObject (gdb_module, "Value", (PyObject *) &value_object_type); values_in_python = NULL; @@ -7355,11 +8406,11 @@ Index: gdb-7.3.50.20110722/gdb/python/py-value.c } -Index: gdb-7.3.50.20110722/gdb/python/python.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/python/python.c 2011-07-21 13:03:47.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/python/python.c 2011-07-29 22:52:02.000000000 +0200 -@@ -49,9 +49,12 @@ static int gdbpy_should_print_stack = 0; +diff --git a/gdb/python/python.c b/gdb/python/python.c +index 13ac15e..0db41ee 100644 +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -66,10 +66,13 @@ static const char *gdbpy_should_print_stack = python_excp_message; #include "linespec.h" #include "source.h" #include "version.h" @@ -7368,11 +8419,12 @@ Index: gdb-7.3.50.20110722/gdb/python/python.c #include "target.h" #include "gdbthread.h" #include "observer.h" + #include "interps.h" +#include "event-top.h" static PyMethodDef GdbMethods[]; -@@ -849,6 +852,53 @@ gdbpy_print_stack (void) +@@ -946,6 +949,53 @@ gdbpy_print_stack (void) /* Return the current Progspace. There always is one. */ @@ -7424,35 +8476,215 @@ Index: gdb-7.3.50.20110722/gdb/python/python.c + + - static PyObject * - gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) -@@ -1333,6 +1383,8 @@ static PyMethodDef GdbMethods[] = - "Get a value from history" }, - { "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS, - "Execute a gdb command" }, -+ { "cli", gdbpy_cli, METH_NOARGS, -+ "Enter the gdb CLI" }, - { "parameter", gdbpy_parameter, METH_VARARGS, - "Return a gdb parameter's value" }, - -Index: gdb-7.3.50.20110722/gdb/python/python.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/python/python.h 2011-03-14 17:09:54.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/python/python.h 2011-07-29 22:52:02.000000000 +0200 -@@ -32,6 +32,8 @@ void eval_python_from_control_command (s + static PyObject * + gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) +@@ -1383,6 +1433,8 @@ static PyMethodDef GdbMethods[] = + "Get a value from history" }, + { "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS, + "Execute a gdb command" }, ++ { "cli", gdbpy_cli, METH_NOARGS, ++ "Enter the gdb CLI" }, + { "parameter", gdbpy_parameter, METH_VARARGS, + "Return a gdb parameter's value" }, + +diff --git a/gdb/python/python.h b/gdb/python/python.h +index ae55cc2..8808866 100644 +--- a/gdb/python/python.h ++++ b/gdb/python/python.h +@@ -32,6 +32,8 @@ void eval_python_from_control_command (struct command_line *); + + void source_python_script (const char *file); + ++void run_python_script (int argc, char **argv); ++ + int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, +diff --git a/gdb/remote.c b/gdb/remote.c +index 9bfebd2..44aeaae 100644 +--- a/gdb/remote.c ++++ b/gdb/remote.c +@@ -9886,7 +9886,7 @@ remote_download_tracepoint (struct bp_location *loc) + char **stepping_actions; + int ndx; + struct cleanup *old_chain = NULL; +- struct agent_expr *aexpr; ++ struct agent_expr *aexpr = NULL; + struct cleanup *aexpr_chain = NULL; + char *pkt; + struct breakpoint *b = loc->owner; +diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c +index 6381675..883620c 100644 +--- a/gdb/s390-nat.c ++++ b/gdb/s390-nat.c +@@ -438,11 +438,36 @@ struct watch_area + CORE_ADDR hi_addr; + }; + +-static struct watch_area *watch_base = NULL; ++/* Per-inferior data key. */ ++ ++struct s390_inferior_data ++ { ++ struct watch_area *watch_base; ++ }; ++ ++static struct s390_inferior_data * ++s390_inferior_data_get (void) ++{ ++ /* Intermediate patch stub. */ ++ static struct i386_inferior_data inf_data_local; ++ struct inferior *inf = current_inferior (); ++ struct i386_inferior_data *inf_data = &inf_data_local; ++ ++ return inf->pid == ptid_get_pid (inferior_ptid) ? inf_data : NULL; ++} ++ ++static struct watch_area * ++s390_watch_base_get (void) ++{ ++ struct s390_inferior_data *inferior_data = s390_inferior_data_get (); ++ ++ return inferior_data ? inferior_data->watch_base : NULL; ++} + + static int + s390_stopped_by_watchpoint (void) + { ++ struct watch_area *watch_base = s390_watch_base_get (); + per_lowcore_bits per_lowcore; + ptrace_area parea; + int result; +@@ -471,9 +496,13 @@ s390_stopped_by_watchpoint (void) + return result; + } + ++/* Update hardware registers of this specific LP. LP must belong to ++ CURRENT_INFERIOR. */ ++ + static void + s390_fix_watch_points (struct lwp_info *lp) + { ++ struct watch_area *watch_base; + int tid; + + per_struct per_info; +@@ -482,9 +511,20 @@ s390_fix_watch_points (struct lwp_info *lp) + CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0; + struct watch_area *area; + +- tid = TIDGET (lp->ptid); +- if (tid == 0) +- tid = PIDGET (lp->ptid); ++ gdb_assert (lp == NULL || current_inferior ()->pid == PIDGET (lp->ptid)); ++ ++ if (lp == NULL) ++ { ++ tid = PIDGET (inferior_ptid); ++ watch_base = NULL; ++ } ++ else ++ { ++ tid = TIDGET (lp->ptid); ++ if (tid == 0) ++ tid = PIDGET (lp->ptid); ++ watch_base = s390_watch_base_get (); ++ } + + for (area = watch_base; area; area = area->next) + { +@@ -515,6 +555,18 @@ s390_fix_watch_points (struct lwp_info *lp) + perror_with_name (_("Couldn't modify watchpoint status")); + } + ++/* Callback for linux_nat_iterate_watchpoint_lwps, ++ to call s390_fix_watch_points. */ ++ ++static int ++s390_fix_watch_points_iterate (struct lwp_info *lp, void *arg) ++{ ++ s390_fix_watch_points (lp); ++ ++ /* Continue the traversal. */ ++ return 0; ++} ++ + static int + s390_insert_watchpoint (CORE_ADDR addr, int len, int type, + struct expression *cond) +@@ -531,8 +583,8 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type, + area->next = watch_base; + watch_base = area; + +- ALL_LWPS (lp) +- s390_fix_watch_points (lp); ++ linux_nat_iterate_watchpoint_lwps (s390_fix_watch_points_iterate, NULL); ++ + return 0; + } + +@@ -559,8 +611,8 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type, + *parea = area->next; + xfree (area); + +- ALL_LWPS (lp) +- s390_fix_watch_points (lp); ++ linux_nat_iterate_watchpoint_lwps (s390_fix_watch_points_iterate, NULL); ++ + return 0; + } + +diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c +index cd0ef9c..8583051 100644 +--- a/gdb/s390-tdep.c ++++ b/gdb/s390-tdep.c +@@ -56,6 +56,12 @@ + #include "features/s390x-linux64v1.c" + #include "features/s390x-linux64v2.c" + ++#include "stap-probe.h" ++#include "ax.h" ++#include "ax-gdb.h" ++#include "user-regs.h" ++#include "cli/cli-utils.h" ++#include + + /* The tdep structure. */ + +@@ -2954,6 +2960,15 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, + return 0; + } + ++static int ++s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) ++{ ++ return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement ++ or indirection. */ ++ || *s == '%' /* Register access. */ ++ || isdigit (*s)); /* Literal number. */ ++} ++ + /* Set up gdbarch struct. */ + + static struct gdbarch * +@@ -3284,6 +3299,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - void source_python_script (FILE *stream, const char *file); + set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type); -+void run_python_script (int argc, char **argv); ++ /* SystemTap functions. */ ++ set_gdbarch_stap_register_prefix (gdbarch, "%"); ++ set_gdbarch_stap_register_indirection_prefix (gdbarch, "("); ++ set_gdbarch_stap_register_indirection_sufix (gdbarch, ")"); ++ set_gdbarch_stap_is_single_operand (gdbarch, s390_stap_is_single_operand); + - int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, -Index: gdb-7.3.50.20110722/gdb/somread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/somread.c 2011-03-07 17:17:29.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/somread.c 2011-07-29 22:52:02.000000000 +0200 -@@ -439,6 +439,7 @@ static const struct sym_fns som_sym_fns + return gdbarch; + } + +diff --git a/gdb/somread.c b/gdb/somread.c +index 70fc3a3..e5c8c9f 100644 +--- a/gdb/somread.c ++++ b/gdb/somread.c +@@ -427,6 +427,7 @@ static const struct sym_fns som_sym_fns = default_symfile_segments, /* Get segment information from a file. */ NULL, default_symfile_relocate, /* Relocate a debug section. */ @@ -7460,37 +8692,27 @@ Index: gdb-7.3.50.20110722/gdb/somread.c &psym_functions }; -Index: gdb-7.3.50.20110722/gdb/stack.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/stack.c 2011-06-27 21:21:50.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/stack.c 2011-07-29 22:52:02.000000000 +0200 -@@ -366,6 +366,7 @@ print_frame_args (struct symbol *func, s - { - const struct language_defn *language; - struct value_print_options opts; -+ struct cleanup *old_chain; - - /* Use the appropriate language to display our symbol, - unless the user forced the language to a specific -@@ -378,7 +379,13 @@ print_frame_args (struct symbol *func, s - get_raw_print_options (&opts); - opts.deref_ref = 0; - opts.summary = summary; -+ -+ /* Frame may be needed for check_typedef of TYPE_DYNAMIC. */ -+ old_chain = make_cleanup_restore_selected_frame (); -+ select_frame (frame); - common_val_print (val, stb->stream, 2, &opts, language); -+ do_cleanups (old_chain); -+ - ui_out_field_stream (uiout, "value", stb); - } - else -Index: gdb-7.3.50.20110722/gdb/stap-probe.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/stap-probe.c 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,2042 @@ +diff --git a/gdb/stack.c b/gdb/stack.c +index c5c54db..9fc3b74 100644 +--- a/gdb/stack.c ++++ b/gdb/stack.c +@@ -511,6 +511,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame, + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup_ui_out_stream_delete (stb); + ++ /* Frame may be needed for check_typedef of TYPE_DYNAMIC. */ ++ make_cleanup_restore_selected_frame (); ++ select_frame (frame); ++ + if (func) + { + struct block *b = SYMBOL_BLOCK_VALUE (func); +diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c +new file mode 100644 +index 0000000..74fd9e9 +--- /dev/null ++++ b/gdb/stap-probe.c +@@ -0,0 +1,1671 @@ +/* SystemTap probe support for GDB. + + Copyright (C) 2011 Free Software Foundation, Inc. @@ -7518,23 +8740,30 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c +#include "objfiles.h" +#include "arch-utils.h" +#include "command.h" ++#include "gdbcmd.h" +#include "filenames.h" +#include "value.h" +#include "exceptions.h" +#include "ax.h" +#include "ax-gdb.h" -+#include "user-regs.h" +#include "complaints.h" +#include "cli/cli-utils.h" +#include "linespec.h" ++#include "user-regs.h" ++#include "parser-defs.h" ++#include "language.h" + +#include + -+/* This define is used to inform whether we are compiling an agent -+ expression or not. */ ++/* The maximum number of arguments that a probe can have, ++ as defined in . */ ++ ++#define STAP_MAX_ARGS 12 ++ ++/* Should we display debug information for the probe's argument expression ++ parsing? */ + -+#define STAP_COMPILING_AGENT_EXPR_P(eval_info) \ -+ (eval_info->aexpr != NULL) ++static int stap_expression_debug = 0; + +/* The various possibilities of bitness defined for a probe's argument. + @@ -7562,14 +8791,12 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + /* The bitness of this argument. */ + enum stap_arg_bitness bitness; + -+ /* The string representing this argument. */ -+ char *arg_str; -+}; -+ -+/* The maximum number of arguments that a probe can have, -+ as defined in . */ ++ /* The corresponding `struct type *' to the bitness. */ ++ struct type *atype; + -+#define STAP_MAX_ARGS 10 ++ /* The argument converted to an internal GDB expression. */ ++ struct expression *aexpr; ++}; + +/* Structure that holds information about all arguments of a probe. */ + @@ -7581,494 +8808,117 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + /* The probe to which these arguments belong. */ + struct stap_probe *probe; + -+ /* Information about each argument. */ -+ struct stap_probe_arg *arg; -+}; -+ -+/* Structure that contains all the necessary information to evaluate -+ an expression. */ -+ -+struct stap_evaluation_info -+{ -+ /* The constant pointer which holds the expression. This is primarily -+ used for printing error messages. Evaluation functions should -+ not modify this pointer directly; instead, they should use the -+ EXP_BUFFER pointer below. */ -+ const char *saved_expr; -+ -+ /* Modifiable version of the above pointer. */ -+ char *exp_buf; -+ -+ /* The pointer to the current gdbarch. */ -+ struct gdbarch *gdbarch; -+ -+ /* The pointer to the current frame, used when accessing registers' -+ contents. */ -+ struct frame_info *frame; -+ -+ /* The bitness specified for this argument. */ -+ enum stap_arg_bitness bitness; -+ -+ /* If the above flag is true (one), this field will contain the -+ pointer to the agent expression. */ -+ struct agent_expr *aexpr; -+ -+ /* The value we are modifying (for agent expression). */ -+ struct axs_value *avalue; ++ /* Information about each argument. This is an array of `stap_probe_arg', ++ with each entry representing one argument. */ ++ struct stap_probe_arg *args; +}; + -+/* This dummy variable is used when parsing a probe's argument fails. -+ In this case, the number of arguments for this probe is zero, so that's -+ why this variable is useful. */ -+ -+static struct stap_args_info dummy_stap_args_info = -+ { 0, NULL, NULL }; -+ -+static struct value *stap_evaluate_probe_argument_2 -+ (struct stap_evaluation_info *eval_info, -+ struct value *lhs, int prec); -+ -+static struct value *stap_evaluate_conditionally -+ (struct stap_evaluation_info *eval_info); -+ -+/* Helper function which decides to skip whitespaces or not in a probe's -+ argument string. Basically, if we are inside a parenthesis expression -+ (i.e., inside a subexpression), we can skip whitespaces; otherwise we -+ cannot. */ -+ -+static void -+stap_skip_whitespace_cond (char **s, int inside_paren) -+{ -+ if (inside_paren) -+ *s = skip_spaces (*s); -+} -+ -+/* Helper function which parses a single argument in a probe's argument -+ string, based on various rules (which can be learned from the `gas' -+ manual). It returns 1 on success, or 0 otherwise. */ -+ -+static int -+stap_parse_arg (const char **p) -+{ -+ char *cur = (char *) *p; -+ int done = 0; -+ int paren_open = 0; -+ -+ while (!done) -+ { -+ switch (*cur) -+ { -+ case ' ': case 0: -+ /* If we're here, then we have already parsed everything -+ from this argument. */ -+ if (paren_open) -+ return 0; -+ done = 1; -+ break; -+ -+ case '(': -+ ++paren_open; -+ ++cur; -+ stap_skip_whitespace_cond (&cur, paren_open); -+ break; -+ -+ case ')': -+ if (!paren_open) -+ return 0; -+ -+ --paren_open; -+ ++cur; -+ if (paren_open) -+ cur = skip_spaces (cur); -+ break; -+ -+ case '+': case '-': -+ case '*': case '/': -+ case '>': case '<': case '|': case '&': -+ case '^': case '!': -+ { -+ char c = *cur; -+ -+ ++cur; -+ switch (*cur) -+ { -+ case '>': -+ if (c != '<' && c != '>') -+ return 0; -+ -+ ++cur; -+ break; -+ -+ case '<': -+ if (c != '<') -+ return 0; -+ -+ ++cur; -+ break; -+ -+ case '=': -+ if (c != '=' && c != '<' && c != '>' && c != '!') -+ return 0; -+ -+ ++cur; -+ break; -+ -+ case '|': -+ if (c != '|') -+ return 0; -+ -+ ++cur; -+ break; -+ -+ case '&': -+ if (c != '&') -+ return 0; -+ -+ ++cur; -+ break; -+ -+ default: -+ break; -+ } -+ /* Infix operators take two arguments, one on either -+ side. Skipping the whitespaces that may happen on the -+ right side. */ -+ stap_skip_whitespace_cond (&cur, paren_open); -+ } -+ break; -+ -+ case '%': -+ { -+ ++cur; -+ stap_skip_whitespace_cond (&cur, paren_open); -+ if (*cur >= 'a' && *cur <= 'z') -+ { -+ /* We're dealing with a register name. */ -+ while (isalnum (*cur)) -+ ++cur; -+ -+ stap_skip_whitespace_cond (&cur, paren_open); -+ -+ /* Some registers (e.g. floating-point register stack -+ registers on Intel i386) have the following syntax: -+ -+ `%st(0)', `%st(1)', and so on. -+ -+ So it's ok to expect parenthesis here. */ -+ if (*cur == '(') -+ { -+ ++cur; -+ stap_skip_whitespace_cond (&cur, paren_open); -+ if (!isdigit (*cur)) -+ /* This is an error, since we only expect numbers -+ inside this parenthesis. */ -+ return 0; -+ ++cur; -+ stap_skip_whitespace_cond (&cur, paren_open); -+ if (*cur != ')') -+ /* We only expect one number. */ -+ return 0; -+ ++cur; -+ stap_skip_whitespace_cond (&cur, paren_open); -+ } -+ } -+ } -+ break; -+ -+ case '$': -+ { -+ /* This is an integer constant. */ -+ ++cur; -+ stap_skip_whitespace_cond (&cur, paren_open); -+ -+ while (isdigit (*cur)) -+ ++cur; -+ -+ stap_skip_whitespace_cond (&cur, paren_open); -+ } -+ break; -+ -+ case '0': case '1': case '2': case '3': case '4': -+ case '5': case '6': case '7': case '8': case '9': -+ { -+ char *old = cur; -+ -+ /* Number. */ -+ while (isdigit (*cur)) -+ ++cur; -+ -+ /* We have to do a lookahead here, because the user may -+ input `2 + 2' (with spaces), and this is not an error. */ -+ cur = skip_spaces (cur); -+ -+ switch (*cur) -+ { -+ case '+': case '-': -+ /* We may find the `@' sign, and it means that the -+ argument has finished, so we shouldn't advance the -+ pointer. */ -+ if (cur[1] && (cur[1] == '4' || cur[1] == '8') -+ && cur[2] && cur[2] == '@') -+ { -+ cur = old; -+ goto fin; -+ } -+ break; -+ -+ case '*': case '/': case '>': case '<': -+ case '|': case '&': case '^': case '!': -+ /* This is a binary operation, which means we'll -+ have to find another number after the operator. */ -+ break; -+ -+ case '(': -+ /* We may also have sentences in the form: -+ -+ `4 (%rax)' */ -+ break; -+ } -+ } -+fin: -+ break; -+ } -+ } -+ -+ *p = cur; -+ -+ return 1; -+} -+ -+/* Helper function which is responsible for freeing the space allocated to -+ hold information about a probe's arguments. */ -+ -+static void -+stap_free_args_info (void *args_info_ptr) -+{ -+ struct stap_args_info *a = (struct stap_args_info *) args_info_ptr; -+ int i; -+ -+ for (i = 0; i < a->n_args; i++) -+ xfree (a->arg[i].arg_str); -+ -+ xfree (a->arg); -+ xfree (a); -+} -+ -+/* Function which parses an argument string from PROBE, correctly splitting -+ the arguments and storing their information in properly ways. This function -+ only separates the arguments, but does not evaluate them. -+ -+ Consider the following argument string: -+ -+ `4@%eax 4@$10' -+ -+ We have two arguments, `%eax' and `$10', both with 32-bit unsigned bitness. -+ This function basically handles them, properly filling some structures with -+ this information. */ -+ -+static void -+stap_parse_probe_arguments (struct stap_probe *probe) -+{ -+ struct stap_args_info *args_info; -+ struct cleanup *back_to; -+ const char *cur = probe->args; -+ int current_arg = -1; -+ /* This is a state-machine parser, which means we will always be -+ in a known state when parsing an argument. The state could be -+ either `NEW_ARG' if we are parsing a new argument, `BITNESS' if -+ we are parsing the bitness-definition part (i.e., `4@'), or -+ `PARSE_ARG' if we are actually parsing the argument part. */ -+ enum -+ { -+ NEW_ARG, -+ BITNESS, -+ PARSE_ARG, -+ } current_state; -+ -+ /* For now, we assume everything is not going to work. */ -+ probe->parsed_args = &dummy_stap_args_info; -+ -+ if (!cur || !*cur || *cur == ':') -+ return; -+ -+ args_info = xmalloc (sizeof (struct stap_args_info)); -+ args_info->n_args = 0; -+ back_to = make_cleanup (stap_free_args_info, args_info); -+ args_info->arg = xcalloc (STAP_MAX_ARGS, sizeof (struct stap_probe_arg)); -+ -+ /* Ok, let's start. */ -+ current_state = NEW_ARG; -+ -+ while (*cur) -+ { -+ switch (current_state) -+ { -+ case NEW_ARG: -+ ++current_arg; -+ -+ if (current_arg >= STAP_MAX_ARGS) -+ { -+ complaint (&symfile_complaints, -+ _("probe `%s' has more arguments than the maximum " -+ "allowed"), probe->name); -+ do_cleanups (back_to); -+ return; -+ } -+ -+ current_state = BITNESS; -+ break; -+ -+ case BITNESS: -+ { -+ enum stap_arg_bitness b; -+ int got_minus = 0; -+ -+ /* We expect to find something like: -+ -+ N@OP -+ -+ Where `N' can be [+,-][4,8]. This is not mandatory, so -+ we check it here. If we don't find it, go to the next -+ state. */ -+ if ((*cur == '-' && cur[1] && cur[2] != '@') -+ && cur[1] != '@') -+ { -+ current_state = PARSE_ARG; -+ args_info->arg[current_arg].bitness -+ = STAP_ARG_BITNESS_UNDEFINED; -+ break; -+ } -+ -+ if (*cur == '-') -+ { -+ /* Discard the `-'. */ -+ ++cur; -+ got_minus = 1; -+ } -+ -+ if (*cur == '4') -+ b = got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED -+ : STAP_ARG_BITNESS_32BIT_UNSIGNED; -+ else if (*cur == '8') -+ b = got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED -+ : STAP_ARG_BITNESS_64BIT_UNSIGNED; -+ else -+ { -+ /* We have an error, because we don't expect anything -+ except 4 and 8. */ -+ complaint (&symfile_complaints, -+ _("unrecognized bitness `%c' for probe `%s'"), -+ *cur, probe->name); -+ do_cleanups (back_to); -+ return; -+ } ++/* When parsing the arguments, we have to establish different precedences ++ for the various kinds of asm operators. This enumeration represents those ++ precedences. + -+ args_info->arg[current_arg].bitness = b; -+ /* Discard the number and the `@' sign. */ -+ cur += 2; -+ /* Move on. */ -+ current_state = PARSE_ARG; -+ } -+ break; ++ This logic behind this is available at ++ , or using ++ the command "info '(as)Infix Ops'". */ + -+ case PARSE_ARG: -+ { -+ const char *start = cur; ++enum stap_operand_prec ++{ ++ /* Lowest precedence, used for non-recognized operands or for the beginning ++ of the parsing process. */ ++ STAP_OPERAND_PREC_NONE = 0, + -+ if (!stap_parse_arg (&cur)) -+ { -+ /* We have tried to parse this argument, but it's -+ malformed. This is an error. */ -+ do_cleanups (back_to); -+ return; -+ } ++ /* Precedence of logical OR. */ ++ STAP_OPERAND_PREC_LOGICAL_OR, + -+ args_info->arg[current_arg].arg_str -+ = savestring (start, cur - start); -+ ++args_info->n_args; -+ /* Start it over again. */ -+ cur = skip_spaces ((char *) cur); -+ current_state = NEW_ARG; -+ } -+ break; -+ } ++ /* Precedence of logical AND. */ ++ STAP_OPERAND_PREC_LOGICAL_AND, + -+ if (!*cur && current_state != NEW_ARG) -+ { -+ /* We reached the end of the argument string, but we're -+ still in the middle of the process of parsing an argument. -+ It means the argument string is malformed. */ -+ complaint (&symfile_complaints, -+ _("malformed argument for probe `%s'"), -+ probe->name); -+ do_cleanups (back_to); -+ return; -+ } -+ } ++ /* Precedence of additive (plus, minus) and comparative (equal, less, ++ greater-than, etc) operands. */ ++ STAP_OPERAND_PREC_ADD_CMP, + -+ args_info->arg = xrealloc (args_info->arg, -+ args_info->n_args -+ * sizeof (struct stap_probe_arg)); -+ args_info->probe = probe; ++ /* Precedence of bitwise operands (bitwise OR, XOR, bitwise AND, ++ logical NOT). */ ++ STAP_OPERAND_PREC_BITWISE, + -+ probe->parsed_args = args_info; ++ /* Precedence of multiplicative operands (multiplication, division, ++ remainder, left shift and right shift). */ ++ STAP_OPERAND_PREC_MUL ++}; + -+ discard_cleanups (back_to); -+} ++/* This dummy variable is used when parsing a probe's argument fails. ++ In this case, the number of arguments for this probe is zero, so that's ++ why this variable is useful. */ + -+/* See definition in stap-probe.h. */ ++static struct stap_args_info dummy_stap_args_info = ++ { 0, NULL, NULL }; + -+int -+stap_get_probe_argument_count (const struct stap_probe *probe) -+{ -+ if (!probe->parsed_args) -+ stap_parse_probe_arguments ((struct stap_probe *) probe); ++static void stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs, ++ enum stap_operand_prec prec); + -+ return probe->parsed_args->n_args; ++static void stap_parse_argument_conditionally (struct stap_parse_info *p); ++ ++/* Returns 1 if *S is an operator, zero otherwise. */ ++ ++static int stap_is_operator (char op); ++ ++static void ++show_stapexpressiondebug (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ fprintf_filtered (file, _("SystemTap Probe expression debugging is %s.\n"), ++ value); +} + -+/* Returns the operator precedence level of OP, or zero if the operator -+ code was not recognized. -+ The levels were taken from the gas manual. */ ++/* Returns the operator precedence level of OP, or STAP_OPERAND_PREC_NONE ++ if the operator code was not recognized. */ + -+static int ++static enum stap_operand_prec +stap_get_operator_prec (enum exp_opcode op) +{ + switch (op) + { + case BINOP_LOGICAL_OR: -+ return 1; ++ return STAP_OPERAND_PREC_LOGICAL_OR; + + case BINOP_LOGICAL_AND: -+ return 2; ++ return STAP_OPERAND_PREC_LOGICAL_AND; + -+ case BINOP_ADD: case BINOP_SUB: -+ case BINOP_EQUAL: case BINOP_NOTEQUAL: -+ case BINOP_LESS: case BINOP_LEQ: -+ case BINOP_GTR: case BINOP_GEQ: -+ return 3; ++ case BINOP_ADD: ++ case BINOP_SUB: ++ case BINOP_EQUAL: ++ case BINOP_NOTEQUAL: ++ case BINOP_LESS: ++ case BINOP_LEQ: ++ case BINOP_GTR: ++ case BINOP_GEQ: ++ return STAP_OPERAND_PREC_ADD_CMP; + -+ case BINOP_BITWISE_IOR: case BINOP_BITWISE_AND: -+ case BINOP_BITWISE_XOR: case UNOP_LOGICAL_NOT: -+ return 4; ++ case BINOP_BITWISE_IOR: ++ case BINOP_BITWISE_AND: ++ case BINOP_BITWISE_XOR: ++ case UNOP_LOGICAL_NOT: ++ return STAP_OPERAND_PREC_BITWISE; + -+ case BINOP_MUL: case BINOP_DIV: case BINOP_REM: -+ case BINOP_LSH: case BINOP_RSH: -+ return 5; ++ case BINOP_MUL: ++ case BINOP_DIV: ++ case BINOP_REM: ++ case BINOP_LSH: ++ case BINOP_RSH: ++ return STAP_OPERAND_PREC_MUL; + + default: -+ return 0; ++ return STAP_OPERAND_PREC_NONE; + } +} + -+/* Given S, this function reads the operator in it and fills the OP -+ pointer with its code. Returns 1 on success, zero if the operator -+ was not recognized. */ ++/* Given S, read the operator in it and fills the OP pointer with its code. ++ Return 1 on success, zero if the operator was not recognized. */ + +static int -+stap_get_opcode (char **s, enum exp_opcode *op) ++stap_get_opcode (const char **s, enum exp_opcode *op) +{ -+ char c = **s; ++ const char c = **s; + int ret = 1; + + *s += 1; @@ -8084,16 +8934,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + break; + + case '%': -+ { -+ if (isalpha (**s)) -+ { -+ /* Dealing with a register name. */ -+ ret = 0; -+ break; -+ } -+ -+ *op = BINOP_REM; -+ } ++ *op = BINOP_REM; + break; + + case '<': @@ -8181,649 +9022,447 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + return ret; +} + -+/* Given the operator OPCODE, this function generates agent bytecode -+ for it. */ ++/* Given the bitness of the argument, represented by B, return the ++ corresponding `struct type *'. */ + -+static void -+stap_opcode_to_ax (struct stap_evaluation_info *eval_info, -+ enum exp_opcode opcode) ++static struct type * ++stap_get_expected_argument_type (struct gdbarch *gdbarch, ++ enum stap_arg_bitness b) +{ -+ struct agent_expr *expr = eval_info->aexpr; -+ -+ switch (opcode) ++ switch (b) + { -+ case BINOP_MUL: -+ ax_simple (expr, aop_mul); -+ break; -+ -+ case BINOP_DIV: -+ ax_simple (expr, aop_div_signed); -+ break; -+ -+ case BINOP_REM: -+ ax_simple (expr, aop_rem_unsigned); -+ break; -+ -+ case BINOP_LESS: -+ ax_simple (expr, aop_less_signed); -+ break; -+ -+ case BINOP_LEQ: -+ /* A <= B is !(B < A) */ -+ ax_simple (expr, aop_swap); -+ ax_simple (expr, aop_less_signed); -+ ax_simple (expr, aop_log_not); -+ break; -+ -+ case BINOP_GTR: -+ /* A > B is B < A */ -+ ax_simple (expr, aop_swap); -+ ax_simple (expr, aop_less_signed); -+ break; -+ -+ case BINOP_GEQ: -+ /* A >= B is !(A < B) */ -+ ax_simple (expr, aop_less_signed); -+ ax_simple (expr, aop_log_not); -+ break; -+ -+ case BINOP_NOTEQUAL: -+ ax_simple (expr, aop_equal); -+ ax_simple (expr, aop_log_not); -+ break; -+ -+ case BINOP_LSH: -+ ax_simple (expr, aop_lsh); -+ break; -+ -+ case BINOP_RSH: -+ ax_simple (expr, aop_rsh_unsigned); -+ break; -+ -+ case BINOP_BITWISE_IOR: -+ ax_simple (expr, aop_bit_or); -+ break; -+ -+ case BINOP_LOGICAL_OR: -+ error (_("Operator logical-or (`||') not supported yet.")); -+ break; -+ -+ case BINOP_BITWISE_AND: -+ ax_simple (expr, aop_bit_and); -+ break; -+ -+ case BINOP_LOGICAL_AND: -+ error (_("Operator logical-and (`&&') not supported yet.")); -+ break; -+ -+ case BINOP_BITWISE_XOR: -+ ax_simple (expr, aop_bit_xor); -+ break; ++ case STAP_ARG_BITNESS_UNDEFINED: ++ if (gdbarch_addr_bit (gdbarch) == 32) ++ return builtin_type (gdbarch)->builtin_uint32; ++ else ++ return builtin_type (gdbarch)->builtin_uint64; + -+ case UNOP_LOGICAL_NOT: -+ ax_simple (expr, aop_log_not); -+ break; ++ case STAP_ARG_BITNESS_32BIT_SIGNED: ++ return builtin_type (gdbarch)->builtin_int32; + -+ case BINOP_ADD: -+ ax_simple (expr, aop_add); -+ break; ++ case STAP_ARG_BITNESS_32BIT_UNSIGNED: ++ return builtin_type (gdbarch)->builtin_uint32; + -+ case BINOP_SUB: -+ ax_simple (expr, aop_sub); -+ break; ++ case STAP_ARG_BITNESS_64BIT_SIGNED: ++ return builtin_type (gdbarch)->builtin_int64; + -+ case BINOP_EQUAL: -+ ax_simple (expr, aop_equal); -+ break; ++ case STAP_ARG_BITNESS_64BIT_UNSIGNED: ++ return builtin_type (gdbarch)->builtin_uint64; + + default: -+ error (_("Invalid operator.")); ++ internal_error (__FILE__, __LINE__, ++ _("Undefined bitness for probe.")); ++ break; + } +} + -+/* Returns 1 if *S is an operator, zero otherwise. */ -+ -+static int -+stap_is_operator (char *s) -+{ -+ char op; -+ -+ if (!s || !*s) -+ return 0; -+ -+ op = *s; -+ -+ if (*s == '%' && isalpha (s[1])) -+ /* Register name. */ -+ return 0; -+ -+ return (op == '+' || op == '-' || op == '*' || op == '/' -+ || op == '>' || op == '<' || op == '!' || op == '^' -+ || op == '|' || op == '&' || op == '%' || op == '='); -+} -+ -+/* This function fetches the value of the register whose -+ name starts in the expression buffer. It also applies any register -+ displacements (e.g., `-4(%eax)'), and indirects the contents of the -+ register (e.g., `(%eax)'). It returns RET if the operation has succeeded, -+ or calls `error' otherwise. */ -+ -+static struct value * -+stap_fetch_reg_value (struct stap_evaluation_info *eval_info, -+ struct value *displacement) -+{ ++static void ++stap_parse_register_operand (struct stap_parse_info *p) ++{ ++ /* Simple flag to indicate whether we have seen a minus signal before ++ certain number. */ ++ int got_minus = 0; ++ /* Flags to indicate whether this register access is being displaced and/or ++ indirected. */ ++ int disp_p = 0, indirect_p = 0; ++ struct gdbarch *gdbarch = p->gdbarch; ++ /* Needed to generate the register name as a part of an expression. */ ++ struct stoken str; ++ /* Variables used to extract the register name from the probe's ++ argument. */ + const char *start; -+ char *s = eval_info->exp_buf; -+ struct gdbarch *gdbarch = eval_info->gdbarch; -+ struct frame_info *frame = eval_info->frame; -+ enum stap_arg_bitness bitness = eval_info->bitness; + char *regname; -+ int len, regnum, indirect_p = 0; -+ struct value *ret = NULL; -+ -+ /* The function which called us did not check if the expression -+ buffer was empty. */ -+ gdb_assert (s && *s); -+ -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ /* If we are compiling, we cannot return NULL because that would -+ lead to errors in future evaluations. That's why we just make -+ this dummy value, representing that the return value of this -+ function is not NULL. */ -+ ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0); -+ -+ /* Valid register name on x86 platforms are: -+ -+ [paren]%{a-z0-9}[paren] -+ -+ Let's check for that here. */ -+ if (*s == '(') ++ int len; ++ ++ /* Prefixes for the parser. */ ++ const char *reg_prefix = gdbarch_stap_register_prefix (gdbarch); ++ const char *reg_ind_prefix ++ = gdbarch_stap_register_indirection_prefix (gdbarch); ++ const char *gdb_reg_prefix = gdbarch_stap_gdb_register_prefix (gdbarch); ++ int reg_prefix_len = reg_prefix ? strlen (reg_prefix) : 0; ++ int reg_ind_prefix_len = reg_ind_prefix ? strlen (reg_ind_prefix) : 0; ++ int gdb_reg_prefix_len = gdb_reg_prefix ? strlen (gdb_reg_prefix) : 0; ++ ++ /* Sufixes for the parser. */ ++ const char *reg_sufix = gdbarch_stap_register_sufix (gdbarch); ++ const char *reg_ind_sufix ++ = gdbarch_stap_register_indirection_sufix (gdbarch); ++ const char *gdb_reg_sufix = gdbarch_stap_gdb_register_sufix (gdbarch); ++ int reg_sufix_len = reg_sufix ? strlen (reg_sufix) : 0; ++ int reg_ind_sufix_len = reg_ind_sufix ? strlen (reg_ind_sufix) : 0; ++ int gdb_reg_sufix_len = gdb_reg_sufix ? strlen (gdb_reg_sufix) : 0; ++ ++ /* Checking for a displacement argument. */ ++ if (*p->arg == '+') ++ /* If it's a plus sign, we don't need to do anything, just advance the ++ pointer. */ ++ ++p->arg; ++ ++ if (*p->arg == '-') + { -+ ++s; -+ if (!*s || *s != '%' -+ || (*s == '%' && !isalpha (s[1]))) -+ error (_("Invalid register name on expression `%s'."), -+ eval_info->saved_expr); -+ ++s; -+ /* The presence of parenthesis means that we want to indirect -+ the register. */ -+ indirect_p = 1; ++ got_minus = 1; ++ ++p->arg; + } -+ else if (*s == '%') ++ ++ if (isdigit (*p->arg)) + { -+ ++s; -+ if (!*s || !isalpha (*s)) -+ error (_("Invalid register name on expression `%s'."), -+ eval_info->saved_expr); ++ /* The value of the displacement. */ ++ long displacement; ++ ++ disp_p = 1; ++ displacement = strtol (p->arg, (char **) &p->arg, 10); ++ ++ /* Generating the expression for the displacement. */ ++ write_exp_elt_opcode (OP_LONG); ++ write_exp_elt_type (builtin_type (gdbarch)->builtin_long); ++ write_exp_elt_longcst (displacement); ++ write_exp_elt_opcode (OP_LONG); ++ if (got_minus) ++ write_exp_elt_opcode (UNOP_NEG); + } -+ else -+ error (_("Invalid register name on expression `%s'."), -+ eval_info->saved_expr); -+ -+ if (displacement && !indirect_p) -+ /* We cannot apply displacement to non-indirect register access. */ -+ error (_("Trying to apply displacement without indirecting register " -+ "on expression `%s'."), eval_info->saved_expr); -+ -+ /* Ok, let's calculate the size of the register name. */ -+ start = s; -+ while (isalnum (*s)) -+ ++s; + -+ len = s - start; -+ -+ if (indirect_p && *s == ')') -+ ++s; -+ -+ regname = alloca (len + 1); -+ strncpy (regname, start, len); -+ regname[len] = '\0'; -+ -+ /* Translating the register name into the corresponding number. */ -+ regnum = user_reg_map_name_to_regnum (gdbarch, regname, len); -+ -+ if (regnum == -1) -+ error (_("Invalid register name `%s' on expression `%s'."), -+ regname, eval_info->saved_expr); -+ -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ ax_reg (eval_info->aexpr, regnum); -+ else -+ ret = value_of_register (regnum, frame); -+ -+ if (indirect_p) ++ /* Getting rid of register indirection prefix. */ ++ if (reg_ind_prefix ++ && strncmp (p->arg, reg_ind_prefix, reg_ind_prefix_len) == 0) + { -+ struct type *t = NULL; -+ enum agent_op aop = aop_ref32; ++ indirect_p = 1; ++ p->arg += reg_ind_prefix_len; ++ } + -+ /* If the user has specified that the register must be indirected, -+ we should know what's the correct type to cast it before making -+ the indirection. This type corresponds to the bitness specified -+ before the `@' sign on the argument string, or it defaults to -+ `unsigned long' if the `@' were not present. */ ++ if (disp_p && !indirect_p) ++ error (_("Invalid register displacement syntax on expression `%s'."), ++ p->saved_arg); + -+ switch (bitness) -+ { -+ case STAP_ARG_BITNESS_UNDEFINED: -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ { -+ if (gdbarch_addr_bit (gdbarch) == 32) -+ aop = aop_ref32; -+ else -+ aop = aop_ref64; -+ } -+ else -+ { -+ if (gdbarch_addr_bit (gdbarch) == 32) -+ t = lookup_pointer_type -+ (builtin_type (gdbarch)->builtin_uint32); -+ else -+ t = lookup_pointer_type -+ (builtin_type (gdbarch)->builtin_uint64); -+ } -+ break; ++ /* Getting rid of register prefix. */ ++ if (reg_prefix && strncmp (p->arg, reg_prefix, reg_prefix_len) == 0) ++ p->arg += reg_prefix_len; + -+ case STAP_ARG_BITNESS_32BIT_SIGNED: -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ aop = aop_ref32; -+ else -+ t = lookup_pointer_type -+ (builtin_type (gdbarch)->builtin_int32); -+ break; ++ /* Now we should have only the register name. Let's extract it and get ++ the associated number. */ ++ start = p->arg; + -+ case STAP_ARG_BITNESS_32BIT_UNSIGNED: -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ aop = aop_ref32; -+ else -+ t = lookup_pointer_type -+ (builtin_type (gdbarch)->builtin_uint32); -+ break; ++ /* We assume the register name is composed by letters and numbers. */ ++ while (isalnum (*p->arg)) ++ ++p->arg; + -+ case STAP_ARG_BITNESS_64BIT_SIGNED: -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ aop = aop_ref64; -+ else -+ t = lookup_pointer_type -+ (builtin_type (gdbarch)->builtin_int64); -+ break; ++ len = p->arg - start; + -+ case STAP_ARG_BITNESS_64BIT_UNSIGNED: -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ aop = aop_ref64; -+ else -+ t = lookup_pointer_type -+ (builtin_type (gdbarch)->builtin_uint64); -+ break; ++ regname = alloca (len + gdb_reg_prefix_len + gdb_reg_sufix_len + 1); ++ regname[0] = '\0'; + -+ default: -+ internal_error (__FILE__, __LINE__, -+ _("Undefined bitness for probe.")); -+ break; -+ } ++ /* We only add the GDB's register prefix/sufix if we are dealing with ++ a numeric register. */ ++ if (gdb_reg_prefix && isdigit (*start)) ++ { ++ strncpy (regname, gdb_reg_prefix, gdb_reg_prefix_len); ++ strncpy (regname + gdb_reg_prefix_len, start, len); + -+ if (displacement) -+ { -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ { -+ ax_const_l (eval_info->aexpr, value_as_long (displacement)); -+ ax_simple (eval_info->aexpr, aop_add); -+ } -+ else -+ ret = value_ptradd (ret, value_as_long (displacement)); -+ } ++ if (gdb_reg_sufix) ++ strncpy (regname + gdb_reg_prefix_len + len, ++ gdb_reg_sufix, gdb_reg_sufix_len); + -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ { -+ if (trace_kludge) -+ { -+ gdb_assert (aop == aop_ref32 || aop == aop_ref64); -+ ax_trace_quick (eval_info->aexpr, aop == aop_ref32 ? 4 : 8); -+ } -+ ax_simple (eval_info->aexpr, aop); -+ } -+ else -+ { -+ ret = value_cast (t, ret); -+ ret = value_ind (ret); -+ } ++ len += gdb_reg_prefix_len + gdb_reg_sufix_len; + } ++ else ++ strncpy (regname, start, len); + -+ /* Updating the expression buffer pointer, because we have made -+ some modifications to it before. */ -+ eval_info->exp_buf = s; -+ -+ return ret; -+} -+ -+/* This function tries to evaluate a single operand of the expression. -+ -+ Single operands can be: -+ -+ - unary operators `-' and `~'; -+ - integer constants (beginning with `$'); -+ - register access, with/out displacement and indirection. */ -+ -+static struct value * -+stap_evaluate_single_operand (struct stap_evaluation_info *eval_info) -+{ -+ struct gdbarch *gdbarch = eval_info->gdbarch; -+ struct frame_info *frame = eval_info->frame; -+ enum stap_arg_bitness bitness = eval_info->bitness; -+ struct value *res = NULL; ++ regname[len] = '\0'; ++ /* Is this a valid register name? */ ++ if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1) ++ error (_("Invalid register name `%s' on expression `%s'."), ++ regname, p->saved_arg); + -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ /* If we are compiling, we cannot return NULL because that would -+ lead to errors in future evaluations. That's why we just make -+ this dummy value, representing that the return value of this -+ function is not NULL. */ -+ res = value_from_longest (builtin_type (gdbarch)->builtin_int, 0); ++ write_exp_elt_opcode (OP_REGISTER); ++ str.ptr = regname; ++ str.length = len; ++ write_exp_string (str); ++ write_exp_elt_opcode (OP_REGISTER); + -+ switch (*eval_info->exp_buf) ++ if (indirect_p) + { -+ case '-': case '~': -+ { -+ char c = *eval_info->exp_buf; -+ -+ /* This is an unary operator (either `-' or `~'). ++ if (disp_p) ++ write_exp_elt_opcode (BINOP_ADD); + -+ If it is followed by a parenthesis, and this parenthesis -+ is NOT followed by a `%', then we are dealing with an expression -+ like `-(2 + 3)' or `~(2 + 3)'. We just have to treat separately -+ and return the result after applying the operation (`-' or `~'). ++ /* Casting to the expected type. */ ++ write_exp_elt_opcode (UNOP_CAST); ++ write_exp_elt_type (lookup_pointer_type (p->arg_type)); ++ write_exp_elt_opcode (UNOP_CAST); + -+ If it is followed by a digit, then we have only one choice: it -+ is a displacement argument for a register access, like -+ `-4(%eax)'. It also means that the operator can *only* be `-', -+ and the characters immediately after the number *must* be `(%'. ++ write_exp_elt_opcode (UNOP_IND); ++ } + -+ If it is followed by a `$', then it is an integer constant, and -+ we should apply the correct operation to it. */ ++ /* Getting rid of the register name sufix. */ ++ if (reg_sufix) ++ { ++ if (strncmp (p->arg, reg_sufix, reg_sufix_len) != 0) ++ error (_("Missing register name sufix `%s' on expression `%s'."), ++ reg_sufix, p->saved_arg); + -+ ++eval_info->exp_buf; -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); -+ if (*eval_info->exp_buf -+ && *eval_info->exp_buf == '(' -+ && eval_info->exp_buf[1] != '%') -+ { -+ struct value *tmp_res; ++ p->arg += reg_sufix_len; ++ } + -+ /* We're not dealing with a register name, but with an -+ expression like `-(2 + 3)' or `~(2 + 3)'. We first have -+ to evaluate the right side of the expression (i.e., the -+ parenthesis), and then apply the specified operation -+ (either `-' or `~') to it. */ -+ tmp_res = stap_evaluate_conditionally (eval_info); ++ /* Getting rid of the register indirection sufix. */ ++ if (indirect_p && reg_ind_sufix) ++ { ++ if (strncmp (p->arg, reg_ind_sufix, reg_ind_sufix_len) != 0) ++ error (_("Missing indirection sufix `%s' on expression `%s'."), ++ reg_ind_sufix, p->saved_arg); + -+ if (c == '-') -+ { -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ { -+ /* We have to add `-1' to the stack, and multiply -+ the two values. */ -+ ax_const_l (eval_info->aexpr, -1); -+ ax_simple (eval_info->aexpr, aop_mul); -+ } -+ else -+ res = value_neg (tmp_res); -+ } -+ else -+ { -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ ax_simple (eval_info->aexpr, aop_bit_not); -+ else -+ res = value_complement (tmp_res); -+ } -+ } -+ else if (isdigit (*eval_info->exp_buf)) -+ { -+ int number; -+ -+ /* This is a number, so it MUST be a register displacement. -+ The only operator allowed here is `-', it MUST be -+ followed by a number, and the number MUST be followed by -+ `(%'. */ -+ if (c != '-') -+ error (_("Invalid operator `%c' for register displacement " -+ "on expression `%s'."), c, eval_info->saved_expr); -+ -+ number = strtol (eval_info->exp_buf, -+ &eval_info->exp_buf, 0) * -1; -+ -+ if (!*eval_info->exp_buf -+ || *eval_info->exp_buf != '(' -+ || (*eval_info->exp_buf == '(' -+ && eval_info->exp_buf[1] != '%')) -+ error (_("Invalid method of indirecting a register on " -+ "expression `%s'."), eval_info->saved_expr); -+ -+ res -+ = value_from_longest (builtin_type (gdbarch)->builtin_int, -+ number); -+ -+ res = stap_fetch_reg_value (eval_info, res); -+ } -+ else if (*eval_info->exp_buf == '$') -+ { -+ int number; -+ -+ /* Last case. We are dealing with an integer constant, so -+ we must read it and then apply the necessary operation, -+ either `-' or `~'. */ -+ ++eval_info->exp_buf; -+ number = strtol (eval_info->exp_buf, -+ &eval_info->exp_buf, 0); -+ -+ if (!STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ res -+ = value_from_longest (builtin_type (gdbarch)->builtin_int, -+ number); -+ else -+ ax_const_l (eval_info->aexpr, number); ++ p->arg += reg_ind_sufix_len; ++ } ++} + -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); ++static void ++stap_parse_single_operand (struct stap_parse_info *p) ++{ ++ struct gdbarch *gdbarch = p->gdbarch; ++ /* Prefixes for the parser. */ ++ const char *const_prefix = gdbarch_stap_integer_prefix (gdbarch); ++ const char *reg_prefix = gdbarch_stap_register_prefix (gdbarch); ++ const char *reg_ind_prefix ++ = gdbarch_stap_register_indirection_prefix (gdbarch); ++ int const_prefix_len = const_prefix ? strlen (const_prefix) : 0; ++ int reg_prefix_len = reg_prefix ? strlen (reg_prefix) : 0; ++ int reg_ind_prefix_len = reg_ind_prefix ? strlen (reg_ind_prefix) : 0; ++ ++ /* Sufixes for the parser. */ ++ const char *const_sufix = gdbarch_stap_integer_sufix (gdbarch); ++ const char *reg_sufix = gdbarch_stap_register_sufix (gdbarch); ++ const char *reg_ind_sufix ++ = gdbarch_stap_register_indirection_sufix (gdbarch); ++ int const_sufix_len = const_sufix ? strlen (const_sufix) : 0; ++ int reg_sufix_len = reg_sufix ? strlen (reg_sufix) : 0; ++ int reg_ind_sufix_len = reg_ind_sufix ? strlen (reg_ind_sufix) : 0; ++ ++ /* We first try to parse this token as a "special token". */ ++ if (gdbarch_stap_parse_special_token_p (gdbarch)) ++ { ++ int ret = gdbarch_stap_parse_special_token (gdbarch, p); + -+ if (c == '-') -+ { -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ ax_simple (eval_info->aexpr, aop_log_not); -+ else -+ res = value_neg (res); -+ } -+ else -+ { -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ ax_simple (eval_info->aexpr, aop_bit_not); -+ else -+ res = value_complement (res); -+ } -+ } -+ else -+ error (_("Invalid operand to unary operator `%c' on " -+ "expression `%s'."), c, eval_info->saved_expr); -+ } -+ break; ++ if (ret) ++ /* If the return value of the above function is not zero, ++ it means it successfully parsed the special token. + -+ case '0': case '1': case '2': case '3': case '4': -+ case '5': case '6': case '7': case '8': case '9': -+ { -+ int number = strtol (eval_info->exp_buf, &eval_info->exp_buf, 0); ++ If it is NULL, we try to parse it using our method. */ ++ return; ++ } + -+ /* This is a register displacement with a positive value. We read -+ the number, and then check for the mandatory `(%' part. */ -+ if (!*eval_info->exp_buf -+ || !(*eval_info->exp_buf == '(' -+ && eval_info->exp_buf[1] == '%')) -+ error (_("Invalid register access on expression `%s'."), -+ eval_info->saved_expr); ++ if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+') ++ { ++ char c = *p->arg; ++ /* We use this variable to do a lookahead. */ ++ const char *tmp = p->arg; + -+ res = value_from_longest (builtin_type (gdbarch)->builtin_int, -+ number); ++ ++tmp; + -+ res = stap_fetch_reg_value (eval_info, res); -+ } -+ break; ++ /* This is an unary operation. Here is a list of allowed tokens ++ here: + -+ case '$': -+ { -+ int number; ++ - numeric literal; ++ - number (from register displacement) ++ - subexpression (beginning with `(') + -+ /* This is an integer constant. We just have to read the number -+ and return it. */ -+ ++eval_info->exp_buf; -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); ++ We handle the register displacement here, and the other cases ++ recursively. */ ++ if (isdigit (*tmp)) ++ { ++ int number = strtol (tmp, (char **) &tmp, 10); + -+ number = strtol (eval_info->exp_buf, &eval_info->exp_buf, 0); ++ if (p->inside_paren_p) ++ tmp = skip_spaces_const (tmp); ++ if (!reg_ind_prefix ++ || strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) != 0) ++ goto not_displacement; + -+ if (STAP_COMPILING_AGENT_EXPR_P (eval_info)) -+ ax_const_l (eval_info->aexpr, number); -+ else -+ res = value_from_longest (builtin_type (gdbarch)->builtin_int, -+ number); ++ /* If we are here, it means it is a displacement. The only ++ operations allowed here are `-' and `+'. */ ++ if (c == '~') ++ error (_("Invalid operator `%c' for register displacement " ++ "on expression `%s'."), c, p->saved_arg); + -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); -+ } -+ break; ++ stap_parse_register_operand (p); ++ } ++ else ++not_displacement: ++ { ++ p->arg = tmp; ++ stap_parse_argument_conditionally (p); ++ if (c == '-') ++ write_exp_elt_opcode (UNOP_NEG); ++ else if (c == '~') ++ write_exp_elt_opcode (UNOP_COMPLEMENT); ++ } ++ } ++ else if (isdigit (*p->arg)) ++ { ++ /* A temporary variable, needed for lookahead. */ ++ const char *tmp = p->arg; ++ long number; ++ ++ /* We can be dealing with a numeric constant (if `const_prefix' is ++ NULL), or with a register displacement. */ ++ number = strtol (tmp, (char **) &tmp, 10); ++ ++ if (p->inside_paren_p) ++ tmp = skip_spaces_const (tmp); ++ if (!const_prefix && reg_ind_prefix ++ && strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) != 0) ++ { ++ /* We are dealing with a numeric constant. */ ++ write_exp_elt_opcode (OP_LONG); ++ write_exp_elt_type (builtin_type (gdbarch)->builtin_long); ++ write_exp_elt_longcst (number); ++ write_exp_elt_opcode (OP_LONG); + -+ case '(': case '%': -+ { -+ /* Register access, with or without indirection. */ -+ res = stap_fetch_reg_value (eval_info, /*displacement=*/NULL); -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); -+ } -+ break; ++ p->arg = tmp; + -+ default: -+ { -+ error (_("Operator `%c' not recognized on expression `%s'."), -+ *eval_info->exp_buf, eval_info->saved_expr); -+ } ++ if (const_sufix) ++ { ++ if (strncmp (p->arg, const_sufix, const_sufix_len) == 0) ++ p->arg += const_sufix_len; ++ else ++ error (_("Invalid constant sufix on expression `%s'."), ++ p->saved_arg); ++ } ++ } ++ else if (reg_ind_prefix ++ && strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) == 0) ++ stap_parse_register_operand (p); ++ else ++ error (_("Unknown numeric token on expression `%s'."), ++ p->saved_arg); + } ++ else if (const_prefix ++ && strncmp (p->arg, const_prefix, const_prefix_len) == 0) ++ { ++ /* We are dealing with a numeric constant. */ ++ long number; + -+ return res; -+} ++ p->arg += const_prefix_len; ++ number = strtol (p->arg, (char **) &p->arg, 10); + -+/* This function is responsible for checking the necessary type of evaluation -+ depending on what is the next "thing" in the buffer. Valid values are: ++ write_exp_elt_opcode (OP_LONG); ++ write_exp_elt_type (builtin_type (gdbarch)->builtin_long); ++ write_exp_elt_longcst (number); ++ write_exp_elt_opcode (OP_LONG); + -+ - Unary operators; -+ - Integer constants; -+ - Register displacement, indirection, and direct access; -+ - Parenthesized operand. */ ++ if (const_sufix) ++ { ++ if (strncmp (p->arg, const_sufix, const_sufix_len) == 0) ++ p->arg += const_sufix_len; ++ else ++ error (_("Invalid constant sufix on expression `%s'."), ++ p->saved_arg); ++ } ++ } ++ else if ((reg_prefix ++ && strncmp (p->arg, reg_prefix, reg_prefix_len) == 0) ++ || (reg_ind_prefix ++ && strncmp (p->arg, reg_ind_prefix, reg_ind_prefix_len) == 0)) ++ stap_parse_register_operand (p); ++ else ++ error (_("Operator `%c' not recognized on expression `%s'."), ++ *p->arg, p->saved_arg); ++} + -+static struct value * -+stap_evaluate_conditionally (struct stap_evaluation_info *eval_info) -+{ -+ char *s = eval_info->exp_buf; -+ struct value *ret = NULL; -+ -+ if (*s == '-' || *s == '~' /* Unary operators. */ -+ || *s == '$' /* Number (integer constant). */ -+ || (isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement. */ -+ || (*s == '(' && s[1] == '%') /* Register indirection. */ -+ || (*s == '%' && isalpha (s[1]))) /* Register value. */ -+ /* This is a single operand, so just evaluate it and return. */ -+ ret = stap_evaluate_single_operand (eval_info); -+ else if (*s == '(') ++static void ++stap_parse_argument_conditionally (struct stap_parse_info *p) ++{ ++ if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+' /* Unary. */ ++ || gdbarch_stap_is_single_operand (p->gdbarch, p->arg)) ++ stap_parse_single_operand (p); ++ else if (*p->arg == '(') + { + /* We are dealing with a parenthesized operand. It means we -+ have to evaluate it as it was a separate expression, without ++ have to parse it as it was a separate expression, without + left-side or precedence. */ -+ ++eval_info->exp_buf; -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); ++ ++p->arg; ++ p->arg = skip_spaces_const (p->arg); ++ ++p->inside_paren_p; + -+ ret = stap_evaluate_probe_argument_2 (eval_info, -+ /*lhs=*/NULL, /*prec=*/0); ++ stap_parse_argument_1 (p, 0, STAP_OPERAND_PREC_NONE); + -+ if (*eval_info->exp_buf != ')') ++ --p->inside_paren_p; ++ if (*p->arg != ')') + error (_("Missign close-paren on expression `%s'."), -+ eval_info->saved_expr); ++ p->saved_arg); + -+ ++eval_info->exp_buf; -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); ++ ++p->arg; ++ if (p->inside_paren_p) ++ p->arg = skip_spaces_const (p->arg); + } + else -+ error (_("Cannot evaluate expression `%s'."), -+ eval_info->saved_expr); -+ -+ return ret; ++ error (_("Cannot parse expression `%s'."), p->saved_arg); +} + -+/* Evaluation function for probe's argument expressions. LHS represents -+ the left side of the expression, and PREC is the precedence of the -+ last operator identified before calling the function. */ -+ -+static struct value * -+stap_evaluate_probe_argument_2 (struct stap_evaluation_info *eval_info, -+ struct value *lhs, int prec) ++static void ++stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs, ++ enum stap_operand_prec prec) +{ -+ struct value *rhs = NULL; -+ int compiling_p = STAP_COMPILING_AGENT_EXPR_P (eval_info); -+ -+ /* This is an operator-precedence parser and evaluator. ++ /* This is an operator-precedence parser. + + We work with left- and right-sides of expressions, and -+ evaluate them depending on the precedence of the operators ++ parse them depending on the precedence of the operators + we find. */ + -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); ++ if (p->inside_paren_p) ++ p->arg = skip_spaces_const (p->arg); + -+ if (!lhs) ++ if (!has_lhs) + /* We were called without a left-side, either because this is the -+ first call, or because we were called to evaluate a parenthesized -+ expression. It doesn't really matter; we have to evaluate the ++ first call, or because we were called to parse a parenthesized ++ expression. It doesn't really matter; we have to parse the + left-side in order to continue the process. */ -+ lhs = stap_evaluate_conditionally (eval_info); ++ stap_parse_argument_conditionally (p); + -+ /* Start to evaluate the right-side, and to "join" left and right sides ++ /* Start to parse the right-side, and to "join" left and right sides + depending on the operation specified. + + This loop shall continue until we run out of characters in the input, + or until we find a close-parenthesis, which means that we've reached + the end of a sub-expression. */ -+ while (eval_info->exp_buf -+ && *eval_info->exp_buf -+ && *eval_info->exp_buf != ')') ++ while (p->arg && *p->arg && *p->arg != ')' && !isspace (*p->arg)) + { -+ char *tmp_exp_buf; ++ const char *tmp_exp_buf; + enum exp_opcode opcode; -+ int cur_prec; ++ enum stap_operand_prec cur_prec; + -+ if (!stap_is_operator (eval_info->exp_buf)) -+ error (_("Invalid operator `%c' on expression `%s'."), -+ *eval_info->exp_buf, eval_info->saved_expr); ++ if (!stap_is_operator (*p->arg)) ++ error (_("Invalid operator `%c' on expression `%s'."), *p->arg, ++ p->saved_arg); + + /* We have to save the current value of the expression buffer because + the `stap_get_opcode' modifies it in order to get the current + operator. If this operator's precedence is lower than PREC, we + should return and not advance the expression buffer pointer. */ -+ tmp_exp_buf = eval_info->exp_buf; ++ tmp_exp_buf = p->arg; + stap_get_opcode (&tmp_exp_buf, &opcode); + + cur_prec = stap_get_operator_prec (opcode); + if (cur_prec < prec) + /* If the precedence of the operator that we are seeing now is + lower than the precedence of the first operator seen before -+ this evaluation process began, it means we should stop evaluating ++ this parsing process began, it means we should stop parsing + and return. */ + break; + -+ eval_info->exp_buf = tmp_exp_buf; -+ eval_info->exp_buf = skip_spaces (eval_info->exp_buf); ++ p->arg = tmp_exp_buf; ++ if (p->inside_paren_p) ++ p->arg = skip_spaces_const (p->arg); + -+ /* Evaluate the right-side of the expression. */ -+ rhs = stap_evaluate_conditionally (eval_info); ++ /* Parse the right-side of the expression. */ ++ stap_parse_argument_conditionally (p); + -+ /* While we still have operators, try to evaluate another ++ /* While we still have operators, try to parse another + right-side, but using the current right-side as a left-side. */ -+ while (*eval_info->exp_buf -+ && stap_is_operator (eval_info->exp_buf)) ++ while (*p->arg && stap_is_operator (*p->arg)) + { + enum exp_opcode lookahead_opcode; -+ int lookahead_prec; ++ enum stap_operand_prec lookahead_prec; + + /* Saving the current expression buffer position. The explanation + is the same as above. */ -+ tmp_exp_buf = eval_info->exp_buf; ++ tmp_exp_buf = p->arg; + stap_get_opcode (&tmp_exp_buf, &lookahead_opcode); + lookahead_prec = stap_get_operator_prec (lookahead_opcode); + @@ -8832,158 +9471,355 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + than the first one, just abandon the attempt. */ + break; + -+ rhs = stap_evaluate_probe_argument_2 (eval_info, -+ rhs, lookahead_prec); ++ /* Parse the right-side of the expression, but since we already ++ have a left-side at this point, set `has_lhs' to 1. */ ++ stap_parse_argument_1 (p, 1, lookahead_prec); + } + -+ /* Now, "join" both left and right sides into one left-side, using -+ the specified operator. */ -+ if (compiling_p) -+ stap_opcode_to_ax (eval_info, opcode); -+ else -+ lhs = value_binop (lhs, rhs, opcode); ++ write_exp_elt_opcode (opcode); ++ } ++} ++ ++/* Parse a probe's argument. ++ ++ Assuming that: ++ ++ LP = literal integer prefix ++ LS = literal integer sufix ++ ++ RP = register prefix ++ RS = register sufix ++ ++ RIP = register indirection prefix ++ RIS = register indirection sufix ++ ++ This routine assumes that arguments' tokens are of the form: ++ ++ - [LP] NUMBER [LS] ++ - [RP] REGISTER [RS] ++ - [RIP] [RP] REGISTER [RS] [RIS] ++ - If we find a number without LP, we try to parse it as a literal integer ++ constant (if LP == NULL), or as a register displacement. ++ - We count parenthesis, and only skip whitespaces if we are inside them. ++ - If we find an operator, we skip it. ++ ++ This function can also call a special function that will try to match ++ unknown tokens. It will return 1 if the argument has been parsed ++ successfully, or zero otherwise. */ ++ ++static int ++stap_parse_argument (const char **arg, struct type *atype, ++ struct gdbarch *gdbarch) ++{ ++ struct stap_parse_info p; ++ volatile struct gdb_exception e; ++ ++ /* We need to initialize the expression buffer, in order to begin ++ our parsing efforts. The language here does not matter, since we ++ are using our own parser. */ ++ initialize_expout (10, current_language, gdbarch); ++ ++ p.saved_arg = *arg; ++ p.arg = *arg; ++ p.arg_type = atype; ++ p.gdbarch = gdbarch; ++ p.inside_paren_p = 0; ++ ++ TRY_CATCH (e, RETURN_MASK_ERROR) ++ { ++ stap_parse_argument_1 (&p, 0, STAP_OPERAND_PREC_NONE); + } ++ if (e.reason < 0) ++ { ++ xfree (expout); ++ return 0; ++ } ++ ++ gdb_assert (p.inside_paren_p == 0); + -+ return lhs; ++ /* Casting the final expression to the appropriate type. */ ++ write_exp_elt_opcode (UNOP_CAST); ++ write_exp_elt_type (atype); ++ write_exp_elt_opcode (UNOP_CAST); ++ ++ reallocate_expout (); ++ ++ p.arg = skip_spaces_const (p.arg); ++ *arg = p.arg; ++ ++ return 1; +} + -+/* This function fills the necessary arguments for the evaluation function -+ to work. */ ++/* Helper function which is responsible for freeing the space allocated to ++ hold information about a probe's arguments. */ + -+static struct value * -+stap_evaluate_probe_argument_1 (struct objfile *objfile, -+ const struct stap_probe *probe, -+ struct frame_info *frame, -+ int n) ++static void ++stap_free_args_info (void *args_info_ptr) ++{ ++ struct stap_args_info *a = (struct stap_args_info *) args_info_ptr; ++ int i; ++ ++ for (i = 0; i < a->n_args; i++) ++ xfree (a->args[i].aexpr); ++ ++ xfree (a->args); ++ xfree (a); ++} ++ ++/* Function which parses an argument string from PROBE, correctly splitting ++ the arguments and storing their information in properly ways. ++ ++ Consider the following argument string (x86 syntax): ++ ++ `4@%eax 4@$10' ++ ++ We have two arguments, `%eax' and `$10', both with 32-bit unsigned bitness. ++ This function basically handles them, properly filling some structures with ++ this information. */ ++ ++static void ++stap_parse_probe_arguments (struct stap_probe *probe) +{ -+ struct stap_evaluation_info eval_info; -+ char *s = (char *) probe->parsed_args->arg[n].arg_str; -+ struct value *res, *vs[4]; ++ struct stap_args_info *args_info; ++ struct cleanup *back_to; ++ const char *cur = probe->args; ++ int current_arg = -1; ++ /* This is a state-machine parser, which means we will always be ++ in a known state when parsing an argument. The state could be ++ either `NEW_ARG' if we are parsing a new argument, `BITNESS' if ++ we are parsing the bitness-definition part (i.e., `4@'), or ++ `PARSE_ARG' if we are actually parsing the argument part. */ ++ enum ++ { ++ NEW_ARG, ++ BITNESS, ++ PARSE_ARG, ++ } current_state; ++ ++ /* For now, we assume everything is not going to work. */ ++ probe->parsed_args = &dummy_stap_args_info; ++ ++ if (!cur || !*cur || *cur == ':') ++ return; ++ ++ args_info = xmalloc (sizeof (struct stap_args_info)); ++ args_info->n_args = 0; ++ back_to = make_cleanup (stap_free_args_info, args_info); ++ args_info->args = xcalloc (STAP_MAX_ARGS, sizeof (struct stap_probe_arg)); ++ ++ /* Ok, let's start. */ ++ current_state = NEW_ARG; ++ ++ while (*cur) ++ { ++ switch (current_state) ++ { ++ case NEW_ARG: ++ ++current_arg; ++ ++ if (current_arg >= STAP_MAX_ARGS) ++ { ++ complaint (&symfile_complaints, ++ _("probe `%s' has more arguments than the maximum " ++ "allowed"), probe->name); ++ do_cleanups (back_to); ++ return; ++ } ++ ++ current_state = BITNESS; ++ break; ++ ++ case BITNESS: ++ { ++ enum stap_arg_bitness b; ++ int got_minus = 0; ++ ++ /* We expect to find something like: ++ ++ N@OP ++ ++ Where `N' can be [+,-][4,8]. This is not mandatory, so ++ we check it here. If we don't find it, go to the next ++ state. */ ++ if ((*cur == '-' && cur[1] && cur[2] != '@') ++ && cur[1] != '@') ++ { ++ current_state = PARSE_ARG; ++ args_info->args[current_arg].bitness ++ = STAP_ARG_BITNESS_UNDEFINED; ++ break; ++ } ++ ++ if (*cur == '-') ++ { ++ /* Discard the `-'. */ ++ ++cur; ++ got_minus = 1; ++ } ++ ++ if (*cur == '4') ++ b = got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED ++ : STAP_ARG_BITNESS_32BIT_UNSIGNED; ++ else if (*cur == '8') ++ b = got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED ++ : STAP_ARG_BITNESS_64BIT_UNSIGNED; ++ else ++ { ++ /* We have an error, because we don't expect anything ++ except 4 and 8. */ ++ complaint (&symfile_complaints, ++ _("unrecognized bitness `%c' for probe `%s'"), ++ *cur, probe->name); ++ do_cleanups (back_to); ++ return; ++ } ++ ++ args_info->args[current_arg].bitness = b; ++ args_info->args[current_arg].atype ++ = stap_get_expected_argument_type (probe->gdbarch, b); ++ /* Discard the number and the `@' sign. */ ++ cur += 2; ++ /* Move on. */ ++ current_state = PARSE_ARG; ++ } ++ break; ++ ++ case PARSE_ARG: ++ { ++ if (!stap_parse_argument (&cur, ++ args_info->args[current_arg].atype, ++ probe->gdbarch)) ++ { ++ /* We have tried to parse this argument, but it's ++ malformed. This is an error. */ ++ complaint (&symfile_complaints, ++ _("malformed argument for probe `%s'"), ++ probe->name); ++ do_cleanups (back_to); ++ return; ++ } ++ ++ if (stap_expression_debug) ++ dump_raw_expression (expout, gdb_stdlog, ++ "before conversion to prefix form"); ++ ++ prefixify_expression (expout); ++ ++ if (stap_expression_debug) ++ dump_prefix_expression (expout, gdb_stdlog); ++ ++ args_info->args[current_arg].aexpr = expout; ++ expout = NULL; ++ ++ ++args_info->n_args; ++ /* Start it over again. */ ++ cur = skip_spaces_const (cur); ++ current_state = NEW_ARG; ++ } ++ break; ++ } ++ ++ if (!*cur && current_state != NEW_ARG) ++ { ++ /* We reached the end of the argument string, but we're ++ still in the middle of the process of parsing an argument. ++ It means the argument string is malformed. */ ++ complaint (&symfile_complaints, ++ _("malformed argument for probe `%s'"), ++ probe->name); ++ do_cleanups (back_to); ++ return; ++ } ++ } ++ ++ args_info->args = xrealloc (args_info->args, ++ args_info->n_args ++ * sizeof (struct stap_probe_arg)); ++ args_info->probe = probe; ++ ++ probe->parsed_args = args_info; ++ ++ discard_cleanups (back_to); ++} ++ ++/* See definition in stap-probe.h. */ + -+ /* Filling necessary information for evaluation function. */ -+ eval_info.saved_expr = s; -+ eval_info.exp_buf = s; -+ eval_info.gdbarch = get_objfile_arch (objfile); -+ eval_info.frame = frame; -+ eval_info.bitness = probe->parsed_args->arg[n].bitness; -+ /* We are not compiling to an agent expression. */ -+ eval_info.aexpr = NULL; -+ eval_info.avalue = NULL; ++int ++stap_get_probe_argument_count (struct stap_probe *probe) ++{ ++ if (!probe->parsed_args) ++ stap_parse_probe_arguments (probe); + -+ res = stap_evaluate_probe_argument_2 (&eval_info, -+ /*lhs=*/NULL, /*prec=*/0); ++ return probe->parsed_args->n_args; ++} + -+ if (!res) -+ error (_("Could not evaluate expression `%s'."), -+ eval_info.saved_expr); ++/* Return 1 if OP is a valid operator inside a probe argument, or zero ++ otherwise. */ + -+ return res; ++static int ++stap_is_operator (char op) ++{ ++ return (op == '+' || op == '-' || op == '*' || op == '/' ++ || op == '>' || op == '<' || op == '!' || op == '^' ++ || op == '|' || op == '&' || op == '%' || op == '='); +} + +/* See definition in stap-probe.h. */ + +struct value * +stap_evaluate_probe_argument (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct frame_info *frame, + int n) +{ ++ int pos = 0; ++ + if (!probe->parsed_args) -+ stap_parse_probe_arguments ((struct stap_probe *) probe); ++ stap_parse_probe_arguments (probe); + -+ if (!probe->parsed_args->arg ++ if (!probe->parsed_args->args + || n >= probe->parsed_args->n_args) + return NULL; + -+ return stap_evaluate_probe_argument_1 (objfile, probe, frame, n); -+} -+ -+/* Helper function which compiles the probe's argument N into an -+ agent expression, suitable for using with tracepoints. */ -+ -+static void -+stap_compile_to_ax_1 (struct objfile *objfile, -+ const struct stap_probe *probe, -+ struct agent_expr *expr, -+ struct axs_value *value, -+ int n) -+{ -+ struct stap_evaluation_info eval_info; -+ struct gdbarch *gdbarch = expr->gdbarch; -+ char *s = (char *) probe->parsed_args->arg[n].arg_str; -+ -+ /* Filling necessary information for evaluation function. */ -+ eval_info.saved_expr = s; -+ eval_info.exp_buf = s; -+ eval_info.gdbarch = expr->gdbarch; -+ eval_info.frame = NULL; -+ eval_info.bitness = probe->parsed_args->arg[n].bitness; -+ /* We are compiling to an agent expression. */ -+ eval_info.aexpr = expr; -+ eval_info.avalue = value; -+ -+ /* We can always use this kind. */ -+ value->kind = axs_rvalue; -+ -+ /* Figuring out the correct type for this axs_value. */ -+ switch (eval_info.bitness) -+ { -+ case STAP_ARG_BITNESS_UNDEFINED: -+ if (gdbarch_addr_bit (gdbarch) == 32) -+ value->type = builtin_type (gdbarch)->builtin_uint32; -+ else -+ value->type = builtin_type (gdbarch)->builtin_uint64; -+ break; -+ -+ case STAP_ARG_BITNESS_32BIT_SIGNED: -+ value->type = builtin_type (gdbarch)->builtin_int32; -+ break; -+ -+ case STAP_ARG_BITNESS_32BIT_UNSIGNED: -+ value->type = builtin_type (gdbarch)->builtin_uint32; -+ break; -+ -+ case STAP_ARG_BITNESS_64BIT_SIGNED: -+ value->type = builtin_type (gdbarch)->builtin_int64; -+ break; -+ -+ case STAP_ARG_BITNESS_64BIT_UNSIGNED: -+ value->type = builtin_type (gdbarch)->builtin_uint64; -+ break; -+ -+ default: -+ internal_error (__FILE__, __LINE__, -+ _("Undefined bitness for probe.")); -+ break; -+ } ++ /* This is needed because on some architectures (e.g., ARM) we need ++ the frame's gdbarch in order to compute the value of the frame ++ pointer. */ ++ probe->parsed_args->args[n].aexpr->gdbarch = get_frame_arch (frame); + -+ stap_evaluate_probe_argument_2 (&eval_info, -+ /*lhs=*/NULL, /*prec=*/0); ++ return evaluate_subexp_standard (probe->parsed_args->args[n].atype, ++ probe->parsed_args->args[n].aexpr, ++ &pos, EVAL_NORMAL); +} + +/* See definition in stap-probe.h. */ + +void +stap_compile_to_ax (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct agent_expr *expr, + struct axs_value *value, + int n) +{ ++ union exp_element *pc; ++ + if (!probe->parsed_args) -+ stap_parse_probe_arguments ((struct stap_probe *) probe); ++ stap_parse_probe_arguments (probe); + -+ if (!probe->parsed_args->arg ++ if (!probe->parsed_args->args + || n >= probe->parsed_args->n_args) + return; + -+ stap_compile_to_ax_1 (objfile, probe, expr, value, n); ++ pc = probe->parsed_args->args[n].aexpr->elts; ++ gen_expr (probe->parsed_args->args[n].aexpr, &pc, expr, value); ++ ++ require_rvalue (expr, value); ++ value->type = probe->parsed_args->args[n].atype; +} + +struct value * +stap_safe_evaluate_at_pc (struct frame_info *frame, int n) +{ -+ const struct stap_probe *probe; ++ struct stap_probe *probe; + struct objfile *objfile; + int n_probes; + @@ -9018,9 +9854,9 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + return; + + for (i = 0; i < parsed_args->n_args; i++) -+ xfree (parsed_args->arg[i].arg_str); ++ xfree (parsed_args->args[i].aexpr); + -+ xfree (parsed_args->arg); ++ xfree (parsed_args->args); + xfree (parsed_args); +} + @@ -9030,7 +9866,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c +struct stap_probe_and_objfile +{ + /* The probe. */ -+ const struct stap_probe *probe; ++ struct stap_probe *probe; + /* The probe's objfile. */ + struct objfile *objfile; +}; @@ -9081,7 +9917,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + + ALL_OBJFILES (objfile) + { -+ const struct stap_probe *probes; ++ struct stap_probe *probes; + int i, num_probes; + + if (! objfile->sf || ! objfile->sf->sym_probe_fns) @@ -9174,7 +10010,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + + items = collect_probes (objname, provider, probe); + make_cleanup (VEC_cleanup (stap_entry), &items); -+ make_cleanup_ui_out_table_begin_end (uiout, 5, ++ make_cleanup_ui_out_table_begin_end (current_uiout, 5, + VEC_length (stap_entry, items), + "SystemTapProbes"); + @@ -9186,31 +10022,31 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + + addr_width = 4 + (gdbarch_ptr_bit (get_current_arch ()) / 4); + -+ ui_out_table_header (uiout, 10, ui_left, "provider", _("Provider")); -+ ui_out_table_header (uiout, 10, ui_left, "name", _("Name")); -+ ui_out_table_header (uiout, addr_width - 1, ui_left, "addr", _("Where")); -+ ui_out_table_header (uiout, addr_width - 1, ui_left, "semaphore", ++ ui_out_table_header (current_uiout, 10, ui_left, "provider", _("Provider")); ++ ui_out_table_header (current_uiout, 10, ui_left, "name", _("Name")); ++ ui_out_table_header (current_uiout, addr_width - 1, ui_left, "addr", _("Where")); ++ ui_out_table_header (current_uiout, addr_width - 1, ui_left, "semaphore", + _("Semaphore")); -+ ui_out_table_header (uiout, 30, ui_left, "object", _("Object")); -+ ui_out_table_body (uiout); ++ ui_out_table_header (current_uiout, 30, ui_left, "object", _("Object")); ++ ui_out_table_body (current_uiout); + + for (i = 0; VEC_iterate (stap_entry, items, i, entry); ++i) + { + struct cleanup *inner; + -+ inner = make_cleanup_ui_out_tuple_begin_end (uiout, "probe"); ++ inner = make_cleanup_ui_out_tuple_begin_end (current_uiout, "probe"); + -+ ui_out_field_string (uiout, "provider", entry->probe->provider); -+ ui_out_field_string (uiout, "name", entry->probe->name); -+ ui_out_field_core_addr (uiout, "addr", get_current_arch (), ++ ui_out_field_string (current_uiout, "provider", entry->probe->provider); ++ ui_out_field_string (current_uiout, "name", entry->probe->name); ++ ui_out_field_core_addr (current_uiout, "addr", get_current_arch (), + entry->probe->address); + if (entry->probe->sem_addr == 0) -+ ui_out_field_skip (uiout, "semaphore"); ++ ui_out_field_skip (current_uiout, "semaphore"); + else -+ ui_out_field_core_addr (uiout, "semaphore", get_current_arch (), ++ ui_out_field_core_addr (current_uiout, "semaphore", get_current_arch (), + entry->probe->sem_addr); -+ ui_out_field_string (uiout, "object", entry->objfile->name); -+ ui_out_text (uiout, "\n"); ++ ui_out_field_string (current_uiout, "object", entry->objfile->name); ++ ui_out_text (current_uiout, "\n"); + + do_cleanups (inner); + } @@ -9219,7 +10055,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + do_cleanups (cleanup); + + if (! any_found) -+ ui_out_message (uiout, 0, _("No probes matched.\n")); ++ ui_out_message (current_uiout, 0, _("No probes matched.\n")); +} + + @@ -9231,7 +10067,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + const char *provider, + const char *name) +{ -+ const struct stap_probe *probes; ++ struct stap_probe *probes; + int i, num_probes; + VEC (stap_probe_p) *result = NULL; + @@ -9258,8 +10094,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c +struct symtabs_and_lines +parse_stap_probe (char **argptr, struct linespec_result *canonical) +{ -+ char *full_arg = extract_arg (argptr); -+ char *arg = xstrdup (full_arg); ++ char *arg_start, *arg_end, *arg; + char *objfile_name = NULL, *provider = NULL, *name, *p; + struct cleanup *cleanup; + struct symtabs_and_lines result; @@ -9268,17 +10103,27 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + result.sals = NULL; + result.nelts = 0; + -+ /* The caller ensured that this starts with 'probe:'. */ -+ gdb_assert (arg && strncmp (arg, "probe:", 6) == 0); ++ arg_start = *argptr; ++ /* The caller ensured that this starts with '-p'. */ ++ gdb_assert (arg_start && strncmp (arg_start, "-p", 2) == 0); ++ arg_end = arg_start + 2; ++ arg_end = skip_spaces (arg_end); ++ ++ if (!*arg_end) ++ error (_("argument to `-p' missing")); ++ ++ arg = arg_end; ++ arg_end = skip_to_space (arg_end); ++ ++ /* We make a copy here so we can write over parts with impunity. */ ++ arg = savestring (arg, arg_end - arg); + cleanup = make_cleanup (xfree, arg); -+ make_cleanup (xfree, full_arg); -+ arg += 6; + + /* Extract each word from the argument, separated by ":"s. */ + p = strchr (arg, ':'); + if (p == NULL) + { -+ /* This is `probe:name'. */ ++ /* This is `-p name'. */ + name = arg; + } + else @@ -9289,13 +10134,13 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + p = strchr (hold, ':'); + if (p == NULL) + { -+ /* This is `probe:provider:name'. */ ++ /* This is `-p provider:name'. */ + provider = arg; + name = hold; + } + else + { -+ /* This is `probe:objfile:provider:name'. */ ++ /* This is `-p objfile:provider:name'. */ + *p = '\0'; + objfile_name = arg; + provider = hold; @@ -9310,12 +10155,9 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + if (objfile_name && *objfile_name == '\0') + error (_("invalid objfile name")); + -+ if (canonical) -+ canonical->canonical = NULL; -+ + ALL_OBJFILES (objfile) + { -+ const struct stap_probe *probes; ++ struct stap_probe *probes; + int i, num_probes; + + if (! objfile->sf || ! objfile->sf->sym_probe_fns) @@ -9349,13 +10191,6 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + sal->section = find_pc_overlay (sal->pc); + sal->pspace = current_program_space; + sal->semaphore = probes[i].sem_addr; -+ -+ if (canonical) -+ { -+ canonical->canonical = xrealloc (canonical->canonical, -+ result.nelts * sizeof (char *)); -+ canonical->canonical[result.nelts - 1] = xstrdup (full_arg); -+ } + } + } + @@ -9372,8 +10207,10 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + { + canonical->special_display = 1; + canonical->pre_expanded = 1; ++ canonical->addr_string = savestring (*argptr, arg_end - *argptr); + } + ++ *argptr = arg_end; + do_cleanups (cleanup); + + return result; @@ -9383,14 +10220,14 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + +/* See definition in stap-probe.h. */ + -+const struct stap_probe * ++struct stap_probe * +find_probe_by_pc (CORE_ADDR pc, struct objfile **objfile_out) +{ + struct objfile *objfile; + + ALL_OBJFILES (objfile) + { -+ const struct stap_probe *probes; ++ struct stap_probe *probes; + int i, num_probes; + stap_entry entry; + @@ -9423,11 +10260,11 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + CORE_ADDR pc = get_frame_pc (frame); + int sel = (int) (uintptr_t) data; + struct objfile *objfile; -+ const struct stap_probe *pc_probe; ++ struct stap_probe *pc_probe; + int n_probes; + -+ /* SEL==10 means "_probe_argc". */ -+ gdb_assert (sel >= 0 && sel <= STAP_MAX_ARGS); ++ /* SEL==-1 means "_probe_argc". */ ++ gdb_assert (sel >= -1 && sel <= STAP_MAX_ARGS); + + pc_probe = find_probe_by_pc (pc, &objfile); + if (pc_probe == NULL) @@ -9436,7 +10273,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + n_probes + = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, + pc_probe); -+ if (sel == 10) ++ if (sel == -1) + return value_from_longest (builtin_type (arch)->builtin_int, n_probes); + + if (sel >= n_probes) @@ -9458,11 +10295,11 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + CORE_ADDR pc = expr->scope; + int sel = (int) (uintptr_t) data; + struct objfile *objfile; -+ const struct stap_probe *pc_probe; ++ struct stap_probe *pc_probe; + int n_probes; + -+ /* SEL==10 means "_probe_argc". */ -+ gdb_assert (sel >= 0 && sel <= 10); ++ /* SEL==-1 means "_probe_argc". */ ++ gdb_assert (sel >= -1 && sel <= STAP_MAX_ARGS); + + pc_probe = find_probe_by_pc (pc, &objfile); + if (pc_probe == NULL) @@ -9471,7 +10308,7 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + n_probes + = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, + pc_probe); -+ if (sel == 10) ++ if (sel == -1) + { + value->kind = axs_rvalue; + value->type = builtin_type (expr->gdbarch)->builtin_int; @@ -9510,8 +10347,18 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c +NAME matches the probe names.\n\ +OBJECT match the executable or shared library name.")); + ++ add_setshow_zinteger_cmd ("stap-expression", class_maintenance, ++ &stap_expression_debug, ++ _("Set SystemTap expression debugging."), ++ _("Show SystemTap expression debugging."), ++ _("When non-zero, the internal representation " ++ "of SystemTap expressions will be printed."), ++ NULL, ++ show_stapexpressiondebug, ++ &setdebuglist, &showdebuglist); ++ + create_internalvar_type_lazy ("_probe_argc", &probe_funcs, -+ (void *) (uintptr_t) 10); ++ (void *) (uintptr_t) -1); + create_internalvar_type_lazy ("_probe_arg0", &probe_funcs, + (void *) (uintptr_t) 0); + create_internalvar_type_lazy ("_probe_arg1", &probe_funcs, @@ -9532,12 +10379,17 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.c + (void *) (uintptr_t) 8); + create_internalvar_type_lazy ("_probe_arg9", &probe_funcs, + (void *) (uintptr_t) 9); -+} -Index: gdb-7.3.50.20110722/gdb/stap-probe.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/stap-probe.h 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,114 @@ ++ create_internalvar_type_lazy ("_probe_arg10", &probe_funcs, ++ (void *) (uintptr_t) 10); ++ create_internalvar_type_lazy ("_probe_arg11", &probe_funcs, ++ (void *) (uintptr_t) 11); ++} +diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h +new file mode 100644 +index 0000000..9b6dc7a +--- /dev/null ++++ b/gdb/stap-probe.h +@@ -0,0 +1,144 @@ +/* SystemTap probe support for GDB. + + Copyright (C) 2011 Free Software Foundation, Inc. @@ -9591,9 +10443,39 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.h + /* Probe's arguments after parsing. This is an opaque structure that + will hold information about the arguments pointed by ARGS. */ + struct stap_args_info *parsed_args; ++ ++ /* gdbarch structure associated with this probe. */ ++ struct gdbarch *gdbarch; ++}; ++ ++/* Structure which holds information about the parsing process of one probe's ++ argument. */ ++ ++struct stap_parse_info ++{ ++ /* The probe's argument in a string format. */ ++ const char *arg; ++ ++ /* A pointer to the full chain of arguments. This is useful for printing ++ error messages. The parser functions should not modify this argument ++ directly; instead, they should use the ARG pointer above. */ ++ const char *saved_arg; ++ ++ /* The expected argument type (bitness), as defined in the probe's ++ argument. For instance, if the argument begins with `-8@', it means ++ the bitness is 64-bit signed. In this case, ARG_TYPE would represent ++ the type `int64_t'. */ ++ struct type *arg_type; ++ ++ /* A pointer to the current gdbarch. */ ++ struct gdbarch *gdbarch; ++ ++ /* Greater than zero if we are inside a parenthesized expression. Useful ++ for knowing when to skip spaces or not. */ ++ int inside_paren_p; +}; + -+typedef const struct stap_probe *stap_probe_p; ++typedef struct stap_probe *stap_probe_p; +DEF_VEC_P (stap_probe_p); + +/* A helper for linespec that decodes a stap probe specification. It @@ -9615,31 +10497,31 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.h + found, set *OBJFILE_OUT to the probe's objfile, and return the + probe. If no probe is found, return NULL. */ + -+extern const struct stap_probe *find_probe_by_pc (CORE_ADDR pc, -+ struct objfile **objfile_out); ++extern struct stap_probe *find_probe_by_pc (CORE_ADDR pc, ++ struct objfile **objfile_out); + +/* Given PROBE, returns the number of arguments present in that probe's + argument string. */ + -+extern int stap_get_probe_argument_count (const struct stap_probe *probe); ++extern int stap_get_probe_argument_count (struct stap_probe *probe); + +/* Given PARSED_ARGS, frees the space allocated to hold information about + the probe's parsed arguments. */ + +extern void stap_free_parsed_args (struct stap_args_info *parsed_args); + -+/* Evaluates the probe's argument N, returning a value corresponding ++/* Evaluate the probe's argument N, returning a value corresponding + to it. */ + +extern struct value *stap_evaluate_probe_argument (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct frame_info *frame, + int n); + +/* Compile the probe's argument N to agent expression. */ + +extern void stap_compile_to_ax (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct agent_expr *expr, + struct axs_value *value, + int n); @@ -9652,10 +10534,10 @@ Index: gdb-7.3.50.20110722/gdb/stap-probe.h + int n); + +#endif /* !defined (STAP_PROBE_H) */ -Index: gdb-7.3.50.20110722/gdb/symfile.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/symfile.h 2011-07-29 22:52:00.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/symfile.h 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/symfile.h b/gdb/symfile.h +index 91605a2..c5b4906 100644 +--- a/gdb/symfile.h ++++ b/gdb/symfile.h @@ -31,6 +31,11 @@ struct objfile; struct obj_section; struct obstack; @@ -9668,8 +10550,8 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h /* Comparison function for symbol look ups. */ -@@ -294,6 +299,52 @@ struct quick_symbol_functions - symbol_filename_ftype *fun, void *data); +@@ -301,6 +306,52 @@ struct quick_symbol_functions + int need_fullname); }; +/* Structure of functions used for SystemTap probe support. If one of @@ -9679,7 +10561,7 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h +{ + /* If non-NULL, return an array of SystemTap probe objects. The + number of objects is returned in *NUM_PROBES. */ -+ const struct stap_probe *(*sym_get_probes) (struct objfile *, ++ struct stap_probe *(*sym_get_probes) (struct objfile *, + int *num_probes); + + /* Return the number of arguments available to PROBE. PROBE will @@ -9687,7 +10569,7 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h + If you provide an implementation of sym_get_probes, you must + implement this method as well. */ + int (*sym_get_probe_argument_count) (struct objfile *objfile, -+ const struct stap_probe *probe); ++ struct stap_probe *probe); + + /* Evaluate the Nth argument available to PROBE. PROBE will have + come from a call to this objfile's sym_get_probes method. N will @@ -9697,7 +10579,7 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h + implementation of sym_get_probes, you must implement this method + as well. */ + struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct frame_info *frame, + int n); + @@ -9707,7 +10589,7 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h + available to this probe. EXPR and VALUE are the agent expression + that is being updated. */ + void (*sym_compile_to_ax) (struct objfile *objfile, -+ const struct stap_probe *probe, ++ struct stap_probe *probe, + struct agent_expr *expr, + struct axs_value *value, + int n); @@ -9721,7 +10603,7 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h /* Structure to keep track of symbol reading functions for various object file types. */ -@@ -364,6 +415,10 @@ struct sym_fns +@@ -371,6 +422,10 @@ struct sym_fns bfd_byte *(*sym_relocate) (struct objfile *, asection *sectp, bfd_byte *buf); @@ -9732,11 +10614,11 @@ Index: gdb-7.3.50.20110722/gdb/symfile.h /* The "quick" (aka partial) symbol functions for this symbol reader. */ const struct quick_symbol_functions *qf; -Index: gdb-7.3.50.20110722/gdb/symtab.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/symtab.c 2011-07-21 17:13:29.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/symtab.c 2011-07-29 22:52:02.000000000 +0200 -@@ -776,6 +776,7 @@ init_sal (struct symtab_and_line *sal) +diff --git a/gdb/symtab.c b/gdb/symtab.c +index 1ea4253..ea83f78 100644 +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -834,6 +834,7 @@ init_sal (struct symtab_and_line *sal) sal->end = 0; sal->explicit_pc = 0; sal->explicit_line = 0; @@ -9744,11 +10626,11 @@ Index: gdb-7.3.50.20110722/gdb/symtab.c } -Index: gdb-7.3.50.20110722/gdb/symtab.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/symtab.h 2011-06-30 00:19:24.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/symtab.h 2011-07-29 22:52:02.000000000 +0200 -@@ -1115,6 +1115,10 @@ struct symtab_and_line +diff --git a/gdb/symtab.h b/gdb/symtab.h +index bbc7f2b..8e41539 100644 +--- a/gdb/symtab.h ++++ b/gdb/symtab.h +@@ -1057,6 +1057,10 @@ struct symtab_and_line CORE_ADDR end; int explicit_pc; int explicit_line; @@ -9759,10 +10641,27 @@ Index: gdb-7.3.50.20110722/gdb/symtab.h }; extern void init_sal (struct symtab_and_line *sal); -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp +index ef7c8b4..d467265 100644 +--- a/gdb/testsuite/gdb.ada/packed_array.exp ++++ b/gdb/testsuite/gdb.ada/packed_array.exp +@@ -64,5 +64,11 @@ gdb_test_multiple "$test" "$test" { + # are. Observed with (FSF GNU Ada 4.5.3 20110124). + xfail $test + } ++ -re "= \\(\\)\[\r\n\]+$gdb_prompt $" { ++ # archer-jankratochvil-vla resolves it as a dynamic type resolved as an ++ # empty array [0..-1]. ++ # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref) ++ xfail $test ++ } + } + +diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S +new file mode 100644 +index 0000000..83faaf6 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S @@ -0,0 +1,457 @@ + .file "x86_64-vla-pointer.c" + .section .debug_abbrev,"",@progbits @@ -10221,10 +11120,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S + .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" + .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" + .section .note.GNU-stack,"",@progbits -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c +new file mode 100644 +index 0000000..fe2c8f7 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c @@ -0,0 +1,43 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -10269,10 +11169,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c +} + +#endif -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp +new file mode 100644 +index 0000000..d243cf1 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp @@ -0,0 +1,66 @@ +# Copyright 2009 Free Software Foundation, Inc. + @@ -10340,10 +11241,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp + +gdb_test "whatis *array" "type = char \\\[78\\\]" "second: whatis *array" +gdb_test "ptype *array" "type = char \\\[78\\\]" "second: ptype *array" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S +new file mode 100644 +index 0000000..66f7a39 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S @@ -0,0 +1,455 @@ + .file "x86_64-vla-typedef.c" + .section .debug_abbrev,"",@progbits @@ -10800,10 +11702,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S + .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" + .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" + .section .note.GNU-stack,"",@progbits -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c +new file mode 100644 +index 0000000..b809c4e +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c @@ -0,0 +1,43 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -10848,10 +11751,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c +} + +#endif -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp +new file mode 100644 +index 0000000..b05411e +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp @@ -0,0 +1,64 @@ +# Copyright 2009 Free Software Foundation, Inc. + @@ -10917,10 +11821,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp +gdb_test "whatis array" "type = array_t" "second: whatis array" + +gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/arrayidx.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.base/arrayidx.c 2011-01-01 16:33:40.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/arrayidx.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c +index 6c158bf..739ce34 100644 +--- a/gdb/testsuite/gdb.base/arrayidx.c ++++ b/gdb/testsuite/gdb.base/arrayidx.c @@ -17,6 +17,13 @@ int array[] = {1, 2, 3, 4}; @@ -10935,10 +11839,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/arrayidx.c int main (void) { -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/arrayidx.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.base/arrayidx.exp 2011-01-01 16:33:40.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/arrayidx.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp +index d8ee5c0..de4ba75 100644 +--- a/gdb/testsuite/gdb.base/arrayidx.exp ++++ b/gdb/testsuite/gdb.base/arrayidx.exp @@ -57,4 +57,12 @@ gdb_test "print array" \ "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ "Print array with array-indexes on" @@ -10953,11 +11857,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/arrayidx.exp + unsupported "$test (no GCC)" + } +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/default.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.base/default.exp 2011-05-20 16:37:20.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/default.exp 2011-07-29 22:52:02.000000000 +0200 -@@ -607,6 +607,17 @@ gdb_test_list_exact "show convenience" " +diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp +index e23ac21..f99221f 100644 +--- a/gdb/testsuite/gdb.base/default.exp ++++ b/gdb/testsuite/gdb.base/default.exp +@@ -611,6 +611,19 @@ gdb_test_list_exact "show convenience" "show convenience" \ {$_sdata = void} \ {$_siginfo = void} \ {$_thread = 0} \ @@ -10972,13 +11876,16 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/default.exp + {$_probe_arg7 = } \ + {$_probe_arg8 = } \ + {$_probe_arg9 = } \ ++ {$_probe_arg10 = } \ ++ {$_probe_arg11 = } \ } #test show directories -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/internal-var-field-address.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/internal-var-field-address.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c +new file mode 100644 +index 0000000..eeb7b85 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/internal-var-field-address.c @@ -0,0 +1,20 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -11000,10 +11907,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/internal-var-field-address.c +struct { + int field; +} staticstruct = { 1 }; -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/internal-var-field-address.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/internal-var-field-address.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.exp b/gdb/testsuite/gdb.base/internal-var-field-address.exp +new file mode 100644 +index 0000000..6d82e73 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/internal-var-field-address.exp @@ -0,0 +1,26 @@ +# Copyright 2009 Free Software Foundation, Inc. + @@ -11031,11 +11939,12 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/internal-var-field-address.exp + +gdb_test {set $varstruct = staticstruct} +gdb_test {p $varstruct.field} " = 1" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.c 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,69 @@ +diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c +new file mode 100644 +index 0000000..236da96 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/stap-probe.c +@@ -0,0 +1,108 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 Free Software Foundation, Inc. @@ -11062,6 +11971,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.c +__extension__ unsigned short teste_two_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); +#define TEST2 teste_two_semaphore + ++__extension__ unsigned short teste_m4_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); ++ ++__extension__ unsigned short teste_pstr_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); ++ ++__extension__ unsigned short teste_ps_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes"))); +#else + +#define TEST 1 @@ -11076,40 +11990,75 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.c +#error "not using SystemTap v3 probes" +#endif + -+void ++struct funcs ++{ ++ int val; ++ ++ const char *(*ps) (int); ++}; ++ ++static void +m1 (void) +{ + if (TEST2) + STAP_PROBE (teste, two); +} + -+void ++static void +m2 (void) +{ + if (TEST2) + STAP_PROBE (teste, two); +} + -+int ++static int +f (int x) +{ + if (TEST) -+ STAP_PROBE1(teste, user, x); ++ STAP_PROBE1 (teste, user, x); + return x+5; +} + ++static const char * ++pstr (int val) ++{ ++ const char *a = "This is a test message."; ++ const char *b = "This is another test message."; ++ ++ STAP_PROBE3 (teste, ps, a, b, val); ++ ++ return val == 0 ? a : b; ++} ++ ++static void ++m4 (const struct funcs *fs, int v) ++{ ++ STAP_PROBE3 (teste, m4, fs->val, fs->ps (v), v); ++} ++ +int +main() +{ -+ f(f(23)); -+ m1(); -+ m2(); ++ struct funcs fs; ++ ++ fs.val = 42; ++ fs.ps = pstr; ++ ++ f (f (23)); ++ m1 (); ++ m2 (); ++ ++ m4 (&fs, 0); ++ m4 (&fs, 1); ++ ++ return 0; /* last break here */ +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.exp 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,72 @@ +diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp +new file mode 100644 +index 0000000..468efb9 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/stap-probe.exp +@@ -0,0 +1,187 @@ +# Copyright (C) 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -11135,9 +12084,9 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.exp + + if {$arg != ""} { + set arg "additional_flags=$arg" -+ set addendum ", with semaphore" ++ set addendum ", with semaphore, not optimized" + } else { -+ set addendum ", no semaphore" ++ set addendum ", no semaphore, not optimized" + } + + if {[prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c \ @@ -11156,23 +12105,135 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.exp + "teste *user *$hex .*" \ + "info probes$addendum" + -+ if {[runto "probe:teste:user"]} { -+ pass "run to probe:teste:user$addendum" ++ if {[runto "-p teste:user"]} { ++ pass "run to -p teste:user$addendum" ++ } else { ++ fail "run to -p teste:user$addendum" ++ } ++ ++ # Test probe arguments. ++ gdb_test "print \$_probe_argc" " = 1" \ ++ "print \$_probe_argc for probe user$addendum" ++ gdb_test "print \$_probe_arg0 == x" " = 1" \ ++ "check \$_probe_arg0 for probe user$addendum" ++ gdb_test "print \$_probe_arg1" \ ++ "Invalid probe argument 1 -- probe has 1 arguments available" \ ++ "check \$_probe_arg1 for probe user$addendum" ++ ++ # Set a breakpoint with multiple probe locations. ++ gdb_test "break -p teste:two" \ ++ "Breakpoint \[0-9\]+ at $hex.*2 locations.*" \ ++ "set multi-location probe breakpoint (probe two)$addendum" ++ ++ # Reinit GDB, set a breakpoint on probe m4. ++ delete_breakpoints ++ rerun_to_main ++ if {[runto "-p teste:m4"]} { ++ pass "run to -p teste:m4$addendum" ++ } else { ++ fail "run to -p teste:m4$addendum" ++ } ++ ++ # Testing probe arguments. ++ gdb_test "print \$_probe_argc" " = 3" \ ++ "print \$_probe_argc for probe m4$addendum" ++ gdb_test "print \$_probe_arg0" " = 42" \ ++ "check \$_probe_arg0 for probe m4$addendum" ++ gdb_test "print (const char *) \$_probe_arg1" \ ++ " = $hex .This is a test message.*" \ ++ "check \$_probe_arg1 for probe m4$addendum" ++ gdb_test "print \$_probe_arg2 == v" " = 1" \ ++ "check \$_probe_arg2 for probe m4$addendum" ++ ++ # Reinit GDB, set a breakpoint on probe ps. ++ delete_breakpoints ++ rerun_to_main ++ if {[runto "-p teste:ps"]} { ++ pass "run to -p teste:m4$addendum" ++ } else { ++ fail "run to -p teste:m4$addendum" ++ } ++ ++ gdb_test "print \$_probe_argc" " = 3" \ ++ "print \$_probe_argc for probe ps$addendum" ++ gdb_test "print (const char *) \$_probe_arg1" \ ++ " = $hex .This is another test message.*" \ ++ "print \$_probe_arg1 for probe ps$addendum" ++ ++ return 0 ++} ++ ++proc stap_test_no_debuginfo {{ arg "" }} { ++ global testfile hex ++ ++ if {$arg != ""} { ++ set arg "additional_flags=$arg" ++ set addendum ", with semaphore, optimized" ++ } else { ++ set addendum ", no semaphore, optimized" ++ } ++ ++ if {[prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c \ ++ {$arg nodebug optimize=-O2}]} { ++ return -1 ++ } ++ ++ if {[runto "-p teste:user"]} { ++ pass "run to -p teste:user$addendum" + } else { -+ fail "run to probe:teste:user$addendum" ++ fail "run to -p teste:user$addendum" + } + + # Test probe arguments. -+ gdb_test "print \$_probe_argc" " = 1" "print \$_probe_argc$addendum" -+ gdb_test "print \$_probe_arg0 == x" " = 1" "check \$_probe_arg0$addendum" ++ gdb_test "print \$_probe_argc" " = 1" \ ++ "print \$_probe_argc for probe user$addendum" ++ gdb_test "print \$_probe_arg0 == 23" " = 1" \ ++ "check \$_probe_arg0 for probe user$addendum" + gdb_test "print \$_probe_arg1" \ + "Invalid probe argument 1 -- probe has 1 arguments available" \ -+ "check \$_probe_arg1$addendum" ++ "check \$_probe_arg1 for probe user$addendum" + + # Set a breakpoint with multiple probe locations. -+ gdb_test "break probe:teste:two" \ -+ "Breakpoint .* at $hex.*2 locations.*" \ -+ "set multi-location probe breakpoint$addendum" ++ # In this scenario, we may expect more than 2 locations because of ++ # the optimizations (inlining, loop unrolling, etc). ++ gdb_test "break -p teste:two" \ ++ "Breakpoint .* at $hex.*\[0-9\]+ locations.*" \ ++ "set multi-location probe breakpoint (probe two)$addendum" ++ ++ # Reinit GDB, set a breakpoint on probe m4. ++ delete_breakpoints ++ rerun_to_main ++ if {[runto "-p teste:m4"]} { ++ pass "run to -p teste:m4$addendum" ++ } else { ++ fail "run to -p teste:m4$addendum" ++ } ++ ++ # Testing probe arguments. ++ gdb_test "print \$_probe_argc" " = 3" \ ++ "print \$_probe_argc for probe m4$addendum" ++ gdb_test "print \$_probe_arg0" " = 42" \ ++ "check \$_probe_arg0 for probe m4$addendum" ++ gdb_test "print (const char *) \$_probe_arg1" \ ++ " = $hex .This is a test message.*" \ ++ "check \$_probe_arg1 for probe m4$addendum" ++ gdb_test "print \$_probe_arg2 == 0" " = 1" \ ++ "check \$_probe_arg2 for probe m4$addendum" ++ ++ # Reinit GDB, set a breakpoint on probe ps. ++ delete_breakpoints ++ rerun_to_main ++ if {[runto "-p teste:ps"]} { ++ pass "run to -p teste:m4$addendum" ++ } else { ++ fail "run to -p teste:m4$addendum" ++ } ++ ++ gdb_test "print \$_probe_argc" " = 3" \ ++ "print \$_probe_argc for probe ps$addendum" ++ gdb_test "print (const char *) \$_probe_arg1" \ ++ " = $hex .This is another test message.*" \ ++ "print \$_probe_arg1 for probe ps$addendum" + + return 0 +} @@ -11181,11 +12242,96 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/stap-probe.exp + untested stap-probe.exp + return -1 +} ++ +stap_test "-DUSE_PROBES" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla-overflow.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla-overflow.c 2011-07-29 22:52:02.000000000 +0200 ++stap_test_no_debuginfo ++stap_test_no_debuginfo "-DUSE_PROBES" +diff --git a/gdb/testsuite/gdb.base/vla-frame.c b/gdb/testsuite/gdb.base/vla-frame.c +new file mode 100644 +index 0000000..5750f68 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla-frame.c +@@ -0,0 +1,31 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2011 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 . */ ++ ++#include ++ ++int ++main (int argc, char **argv) ++{ ++ char s[2 + argc]; ++ void (*f) (char *) = 0; ++ ++ memset (s, 0, sizeof (s)); ++ s[0] = 'X'; ++ ++ f (s); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/vla-frame.exp b/gdb/testsuite/gdb.base/vla-frame.exp +new file mode 100644 +index 0000000..47736c7 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla-frame.exp +@@ -0,0 +1,38 @@ ++# Copyright 2011 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 . ++ ++set testfile vla-frame ++set executable ${testfile} ++ ++if { [prepare_for_testing ${testfile}.exp ${executable}] } { ++ return -1 ++} ++ ++if ![runto_main] { ++ return -1 ++} ++ ++set test "continue" ++gdb_test_multiple $test $test { ++ -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ untested ${testfile}.exp ++ return ++ } ++} ++ ++gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*" +diff --git a/gdb/testsuite/gdb.base/vla-overflow.c b/gdb/testsuite/gdb.base/vla-overflow.c +new file mode 100644 +index 0000000..c5d5ee0 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla-overflow.c @@ -0,0 +1,30 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -11217,10 +12363,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla-overflow.c + + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla-overflow.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla-overflow.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp +new file mode 100644 +index 0000000..24a608f +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla-overflow.exp @@ -0,0 +1,109 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -11331,10 +12478,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla-overflow.exp +gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()" + +verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.base/vla.c b/gdb/testsuite/gdb.base/vla.c +new file mode 100644 +index 0000000..e1f3ed1 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla.c @@ -0,0 +1,55 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -11391,10 +12539,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla.c + foo (78); + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.base/vla.exp b/gdb/testsuite/gdb.base/vla.exp +new file mode 100644 +index 0000000..5da7378 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/vla.exp @@ -0,0 +1,62 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -11458,11 +12607,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/vla.exp +gdb_test "p temp1" " = '1' " "second: print temp1" +gdb_test "p temp2" " = '2' " "second: print temp2" +gdb_test "p temp3" " = '3' " "second: print temp3" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.cp/nextoverthrow.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.cp/nextoverthrow.exp 2011-01-01 16:33:44.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.cp/nextoverthrow.exp 2011-07-29 22:52:02.000000000 +0200 -@@ -53,6 +53,17 @@ gdb_test_multiple "print _Unwind_DebugHo +diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp +index cc9fe86..2f16af1 100644 +--- a/gdb/testsuite/gdb.cp/nextoverthrow.exp ++++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp +@@ -58,6 +58,17 @@ gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" { } } if {!$ok} { @@ -11480,10 +12629,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.cp/nextoverthrow.exp unsupported "nextoverthrow.exp could not find _Unwind_DebugHook" return -1 } -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S +new file mode 100644 +index 0000000..aac3baa +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S @@ -0,0 +1,246 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -11731,10 +12881,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S + .string "char" +.Luint_str: + .string "unsigned int" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp +new file mode 100644 +index 0000000..815ed93 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp @@ -0,0 +1,54 @@ +# Copyright 2010 Free Software Foundation, Inc. + @@ -11790,10 +12941,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp + +# The register contains unpredictable value - the array size. +gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-stripped.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-stripped.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c +new file mode 100644 +index 0000000..1f02d90 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c @@ -0,0 +1,42 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -11837,10 +12989,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-stripped.c + func1 (1, 2); + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp +new file mode 100644 +index 0000000..1c6e84a +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp @@ -0,0 +1,79 @@ +# Copyright 2006 Free Software Foundation, Inc. + @@ -11921,10 +13074,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp +gdb_test "step" \ + "func.* \\(.*\\) at .*" \ + "step" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S +new file mode 100644 +index 0000000..5fcdd84 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S @@ -0,0 +1,83 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -12009,10 +13163,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-locat + + .byte 0x0 /* Terminator */ + .byte 0x0 /* Terminator */ -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp +new file mode 100644 +index 0000000..c41151c +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp @@ -0,0 +1,37 @@ +# Copyright 2009 Free Software Foundation, Inc. + @@ -12051,10 +13206,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-locat +clean_restart $binfile + +gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dwarf-stride.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp +new file mode 100644 +index 0000000..d7b8bea +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/dwarf-stride.exp @@ -0,0 +1,42 @@ +# Copyright 2009 Free Software Foundation, Inc. + @@ -12098,10 +13254,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dwarf-stride.exp +gdb_continue_to_breakpoint "break-here" ".*break-here.*" +gdb_test "p c40pt(1)" " = '0-hello.*" +gdb_test "p c40pt(2)" " = '1-hello.*" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dwarf-stride.f90 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dwarf-stride.f90 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.f90 b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 +new file mode 100644 +index 0000000..e492b3a +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 @@ -0,0 +1,40 @@ +! Copyright 2009 Free Software Foundation, Inc. +! @@ -12143,10 +13300,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dwarf-stride.f90 + print *, c40pt ! break-here + +end program repro -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 +new file mode 100644 +index 0000000..261ce17 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 @@ -0,0 +1,24 @@ +! Copyright 2010 Free Software Foundation, Inc. +! @@ -12172,10 +13330,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f9 + real :: dummy + dummy = 1 +end subroutine bar -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp +new file mode 100644 +index 0000000..fa41b80 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp @@ -0,0 +1,37 @@ +# Copyright 2010 Free Software Foundation, Inc. + @@ -12214,10 +13373,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp +} + +gdb_test "bt" {foo \(string='hello'.*} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 +new file mode 100644 +index 0000000..2bc637d +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 @@ -0,0 +1,36 @@ +! Copyright 2010 Free Software Foundation, Inc. +! @@ -12255,11 +13415,12 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 + end interface + call foo ('hello') +end -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic.exp 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,145 @@ +diff --git a/gdb/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp +new file mode 100644 +index 0000000..e79e94a +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/dynamic.exp +@@ -0,0 +1,152 @@ +# Copyright 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -12327,6 +13488,13 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic.exp +gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv unassociated" +gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv unassociated" + ++set test "output varx" ++gdb_test_multiple $test $test { ++ -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" { ++ pass $test ++ } ++} ++ +gdb_breakpoint [gdb_get_line_number "varv-associated"] +gdb_continue_to_breakpoint "varv-associated" +gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated" @@ -12405,10 +13573,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic.exp +gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9" +# maps to foo::vary(1,3) +gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic.f90 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic.f90 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/dynamic.f90 b/gdb/testsuite/gdb.fortran/dynamic.f90 +new file mode 100644 +index 0000000..0f43564 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/dynamic.f90 @@ -0,0 +1,98 @@ +! Copyright 2007 Free Software Foundation, Inc. +! @@ -12508,10 +13677,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/dynamic.f90 + if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort + if (x (3, 1) .ne. 10) call abort +end -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/string.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/string.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp +new file mode 100644 +index 0000000..39de2c4 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/string.exp @@ -0,0 +1,59 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -12572,10 +13742,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/string.exp +gdb_continue_to_breakpoint "var-finish" +gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set" +gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/string.f90 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/string.f90 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90 +new file mode 100644 +index 0000000..226dc5d +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/string.f90 @@ -0,0 +1,37 @@ +! Copyright 2008 Free Software Foundation, Inc. +! @@ -12614,10 +13785,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/string.f90 + h = 'h' + call foo (g, h) +end -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/subrange.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/subrange.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp +new file mode 100644 +index 0000000..c819e23 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/subrange.exp @@ -0,0 +1,60 @@ +# Copyright 2011 Free Software Foundation, Inc. + @@ -12679,10 +13851,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/subrange.exp +delete_breakpoints +gdb_unload +gdb_test {p $a (3, 2:2)} { = \(23\)} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/subrange.f90 -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/subrange.f90 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90 +new file mode 100644 +index 0000000..4747ea9 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/subrange.f90 @@ -0,0 +1,28 @@ +! Copyright 2011 Free Software Foundation, Inc. +! @@ -12712,10 +13885,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/subrange.f90 + ptr => a + write (*,*) a ! break-static +end -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.gdb/selftest.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.gdb/selftest.exp 2011-07-29 22:52:00.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.gdb/selftest.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp +index 30a71dd..4bb8e7d 100644 +--- a/gdb/testsuite/gdb.gdb/selftest.exp ++++ b/gdb/testsuite/gdb.gdb/selftest.exp @@ -92,6 +92,10 @@ proc do_steps_and_nexts {} { set description "step over ttyarg initialization" set command "step" @@ -12727,10 +13900,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.gdb/selftest.exp -re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" { set description "next over make_command_stats_cleanup and everything it calls" set command "next" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-var-stale-type.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-var-stale-type.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.c b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c +new file mode 100644 +index 0000000..ebced3c +--- /dev/null ++++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c @@ -0,0 +1,26 @@ +/* Copyright 2011 Free Software Foundation, Inc. + @@ -12758,10 +13932,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-var-stale-type.c + + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp +new file mode 100644 +index 0000000..74a104e +--- /dev/null ++++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp @@ -0,0 +1,57 @@ +# Copyright 2011 Free Software Foundation, Inc. +# @@ -12820,14 +13995,15 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp +mi_create_varobj "vla" "vla" "create local variable vla" + +mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.c 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,59 @@ +diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.c b/gdb/testsuite/gdb.multi/watchpoint-multi.c +new file mode 100644 +index 0000000..51697b0 +--- /dev/null ++++ b/gdb/testsuite/gdb.multi/watchpoint-multi.c +@@ -0,0 +1,51 @@ +/* This testcase is part of GDB, the GNU debugger. + -+ Copyright 2010 Free Software Foundation, Inc. ++ Copyright 2012 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 @@ -12848,14 +14024,7 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.c +static volatile int a, b, c; + +static void -+marker_exit1 (void) -+{ -+ a = 1; -+} -+ -+/* Workaround PR breakpoints/12272 by two different breakpoint locations. */ -+static void -+marker_exit2 (void) ++marker_exit (void) +{ + a = 1; +} @@ -12880,17 +14049,17 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.c + i = pthread_join (thread, NULL); + assert (i == 0); + -+ marker_exit1 (); -+ marker_exit2 (); ++ marker_exit (); + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.exp 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,113 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ +diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.exp b/gdb/testsuite/gdb.multi/watchpoint-multi.exp +new file mode 100644 +index 0000000..d7daeec +--- /dev/null ++++ b/gdb/testsuite/gdb.multi/watchpoint-multi.exp +@@ -0,0 +1,92 @@ ++# Copyright 2012 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 @@ -12904,7 +14073,8 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.exp +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + -+if { [is_remote target] || ![isnative] } then { ++if [is_remote target] { ++ # It is KFAIL. + continue +} + @@ -12949,63 +14119,42 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.multi/watchpoint-multi.exp +# Do not use simple hardware watchpoint ("watch") as its false hit may be +# unnoticed by GDB if it reads it still has the same value. +gdb_test "awatch c" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c" -+# Never keep/use any non-hw breakpoints to workaround a multi-inferior bug. -+# Use `*' to workaround a multi-inferior bug. -+set test "hbreak *marker_exit2" ++ ++gdb_breakpoint "marker_exit" ++ ++gdb_test "inferior 1" "witching to inferior 1 .*" ++ ++set have_awatch_b 0 ++set test "awatch b" +gdb_test_multiple $test $test { -+ -re "Hardware assisted breakpoint \[0-9\]+ at .*\r\n$gdb_prompt $" { ++ -re "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b\r\n$gdb_prompt $" { + pass $test ++ set have_awatch_b 1 + } -+ -re "(No hardware breakpoint support in the target\\.|Hardware breakpoints used exceeds limit\\.)\r\n$gdb_prompt $" { -+ pass $test -+ untested ${testfile}.exp ++ -re "There are not enough available hardware resources for this watchpoint\\.\r\n$gdb_prompt $" { ++ untested $test + return + } +} + -+gdb_test "inferior 1" "witching to inferior 1 .*" -+ -+gdb_test "awatch b" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b" -+gdb_test "hbreak *marker_exit1" {Hardware assisted breakpoint [0-9]+ at .*} -+ +gdb_test "inferior 2" "witching to inferior 2 .*" + +# FAIL would be a hit on watchpoint for `b' - that one is for the other +# inferior. +gdb_test "continue" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c\r\n\r\nOld value = 0\r\nNew value = 3\r\n.*" "catch c" + -+set test "catch marker_exit2" -+gdb_test_multiple "continue" $test { -+ -re "Breakpoint \[0-9\]+, marker_exit2 .*\r\n$gdb_prompt $" { -+ setup_kfail breakpoints/12312 *-*-* -+ pass $test -+ } -+ -re "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c\r\n\r\nValue = 3\r\n(.* in )?\\*?(__GI_)?__nptl_death_event .*\r\n$gdb_prompt $" { -+ setup_kfail breakpoints/12312 *-*-* -+ fail $test -+ } -+} ++gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit in inferior 2" + +gdb_test "inferior 1" "witching to inferior 1 .*" + +gdb_test "continue" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b\r\n\r\nOld value = 0\r\nNew value = 2\r\n.*" "catch b" + -+set test "catch marker_exit1" -+gdb_test_multiple "continue" $test { -+ -re "Breakpoint \[0-9\]+, marker_exit1 .*\r\n$gdb_prompt $" { -+ setup_kfail breakpoints/12312 *-*-* -+ pass $test -+ } -+ -re "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b\r\n\r\nValue = 2\r\n(.* in )?\\*?(__GI_)?__nptl_death_event .*\r\n$gdb_prompt $" { -+ setup_kfail breakpoints/12312 *-*-* -+ fail $test -+ } -+} -+ -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register-func.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register-func.c 2011-07-29 22:52:02.000000000 +0200 ++gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit in inferior 1" +diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c +new file mode 100644 +index 0000000..729f457 +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/array-from-register-func.c @@ -0,0 +1,22 @@ +/* This file is part of GDB, the GNU debugger. + @@ -13029,10 +14178,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register-func.c +{ + return arr[0]; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.opt/array-from-register.c b/gdb/testsuite/gdb.opt/array-from-register.c +new file mode 100644 +index 0000000..3090e7e +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/array-from-register.c @@ -0,0 +1,28 @@ +/* This file is part of GDB, the GNU debugger. + @@ -13062,10 +14212,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register.c + + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.opt/array-from-register.exp b/gdb/testsuite/gdb.opt/array-from-register.exp +new file mode 100644 +index 0000000..f2de718 +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/array-from-register.exp @@ -0,0 +1,33 @@ +# Copyright 2009 Free Software Foundation, Inc. +# @@ -13100,10 +14251,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.opt/array-from-register.exp +# Seen regression: +# Address requested for identifier "arr" which is in register $rdi +gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.pascal/arrays.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.pascal/arrays.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp +new file mode 100644 +index 0000000..ccc6e1e +--- /dev/null ++++ b/gdb/testsuite/gdb.pascal/arrays.exp @@ -0,0 +1,104 @@ +# Copyright 2008, 2009 Free Software Foundation, Inc. +# @@ -13209,10 +14361,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.pascal/arrays.exp +} +gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char" + -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.pascal/arrays.pas -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.pascal/arrays.pas 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas +new file mode 100644 +index 0000000..295602d +--- /dev/null ++++ b/gdb/testsuite/gdb.pascal/arrays.pas @@ -0,0 +1,82 @@ +{ + Copyright 2008, 2009 Free Software Foundation, Inc. @@ -13296,11 +14449,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.pascal/arrays.pas + s := 'test'#0'string'; + writeln(s); { set breakpoint 2 here } +end. -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.python/py-frame.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.python/py-frame.exp 2011-02-26 15:06:28.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.python/py-frame.exp 2011-07-29 22:52:02.000000000 +0200 -@@ -78,8 +78,6 @@ gdb_test "python print bframe == gdb.new +diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp +index 1cb573e..3605ee5 100644 +--- a/gdb/testsuite/gdb.python/py-frame.exp ++++ b/gdb/testsuite/gdb.python/py-frame.exp +@@ -78,8 +78,6 @@ gdb_test "python print bframe == gdb.newest_frame()" True \ gdb_test "python print 'result =', f0 == f1" " = False" "test equality comparison (false)" gdb_test "python print 'result =', f0 == f0" " = True" "test equality comparison (true)" @@ -13309,17 +14462,17 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.python/py-frame.exp gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_valid" gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name" gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type" -@@ -94,3 +92,5 @@ gdb_test "python print 'result =', f0.re +@@ -94,3 +92,5 @@ gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_ex gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success" gdb_test "python print 'result =', gdb.selected_frame () == f1" " = True" "test gdb.selected_frame" + +gdb_test "python print 'result =', f0.block ()" "" "test Frame.block" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.python/py-value.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.python/py-value.exp 2011-04-24 11:04:38.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.python/py-value.exp 2011-07-29 22:52:02.000000000 +0200 -@@ -319,6 +319,15 @@ proc test_value_after_death {} { +diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp +index 59d79ae..75b7d72 100644 +--- a/gdb/testsuite/gdb.python/py-value.exp ++++ b/gdb/testsuite/gdb.python/py-value.exp +@@ -364,6 +364,15 @@ proc test_value_after_death {} { "print value's type" } @@ -13335,22 +14488,23 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.python/py-value.exp # 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. -@@ -456,6 +465,7 @@ test_value_in_inferior +@@ -500,6 +509,7 @@ test_value_in_inferior test_inferior_function_call test_lazy_strings test_value_after_death +test_cast_regression - # The following test recompiles the binary to test either C or C++ - # values. -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-child.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-child.c 2011-07-29 22:52:02.000000000 +0200 -@@ -0,0 +1,127 @@ + # Test either C or C++ values. + test_subscript_regression "${binfile}" "c" +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-child.c b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c +new file mode 100644 +index 0000000..7a7e07f +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c +@@ -0,0 +1,129 @@ +/* Test case for forgotten hw-watchpoints after fork()-off of a process. + -+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc. ++ Copyright 2012 Free Software Foundation, Inc. + + This file is part of GDB. + @@ -13378,6 +14532,8 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-child.c + +#include "watchpoint-fork.h" + ++/* `pid_t' may not be available. */ ++ +static volatile int usr1_got; + +static void @@ -13389,7 +14545,7 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-child.c +void +forkoff (int nr) +{ -+ pid_t child, save_parent = getpid (); ++ int child, save_parent = getpid (); + int i; + struct sigaction act, oldact; +#ifdef THREAD @@ -13475,14 +14631,15 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-child.c + i = sigaction (SIGUSR1, &oldact, NULL); + assert (i == 0); +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c +new file mode 100644 +index 0000000..bfdd89f +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c @@ -0,0 +1,174 @@ +/* Test case for forgotten hw-watchpoints after fork()-off of a process. + -+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc. ++ Copyright 2012 Free Software Foundation, Inc. + + This file is part of GDB. + @@ -13654,14 +14811,15 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c + mark_exit (); + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c b/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c +new file mode 100644 +index 0000000..9bbf438 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c @@ -0,0 +1,74 @@ +/* Test case for forgotten hw-watchpoints after fork()-off of a process. + -+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc. ++ Copyright 2012 Free Software Foundation, Inc. + + This file is part of GDB. + @@ -13733,14 +14891,15 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c + marker (); + } +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-st.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-st.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-st.c b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c +new file mode 100644 +index 0000000..17cc058 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c @@ -0,0 +1,61 @@ +/* Test case for forgotten hw-watchpoints after fork()-off of a process. + -+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc. ++ Copyright 2012 Free Software Foundation, Inc. + + This file is part of GDB. + @@ -13799,13 +14958,14 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork-st.c + mark_exit (); + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp +new file mode 100644 +index 0000000..2e01344 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp @@ -0,0 +1,149 @@ -+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. -+ ++# Copyright 2012 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 @@ -13953,14 +15113,15 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork.exp +} else { + untested "child" +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork.h 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.h b/gdb/testsuite/gdb.threads/watchpoint-fork.h +new file mode 100644 +index 0000000..cb109fa +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork.h @@ -0,0 +1,32 @@ +/* Test case for forgotten hw-watchpoints after fork()-off of a process. + -+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc. ++ Copyright 2012 Free Software Foundation, Inc. + + This file is part of GDB. + @@ -13990,10 +15151,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/watchpoint-fork.h + +extern void marker (void); +extern void forkoff (int nr); -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.trace/stap-trace.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.trace/stap-trace.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.trace/stap-trace.c b/gdb/testsuite/gdb.trace/stap-trace.c +new file mode 100644 +index 0000000..27f317e +--- /dev/null ++++ b/gdb/testsuite/gdb.trace/stap-trace.c @@ -0,0 +1,71 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -14066,10 +15228,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.trace/stap-trace.c + + return 0; +} -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.trace/stap-trace.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.trace/stap-trace.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/gdb.trace/stap-trace.exp b/gdb/testsuite/gdb.trace/stap-trace.exp +new file mode 100644 +index 0000000..b0f1d7d +--- /dev/null ++++ b/gdb/testsuite/gdb.trace/stap-trace.exp @@ -0,0 +1,129 @@ +# Copyright 2011 +# Free Software Foundation, Inc. @@ -14192,18 +15355,18 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.trace/stap-trace.exp + return 1; +} + -+gdb_collect_probe_arg "probe args without semaphore" "probe:user" "23" ++gdb_collect_probe_arg "probe args without semaphore" "-p user" "23" +gdb_exit + +compile_stap_bin "-DUSE_PROBES" -+gdb_collect_probe_arg "probe args with semaphore" "probe:two" "46" ++gdb_collect_probe_arg "probe args with semaphore" "-p two" "46" + +# Finished! +gdb_test "tfind none" ".*" "" -Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/gdb.exp 2011-07-15 16:11:22.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index fc7e223..3ea5ce0 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp @@ -141,6 +141,11 @@ proc gdb_unload {} { send_gdb "y\n" exp_continue @@ -14216,10 +15379,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp -re "Discard symbol table from .*y or n.*$" { send_gdb "y\n" exp_continue -Index: gdb-7.3.50.20110722/gdb/testsuite/lib/pascal.exp -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/pascal.exp 2011-01-01 16:33:52.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/testsuite/lib/pascal.exp 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp +index 891da37..236c5ca 100644 +--- a/gdb/testsuite/lib/pascal.exp ++++ b/gdb/testsuite/lib/pascal.exp @@ -37,6 +37,9 @@ proc pascal_init {} { global pascal_compiler_is_fpc global gpc_compiler @@ -14251,11 +15414,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/pascal.exp } set pascal_init_done 1 } -Index: gdb-7.3.50.20110722/gdb/thread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/thread.c 2011-05-30 20:04:32.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/thread.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1441,7 +1441,8 @@ update_thread_list (void) +diff --git a/gdb/thread.c b/gdb/thread.c +index 8cca83d..54adf7e 100644 +--- a/gdb/thread.c ++++ b/gdb/thread.c +@@ -1432,7 +1432,8 @@ update_thread_list (void) no thread is selected, or no threads exist. */ static struct value * @@ -14265,7 +15428,7 @@ Index: gdb-7.3.50.20110722/gdb/thread.c { struct thread_info *tp = find_thread_ptid (inferior_ptid); -@@ -1452,6 +1453,15 @@ thread_id_make_value (struct gdbarch *gd +@@ -1443,6 +1444,15 @@ thread_id_make_value (struct gdbarch *gdbarch, struct internalvar *var) /* Commands with a prefix of `thread'. */ struct cmd_list_element *thread_cmd_list = NULL; @@ -14281,18 +15444,18 @@ Index: gdb-7.3.50.20110722/gdb/thread.c void _initialize_thread (void) { -@@ -1497,5 +1507,5 @@ Show printing of thread events (such as +@@ -1488,5 +1498,5 @@ Show printing of thread events (such as thread start and exit)."), NULL, show_print_thread_events, &setprintlist, &showprintlist); - create_internalvar_type_lazy ("_thread", thread_id_make_value); + create_internalvar_type_lazy ("_thread", &thread_funcs, NULL); } -Index: gdb-7.3.50.20110722/gdb/top.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/top.c 2011-07-21 13:03:45.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/top.c 2011-07-29 22:52:02.000000000 +0200 -@@ -347,6 +347,9 @@ prepare_execute_command (void) +diff --git a/gdb/top.c b/gdb/top.c +index c593769..a4b7b09 100644 +--- a/gdb/top.c ++++ b/gdb/top.c +@@ -351,6 +351,9 @@ prepare_execute_command (void) mark = value_mark (); cleanup = make_cleanup_value_free_to_mark (mark); @@ -14302,39 +15465,56 @@ Index: gdb-7.3.50.20110722/gdb/top.c /* With multiple threads running while the one we're examining is stopped, the dcache can get stale without us being able to detect -Index: gdb-7.3.50.20110722/gdb/tracepoint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/tracepoint.c 2011-07-07 15:32:55.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/tracepoint.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1609,6 +1609,8 @@ start_tracing (void) +diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c +index 79a64a3..dc74162 100644 +--- a/gdb/tracepoint.c ++++ b/gdb/tracepoint.c +@@ -684,7 +684,7 @@ validate_actionline (char **line, struct breakpoint *b) + struct cleanup *old_chain = NULL; + char *p, *tmp_p; + struct bp_location *loc; +- struct agent_expr *aexpr; ++ struct agent_expr *aexpr = NULL; + struct tracepoint *t = (struct tracepoint *) b; + + /* If EOF is typed, *line is NULL. */ +@@ -1353,7 +1353,7 @@ encode_actions_1 (struct command_line *action, + int i; + struct value *tempval; + struct cmd_list_element *cmd; +- struct agent_expr *aexpr; ++ struct agent_expr *aexpr = NULL; - for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++) + for (; action; action = action->next) { +@@ -1717,6 +1717,7 @@ start_tracing (char *notes) + for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++) + { + struct tracepoint *t = (struct tracepoint *) b; + struct bp_location *loc; + + if (b->enable_state == bp_enabled) + any_enabled = 1; +@@ -1779,6 +1780,9 @@ start_tracing (char *notes) + } + + t->number_on_target = b->number; + - if ((t->type == bp_fast_tracepoint - ? !may_insert_fast_tracepoints - : !may_insert_tracepoints)) -@@ -1617,6 +1619,9 @@ start_tracing (void) - t->number_on_target = 0; - target_download_tracepoint (t); - t->number_on_target = t->number; -+ -+ for (loc = t->loc; loc; loc = loc->next) ++ for (loc = b->loc; loc; loc = loc->next) + modify_semaphore (loc, 1); } VEC_free (breakpoint_p, tp_vec); -@@ -1678,7 +1683,28 @@ trace_stop_command (char *args, int from - void - stop_tracing (void) +@@ -1851,9 +1855,28 @@ void + stop_tracing (char *note) { + int ret; + VEC(breakpoint_p) *tp_vec = NULL; + int ix; + struct breakpoint *t; -+ + target_trace_stop (); -+ + + tp_vec = all_tracepoints (); + for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++) + { @@ -14351,10 +15531,10 @@ Index: gdb-7.3.50.20110722/gdb/tracepoint.c + + VEC_free (breakpoint_p, tp_vec); + - /* Should change in response to reply? */ - current_trace_status ()->running = 0; - } -@@ -4521,7 +4547,8 @@ info_static_tracepoint_markers_command ( + if (!note) + note = trace_stop_notes; + ret = target_set_trace_notes (NULL, NULL, note); +@@ -4925,7 +4948,8 @@ info_static_tracepoint_markers_command (char *arg, int from_tty) available. */ static struct value * @@ -14364,7 +15544,7 @@ Index: gdb-7.3.50.20110722/gdb/tracepoint.c { LONGEST size; gdb_byte *buf; -@@ -4700,6 +4727,15 @@ traceframe_available_memory (VEC(mem_ran +@@ -5104,6 +5128,15 @@ traceframe_available_memory (VEC(mem_range_s) **result, return 0; } @@ -14380,7 +15560,7 @@ Index: gdb-7.3.50.20110722/gdb/tracepoint.c /* module initialization */ void _initialize_tracepoint (void) -@@ -4710,7 +4746,7 @@ _initialize_tracepoint (void) +@@ -5114,7 +5147,7 @@ _initialize_tracepoint (void) value with a void typed value, and when we get here, gdbarch isn't initialized yet. At this point, we're quite sure there isn't another convenience variable of the same name. */ @@ -14389,10 +15569,10 @@ Index: gdb-7.3.50.20110722/gdb/tracepoint.c traceframe_number = -1; tracepoint_number = -1; -Index: gdb-7.3.50.20110722/gdb/typeprint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/typeprint.c 2011-01-11 22:53:25.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/typeprint.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/typeprint.c b/gdb/typeprint.c +index cf4158d..f157962 100644 +--- a/gdb/typeprint.c ++++ b/gdb/typeprint.c @@ -36,6 +36,7 @@ #include "gdb_string.h" #include "exceptions.h" @@ -14405,7 +15585,7 @@ Index: gdb-7.3.50.20110722/gdb/typeprint.c type_print (struct type *type, char *varstring, struct ui_file *stream, int show) { -+ if (show >= 0) ++ if (show >= 0 && current_language->la_language != language_ada) + type = check_typedef (type); + LA_PRINT_TYPE (type, varstring, stream, show, 0); @@ -14446,11 +15626,11 @@ Index: gdb-7.3.50.20110722/gdb/typeprint.c } static void -Index: gdb-7.3.50.20110722/gdb/utils.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/utils.c 2011-07-22 01:46:09.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/utils.c 2011-07-29 22:52:02.000000000 +0200 -@@ -1874,6 +1874,36 @@ set_batch_flag_and_make_cleanup_restore_ +diff --git a/gdb/utils.c b/gdb/utils.c +index d55e6f1..be7c72b 100644 +--- a/gdb/utils.c ++++ b/gdb/utils.c +@@ -1906,6 +1906,36 @@ set_batch_flag_and_make_cleanup_restore_page_info (void) return back_to; } @@ -14487,11 +15667,11 @@ Index: gdb-7.3.50.20110722/gdb/utils.c /* Set the screen size based on LINES_PER_PAGE and CHARS_PER_LINE. */ static void -Index: gdb-7.3.50.20110722/gdb/valarith.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/valarith.c 2011-02-18 20:10:46.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/valarith.c 2011-07-29 22:52:02.000000000 +0200 -@@ -198,7 +198,10 @@ value_subscripted_rvalue (struct value * +diff --git a/gdb/valarith.c b/gdb/valarith.c +index 3250cc7..22da067 100644 +--- a/gdb/valarith.c ++++ b/gdb/valarith.c +@@ -198,7 +198,10 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); unsigned int elt_size = TYPE_LENGTH (elt_type); @@ -14514,10 +15694,10 @@ Index: gdb-7.3.50.20110722/gdb/valarith.c return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2)); } -Index: gdb-7.3.50.20110722/gdb/valops.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/valops.c 2011-07-14 17:00:20.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/valops.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/valops.c b/gdb/valops.c +index 29d1fbd..44cdd49 100644 +--- a/gdb/valops.c ++++ b/gdb/valops.c @@ -47,6 +47,7 @@ #include "objfiles.h" #include "symtab.h" @@ -14526,7 +15706,7 @@ Index: gdb-7.3.50.20110722/gdb/valops.c extern int overload_debug; /* Local functions. */ -@@ -915,6 +916,65 @@ value_one (struct type *type, enum lval_ +@@ -917,6 +918,65 @@ value_one (struct type *type) return val; } @@ -14592,7 +15772,7 @@ Index: gdb-7.3.50.20110722/gdb/valops.c /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */ static struct value * -@@ -1011,12 +1071,20 @@ value_fetch_lazy (struct value *val) +@@ -1013,12 +1073,20 @@ value_fetch_lazy (struct value *val) } else if (VALUE_LVAL (val) == lval_memory) { @@ -14618,7 +15798,7 @@ Index: gdb-7.3.50.20110722/gdb/valops.c } else if (VALUE_LVAL (val) == lval_register) { -@@ -1528,7 +1596,18 @@ address_of_variable (struct symbol *var, +@@ -1530,7 +1598,18 @@ address_of_variable (struct symbol *var, struct block *b) if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) || TYPE_CODE (type) == TYPE_CODE_FUNC) { @@ -14638,7 +15818,7 @@ Index: gdb-7.3.50.20110722/gdb/valops.c return value_from_pointer (lookup_pointer_type (type), addr); } -@@ -1635,6 +1714,7 @@ struct value * +@@ -1637,6 +1716,7 @@ struct value * value_coerce_array (struct value *arg1) { struct type *type = check_typedef (value_type (arg1)); @@ -14646,7 +15826,7 @@ Index: gdb-7.3.50.20110722/gdb/valops.c /* If the user tries to do something requiring a pointer with an array that has not yet been pushed to the target, then this would -@@ -1644,8 +1724,12 @@ value_coerce_array (struct value *arg1) +@@ -1646,8 +1726,12 @@ value_coerce_array (struct value *arg1) if (VALUE_LVAL (arg1) != lval_memory) error (_("Attempt to take address of value not located in memory.")); @@ -14660,7 +15840,7 @@ Index: gdb-7.3.50.20110722/gdb/valops.c } /* Given a value which is a function, return a value which is a pointer -@@ -3676,6 +3760,8 @@ value_slice (struct value *array, int lo +@@ -3696,6 +3780,8 @@ value_slice (struct value *array, int lowbound, int length) TYPE_TARGET_TYPE (range_type), lowbound, lowbound + length - 1); @@ -14669,10 +15849,10 @@ Index: gdb-7.3.50.20110722/gdb/valops.c if (TYPE_CODE (array_type) == TYPE_CODE_BITSTRING) { int i; -Index: gdb-7.3.50.20110722/gdb/valprint.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/valprint.c 2011-06-29 17:32:39.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/valprint.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/valprint.c b/gdb/valprint.c +index b4ac4ec..377905e 100644 +--- a/gdb/valprint.c ++++ b/gdb/valprint.c @@ -39,6 +39,7 @@ #include "gdb_obstack.h" #include "charset.h" @@ -14689,7 +15869,7 @@ Index: gdb-7.3.50.20110722/gdb/valprint.c case TYPE_CODE_BITSTRING: return 0; default: -@@ -1196,6 +1196,7 @@ val_print_array_elements (struct type *t +@@ -1200,6 +1200,7 @@ val_print_array_elements (struct type *type, { unsigned int things_printed = 0; unsigned len; @@ -14697,7 +15877,7 @@ Index: gdb-7.3.50.20110722/gdb/valprint.c struct type *elttype, *index_type; unsigned eltlen; /* Position of the array element we are examining to see -@@ -1204,9 +1205,33 @@ val_print_array_elements (struct type *t +@@ -1208,9 +1209,33 @@ val_print_array_elements (struct type *type, /* Number of repetitions we have detected so far. */ unsigned int reps; LONGEST low_bound, high_bound; @@ -14733,7 +15913,7 @@ Index: gdb-7.3.50.20110722/gdb/valprint.c index_type = TYPE_INDEX_TYPE (type); if (get_array_bounds (type, &low_bound, &high_bound)) -@@ -1293,6 +1318,8 @@ val_print_array_elements (struct type *t +@@ -1297,6 +1322,8 @@ val_print_array_elements (struct type *type, { fprintf_filtered (stream, "..."); } @@ -14742,10 +15922,10 @@ Index: gdb-7.3.50.20110722/gdb/valprint.c } /* Read LEN bytes of target memory at address MEMADDR, placing the -Index: gdb-7.3.50.20110722/gdb/value.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/value.c 2011-07-14 17:00:20.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/value.c 2011-07-29 22:52:02.000000000 +0200 +diff --git a/gdb/value.c b/gdb/value.c +index d02bc27..c83e1a8 100644 +--- a/gdb/value.c ++++ b/gdb/value.c @@ -43,6 +43,7 @@ #include "python/python.h" #include @@ -14754,7 +15934,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c /* Prototypes for exported functions. */ -@@ -1354,12 +1355,15 @@ void +@@ -1387,12 +1388,15 @@ void set_value_component_location (struct value *component, const struct value *whole) { @@ -14770,7 +15950,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c if (whole->lval == lval_computed) { const struct lval_funcs *funcs = whole->location.computed.funcs; -@@ -1367,6 +1371,12 @@ set_value_component_location (struct val +@@ -1400,6 +1404,12 @@ set_value_component_location (struct value *component, if (funcs->copy_closure) component->location.computed.closure = funcs->copy_closure (whole); } @@ -14783,7 +15963,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c } -@@ -1500,6 +1510,31 @@ show_values (char *num_exp, int from_tty +@@ -1533,6 +1543,31 @@ show_values (char *num_exp, int from_tty) num_exp[1] = '\0'; } } @@ -14815,7 +15995,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c /* Internal variables. These are variables within the debugger that hold values assigned by debugger commands. -@@ -1545,7 +1580,14 @@ struct internalvar +@@ -1578,7 +1613,14 @@ struct internalvar struct value *value; /* The call-back routine used with INTERNALVAR_MAKE_VALUE. */ @@ -14831,7 +16011,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c /* The internal function used with INTERNALVAR_FUNCTION. */ struct -@@ -1644,18 +1686,39 @@ create_internalvar (const char *name) +@@ -1677,18 +1719,39 @@ create_internalvar (const char *name) /* Create an internal variable with name NAME and register FUN as the function that value_of_internalvar uses to create a value whenever this variable is referenced. NAME should not normally include a @@ -14874,7 +16054,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c /* Look up an internal variable with name NAME. NAME should not normally include a dollar sign. -@@ -1728,7 +1791,8 @@ value_of_internalvar (struct gdbarch *gd +@@ -1761,7 +1824,8 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var) break; case INTERNALVAR_MAKE_VALUE: @@ -14884,7 +16064,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c break; default: -@@ -1924,6 +1988,11 @@ clear_internalvar (struct internalvar *v +@@ -1957,6 +2021,11 @@ clear_internalvar (struct internalvar *var) xfree (var->u.string); break; @@ -14896,7 +16076,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c default: break; } -@@ -1978,6 +2047,38 @@ call_internal_function (struct gdbarch * +@@ -2011,6 +2080,38 @@ call_internal_function (struct gdbarch *gdbarch, return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); } @@ -14935,7 +16115,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c /* The 'function' command. This does nothing -- it is just a placeholder to let "help function NAME" work. This is also used as the implementation of the sub-command that is created when -@@ -2025,11 +2126,10 @@ preserve_one_value (struct value *value, +@@ -2058,11 +2159,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, htab_t copied_types) { if (TYPE_OBJFILE (value->type) == objfile) @@ -14949,7 +16129,7 @@ Index: gdb-7.3.50.20110722/gdb/value.c copied_types); } -@@ -2044,7 +2144,7 @@ preserve_one_internalvar (struct interna +@@ -2077,7 +2177,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, case INTERNALVAR_INTEGER: if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile) var->u.integer.type @@ -14958,39 +16138,14 @@ Index: gdb-7.3.50.20110722/gdb/value.c break; case INTERNALVAR_VALUE: -@@ -2095,14 +2195,22 @@ show_convenience (char *ignore, int from - get_user_print_options (&opts); - for (var = internalvars; var; var = var->next) - { -+ volatile struct gdb_exception e; -+ - if (!varseen) - { - varseen = 1; - } - printf_filtered (("$%s = "), var->name); -- value_print (value_of_internalvar (gdbarch, var), gdb_stdout, -- &opts); -- printf_filtered (("\n")); -+ -+ TRY_CATCH (e, RETURN_MASK_ERROR) -+ { -+ value_print (value_of_internalvar (gdbarch, var), gdb_stdout, -+ &opts); -+ printf_filtered (("\n")); -+ } -+ if (e.reason < 0) -+ printf_filtered (_("\n"), e.message); - } - if (!varseen) - printf_unfiltered (_("No debugger convenience variables now defined.\n" -@@ -3075,7 +3183,24 @@ value_from_history_ref (char *h, char ** +@@ -3139,9 +3239,26 @@ coerce_ref_if_computed (const struct value *arg) struct value * coerce_ref (struct value *arg) { - struct type *value_type_arg_tmp = check_typedef (value_type (arg)); + struct type *value_type_arg_tmp; -+ + struct value *retval; + + if (TYPE_DYNAMIC (value_type (arg))) + { + struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); @@ -15007,10 +16162,11 @@ Index: gdb-7.3.50.20110722/gdb/value.c + } + else + value_type_arg_tmp = check_typedef (value_type (arg)); - - if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF) - arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp), -@@ -3173,4 +3298,10 @@ VARIABLE is already initialized.")); ++ + retval = coerce_ref_if_computed (arg); + if (retval) + return retval; +@@ -3243,4 +3360,10 @@ VARIABLE is already initialized.")); add_prefix_cmd ("function", no_class, function_command, _("\ Placeholder command for showing help on convenience functions."), &functionlist, "function ", 0, &cmdlist); @@ -15021,11 +16177,11 @@ Index: gdb-7.3.50.20110722/gdb/value.c + observer_attach_mark_used (value_types_mark_used); +#endif } -Index: gdb-7.3.50.20110722/gdb/value.h -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/value.h 2011-07-14 17:00:20.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/value.h 2011-07-29 22:52:02.000000000 +0200 -@@ -475,6 +475,10 @@ extern struct value *value_from_decfloat +diff --git a/gdb/value.h b/gdb/value.h +index 167847f..ccd68fc 100644 +--- a/gdb/value.h ++++ b/gdb/value.h +@@ -490,6 +490,10 @@ extern struct value *value_from_decfloat (struct type *type, const gdb_byte *decbytes); extern struct value *value_from_history_ref (char *, char **); @@ -15036,7 +16192,7 @@ Index: gdb-7.3.50.20110722/gdb/value.h extern struct value *value_at (struct type *type, CORE_ADDR addr); extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); -@@ -700,10 +704,52 @@ extern struct internalvar *lookup_only_i +@@ -719,10 +723,52 @@ extern struct internalvar *lookup_only_internalvar (const char *name); extern struct internalvar *create_internalvar (const char *name); @@ -15092,11 +16248,11 @@ Index: gdb-7.3.50.20110722/gdb/value.h extern struct internalvar *lookup_internalvar (const char *name); -Index: gdb-7.3.50.20110722/gdb/windows-tdep.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/windows-tdep.c 2011-07-14 17:00:20.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/windows-tdep.c 2011-07-29 22:52:02.000000000 +0200 -@@ -268,7 +268,7 @@ static const struct lval_funcs tlb_value +diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c +index 5e80aaf..f5ee5ff 100644 +--- a/gdb/windows-tdep.c ++++ b/gdb/windows-tdep.c +@@ -268,7 +268,7 @@ static const struct lval_funcs tlb_value_funcs = if there's no object available. */ static struct value * @@ -15128,11 +16284,11 @@ Index: gdb-7.3.50.20110722/gdb/windows-tdep.c - create_internalvar_type_lazy ("_tlb", tlb_make_value); + create_internalvar_type_lazy ("_tlb", &tlb_funcs, NULL); } -Index: gdb-7.3.50.20110722/gdb/xcoffread.c -=================================================================== ---- gdb-7.3.50.20110722.orig/gdb/xcoffread.c 2011-07-29 22:52:00.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/xcoffread.c 2011-07-29 22:52:02.000000000 +0200 -@@ -3125,6 +3125,7 @@ static const struct sym_fns xcoff_sym_fn +diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c +index d7760ee..8a8f5fc 100644 +--- a/gdb/xcoffread.c ++++ b/gdb/xcoffread.c +@@ -3125,6 +3125,7 @@ static const struct sym_fns xcoff_sym_fns = default_symfile_segments, /* Get segment information from a file. */ aix_process_linenos, default_symfile_relocate, /* Relocate a debug section. */ diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch index a81d627..7cc2a38 100644 --- a/gdb-bz541866-rwatch-before-run.patch +++ b/gdb-bz541866-rwatch-before-run.patch @@ -1,20 +1,20 @@ -Index: gdb-7.3.50.20110722/gdb/config/i386/linux64.mh +Index: gdb-7.4.50.20111218/gdb/config/i386/linux64.mh =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/config/i386/linux64.mh 2011-07-22 01:46:10.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/config/i386/linux64.mh 2011-07-22 19:32:41.000000000 +0200 -@@ -3,7 +3,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \ - i386-nat.o amd64-nat.o amd64-linux-nat.o \ +--- gdb-7.4.50.20111218.orig/gdb/config/i386/linux64.mh 2011-08-24 14:07:26.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/config/i386/linux64.mh 2011-12-19 01:40:49.492625837 +0100 +@@ -4,7 +4,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \ linux-nat.o linux-osdata.o \ - proc-service.o linux-thread-db.o linux-fork.o + proc-service.o linux-thread-db.o linux-fork.o \ + linux-procfs.o -NAT_FILE= config/nm-linux.h +NAT_FILE= nm-linux64.h NAT_CDEPS = $(srcdir)/proc-service.list # The dynamically loaded libthread_db needs access to symbols in the -Index: gdb-7.3.50.20110722/gdb/config/i386/linux.mh +Index: gdb-7.4.50.20111218/gdb/config/i386/linux.mh =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/config/i386/linux.mh 2011-07-22 01:46:10.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/config/i386/linux.mh 2011-07-22 19:32:21.000000000 +0200 +--- gdb-7.4.50.20111218.orig/gdb/config/i386/linux.mh 2011-08-24 14:07:26.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/config/i386/linux.mh 2011-12-19 01:40:32.453689006 +0100 @@ -1,6 +1,6 @@ # Host: Intel 386 running GNU/Linux. @@ -23,10 +23,10 @@ Index: gdb-7.3.50.20110722/gdb/config/i386/linux.mh NATDEPFILES= inf-ptrace.o fork-child.o \ i386-nat.o i386-linux-nat.o \ proc-service.o linux-thread-db.o \ -Index: gdb-7.3.50.20110722/gdb/config/i386/nm-linux.h +Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/config/i386/nm-linux.h 2011-07-22 19:32:21.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h 2011-12-19 01:40:32.454689002 +0100 @@ -0,0 +1,28 @@ +/* Native support for GNU/Linux i386. + @@ -56,10 +56,10 @@ Index: gdb-7.3.50.20110722/gdb/config/i386/nm-linux.h +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1 + +#endif /* NM_LINUX64_H */ -Index: gdb-7.3.50.20110722/gdb/config/i386/nm-linux64.h +Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/config/i386/nm-linux64.h 2011-07-22 19:32:21.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h 2011-12-19 01:40:32.455688998 +0100 @@ -0,0 +1,28 @@ +/* Native support for GNU/Linux amd64. + @@ -89,11 +89,11 @@ Index: gdb-7.3.50.20110722/gdb/config/i386/nm-linux64.h +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1 + +#endif /* NM_LINUX64_H */ -Index: gdb-7.3.50.20110722/gdb/target.h +Index: gdb-7.4.50.20111218/gdb/target.h =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/target.h 2011-06-06 14:47:07.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/target.h 2011-07-22 19:32:21.000000000 +0200 -@@ -1349,8 +1349,10 @@ extern char *target_thread_name (struct +--- gdb-7.4.50.20111218.orig/gdb/target.h 2011-12-06 21:03:13.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/target.h 2011-12-19 01:40:32.456688995 +0100 +@@ -1391,8 +1391,10 @@ extern char *target_thread_name (struct bp_hardware_breakpoint. CNT is the number of such watchpoints used so far (including this one?). OTHERTYPE is who knows what... */ @@ -104,10 +104,10 @@ Index: gdb-7.3.50.20110722/gdb/target.h /* Returns the number of debug registers needed to watch the given memory region, or zero if not supported. */ -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2011-07-22 19:32:21.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2011-12-19 01:40:32.464688965 +0100 @@ -0,0 +1,40 @@ +# Copyright 2009, 2010 Free Software Foundation, Inc. + diff --git a/gdb-bz592031-siginfo-lost-4of5.patch b/gdb-bz592031-siginfo-lost-4of5.patch index 639b37d..3810fec 100644 --- a/gdb-bz592031-siginfo-lost-4of5.patch +++ b/gdb-bz592031-siginfo-lost-4of5.patch @@ -78,11 +78,11 @@ gdb/testsuite/ * gdb.threads/sigstep-threads.exp: New file. * gdb.threads/sigstep-threads.c: New file. -Index: gdb-7.2.50.20110117/gdb/linux-nat.c +Index: gdb-7.4.50.20111218/gdb/linux-nat.c =================================================================== ---- gdb-7.2.50.20110117.orig/gdb/linux-nat.c 2011-01-17 15:53:14.000000000 +0100 -+++ gdb-7.2.50.20110117/gdb/linux-nat.c 2011-01-17 16:05:57.000000000 +0100 -@@ -2803,6 +2803,8 @@ stop_wait_callback (struct lwp_info *lp, +--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-19 01:25:42.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 02:17:05.412607735 +0100 +@@ -2843,6 +2843,8 @@ stop_wait_callback (struct lwp_info *lp, { int status; @@ -91,7 +91,7 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c status = wait_lwp (lp); if (status == 0) return 0; -@@ -2828,110 +2830,61 @@ stop_wait_callback (struct lwp_info *lp, +@@ -2868,110 +2870,61 @@ stop_wait_callback (struct lwp_info *lp, if (WSTOPSIG (status) != SIGSTOP) { @@ -146,9 +146,7 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c - status_to_str ((int) status)); - kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status)); - } -+ /* Save the trap's siginfo in case we need it later. */ -+ save_siginfo (lp); - +- - /* Save the sigtrap event. */ - lp->status = status; - return 0; @@ -157,7 +155,8 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c - { - /* The thread was stopped with a signal other than - SIGSTOP, and didn't accidentally trip a breakpoint. */ -+ save_sigtrap (lp); ++ /* Save the trap's siginfo in case we need it later. */ ++ save_siginfo (lp); - if (debug_linux_nat) - { @@ -174,7 +173,8 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c - "SWC: PTRACE_CONT %s, 0, 0 (%s)\n", - target_pid_to_str (lp->ptid), - errno ? safe_strerror (errno) : "OK"); -- ++ save_sigtrap (lp); + - /* Hold this event/waitstatus while we check to see if - there are any more (we still want to get that SIGSTOP). */ - stop_wait_callback (lp, NULL); @@ -248,11 +248,11 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c lp->signalled = 0; } } -@@ -3514,52 +3467,6 @@ retry: +@@ -3627,54 +3580,6 @@ retry: lp = NULL; } -- if (lp && lp->signalled) +- if (lp && lp->signalled && lp->last_resume_kind != resume_stop) - { - /* A pending SIGSTOP may interfere with the normal stream of - events. In a typical case where interference is a problem, @@ -266,6 +266,8 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c - /* Resume the thread. It should halt immediately returning the - pending SIGSTOP. */ - registers_changed (); +- if (linux_nat_prepare_to_resume != NULL) +- linux_nat_prepare_to_resume (lp); - linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)), - lp->step, TARGET_SIGNAL_0); - if (debug_linux_nat) @@ -301,10 +303,10 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c if (!target_can_async_p ()) { /* Causes SIGINT to be passed on to the attached process. */ -Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.c +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.c 2011-01-17 16:02:40.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c 2011-12-19 02:16:35.236720272 +0100 @@ -0,0 +1,447 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -753,10 +755,10 @@ Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.c + + return EXIT_SUCCESS; +} -Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.exp 2011-01-17 16:02:40.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp 2011-12-19 02:16:35.237720268 +0100 @@ -0,0 +1,94 @@ +# Copyright 2010 Free Software Foundation, Inc. + @@ -852,10 +854,10 @@ Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.exp +} + +gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*" -Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.c +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.c 2011-01-17 16:02:40.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c 2011-12-19 02:16:35.237720268 +0100 @@ -0,0 +1,54 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -911,10 +913,10 @@ Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.c + start (NULL); /* main-start */ + return 0; +} -Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.exp 2011-01-17 16:02:40.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp 2011-12-19 02:16:35.237720268 +0100 @@ -0,0 +1,74 @@ +# Copyright 2010 Free Software Foundation, Inc. + diff --git a/gdb-bz592031-siginfo-lost-5of5.patch b/gdb-bz592031-siginfo-lost-5of5.patch index b8212bb..8f4e440 100644 --- a/gdb-bz592031-siginfo-lost-5of5.patch +++ b/gdb-bz592031-siginfo-lost-5of5.patch @@ -26,27 +26,27 @@ gdb/ (linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO. * linux-nat.h (struct lwp_info) : Remove. -Index: gdb-7.2.50.20101116/gdb/linux-nat.c +Index: gdb-7.4.50.20111218/gdb/linux-nat.c =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 09:12:26.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 09:13:21.000000000 +0100 -@@ -1850,7 +1850,6 @@ resume_callback (struct lwp_info *lp, vo - target_pid_to_str (lp->ptid)); - lp->stopped = 0; - lp->step = 0; -- memset (&lp->siginfo, 0, sizeof (lp->siginfo)); - lp->stopped_by_watchpoint = 0; - } - else if (lp->stopped && debug_linux_nat) -@@ -1993,7 +1992,6 @@ linux_nat_resume (struct target_ops *ops - ptid = pid_to_ptid (GET_LWP (lp->ptid)); - +--- gdb-7.4.50.20111218.orig/gdb/linux-nat.c 2011-12-19 02:17:05.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 02:17:43.188466854 +0100 +@@ -1883,7 +1883,6 @@ resume_lwp (struct lwp_info *lp, int ste + step, TARGET_SIGNAL_0); + lp->stopped = 0; + lp->step = step; +- memset (&lp->siginfo, 0, sizeof (lp->siginfo)); + lp->stopped_by_watchpoint = 0; + } + else +@@ -2027,7 +2026,6 @@ linux_nat_resume (struct target_ops *ops + if (linux_nat_prepare_to_resume != NULL) + linux_nat_prepare_to_resume (lp); linux_ops->to_resume (linux_ops, ptid, step, signo); - memset (&lp->siginfo, 0, sizeof (lp->siginfo)); lp->stopped_by_watchpoint = 0; if (debug_linux_nat) -@@ -2503,22 +2501,6 @@ wait_lwp (struct lwp_info *lp) +@@ -2612,22 +2610,6 @@ wait_lwp (struct lwp_info *lp) return status; } @@ -69,7 +69,7 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c /* Send a SIGSTOP to LP. */ static int -@@ -2787,9 +2769,6 @@ stop_wait_callback (struct lwp_info *lp, +@@ -2872,9 +2854,6 @@ stop_wait_callback (struct lwp_info *lp, { /* The thread was stopped with a signal other than SIGSTOP. */ @@ -79,7 +79,7 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c save_sigtrap (lp); if (debug_linux_nat) -@@ -3155,12 +3134,7 @@ linux_nat_filter_event (int lwpid, int s +@@ -3278,12 +3257,7 @@ linux_nat_filter_event (int lwpid, int s } if (linux_nat_status_is_event (status)) @@ -93,7 +93,7 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c /* Check if the thread has exited. */ if ((WIFEXITED (status) || WIFSIGNALED (status)) -@@ -3763,7 +3737,6 @@ resume_stopped_resumed_lwps (struct lwp_ +@@ -3961,7 +3935,6 @@ resume_stopped_resumed_lwps (struct lwp_ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)), lp->step, TARGET_SIGNAL_0); lp->stopped = 0; @@ -101,7 +101,7 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c lp->stopped_by_watchpoint = 0; } -@@ -5932,11 +5905,19 @@ linux_nat_set_siginfo_fixup (struct targ +@@ -6029,11 +6002,19 @@ linux_nat_set_prepare_to_resume (struct struct siginfo * linux_nat_get_siginfo (ptid_t ptid) { @@ -124,11 +124,11 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c } /* Provide a prototype to silence -Wmissing-prototypes. */ -Index: gdb-7.2.50.20101116/gdb/linux-nat.h +Index: gdb-7.4.50.20111218/gdb/linux-nat.h =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/linux-nat.h 2010-11-16 07:54:36.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/linux-nat.h 2010-11-16 09:12:44.000000000 +0100 -@@ -58,10 +58,6 @@ struct lwp_info +--- gdb-7.4.50.20111218.orig/gdb/linux-nat.h 2011-12-18 23:40:59.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-19 02:17:21.355548276 +0100 +@@ -77,10 +77,6 @@ struct lwp_info /* The kind of stepping of this LWP. */ enum resume_step step; diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch index 87ccc0b..a421367 100644 --- a/gdb-core-open-vdso-warning.patch +++ b/gdb-core-open-vdso-warning.patch @@ -33,36 +33,35 @@ gdb/ [ Context backport. ] -Index: gdb-7.3.50.20110722/gdb/solib-svr4.c +Index: gdb-7.4.50.20111218/gdb/solib-svr4.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/solib-svr4.c 2011-07-22 19:26:46.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/solib-svr4.c 2011-07-22 19:29:36.000000000 +0200 -@@ -1197,8 +1197,18 @@ svr4_current_sos (void) - target_read_string (lm_name (new), &buffer, - SO_NAME_MAX_PATH_SIZE - 1, &errcode); - if (errcode != 0) -- warning (_("Can't read pathname for load map: %s."), -- safe_strerror (errcode)); -+ { -+ /* During the first ever DSO list reading some strings may be -+ unreadable as residing in the ld.so readonly memory not being -+ present in a dumped core file. Delay the error check after -+ the first pass of DSO list scanning when ld.so should be -+ already mapped in and all the DSO list l_name memory gets -+ readable. */ +--- gdb-7.4.50.20111218.orig/gdb/solib-svr4.c 2011-12-19 01:14:31.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/solib-svr4.c 2011-12-19 01:31:10.106752164 +0100 +@@ -1222,8 +1222,17 @@ svr4_read_so_list (CORE_ADDR lm, struct + SO_NAME_MAX_PATH_SIZE - 1, &errcode); + if (errcode != 0) + { +- warning (_("Can't read pathname for load map: %s."), +- safe_strerror (errcode)); ++ /* During the first ever DSO list reading some strings may be ++ unreadable as residing in the ld.so readonly memory not being ++ present in a dumped core file. Delay the error check after ++ the first pass of DSO list scanning when ld.so should be ++ already mapped in and all the DSO list l_name memory gets ++ readable. */ + -+ if (master_so_list () != NULL) -+ warning (_("Can't read pathname for load map: %s."), -+ safe_strerror (errcode)); -+ } - else - { - struct build_id *build_id; -Index: gdb-7.3.50.20110722/gdb/solib.c ++ if (master_so_list () != NULL) ++ warning (_("Can't read pathname for load map: %s."), ++ safe_strerror (errcode)); ++ + do_cleanups (old_chain); + continue; + } +Index: gdb-7.4.50.20111218/gdb/solib.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/solib.c 2011-06-30 21:29:54.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/solib.c 2011-07-22 19:29:10.000000000 +0200 -@@ -706,6 +706,7 @@ update_solib_list (int from_tty, struct +--- gdb-7.4.50.20111218.orig/gdb/solib.c 2011-09-12 21:00:22.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/solib.c 2011-12-19 01:29:04.815227898 +0100 +@@ -676,6 +676,7 @@ update_solib_list (int from_tty, struct struct target_so_ops *ops = solib_ops (target_gdbarch); struct so_list *inferior = ops->current_sos(); struct so_list *gdb, **gdb_link; @@ -70,7 +69,7 @@ Index: gdb-7.3.50.20110722/gdb/solib.c /* We can reach here due to changing solib-search-path or the sysroot, before having any inferior. */ -@@ -846,6 +847,12 @@ update_solib_list (int from_tty, struct +@@ -817,6 +818,12 @@ update_solib_list (int from_tty, struct observer_notify_solib_loaded (i); } diff --git a/gdb-dlopen-skip_inline_frames-perf.patch b/gdb-dlopen-skip_inline_frames-perf.patch deleted file mode 100644 index 1141dd2..0000000 --- a/gdb-dlopen-skip_inline_frames-perf.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff --git a/gdb/infrun.c b/gdb/infrun.c -index 91e0fc2..1d7c808 100644 ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -3111,6 +3111,56 @@ fill_in_stop_func (struct gdbarch *gdbarch, - } - } - -+/* Argument for at_solib_event_breakpoint_helper. */ -+ -+struct solib_event_breakpoint_helper_arg -+{ -+ CORE_ADDR prev_pc; -+ int shlib_bp_count; -+ int other_bp_count; -+}; -+ -+/* Helper for at_solib_event_breakpoint. */ -+ -+static int -+at_solib_event_breakpoint_helper (struct breakpoint *b, void *argp) -+{ -+ struct solib_event_breakpoint_helper_arg *arg -+ = (struct solib_event_breakpoint_helper_arg *) argp; -+ struct bp_location *loc; -+ -+ for (loc = b->loc; loc; loc = loc->next) -+ { -+ if (loc->pspace == current_program_space -+ && (loc->address == stop_pc || loc->address == arg->prev_pc)) -+ { -+ if (b->type == bp_shlib_event) -+ arg->shlib_bp_count++; -+ else -+ { -+ arg->other_bp_count++; -+ return 1; /* quick exit */ -+ } -+ } -+ } -+ -+ return 0; /* carry on looking */ -+} -+ -+/* Nonzero if the location stopoed at is the shlib event breakpoint. */ -+ -+static int -+at_solib_event_breakpoint (struct execution_control_state *ecs) -+{ -+ struct solib_event_breakpoint_helper_arg arg; -+ arg.prev_pc = ecs->event_thread->prev_pc; -+ arg.shlib_bp_count = arg.other_bp_count = 0; -+ -+ iterate_over_breakpoints (at_solib_event_breakpoint_helper, &arg); -+ -+ return arg.shlib_bp_count && !arg.other_bp_count; -+} -+ - /* Given an execution control state that has been freshly filled in - by an event from the inferior, figure out what it means and take - appropriate action. */ -@@ -3964,11 +4014,23 @@ handle_inferior_event (struct execution_control_state *ecs) - ecs->random_signal = 0; - stopped_by_random_signal = 0; - -- /* Hide inlined functions starting here, unless we just performed stepi or -- nexti. After stepi and nexti, always show the innermost frame (not any -- inline function call sites). */ -- if (ecs->event_thread->control.step_range_end != 1) -- skip_inline_frames (ecs->ptid); -+ /* If we have stopped at the solib event breakpoint and -+ stop_on_solib_events is not set then we can avoid calling -+ anything that calls find_pc_section. This saves a lot -+ of time when the inferior loads a lot of shared libraries, -+ because otherwise the section map gets regenerated every -+ time we stop. */ -+ if (stop_on_solib_events -+ || ecs->event_thread->suspend.stop_signal != TARGET_SIGNAL_TRAP -+ || stop_after_trap -+ || !at_solib_event_breakpoint (ecs)) -+ { -+ /* Hide inlined functions starting here, unless we just -+ performed stepi or nexti. After stepi and nexti, always show -+ the innermost frame (not any inline function call sites). */ -+ if (ecs->event_thread->control.step_range_end != 1) -+ skip_inline_frames (ecs->ptid); -+ } - - if (ecs->event_thread->suspend.stop_signal == TARGET_SIGNAL_TRAP - && ecs->event_thread->control.trap_expected diff --git a/gdb-gcc46-stdarg-prologue.patch b/gdb-gcc46-stdarg-prologue.patch deleted file mode 100644 index d0f318e..0000000 --- a/gdb-gcc46-stdarg-prologue.patch +++ /dev/null @@ -1,655 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2011-07/msg00645.html -Subject: [patch] workaround gcc46: prologue skip skips too far (PR 12435) #2 - -Hi, - -this is an improved patch of a former: - [patch] workaround gcc46: prologue skip skips too far (PR 12435) - http://sourceware.org/ml/gdb-patches/2011-03/msg01108.html - cancel/FYI: Re: [patch] workaround gcc46: prologue skip skips too far (PR 12435) - http://sourceware.org/ml/gdb-patches/2011-03/msg01123.html - -For example `break error' does not work for debugging GDB with gcc-4.6.x. - -As gcc-4.6.0 and now even 4.6.1 still has this bug and I have seen a user(s?) -on non-Fedora platform asking about this bug and as there may be enough -binaries out there (although it affects only -O0 -g compilation) coded it -properly I have coded the workaround properly this time. - -It does not solve overlays well, but the code just does not work for overlays, -it has no other negative effect. - -I will update the code after FSF gcc gets fixed to minimize the workaround. - -No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu. - -I would welcome a comment whether it is suitable for FSF GDB. - - -Thanks, -Jan - - -gdb/ -2011-07-22 Jan Kratochvil - - PR breakpoints/12435 - * amd64-tdep.c (amd64_skip_prologue): New variables start_pc_sal, - next_sal, buf, offset and xmmreg. Advance PC if it sees the PR. - * dwarf2read.c (process_full_comp_unit): Initialize - amd64_prologue_line_bug. - * symtab.h (struct symtab): New field amd64_prologue_line_bug. - -gdb/testsuite/ -2011-07-22 Jan Kratochvil - - PR breakpoints/12435 - * gdb.arch/amd64-prologue-xmm.c: New file. - * gdb.arch/amd64-prologue-xmm.exp: New file. - * gdb.arch/amd64-prologue-xmm.s: New file. - ---- a/gdb/amd64-tdep.c -+++ b/gdb/amd64-tdep.c -@@ -1902,6 +1902,9 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) - { - struct amd64_frame_cache cache; - CORE_ADDR pc; -+ struct symtab_and_line start_pc_sal, next_sal; -+ gdb_byte buf[4 + 8 * 7]; -+ int offset, xmmreg; - - amd64_init_frame_cache (&cache); - pc = amd64_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffLL, -@@ -1909,7 +1912,71 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) - if (cache.frameless_p) - return start_pc; - -- return pc; -+ /* GCC PR debug/48827 produced false prologue end: -+ 84 c0 test %al,%al -+ 74 23 je after -+ <-- here is 0 lines advance - the false prologue end marker. -+ 0f 29 85 70 ff ff ff movaps %xmm0,-0x90(%rbp) -+ 0f 29 4d 80 movaps %xmm1,-0x80(%rbp) -+ 0f 29 55 90 movaps %xmm2,-0x70(%rbp) -+ 0f 29 5d a0 movaps %xmm3,-0x60(%rbp) -+ 0f 29 65 b0 movaps %xmm4,-0x50(%rbp) -+ 0f 29 6d c0 movaps %xmm5,-0x40(%rbp) -+ 0f 29 75 d0 movaps %xmm6,-0x30(%rbp) -+ 0f 29 7d e0 movaps %xmm7,-0x20(%rbp) -+ after: */ -+ -+ if (pc == start_pc) -+ return pc; -+ -+ start_pc_sal = find_pc_sect_line (start_pc, NULL, 0); -+ if (start_pc_sal.symtab == NULL -+ || !start_pc_sal.symtab->amd64_prologue_line_bug -+ || start_pc_sal.pc != start_pc || pc >= start_pc_sal.end) -+ return pc; -+ -+ next_sal = find_pc_sect_line (start_pc_sal.end, NULL, 0); -+ if (next_sal.line != start_pc_sal.line) -+ return pc; -+ -+ /* START_PC can be from overlayed memory, ignored here. */ -+ if (target_read_memory (next_sal.pc - 4, buf, sizeof (buf)) != 0) -+ return pc; -+ -+ /* test %al,%al */ -+ if (buf[0] != 0x84 || buf[1] != 0xc0) -+ return pc; -+ /* je AFTER */ -+ if (buf[2] != 0x74) -+ return pc; -+ -+ offset = 4; -+ for (xmmreg = 0; xmmreg < 8; xmmreg++) -+ { -+ /* movaps %xmmreg?,-0x??(%rbp) */ -+ if (buf[offset] != 0x0f || buf[offset + 1] != 0x29 -+ || (buf[offset + 2] & 0b00111111) != (xmmreg << 3 | 0b101)) -+ return pc; -+ -+ if ((buf[offset + 2] & 0b11000000) == 0b01000000) -+ { -+ /* 8-bit displacement. */ -+ offset += 4; -+ } -+ else if ((buf[offset + 2] & 0b11000000) == 0b10000000) -+ { -+ /* 32-bit displacement. */ -+ offset += 7; -+ } -+ else -+ return pc; -+ } -+ -+ /* je AFTER */ -+ if (offset - 4 != buf[3]) -+ return pc; -+ -+ return next_sal.end; - } - - ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -4818,6 +4818,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) - - if (gcc_4_minor >= 5) - symtab->epilogue_unwind_valid = 1; -+ -+ if (gcc_4_minor >= 6) -+ symtab->amd64_prologue_line_bug = 1; - } - - if (dwarf2_per_objfile->using_index) ---- a/gdb/symtab.h -+++ b/gdb/symtab.h -@@ -784,6 +784,11 @@ struct symtab - - unsigned int epilogue_unwind_valid : 1; - -+ /* At least GCC 4.6.0 and 4.6.1 can produce invalid false prologue and marker -+ on amd64. This flag is set independently of the symtab arch. */ -+ -+ unsigned amd64_prologue_line_bug : 1; -+ - /* The macro table for this symtab. Like the blockvector, this - may be shared between different symtabs --- and normally is for - all the symtabs in a given compilation unit. */ ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.c -@@ -0,0 +1,38 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2011 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 . */ -+ -+static volatile int v, fail; -+ -+static void -+func (int i, ...) -+{ -+ v = i; -+} -+ -+static void -+marker (void) -+{ -+} -+ -+int -+main (void) -+{ -+ func (1); -+ fail = 1; -+ marker (); -+ return 0; -+} ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp -@@ -0,0 +1,46 @@ -+# Copyright 2011 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 . -+ -+# Test GCC PR debug/48827 workaround in GDB. -+ -+set testfile "amd64-prologue-xmm" -+set srcfile ${testfile}.s -+set csrcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile}.x -+set opts {} -+ -+if [info exists COMPILE] { -+ # make check RUNTESTFLAGS='gdb.arch/amd64-prologue-xmm.exp COMPILE=1' -+ set srcfile ${csrcfile} -+ lappend opts debug optimize=-O0 -+} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } { -+ verbose "Skipping amd64-prologue-xmm test." -+ return 0 -+} -+ -+if {[prepare_for_testing ${testfile}.exp ${testfile} $srcfile $opts]} { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+gdb_breakpoint "func" -+gdb_breakpoint "marker" -+ -+gdb_continue_to_breakpoint "func" -+ -+gdb_test "p fail" " = 0" "stopped at func" ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/amd64-prologue-xmm.s -@@ -0,0 +1,400 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2011 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 . */ -+ -+/* This file is compiled from gdb.arch/amd64-prologue-xmm.c -+ using -g -dA -S. */ -+ -+ .file "amd64-prologue-xmm.c" -+ .text -+.Ltext0: -+ .local v -+ .comm v,4,4 -+ .local fail -+ .comm fail,4,4 -+ .type func, @function -+func: -+.LFB0: -+ .file 1 "gdb.arch/amd64-prologue-xmm.c" -+ # gdb.arch/amd64-prologue-xmm.c:22 -+ .loc 1 22 0 -+ .cfi_startproc -+ # basic block 2 -+ pushq %rbp -+ .cfi_def_cfa_offset 16 -+ .cfi_offset 6, -16 -+ movq %rsp, %rbp -+ .cfi_def_cfa_register 6 -+ subq $72, %rsp -+ movq %rsi, -168(%rbp) -+ movq %rdx, -160(%rbp) -+ movq %rcx, -152(%rbp) -+ movq %r8, -144(%rbp) -+ movq %r9, -136(%rbp) -+ testb %al, %al -+ je .L2 -+ # basic block 3 -+ # gdb.arch/amd64-prologue-xmm.c:22 -+ .loc 1 22 0 -+ movaps %xmm0, -128(%rbp) -+ movaps %xmm1, -112(%rbp) -+ movaps %xmm2, -96(%rbp) -+ movaps %xmm3, -80(%rbp) -+ movaps %xmm4, -64(%rbp) -+ movaps %xmm5, -48(%rbp) -+ movaps %xmm6, -32(%rbp) -+ movaps %xmm7, -16(%rbp) -+.L2: -+ # basic block 4 -+ movl %edi, -180(%rbp) -+ # gdb.arch/amd64-prologue-xmm.c:23 -+ .loc 1 23 0 -+ movl -180(%rbp), %eax -+ movl %eax, v(%rip) -+ # gdb.arch/amd64-prologue-xmm.c:24 -+ .loc 1 24 0 -+ leave -+ .cfi_def_cfa 7, 8 -+ ret -+ .cfi_endproc -+.LFE0: -+ .size func, .-func -+ .type marker, @function -+marker: -+.LFB1: -+ # gdb.arch/amd64-prologue-xmm.c:28 -+ .loc 1 28 0 -+ .cfi_startproc -+ # basic block 2 -+ pushq %rbp -+ .cfi_def_cfa_offset 16 -+ .cfi_offset 6, -16 -+ movq %rsp, %rbp -+ .cfi_def_cfa_register 6 -+ # gdb.arch/amd64-prologue-xmm.c:29 -+ .loc 1 29 0 -+ popq %rbp -+ .cfi_def_cfa 7, 8 -+ ret -+ .cfi_endproc -+.LFE1: -+ .size marker, .-marker -+ .globl main -+ .type main, @function -+main: -+.LFB2: -+ # gdb.arch/amd64-prologue-xmm.c:33 -+ .loc 1 33 0 -+ .cfi_startproc -+ # basic block 2 -+ pushq %rbp -+ .cfi_def_cfa_offset 16 -+ .cfi_offset 6, -16 -+ movq %rsp, %rbp -+ .cfi_def_cfa_register 6 -+ # gdb.arch/amd64-prologue-xmm.c:34 -+ .loc 1 34 0 -+ movl $1, %edi -+ movl $0, %eax -+ call func -+ # gdb.arch/amd64-prologue-xmm.c:35 -+ .loc 1 35 0 -+ movl $1, fail(%rip) -+ # gdb.arch/amd64-prologue-xmm.c:36 -+ .loc 1 36 0 -+ call marker -+ # gdb.arch/amd64-prologue-xmm.c:37 -+ .loc 1 37 0 -+ movl $0, %eax -+ # gdb.arch/amd64-prologue-xmm.c:38 -+ .loc 1 38 0 -+ popq %rbp -+ .cfi_def_cfa 7, 8 -+ ret -+ .cfi_endproc -+.LFE2: -+ .size main, .-main -+.Letext0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .long 0xc0 # Length of Compilation Unit Info -+ .value 0x4 # DWARF version number -+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section -+ .byte 0x8 # Pointer Size (in bytes) -+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) -+ .long .LASF1 # DW_AT_producer: "GNU C 4.6.1 20110715 (Red Hat 4.6.1-3)" -+ .byte 0x1 # DW_AT_language -+ .long .LASF2 # DW_AT_name: "gdb.arch/amd64-prologue-xmm.c" -+ .long .LASF3 # DW_AT_comp_dir: "" -+ .quad .Ltext0 # DW_AT_low_pc -+ .quad .Letext0 # DW_AT_high_pc -+ .long .Ldebug_line0 # DW_AT_stmt_list -+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) -+ .long .LASF4 # DW_AT_name: "func" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c) -+ .byte 0x15 # DW_AT_decl_line -+ # DW_AT_prototyped -+ .quad .LFB0 # DW_AT_low_pc -+ .quad .LFE0 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ # DW_AT_GNU_all_call_sites -+ .long 0x59 # DW_AT_sibling -+ .uleb128 0x3 # (DIE (0x4a) DW_TAG_formal_parameter) -+ .ascii "i\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c) -+ .byte 0x15 # DW_AT_decl_line -+ .long 0x59 # DW_AT_type -+ .uleb128 0x3 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -196 -+ .uleb128 0x4 # (DIE (0x57) DW_TAG_unspecified_parameters) -+ .byte 0 # end of children of DIE 0x2d -+ .uleb128 0x5 # (DIE (0x59) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x5 # DW_AT_encoding -+ .ascii "int\0" # DW_AT_name -+ .uleb128 0x6 # (DIE (0x60) DW_TAG_subprogram) -+ .long .LASF5 # DW_AT_name: "marker" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c) -+ .byte 0x1b # DW_AT_decl_line -+ # DW_AT_prototyped -+ .quad .LFB1 # DW_AT_low_pc -+ .quad .LFE1 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ # DW_AT_GNU_all_call_sites -+ .uleb128 0x7 # (DIE (0x79) DW_TAG_subprogram) -+ # DW_AT_external -+ .long .LASF6 # DW_AT_name: "main" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c) -+ .byte 0x20 # DW_AT_decl_line -+ # DW_AT_prototyped -+ .long 0x59 # DW_AT_type -+ .quad .LFB2 # DW_AT_low_pc -+ .quad .LFE2 # DW_AT_high_pc -+ .uleb128 0x1 # DW_AT_frame_base -+ .byte 0x9c # DW_OP_call_frame_cfa -+ # DW_AT_GNU_all_tail_call_sites -+ .uleb128 0x8 # (DIE (0x96) DW_TAG_variable) -+ .ascii "v\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c) -+ .byte 0x12 # DW_AT_decl_line -+ .long 0xa9 # DW_AT_type -+ .uleb128 0x9 # DW_AT_location -+ .byte 0x3 # DW_OP_addr -+ .quad v -+ .uleb128 0x9 # (DIE (0xa9) DW_TAG_volatile_type) -+ .long 0x59 # DW_AT_type -+ .uleb128 0xa # (DIE (0xae) DW_TAG_variable) -+ .long .LASF0 # DW_AT_name: "fail" -+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c) -+ .byte 0x12 # DW_AT_decl_line -+ .long 0xa9 # DW_AT_type -+ .uleb128 0x9 # DW_AT_location -+ .byte 0x3 # DW_OP_addr -+ .quad fail -+ .byte 0 # end of children of DIE 0xb -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .uleb128 0x1 # (abbrev code) -+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x25 # (DW_AT_producer) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x13 # (DW_AT_language) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x1b # (DW_AT_comp_dir) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x10 # (DW_AT_stmt_list) -+ .uleb128 0x17 # (DW_FORM_sec_offset) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x2 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x3 # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x4 # (abbrev code) -+ .uleb128 0x18 # (TAG: DW_TAG_unspecified_parameters) -+ .byte 0 # DW_children_no -+ .byte 0 -+ .byte 0 -+ .uleb128 0x5 # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0 # DW_children_no -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3e # (DW_AT_encoding) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x6 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x7 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0 # DW_children_no -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites) -+ .uleb128 0x19 # (DW_FORM_flag_present) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x8 # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x9 # (abbrev code) -+ .uleb128 0x35 # (TAG: DW_TAG_volatile_type) -+ .byte 0 # DW_children_no -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xa # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x18 # (DW_FORM_exprloc) -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c # Length of Address Ranges Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .byte 0x8 # Size of Address -+ .byte 0 # Size of Segment Descriptor -+ .value 0 # Pad to 16 byte boundary -+ .value 0 -+ .quad .Ltext0 # Address -+ .quad .Letext0-.Ltext0 # Length -+ .quad 0 -+ .quad 0 -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .section .debug_str,"MS",@progbits,1 -+.LASF3: -+ .string "" -+.LASF0: -+ .string "fail" -+.LASF4: -+ .string "func" -+.LASF1: -+ .string "GNU C 4.6.1 20110715 (Red Hat 4.6.1-3)" -+.LASF2: -+ .string "gdb.arch/amd64-prologue-xmm.c" -+.LASF5: -+ .string "marker" -+.LASF6: -+ .string "main" -+ .ident "GCC: (GNU) 4.6.1 20110715 (Red Hat 4.6.1-3)" -+ .section .note.GNU-stack,"",@progbits - diff --git a/gdb-gcc47-gcore-zero.patch b/gdb-gcc47-gcore-zero.patch new file mode 100644 index 0000000..88f0ff1 --- /dev/null +++ b/gdb-gcc47-gcore-zero.patch @@ -0,0 +1,118 @@ +http://sourceware.org/ml/binutils/2011-12/msg00298.html +Subject: [patch] Fix zero registers core files w/gcc-4.7 + +Hello H.J., + +there is a regression by: + commit 2c9c556617a7de8657c25b512d272c26b070ae22 + Author: H.J. Lu + Date: Thu Jun 16 22:08:10 2011 +0000 + Suport x32 gcore. + +when built with -O2 by + gcc (GCC) 4.7.0 20111223 (experimental) + (not by 4.6.x) + +as the code violates ISO C99 6.2.4 item 5 by using local variable outside of +its block, GCC optimizes out the second memcpy, keeping there only that +memset. + +./gdb -nx ./gdb -ex start -ex 'gcore 1' -ex 'set confirm no' -ex q;gdb -nx ./gdb ./1 -ex q +will print: +Core was generated by `.../gdb/gdb'. +#0 0x0000000000000000 in ?? () + +No regressions on x86_64-fedora16-linux-gnu. + +Probably obvious, OK to check it in? + + +Thanks, +Jan + + +bfd/ +2011-12-23 Jan Kratochvil + + Fix zero registers core files when built by gcc-4.7. + * elf64-x86-64.c (elf_x86_64_write_core_note): Remove variables p and + size. Call elfcore_write_note for the local variables. Remove the + final elfcore_write_note call. Add NOTREACHED comments. + +--- a/bfd/elf64-x86-64.c ++++ b/bfd/elf64-x86-64.c +@@ -420,8 +420,6 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, + int note_type, ...) + { + const struct elf_backend_data *bed = get_elf_backend_data (abfd); +- const void *p; +- int size; + va_list ap; + const char *fname, *psargs; + long pid; +@@ -445,8 +443,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, + memset (&data, 0, sizeof (data)); + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); +- p = (const void *) &data; +- size = sizeof (data); ++ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, ++ &data, sizeof (data)); + } + else + { +@@ -454,10 +452,10 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, + memset (&data, 0, sizeof (data)); + strncpy (data.pr_fname, fname, sizeof (data.pr_fname)); + strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs)); +- p = (const void *) &data; +- size = sizeof (data); ++ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, ++ &data, sizeof (data)); + } +- break; ++ /* NOTREACHED */ + + case NT_PRSTATUS: + va_start (ap, note_type); +@@ -475,8 +473,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, + prstat.pr_pid = pid; + prstat.pr_cursig = cursig; + memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg)); +- p = (const void *) &prstat; +- size = sizeof (prstat); ++ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, ++ &prstat, sizeof (prstat)); + } + else + { +@@ -485,8 +483,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, + prstat.pr_pid = pid; + prstat.pr_cursig = cursig; + memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg)); +- p = (const void *) &prstat; +- size = sizeof (prstat); ++ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, ++ &prstat, sizeof (prstat)); + } + } + else +@@ -496,14 +494,11 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz, + prstat.pr_pid = pid; + prstat.pr_cursig = cursig; + memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg)); +- p = (const void *) &prstat; +- size = sizeof (prstat); ++ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, ++ &prstat, sizeof (prstat)); + } +- break; + } +- +- return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, p, +- size); ++ /* NOTREACHED */ + } + #endif + + diff --git a/gdb-gdb-add-index-script.patch b/gdb-gdb-add-index-script.patch index 1c145ac..c15df68 100644 --- a/gdb-gdb-add-index-script.patch +++ b/gdb-gdb-add-index-script.patch @@ -40,16 +40,16 @@ Subject: [PATCH 4/4] add gdb-add-index 5 files changed, 57 insertions(+), 1 deletions(-) create mode 100755 gdb/gdb-add-index -Index: gdb-7.2.50.20101116/gdb/Makefile.in +Index: gdb-7.4.50.20120103/gdb/Makefile.in =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/Makefile.in 2010-11-16 08:03:17.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/Makefile.in 2010-11-16 08:47:45.000000000 +0100 -@@ -986,7 +986,16 @@ install-only: install-gstack $(CONFIG_IN - $(SHELL) $(srcdir)/../mkinstalldirs \ - $(DESTDIR)$(man1dir) ; \ +--- gdb-7.4.50.20120103.orig/gdb/Makefile.in 2012-01-03 05:53:25.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/Makefile.in 2012-01-03 15:24:25.693543435 +0100 +@@ -1033,7 +1033,16 @@ install-only: install-gstack $(CONFIG_IN $(INSTALL_DATA) $(srcdir)/gdb.1 \ -- $(DESTDIR)$(man1dir)/$$transformed_name.1 -+ $(DESTDIR)$(man1dir)/$$transformed_name.1; \ + $(DESTDIR)$(man1dir)/$$transformed_name.1 ; \ + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \ +- $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h ++ $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h; \ + transformed_name=`t='$(program_transform_name)'; \ + echo gdb-add-index | sed -e "$$t"` ; \ + if test "x$$transformed_name" = x; then \ @@ -60,13 +60,13 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in + $(INSTALL_PROGRAM) $(srcdir)/gdb-add-index \ + $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do - .PHONY: install-tui - install-tui: -Index: gdb-7.2.50.20101116/gdb/doc/gdb.texinfo + + install-python: +Index: gdb-7.4.50.20120103/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/doc/gdb.texinfo 2010-11-16 08:04:18.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/doc/gdb.texinfo 2010-11-16 08:56:30.000000000 +0100 -@@ -15500,6 +15500,14 @@ There are currently some limitation on i +--- gdb-7.4.50.20120103.orig/gdb/doc/gdb.texinfo 2012-01-03 15:20:54.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/doc/gdb.texinfo 2012-01-03 15:23:43.295231946 +0100 +@@ -16228,6 +16228,14 @@ There are currently some limitation on i for DWARF debugging information, not stabs. And, they do not currently work for programs using Ada. @@ -81,10 +81,10 @@ Index: gdb-7.2.50.20101116/gdb/doc/gdb.texinfo @node Symbol Errors @section Errors Reading Symbol Files -Index: gdb-7.2.50.20101116/gdb/gdb-add-index +Index: gdb-7.4.50.20120103/gdb/gdb-add-index =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2.50.20101116/gdb/gdb-add-index 2010-11-16 08:47:45.000000000 +0100 ++++ gdb-7.4.50.20120103/gdb/gdb-add-index 2012-01-03 15:23:43.296231942 +0100 @@ -0,0 +1,30 @@ +#! /bin/sh + diff --git a/gdb-implptr-64bit-1of2.patch b/gdb-implptr-64bit-1of2.patch deleted file mode 100644 index e24595d..0000000 --- a/gdb-implptr-64bit-1of2.patch +++ /dev/null @@ -1,110 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2011-09/msg00450.html -Subject: [patch 1/2] Code cleanup: Unify dwarf2_per_cu_addr_size, dwarf2_per_cu_offset_size - -Hi, - -this is more rather for patch 2/2, it has positive LoC change but still -I would find it applicable even on its own. - -No functionality change intended. - - -Thanks, -Jan - - -gdb/ -2011-09-26 Jan Kratochvil - - Code cleanup. - * dwarf2read.c (per_cu_header_read_in): New function. - (dwarf2_per_cu_addr_size, dwarf2_per_cu_offset_size): Use it, with new - variables cu_header_local and cu_headerp. - ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -15187,26 +15187,42 @@ dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu) - return objfile; - } - -+/* Return comp_unit_head for PER_CU, either already available in PER_CU->CU -+ (CU_HEADERP is unused in such case) or prepare a temporary copy at -+ CU_HEADERP first. */ -+ -+static const struct comp_unit_head * -+per_cu_header_read_in (struct comp_unit_head *cu_headerp, -+ struct dwarf2_per_cu_data *per_cu) -+{ -+ struct objfile *objfile; -+ struct dwarf2_per_objfile *per_objfile; -+ gdb_byte *info_ptr; -+ -+ if (per_cu->cu) -+ return &per_cu->cu->header; -+ -+ objfile = per_cu->objfile; -+ per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); -+ info_ptr = per_objfile->info.buffer + per_cu->offset; -+ -+ memset (cu_headerp, 0, sizeof (*cu_headerp)); -+ read_comp_unit_head (cu_headerp, info_ptr, objfile->obfd); -+ -+ return cu_headerp; -+} -+ - /* Return the address size given in the compilation unit header for CU. */ - - CORE_ADDR - dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu) - { -- if (per_cu->cu) -- return per_cu->cu->header.addr_size; -- else -- { -- /* If the CU is not currently read in, we re-read its header. */ -- struct objfile *objfile = per_cu->objfile; -- struct dwarf2_per_objfile *per_objfile -- = objfile_data (objfile, dwarf2_objfile_data_key); -- gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset; -- struct comp_unit_head cu_header; -+ struct comp_unit_head cu_header_local; -+ const struct comp_unit_head *cu_headerp; - -- memset (&cu_header, 0, sizeof cu_header); -- read_comp_unit_head (&cu_header, info_ptr, objfile->obfd); -- return cu_header.addr_size; -- } -+ cu_headerp = per_cu_header_read_in (&cu_header_local, per_cu); -+ -+ return cu_headerp->addr_size; - } - - /* Return the offset size given in the compilation unit header for CU. */ -@@ -15214,21 +15230,12 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu) - int - dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu) - { -- if (per_cu->cu) -- return per_cu->cu->header.offset_size; -- else -- { -- /* If the CU is not currently read in, we re-read its header. */ -- struct objfile *objfile = per_cu->objfile; -- struct dwarf2_per_objfile *per_objfile -- = objfile_data (objfile, dwarf2_objfile_data_key); -- gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset; -- struct comp_unit_head cu_header; -+ struct comp_unit_head cu_header_local; -+ const struct comp_unit_head *cu_headerp; - -- memset (&cu_header, 0, sizeof cu_header); -- read_comp_unit_head (&cu_header, info_ptr, objfile->obfd); -- return cu_header.offset_size; -- } -+ cu_headerp = per_cu_header_read_in (&cu_header_local, per_cu); -+ -+ return cu_headerp->offset_size; - } - - /* Return the text offset of the CU. The returned offset comes from - diff --git a/gdb-implptr-64bit-2of2.patch b/gdb-implptr-64bit-2of2.patch deleted file mode 100644 index d180674..0000000 --- a/gdb-implptr-64bit-2of2.patch +++ /dev/null @@ -1,411 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2011-09/msg00451.html -Subject: [patch 2/2] Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches - -Hi, - -on 64-bit targets DWARF-3+ is used DW_OP_GNU_implicit_pointer does not work. - -DWARF-2 says: - This type of reference (DW_FORM_ref_addr) is the size of an address on - the target architecture; -DWARF-3 says: - 1.5.1 Upward Compatibility - References that use the attribute form DW_FORM_ref_addr are specified - to be four bytes in the DWARF 32-bit format and eight bytes in the - DWARF 64-bit format, while DWARF Version 2 specifies that such - references have the same size as an address on the target system (see - Sections 7.4 and 7.5.4). - - (DW_FORM_ref_addr) - In the 32-bit DWARF format, this offset is a 4-byte unsigned value; in - the 64-bit DWARF format, it is an 8-byte unsigned value (see Section - 7.4). - -GDB currently parsed DW_OP_GNU_implicit_pointer the DWARF-2 way, being -incompatible with DWARF-3+. - -I think DW_OP_GNU_implicit_pointer does not make sense to be used from -.debug_frame (DWARF-5 is not yet released to say more) so for .debug_frame its -use is just not permitted (the code would be more complicated otherwise). - -No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu. - - -Thanks, -Jan - - -gdb/ -2011-09-26 Jan Kratochvil - - Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches. - * dwarf2-frame.c (execute_stack_op): Initialize ctx->ref_addr_size. - * dwarf2expr.c (execute_stack_op) : Use - ctx->ref_addr_size. Handle its invalid value. - * dwarf2expr.h (struct dwarf_expr_context): New field ref_addr_size. - * dwarf2loc.c (dwarf2_evaluate_loc_desc_full) - (dwarf2_loc_desc_needs_frame): Initialize ctx->ref_addr_size. - * dwarf2loc.h (dwarf2_per_cu_ref_addr_size): New declaration. - * dwarf2read.c (decode_locdesc): Initialize ctx->ref_addr_size. - (dwarf2_per_cu_ref_addr_size): New function. - -gdb/testsuite/ -2011-09-26 Jan Kratochvil - - Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches. - * gdb.dwarf2/implptr-64bit.S: New file. - * gdb.dwarf2/implptr-64bit.exp: New file. - ---- a/gdb/dwarf2-frame.c -+++ b/gdb/dwarf2-frame.c -@@ -371,6 +371,7 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size, - - ctx->gdbarch = get_frame_arch (this_frame); - ctx->addr_size = addr_size; -+ ctx->ref_addr_size = -1; - ctx->offset = offset; - ctx->baton = this_frame; - ctx->funcs = &dwarf2_frame_ctx_funcs; ---- a/gdb/dwarf2expr.c -+++ b/gdb/dwarf2expr.c -@@ -709,10 +709,14 @@ execute_stack_op (struct dwarf_expr_context *ctx, - ULONGEST die; - LONGEST len; - -+ if (ctx->ref_addr_size == -1) -+ error (_("DWARF-2 expression error: DW_OP_GNU_implicit_pointer " -+ "is not allowed in frame context")); -+ - /* The referred-to DIE. */ -- ctx->len = extract_unsigned_integer (op_ptr, ctx->addr_size, -+ ctx->len = extract_unsigned_integer (op_ptr, ctx->ref_addr_size, - byte_order); -- op_ptr += ctx->addr_size; -+ op_ptr += ctx->ref_addr_size; - - /* The byte offset into the data. */ - op_ptr = read_sleb128 (op_ptr, op_end, &len); ---- a/gdb/dwarf2expr.h -+++ b/gdb/dwarf2expr.h -@@ -125,6 +125,10 @@ struct dwarf_expr_context - /* Target address size in bytes. */ - int addr_size; - -+ /* DW_FORM_ref_addr size in bytes. If -1 DWARF is executed from a frame -+ context and operations depending on DW_FORM_ref_addr are not allowed. */ -+ int ref_addr_size; -+ - /* Offset used to relocate DW_OP_addr argument. */ - CORE_ADDR offset; - ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c -@@ -1118,6 +1118,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - - ctx->gdbarch = get_objfile_arch (objfile); - ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); -+ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); - ctx->offset = dwarf2_per_cu_text_offset (per_cu); - ctx->baton = &baton; - ctx->funcs = &dwarf_expr_ctx_funcs; -@@ -1398,6 +1399,7 @@ dwarf2_loc_desc_needs_frame (const gdb_byte *data, unsigned short size, - - ctx->gdbarch = get_objfile_arch (objfile); - ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); -+ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); - ctx->offset = dwarf2_per_cu_text_offset (per_cu); - ctx->baton = &baton; - ctx->funcs = &needs_frame_ctx_funcs; ---- a/gdb/dwarf2loc.h -+++ b/gdb/dwarf2loc.h -@@ -39,6 +39,10 @@ struct objfile *dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *cu); - /* Return the address size given in the compilation unit header for CU. */ - CORE_ADDR dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *cu); - -+/* Return the DW_FORM_ref_addr size given in the compilation unit header for -+ CU. */ -+int dwarf2_per_cu_ref_addr_size (struct dwarf2_per_cu_data *cu); -+ - /* Return the offset size given in the compilation unit header for CU. */ - int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu); - ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -15238,6 +15239,22 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu) - return cu_headerp->offset_size; - } - -+/* See its dwarf2loc.h declaration. */ -+ -+int -+dwarf2_per_cu_ref_addr_size (struct dwarf2_per_cu_data *per_cu) -+{ -+ struct comp_unit_head cu_header_local; -+ const struct comp_unit_head *cu_headerp; -+ -+ cu_headerp = per_cu_header_read_in (&cu_header_local, per_cu); -+ -+ if (cu_headerp->version == 2) -+ return cu_headerp->addr_size; -+ else -+ return cu_headerp->offset_size; -+} -+ - /* Return the text offset of the CU. The returned offset comes from - this CU's objfile. If this objfile came from a separate debuginfo - file, then the offset may be different from the corresponding ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/implptr-64bit.S -@@ -0,0 +1,197 @@ -+/* Copyright 2010, 2011 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 . */ -+ -+ .section .debug_info -+d: -+ /* Length of Compilation Unit Info */ -+#if OFFSET_SIZE == 4 -+# define OFFSET .4byte -+ .4byte debug_end - 1f -+#elif OFFSET_SIZE == 8 -+# define OFFSET .8byte -+ .4byte 0xffffffff -+ .8byte debug_end - 1f -+#else -+# error -+#endif -+#if ADDR_SIZE == 4 -+# define ADDR .4byte -+#elif ADDR_SIZE == 8 -+# define ADDR .8byte -+#else -+# error -+#endif -+#if REF_ADDR_SIZE == 4 -+# define REF_ADDR .4byte -+#elif REF_ADDR_SIZE == 8 -+# define REF_ADDR .8byte -+#else -+# error -+#endif -+1: -+ .2byte DWARF_VERSION /* DWARF version number */ -+ OFFSET .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte ADDR_SIZE /* Pointer Size (in bytes) */ -+ -+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */ -+ .ascii "GNU C 4.4.3\0" /* DW_AT_producer */ -+ .byte 0x1 /* DW_AT_language */ -+ .ascii "1.c\0" /* DW_AT_name */ -+ -+.Ltype_int: -+ .uleb128 0x7 /* DW_TAG_base_type */ -+ .byte 0x4 /* DW_AT_byte_size */ -+ .byte 0x5 /* DW_AT_encoding */ -+ .ascii "int\0" /* DW_AT_name */ -+ -+.Ltype_struct: -+ .uleb128 0x2 /* DW_TAG_structure_type */ -+ .ascii "s\0" /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ -+ .uleb128 0x3 /* DW_TAG_member */ -+ .ascii "f\0" /* DW_AT_name */ -+ .4byte .Ltype_int - d /* DW_AT_type */ -+ .byte 0 /* DW_AT_data_member_location */ -+ -+ .byte 0x0 /* end of children of DW_TAG_structure_type */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_subprogram */ -+ .ascii "main\0" /* DW_AT_name */ -+ ADDR main /* DW_AT_low_pc */ -+ ADDR main + 0x100 /* DW_AT_high_pc */ -+ .4byte .Ltype_int - d /* DW_AT_type */ -+ .byte 1 /* DW_AT_external */ -+ -+.Ltype_structptr: -+ .uleb128 0x5 /* DW_TAG_pointer_type */ -+ .byte ADDR_SIZE /* DW_AT_byte_size */ -+ .4byte .Ltype_struct - d /* DW_AT_type */ -+ -+.Lvar_out: -+ .uleb128 0x4 /* (DW_TAG_variable) */ -+ .ascii "v\0" /* DW_AT_name */ -+ .byte 2f - 1f /* DW_AT_location: DW_FORM_block1 */ -+1: -+ .byte 0x9e /* DW_OP_implicit_value */ -+ .uleb128 2f - 3f -+3: -+ .byte 1, 1, 1, 1 -+2: -+ .4byte .Ltype_struct - d /* DW_AT_type */ -+ -+ .uleb128 0x4 /* (DW_TAG_variable) */ -+ .ascii "p\0" /* DW_AT_name */ -+ .byte 2f - 1f /* DW_AT_location: DW_FORM_block1 */ -+1: -+ .byte 0xf2 /* DW_OP_GNU_implicit_pointer */ -+ REF_ADDR .Lvar_out - d /* referenced DIE */ -+ .sleb128 0 /* offset */ -+2: -+ .4byte .Ltype_structptr - d /* DW_AT_type */ -+ -+ .byte 0x0 /* end of children of main */ -+ -+ .byte 0x0 /* end of children of CU */ -+debug_end: -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ -+ .uleb128 0x1 /* (abbrev code) */ -+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x25 /* (DW_AT_producer) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x13 /* (DW_AT_language) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .byte 0x0 -+ .byte 0x0 -+ -+ .uleb128 0x2 /* (abbrev code) */ -+ .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .byte 0 -+ .byte 0 -+ -+ .uleb128 0x3 /* (abbrev code) */ -+ .uleb128 0xd /* (TAG: DW_TAG_member) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x38 /* (DW_AT_data_member_location) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .byte 0 -+ .byte 0 -+ -+ .uleb128 0x4 /* (abbrev code) */ -+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */ -+ .byte 0x0 /* DW_children_yes */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x02 /* (DW_AT_location) */ -+ .uleb128 0xa /* (DW_FORM_block1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0x0 -+ .byte 0x0 -+ -+ .uleb128 0x5 /* (abbrev code) */ -+ .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */ -+ .byte 0x0 /* DW_children_no */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0x0 -+ .byte 0x0 -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 0x7 /* (abbrev code) */ -+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3e /* (DW_AT_encoding) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .byte 0 -+ .byte 0 -+ -+ .byte 0x0 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp -@@ -0,0 +1,51 @@ -+# Copyright 2011 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 . -+load_lib dwarf.exp -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ return 0 -+} -+ -+set testfile "implptr-64bit" -+set srcfile ${testfile}.S -+set mainfile main.c -+ -+proc test { dwarf_version offset_size addr_size ref_addr_size } { -+ global testfile srcfile mainfile -+ -+ set opts {} -+ foreach n { dwarf_version offset_size addr_size ref_addr_size } { -+ lappend opts "additional_flags=-D[string toupper $n]=[expr "\$$n"]" -+ } -+ -+ set name "d${dwarf_version}o${offset_size}a${addr_size}r${ref_addr_size}" -+ set executable ${testfile}-${name} -+ if [prepare_for_testing ${testfile}.exp $executable "${srcfile} ${mainfile}" $opts] { -+ return -1 -+ } -+ -+ if ![runto_main] { -+ return -1 -+ } -+ -+ gdb_test "p/x p->f" " = 0x1010101" $name -+} -+ -+# DWARF_VERSION OFFSET_SIZE ADDR_SIZE REF_ADDR_SIZE -+test 2 8 4 4 -+test 2 4 8 8 -+test 3 8 4 8 -+test 3 4 8 4 - diff --git a/gdb-optimized-out-internal-error.patch b/gdb-optimized-out-internal-error.patch deleted file mode 100644 index 1588ce6..0000000 --- a/gdb-optimized-out-internal-error.patch +++ /dev/null @@ -1,302 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2011-09/msg00449.html -Subject: [patch] Fix internal error on optimized-out values (regression by me) - -Hi, - -since: - Re: [patch] Code cleanup: Introduce allocate_optimized_out_value - http://sourceware.org/ml/gdb-patches/2011-07/msg00327.html - acfe85f56075910a3ba5e8b76189e0770079b8d1 -can occur: - (gdb) p p->f - valops.c:1118: internal-error: Unexpected lazy value type. - A problem internal to GDB has been detected, - -in that mail referenced above: -# It is true it would be definitely a bug in a code incompatible with such -# change so one may rather fix that possible regression there. - -so this testcase exploits such case. The problem is formerly the code -allocated (in some cases) optimized out values as non-lazy ones. Now they are -allocated all as lazy (*) which breaks some code not expecting lazy values. - -(*) Such lazy optimized out value still gets silently allocate_value_contents - by value_fetch_lazy, allocate_value_contents should be suppressed in such - case; such more radical change has never been made. - -Formerly (incl. gdb-7.3) did: - (gdb) p p->f - $1 = 0 -which was also wrong, ((struct *) )->field should be IMO still -; just it became internal-error now. - -GDB usually does require_not_optimized_out throwing error() when it meets any -first value. I have just produced new optimized value -instead; require_not_optimized_out is not exported and I find it better this -way. - -Following the rule that it is better if GDB does something wrong rather then -it throws internal-error to make the patch from July above fully safe one -would have to change allocate_optimized_out_value to allocate everything as -non-lazy. I find that as a too ugly workaround of the codebase. - -No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu. - - -Andre, do you still see the bug even with this patch? - - -Thanks, -Jan - - -gdb/ -2011-09-26 Jan Kratochvil - - Fix internal error regression. - * value.c (value_primitive_field): Handle value_optimized_out. Move - packed bitfields comment. - -gdb/testsuite/ -2011-09-26 Jan Kratochvil - - Fix internal error regression. - * gdb.dwarf2/implptr-optimized-out.S: New file. - * gdb.dwarf2/implptr-optimized-out.exp: New file. - ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -2482,16 +2482,19 @@ value_primitive_field (struct value *arg1, int offset, - description correctly. */ - check_typedef (type); - -- /* Handle packed fields */ -- -- if (TYPE_FIELD_BITSIZE (arg_type, fieldno)) -+ if (value_optimized_out (arg1)) -+ v = allocate_optimized_out_value (type); -+ else if (TYPE_FIELD_BITSIZE (arg_type, fieldno)) - { -- /* Create a new value for the bitfield, with bitpos and bitsize -+ /* Handle packed fields. -+ -+ Create a new value for the bitfield, with bitpos and bitsize - set. If possible, arrange offset and bitpos so that we can - do a single aligned read of the size of the containing type. - Otherwise, adjust offset to the byte containing the first - bit. Assume that the address, offset, and embedded offset - are sufficiently aligned. */ -+ - int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno); - int container_bitsize = TYPE_LENGTH (type) * 8; - ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.S -@@ -0,0 +1,166 @@ -+/* Copyright 2010, 2011 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 . */ -+ -+ .section .debug_info -+d: -+ .long debug_end - 1f /* Length of Compilation Unit Info */ -+1: -+ .2byte 0x3 /* DWARF version number */ -+ .long .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 0x4 /* Pointer Size (in bytes) */ -+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */ -+ .ascii "GNU C 4.4.3\0" /* DW_AT_producer */ -+ .byte 0x1 /* DW_AT_language */ -+ .ascii "1.c\0" /* DW_AT_name */ -+ -+.Ltype_int: -+ .uleb128 0x7 /* DW_TAG_base_type */ -+ .byte 0x4 /* DW_AT_byte_size */ -+ .byte 0x5 /* DW_AT_encoding */ -+ .ascii "int\0" /* DW_AT_name */ -+ -+.Ltype_struct: -+ .uleb128 0x2 /* DW_TAG_structure_type */ -+ .ascii "s\0" /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ -+ .uleb128 0x3 /* DW_TAG_member */ -+ .ascii "f\0" /* DW_AT_name */ -+ .4byte .Ltype_int - d /* DW_AT_type */ -+ .byte 0 /* DW_AT_data_member_location */ -+ -+ .byte 0x0 /* end of children of DW_TAG_structure_type */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_subprogram */ -+ .ascii "main\0" /* DW_AT_name */ -+ .4byte main /* DW_AT_low_pc */ -+ .4byte main + 0x100 /* DW_AT_high_pc */ -+ .4byte .Ltype_int - d /* DW_AT_type */ -+ .byte 1 /* DW_AT_external */ -+ -+.Ltype_structptr: -+ .uleb128 0x5 /* DW_TAG_pointer_type */ -+ .byte 0x4 /* DW_AT_byte_size */ -+ .long .Ltype_struct - d /* DW_AT_type */ -+ -+.Lvar_out: -+ .uleb128 0x4 /* (DW_TAG_variable) */ -+ .ascii "v\0" /* DW_AT_name */ -+ .byte 0 /* DW_AT_location: DW_FORM_block1 */ -+ .4byte .Ltype_struct - d /* DW_AT_type */ -+ -+ .uleb128 0x4 /* (DW_TAG_variable) */ -+ .ascii "p\0" /* DW_AT_name */ -+ .byte 2f - 1f /* DW_AT_location: DW_FORM_block1 */ -+1: -+ .byte 0xf2 /* DW_OP_GNU_implicit_pointer */ -+ .4byte .Lvar_out - d /* referenced DIE */ -+ .sleb128 0 /* offset */ -+2: -+ .4byte .Ltype_structptr - d /* DW_AT_type */ -+ -+ .byte 0x0 /* end of children of main */ -+ -+ .byte 0x0 /* end of children of CU */ -+debug_end: -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ -+ .uleb128 0x1 /* (abbrev code) */ -+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x25 /* (DW_AT_producer) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x13 /* (DW_AT_language) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .byte 0x0 -+ .byte 0x0 -+ -+ .uleb128 0x2 /* (abbrev code) */ -+ .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .byte 0 -+ .byte 0 -+ -+ .uleb128 0x3 /* (abbrev code) */ -+ .uleb128 0xd /* (TAG: DW_TAG_member) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x38 /* (DW_AT_data_member_location) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .byte 0 -+ .byte 0 -+ -+ .uleb128 0x4 /* (abbrev code) */ -+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */ -+ .byte 0x0 /* DW_children_yes */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x02 /* (DW_AT_location) */ -+ .uleb128 0xa /* (DW_FORM_block1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0x0 -+ .byte 0x0 -+ -+ .uleb128 0x5 /* (abbrev code) */ -+ .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */ -+ .byte 0x0 /* DW_children_no */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0x0 -+ .byte 0x0 -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 0x7 /* (abbrev code) */ -+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3e /* (DW_AT_encoding) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .byte 0 -+ .byte 0 -+ -+ .byte 0x0 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/implptr-optimized-out.exp -@@ -0,0 +1,37 @@ -+# Copyright 2011 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 . -+load_lib dwarf.exp -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ return 0 -+} -+ -+set testfile "implptr-optimized-out" -+set srcfile ${testfile}.S -+set mainfile main.c -+set executable ${testfile} -+set binfile ${objdir}/${subdir}/${executable} -+ -+if [prepare_for_testing ${testfile}.exp $executable "${srcfile} ${mainfile}" {}] { -+ return -1 -+} -+ -+# DW_OP_GNU_implicit_pointer implementation requires a valid frame. -+if ![runto_main] { -+ return -1 -+} -+ -+gdb_test "p p->f" " = " - diff --git a/gdb-rhel5-compat.patch b/gdb-rhel5-compat.patch index 7defddb..9f4cba3 100644 --- a/gdb-rhel5-compat.patch +++ b/gdb-rhel5-compat.patch @@ -1,11 +1,11 @@ gdb/linux-nat.c: - Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595). -Index: gdb-7.2.50.20110328/gdb/elfread.c +Index: gdb-7.4.50.20111218/gdb/elfread.c =================================================================== ---- gdb-7.2.50.20110328.orig/gdb/elfread.c 2011-03-28 18:46:16.000000000 +0200 -+++ gdb-7.2.50.20110328/gdb/elfread.c 2011-03-28 18:48:19.000000000 +0200 -@@ -1083,7 +1083,7 @@ elf_gnu_ifunc_resolver_return_stop (stru +--- gdb-7.4.50.20111218.orig/gdb/elfread.c 2011-12-19 01:41:31.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/elfread.c 2011-12-19 02:31:30.998241760 +0100 +@@ -1053,7 +1053,7 @@ elf_gnu_ifunc_resolver_return_stop (stru #define BUILD_ID_VERBOSE_NONE 0 #define BUILD_ID_VERBOSE_FILENAMES 1 #define BUILD_ID_VERBOSE_BINARY_PARSE 2 @@ -14,7 +14,7 @@ Index: gdb-7.2.50.20110328/gdb/elfread.c static void show_build_id_verbose (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) -@@ -2173,8 +2173,10 @@ find_separate_debug_file_by_buildid (str +@@ -2172,8 +2172,10 @@ find_separate_debug_file_by_buildid (str if (build_id_name != NULL && filename_cmp (build_id_name, objfile->name) == 0) { @@ -25,11 +25,11 @@ Index: gdb-7.2.50.20110328/gdb/elfread.c xfree (build_id_name); } else if (build_id_name != NULL) -Index: gdb-7.2.50.20110328/gdb/corelow.c +Index: gdb-7.4.50.20111218/gdb/corelow.c =================================================================== ---- gdb-7.2.50.20110328.orig/gdb/corelow.c 2011-03-28 18:46:16.000000000 +0200 -+++ gdb-7.2.50.20110328/gdb/corelow.c 2011-03-28 18:47:56.000000000 +0200 -@@ -282,7 +282,7 @@ add_to_thread_list (bfd *abfd, asection +--- gdb-7.4.50.20111218.orig/gdb/corelow.c 2011-12-19 01:16:15.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/corelow.c 2011-12-19 02:31:30.998241760 +0100 +@@ -282,7 +282,7 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current. */ } @@ -38,32 +38,3 @@ Index: gdb-7.2.50.20110328/gdb/corelow.c static void build_id_locate_exec (int from_tty) -Index: gdb-7.2.50.20110328/gdb/linux-nat.c -=================================================================== ---- gdb-7.2.50.20110328.orig/gdb/linux-nat.c 2011-03-28 18:46:16.000000000 +0200 -+++ gdb-7.2.50.20110328/gdb/linux-nat.c 2011-03-28 18:47:56.000000000 +0200 -@@ -1774,8 +1774,22 @@ get_pending_status (struct lwp_info *lp, - target_signal_to_string (signo)); - } - -- if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped) -- *status = W_STOPCODE (SIGSTOP); -+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that -+ many TIDs are left unstopped). See RH Bug 496732. */ -+ if (GET_PID (lp->ptid) == pid_was_stopped) -+ { -+ int err; -+ -+ errno = 0; -+ err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP); -+ if (debug_linux_nat) -+ { -+ fprintf_unfiltered (gdb_stdlog, -+ "SC: lwp kill %d %s\n", -+ err, -+ errno ? safe_strerror (errno) : "ERRNO-OK"); -+ } -+ } - - return 0; - } diff --git a/gdb-rhel5-gcc44.patch b/gdb-rhel5-gcc44.patch index a5a6567..ccbb30a 100644 --- a/gdb-rhel5-gcc44.patch +++ b/gdb-rhel5-gcc44.patch @@ -1,10 +1,10 @@ Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as the default gcc and gfortran binaries are from gcc-4.1. -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/vla.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/vla.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.base/vla.exp 2010-11-16 09:26:50.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/vla.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.base/vla.exp 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/vla.exp 2011-12-19 02:27:16.745327844 +0100 @@ -16,7 +16,25 @@ set testfile vla set srcfile ${testfile}.c @@ -32,11 +32,11 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/vla.exp untested "Couldn't compile test program" return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/break-interp.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/break-interp.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.base/break-interp.exp 2010-10-12 20:41:06.000000000 +0200 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/break-interp.exp 2010-11-16 09:28:40.000000000 +0100 -@@ -33,9 +33,29 @@ if [get_compiler_info ${binfile_lib}] { +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.base/break-interp.exp 2011-12-19 02:21:56.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/break-interp.exp 2011-12-19 02:27:16.745327844 +0100 +@@ -34,9 +34,29 @@ if [get_compiler_info ${binfile_lib}] { return -1 } @@ -67,10 +67,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/break-interp.exp return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/common-block.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/common-block.exp 2010-11-16 09:26:54.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/common-block.exp 2011-12-19 01:31:24.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/common-block.exp 2011-12-19 02:27:16.746327840 +0100 @@ -20,7 +20,25 @@ set testfile "common-block" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -98,10 +98,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dwarf-stride.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dwarf-stride.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-11-16 09:26:50.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2011-12-19 02:27:16.746327840 +0100 @@ -27,7 +27,25 @@ set testfile dwarf-stride set srcfile ${testfile}.f90 @@ -129,10 +129,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dwarf-stride.exp return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dynamic.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dynamic.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2010-11-16 09:26:50.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dynamic.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dynamic.exp 2011-12-19 02:27:16.746327840 +0100 @@ -25,7 +25,25 @@ set testfile "dynamic" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -160,10 +160,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dynamic.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/library-module.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/library-module.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/library-module.exp 2010-06-03 00:41:56.000000000 +0200 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/library-module.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/library-module.exp 2011-11-30 09:24:32.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/library-module.exp 2011-12-19 02:31:10.991318026 +0100 @@ -25,16 +25,34 @@ if [get_compiler_info not-used] { return -1 } @@ -186,9 +186,9 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/library-module.exp # just for the linking phase (and not the source compilation phase). And any # warnings on ignored $libfile abort the process. --if { [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f90}] != "" } { +-if { [gdb_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug f90 shlib=$objdir/$subdir/$libfile]] != "" } { +set err1 [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f90}] -+set err2 [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f90}] ++set err2 [gdb_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug f90 shlib=$objdir/$subdir/$libfile]] + +unset_board_info f90compiler +if [info exists old_f90compiler] { @@ -203,10 +203,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/library-module.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/module.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/module.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/module.exp 2010-09-22 21:22:44.000000000 +0200 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/module.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/module.exp 2011-06-30 00:05:16.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/module.exp 2011-12-19 02:27:16.747327836 +0100 @@ -16,7 +16,25 @@ set testfile "module" set srcfile ${testfile}.f90 @@ -234,10 +234,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/module.exp return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/string.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/string.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/string.exp 2010-11-16 09:26:50.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/string.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/string.exp 2011-12-18 23:35:23.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/string.exp 2011-12-19 02:27:16.747327836 +0100 @@ -23,7 +23,25 @@ set testfile "string" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -265,10 +265,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/string.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/omp-step.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/omp-step.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2010-11-16 09:26:54.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/omp-step.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2011-12-19 01:31:24.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/omp-step.exp 2011-12-19 02:27:16.748327832 +0100 @@ -15,7 +15,26 @@ set testfile "omp-step" @@ -297,10 +297,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/omp-step.exp return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/derived-type.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/derived-type.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-01 08:32:02.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/derived-type.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2011-06-29 19:50:47.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/derived-type.exp 2011-12-19 02:27:16.748327832 +0100 @@ -28,8 +28,26 @@ set testfile "derived-type" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -330,10 +330,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/derived-type.exp return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/subarray.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/subarray.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-01 08:32:02.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/subarray.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/subarray.exp 2011-06-29 19:50:47.000000000 +0200 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/subarray.exp 2011-12-19 02:27:16.748327832 +0100 @@ -28,8 +28,26 @@ set testfile "subarray" set srcfile ${testfile}.f set binfile ${objdir}/${subdir}/${testfile} @@ -363,10 +363,10 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/subarray.exp return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/tls-sepdebug.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/tls-sepdebug.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-11-16 09:26:51.000000000 +0100 -+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-11-16 09:27:20.000000000 +0100 +--- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2011-12-19 00:28:11.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2011-12-19 02:27:16.748327832 +0100 @@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi # FIXME: gcc dependency (-Wl,-soname). @@ -394,11 +394,11 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/tls-sepdebug.exp untested "Couldn't compile test library" return -1 } -Index: gdb-7.2.50.20101116/gdb/testsuite/lib/prelink-support.exp +Index: gdb-7.4.50.20111218/gdb/testsuite/lib/prelink-support.exp =================================================================== ---- gdb-7.2.50.20101116.orig/gdb/testsuite/lib/prelink-support.exp 2010-10-12 20:12:49.000000000 +0200 -+++ gdb-7.2.50.20101116/gdb/testsuite/lib/prelink-support.exp 2010-11-16 09:27:20.000000000 +0100 -@@ -118,9 +118,31 @@ proc file_copy {src dest} { +--- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/prelink-support.exp 2011-12-19 02:21:56.000000000 +0100 ++++ gdb-7.4.50.20111218/gdb/testsuite/lib/prelink-support.exp 2011-12-19 02:27:16.749327828 +0100 +@@ -119,9 +119,31 @@ proc file_copy {src dest} { proc build_executable_own_libs {testname executable sources options {interp ""} {dir ""}} { global objdir subdir @@ -415,7 +415,7 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/lib/prelink-support.exp + unset_board_info compiler + } elseif [info exists old_compiler] { + unset old_compiler - } ++ } + set_board_info compiler gcc44 + + set err [build_executable $testname $executable $sources $options] @@ -423,7 +423,7 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/lib/prelink-support.exp + unset_board_info compiler + if [info exists old_compiler] { + set_board_info compiler $old_compiler -+ } + } + + if { $err == -1 } { + return "" diff --git a/gdb-tui-strip-stepi.patch b/gdb-tui-strip-stepi.patch deleted file mode 100644 index c4bdcb0..0000000 --- a/gdb-tui-strip-stepi.patch +++ /dev/null @@ -1,73 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2011-08/msg00283.html -Subject: [patch] TUI: Permit stepi on stripped code - -Hi, - -nick on #gdb@freenode complained one cannot stepi on stripped binary. - -echo -e '#include\nint main(void){return alarm(0);}'|gcc -Wall -s -x c -;./gdbtui ./a.out -nx -ex 'layout asm' -ex 'b alarm' -ex r -ex fini -will: - 0x7ffff7ae25c0 mov $0x25,%eax - ------------------------------------------------- - (gdb) p/x $pc - $1 = 0x4004d2 - (gdb) stepi - No function contains program counter for selected frame. - (gdb) p/x $pc - $2 = 0x4004d2 - -That is the window still displays stale content, stepi does not work at all. - -#0 throw_verror (error=GENERIC_ERROR, fmt=0xe73d20 "No function contains program counter for selected frame.", ap=0x7fffdbd3b0a8) at exceptions.c:400 -#1 in error (string=0xe73d20 "No function contains program counter for selected frame.") at utils.c:780 -#2 in tui_show_frame_info (fi=0x3eca1e0) at ./tui/tui-stack.c:383 -#3 in tui_selected_frame_level_changed_hook (level=0) at ./tui/tui-hooks.c:218 -#4 in select_frame (fi=0x3eca1e0) at frame.c:1396 -#5 in restore_selected_frame (a_frame_id=..., frame_level=0) at thread.c:1049 -#6 in do_restore_current_thread_cleanup (arg=0x456dca0) at thread.c:1116 -#7 in do_my_cleanups (pmy_chain=0x1c865f0, old_chain=0x456de90) at utils.c:515 -#8 in do_cleanups (old_chain=0x456de90) at utils.c:497 -#9 in insert_breakpoint_locations () at breakpoint.c:2021 -#10 in insert_breakpoints () at breakpoint.c:1919 -#11 in proceed (addr=18446744073709551615, siggnal=TARGET_SIGNAL_DEFAULT, step=1) at infrun.c:2156 -#12 in step_once (skip_subroutines=0, single_inst=1, count=1, thread=-1) at infcmd.c:1068 -#13 in step_1 (skip_subroutines=0, single_inst=1, count_string=0x0) at infcmd.c:903 -#14 in stepi_command (count_string=0x0, from_tty=1) at infcmd.c:839 - -With the fix stepi works and the window correctly displays: - 0x4004d2 pop %rbp - ------------------------------------------------- - -I haven't found any TUI testsuite. - -I will check it in (after regression testing(?)) in some time. - - -Thanks, -Jan - - -gdb/ -2011-08-14 Jan Kratochvil - - Fix TUI stepi on code without symbols. - * tui/tui-stack.c (tui_show_frame_info): Remove error, set LOW for - current PC instead. - ---- a/gdb/tui/tui-stack.c -+++ b/gdb/tui/tui-stack.c -@@ -380,8 +380,11 @@ tui_show_frame_info (struct frame_info *fi) - { - if (find_pc_partial_function (get_frame_pc (fi), (char **) NULL, - &low, (CORE_ADDR) 0) == 0) -- error (_("No function contains program " -- "counter for selected frame.")); -+ { -+ /* There is no symbol available for current PC. There is no -+ safe way how to "disassemble backwards". */ -+ low = get_frame_pc (fi); -+ } - else - low = tui_get_low_disassembly_address (get_frame_arch (fi), - low, get_frame_pc (fi)); - diff --git a/gdb-upstream.patch b/gdb-upstream.patch deleted file mode 100644 index c81f72a..0000000 --- a/gdb-upstream.patch +++ /dev/null @@ -1,1485 +0,0 @@ -http://sourceware.org/ml/binutils-cvs/2011-07/msg00116.html - -### src/include/ChangeLog 2011/07/22 14:37:50 1.546 -### src/include/ChangeLog 2011/07/22 20:37:50 1.547 -## -1,5 +1,8 @@ - 2011-07-22 Jakub Jelinek - -+ * dwarf2.h (DW_AT_GNU_macros): New. -+ (enum dwarf_macro_record_type): New enum. Add DW_MACRO_GNU_*. -+ - PR c++/49756 - * libiberty.h (stack_limit_increase): New prototype. - ---- src/include/dwarf2.h 2011/06/22 15:03:19 1.26 -+++ src/include/dwarf2.h 2011/07/22 20:37:50 1.27 -@@ -366,6 +366,8 @@ - DW_AT_GNU_all_tail_call_sites = 0x2116, - DW_AT_GNU_all_call_sites = 0x2117, - DW_AT_GNU_all_source_call_sites = 0x2118, -+ /* Section offset into .debug_macro section. */ -+ DW_AT_GNU_macros = 0x2119, - /* VMS extensions. */ - DW_AT_VMS_rtnbeg_pd_address = 0x2201, - /* GNAT extensions. */ -@@ -879,6 +881,20 @@ - DW_MACINFO_end_file = 4, - DW_MACINFO_vendor_ext = 255 - }; -+ -+/* Names and codes for new style macro information. */ -+enum dwarf_macro_record_type -+ { -+ DW_MACRO_GNU_define = 1, -+ DW_MACRO_GNU_undef = 2, -+ DW_MACRO_GNU_start_file = 3, -+ DW_MACRO_GNU_end_file = 4, -+ DW_MACRO_GNU_define_indirect = 5, -+ DW_MACRO_GNU_undef_indirect = 6, -+ DW_MACRO_GNU_transparent_include = 7, -+ DW_MACRO_GNU_lo_user = 0xe0, -+ DW_MACRO_GNU_hi_user = 0xff -+ }; - - /* @@@ For use with GNU frame unwind information. */ - - - - -FYI: implement new DWARF macro proposal -http://sourceware.org/ml/gdb-patches/2011-07/msg00732.html -http://sourceware.org/ml/gdb-cvs/2011-07/msg00212.html - -### src/gdb/ChangeLog 2011/07/26 15:24:01 1.13224 -### src/gdb/ChangeLog 2011/07/26 17:04:21 1.13225 -## -1,3 +1,20 @@ -+2011-07-26 Tom Tromey -+ -+ * symfile.h (struct dwarf2_debug_sections) : New field. -+ * dwarf2read.c (read_indirect_string_at_offset): New function. -+ (read_indirect_string): Use it. -+ (dwarf_decode_macro_bytes): New function, taken from -+ dwarf_decode_macros. Handle DW_MACRO_GNU_*. -+ (dwarf_decode_macros): Use it. handle DW_MACRO_GNU_*. -+ (dwarf_parse_macro_header, skip_form_bytes, skip_unknown_opcode): -+ New functions. -+ (struct dwarf2_per_objfile) : New field. -+ (dwarf2_elf_names): Add .debug_macro. -+ (dwarf2_macros_too_long_complaint): Add 'section' argument. -+ (dwarf2_locate_sections): Handle new section. -+ (read_file_scope): Handle DW_AT_GNU_macros. -+ (dwarf2_per_objfile_free): Unmap the .debug_macro section. -+ - 2011-07-26 Paul Pluzhnikov - - * NEWS: Mention dcache configuration. ---- src/gdb/dwarf2read.c 2011/07/20 15:13:49 1.554 -+++ src/gdb/dwarf2read.c 2011/07/26 17:04:23 1.555 -@@ -187,6 +187,7 @@ - struct dwarf2_section_info line; - struct dwarf2_section_info loc; - struct dwarf2_section_info macinfo; -+ struct dwarf2_section_info macro; - struct dwarf2_section_info str; - struct dwarf2_section_info ranges; - struct dwarf2_section_info frame; -@@ -264,6 +265,7 @@ - { ".debug_line", ".zdebug_line" }, - { ".debug_loc", ".zdebug_loc" }, - { ".debug_macinfo", ".zdebug_macinfo" }, -+ { ".debug_macro", ".zdebug_macro" }, - { ".debug_str", ".zdebug_str" }, - { ".debug_ranges", ".zdebug_ranges" }, - { ".debug_types", ".zdebug_types" }, -@@ -858,10 +860,11 @@ - } - - static void --dwarf2_macros_too_long_complaint (void) -+dwarf2_macros_too_long_complaint (struct dwarf2_section_info *section) - { - complaint (&symfile_complaints, -- _("macro info runs off end of `.debug_macinfo' section")); -+ _("macro info runs off end of `%s' section"), -+ section->asection->name); - } - - static void -@@ -1233,7 +1236,9 @@ - struct dwarf2_cu *); - - static void dwarf_decode_macros (struct line_header *, unsigned int, -- char *, bfd *, struct dwarf2_cu *); -+ char *, bfd *, struct dwarf2_cu *, -+ struct dwarf2_section_info *, -+ int); - - static int attr_form_is_block (struct attribute *); - -@@ -1438,6 +1443,11 @@ - dwarf2_per_objfile->macinfo.asection = sectp; - dwarf2_per_objfile->macinfo.size = bfd_get_section_size (sectp); - } -+ else if (section_is_p (sectp->name, &names->macro)) -+ { -+ dwarf2_per_objfile->macro.asection = sectp; -+ dwarf2_per_objfile->macro.size = bfd_get_section_size (sectp); -+ } - else if (section_is_p (sectp->name, &names->str)) - { - dwarf2_per_objfile->str.asection = sectp; -@@ -5641,13 +5651,28 @@ - refers to information in the line number info statement program - header, so we can only read it if we've read the header - successfully. */ -- attr = dwarf2_attr (die, DW_AT_macro_info, cu); -+ attr = dwarf2_attr (die, DW_AT_GNU_macros, cu); - if (attr && cu->line_header) - { -- unsigned int macro_offset = DW_UNSND (attr); -+ if (dwarf2_attr (die, DW_AT_macro_info, cu)) -+ complaint (&symfile_complaints, -+ _("CU refers to both DW_AT_GNU_macros and DW_AT_macro_info")); -+ -+ dwarf_decode_macros (cu->line_header, DW_UNSND (attr), -+ comp_dir, abfd, cu, -+ &dwarf2_per_objfile->macro, 1); -+ } -+ else -+ { -+ attr = dwarf2_attr (die, DW_AT_macro_info, cu); -+ if (attr && cu->line_header) -+ { -+ unsigned int macro_offset = DW_UNSND (attr); - -- dwarf_decode_macros (cu->line_header, macro_offset, -- comp_dir, abfd, cu); -+ dwarf_decode_macros (cu->line_header, macro_offset, -+ comp_dir, abfd, cu, -+ &dwarf2_per_objfile->macinfo, 0); -+ } - } - do_cleanups (back_to); - } -@@ -10262,32 +10287,32 @@ - } - - static char * --read_indirect_string (bfd *abfd, gdb_byte *buf, -- const struct comp_unit_head *cu_header, -- unsigned int *bytes_read_ptr) -+read_indirect_string_at_offset (bfd *abfd, LONGEST str_offset) - { -- LONGEST str_offset = read_offset (abfd, buf, cu_header, bytes_read_ptr); -- - dwarf2_read_section (dwarf2_per_objfile->objfile, &dwarf2_per_objfile->str); - if (dwarf2_per_objfile->str.buffer == NULL) -- { -- error (_("DW_FORM_strp used without .debug_str section [in module %s]"), -- bfd_get_filename (abfd)); -- return NULL; -- } -+ error (_("DW_FORM_strp used without .debug_str section [in module %s]"), -+ bfd_get_filename (abfd)); - if (str_offset >= dwarf2_per_objfile->str.size) -- { -- error (_("DW_FORM_strp pointing outside of " -- ".debug_str section [in module %s]"), -- bfd_get_filename (abfd)); -- return NULL; -- } -+ error (_("DW_FORM_strp pointing outside of " -+ ".debug_str section [in module %s]"), -+ bfd_get_filename (abfd)); - gdb_assert (HOST_CHAR_BIT == 8); - if (dwarf2_per_objfile->str.buffer[str_offset] == '\0') - return NULL; - return (char *) (dwarf2_per_objfile->str.buffer + str_offset); - } - -+static char * -+read_indirect_string (bfd *abfd, gdb_byte *buf, -+ const struct comp_unit_head *cu_header, -+ unsigned int *bytes_read_ptr) -+{ -+ LONGEST str_offset = read_offset (abfd, buf, cu_header, bytes_read_ptr); -+ -+ return read_indirect_string_at_offset (abfd, str_offset); -+} -+ - static unsigned long - read_unsigned_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr) - { -@@ -14669,117 +14694,205 @@ - dwarf2_macro_malformed_definition_complaint (body); - } - -+/* Skip some bytes from BYTES according to the form given in FORM. -+ Returns the new pointer. */ - --static void --dwarf_decode_macros (struct line_header *lh, unsigned int offset, -- char *comp_dir, bfd *abfd, -- struct dwarf2_cu *cu) -+static gdb_byte * -+skip_form_bytes (bfd *abfd, gdb_byte *bytes, -+ enum dwarf_form form, -+ unsigned int offset_size, -+ struct dwarf2_section_info *section) - { -- gdb_byte *mac_ptr, *mac_end; -- struct macro_source_file *current_file = 0; -- enum dwarf_macinfo_record_type macinfo_type; -- int at_commandline; -+ unsigned int bytes_read; - -- dwarf2_read_section (dwarf2_per_objfile->objfile, -- &dwarf2_per_objfile->macinfo); -- if (dwarf2_per_objfile->macinfo.buffer == NULL) -+ switch (form) - { -- complaint (&symfile_complaints, _("missing .debug_macinfo section")); -- return; -+ case DW_FORM_data1: -+ case DW_FORM_flag: -+ ++bytes; -+ break; -+ -+ case DW_FORM_data2: -+ bytes += 2; -+ break; -+ -+ case DW_FORM_data4: -+ bytes += 4; -+ break; -+ -+ case DW_FORM_data8: -+ bytes += 8; -+ break; -+ -+ case DW_FORM_string: -+ read_direct_string (abfd, bytes, &bytes_read); -+ bytes += bytes_read; -+ break; -+ -+ case DW_FORM_sec_offset: -+ case DW_FORM_strp: -+ bytes += offset_size; -+ break; -+ -+ case DW_FORM_block: -+ bytes += read_unsigned_leb128 (abfd, bytes, &bytes_read); -+ bytes += bytes_read; -+ break; -+ -+ case DW_FORM_block1: -+ bytes += 1 + read_1_byte (abfd, bytes); -+ break; -+ case DW_FORM_block2: -+ bytes += 2 + read_2_bytes (abfd, bytes); -+ break; -+ case DW_FORM_block4: -+ bytes += 4 + read_4_bytes (abfd, bytes); -+ break; -+ -+ case DW_FORM_sdata: -+ case DW_FORM_udata: -+ bytes = skip_leb128 (abfd, bytes); -+ break; -+ -+ default: -+ { -+ complain: -+ complaint (&symfile_complaints, -+ _("invalid form 0x%x in `%s'"), -+ form, -+ section->asection->name); -+ return NULL; -+ } - } - -- /* First pass: Find the name of the base filename. -- This filename is needed in order to process all macros whose definition -- (or undefinition) comes from the command line. These macros are defined -- before the first DW_MACINFO_start_file entry, and yet still need to be -- associated to the base file. -+ return bytes; -+} - -- To determine the base file name, we scan the macro definitions until we -- reach the first DW_MACINFO_start_file entry. We then initialize -- CURRENT_FILE accordingly so that any macro definition found before the -- first DW_MACINFO_start_file can still be associated to the base file. */ -+/* A helper for dwarf_decode_macros that handles skipping an unknown -+ opcode. Returns an updated pointer to the macro data buffer; or, -+ on error, issues a complaint and returns NULL. */ - -- mac_ptr = dwarf2_per_objfile->macinfo.buffer + offset; -- mac_end = dwarf2_per_objfile->macinfo.buffer -- + dwarf2_per_objfile->macinfo.size; -+static gdb_byte * -+skip_unknown_opcode (unsigned int opcode, -+ gdb_byte **opcode_definitions, -+ gdb_byte *mac_ptr, -+ bfd *abfd, -+ unsigned int offset_size, -+ struct dwarf2_section_info *section) -+{ -+ unsigned int bytes_read, i; -+ unsigned long arg; -+ gdb_byte *defn; - -- do -+ if (opcode_definitions[opcode] == NULL) - { -- /* Do we at least have room for a macinfo type byte? */ -- if (mac_ptr >= mac_end) -- { -- /* Complaint is printed during the second pass as GDB will probably -- stop the first pass earlier upon finding -- DW_MACINFO_start_file. */ -- break; -- } -+ complaint (&symfile_complaints, -+ _("unrecognized DW_MACFINO opcode 0x%x"), -+ opcode); -+ return NULL; -+ } - -- macinfo_type = read_1_byte (abfd, mac_ptr); -- mac_ptr++; -+ defn = opcode_definitions[opcode]; -+ arg = read_unsigned_leb128 (abfd, defn, &bytes_read); -+ defn += bytes_read; - -- switch (macinfo_type) -- { -- /* A zero macinfo type indicates the end of the macro -- information. */ -- case 0: -- break; -+ for (i = 0; i < arg; ++i) -+ { -+ mac_ptr = skip_form_bytes (abfd, mac_ptr, defn[i], offset_size, section); -+ if (mac_ptr == NULL) -+ { -+ /* skip_form_bytes already issued the complaint. */ -+ return NULL; -+ } -+ } - -- case DW_MACINFO_define: -- case DW_MACINFO_undef: -- /* Only skip the data by MAC_PTR. */ -- { -- unsigned int bytes_read; -+ return mac_ptr; -+} - -- read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- read_direct_string (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- } -- break; -+/* A helper function which parses the header of a macro section. -+ If the macro section is the extended (for now called "GNU") type, -+ then this updates *OFFSET_SIZE. Returns a pointer to just after -+ the header, or issues a complaint and returns NULL on error. */ - -- case DW_MACINFO_start_file: -- { -- unsigned int bytes_read; -- int line, file; -+static gdb_byte * -+dwarf_parse_macro_header (gdb_byte **opcode_definitions, -+ bfd *abfd, -+ gdb_byte *mac_ptr, -+ unsigned int *offset_size, -+ int section_is_gnu) -+{ -+ memset (opcode_definitions, 0, 256 * sizeof (gdb_byte *)); - -- line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -+ if (section_is_gnu) -+ { -+ unsigned int version, flags; - -- current_file = macro_start_file (file, line, current_file, -- comp_dir, lh, cu->objfile); -- } -- break; -+ version = read_2_bytes (abfd, mac_ptr); -+ if (version != 4) -+ { -+ complaint (&symfile_complaints, -+ _("unrecognized version `%d' in .debug_macro section"), -+ version); -+ return NULL; -+ } -+ mac_ptr += 2; - -- case DW_MACINFO_end_file: -- /* No data to skip by MAC_PTR. */ -- break; -+ flags = read_1_byte (abfd, mac_ptr); -+ ++mac_ptr; -+ *offset_size = (flags & 1) ? 8 : 4; - -- case DW_MACINFO_vendor_ext: -- /* Only skip the data by MAC_PTR. */ -- { -- unsigned int bytes_read; -+ if ((flags & 2) != 0) -+ /* We don't need the line table offset. */ -+ mac_ptr += *offset_size; - -- read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- read_direct_string (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- } -- break; -+ /* Vendor opcode descriptions. */ -+ if ((flags & 4) != 0) -+ { -+ unsigned int i, count; - -- default: -- break; -+ count = read_1_byte (abfd, mac_ptr); -+ ++mac_ptr; -+ for (i = 0; i < count; ++i) -+ { -+ unsigned int opcode, bytes_read; -+ unsigned long arg; -+ -+ opcode = read_1_byte (abfd, mac_ptr); -+ ++mac_ptr; -+ opcode_definitions[opcode] = mac_ptr; -+ arg = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ mac_ptr += arg; -+ } - } -- } while (macinfo_type != 0 && current_file == NULL); -+ } - -- /* Second pass: Process all entries. -+ return mac_ptr; -+} - -- Use the AT_COMMAND_LINE flag to determine whether we are still processing -- command-line macro definitions/undefinitions. This flag is unset when we -- reach the first DW_MACINFO_start_file entry. */ -+/* A helper for dwarf_decode_macros that handles the GNU extensions, -+ including DW_GNU_MACINFO_transparent_include. */ -+ -+static void -+dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, -+ struct macro_source_file *current_file, -+ struct line_header *lh, char *comp_dir, -+ struct dwarf2_section_info *section, -+ int section_is_gnu, -+ unsigned int offset_size, -+ struct objfile *objfile) -+{ -+ enum dwarf_macro_record_type macinfo_type; -+ int at_commandline; -+ gdb_byte *opcode_definitions[256]; - -- mac_ptr = dwarf2_per_objfile->macinfo.buffer + offset; -+ mac_ptr = dwarf_parse_macro_header (opcode_definitions, abfd, mac_ptr, -+ &offset_size, section_is_gnu); -+ if (mac_ptr == NULL) -+ { -+ /* We already issued a complaint. */ -+ return; -+ } - - /* Determines if GDB is still before first DW_MACINFO_start_file. If true - GDB is still reading the definitions from command line. First -@@ -14795,13 +14908,15 @@ - /* Do we at least have room for a macinfo type byte? */ - if (mac_ptr >= mac_end) - { -- dwarf2_macros_too_long_complaint (); -+ dwarf2_macros_too_long_complaint (section); - break; - } - - macinfo_type = read_1_byte (abfd, mac_ptr); - mac_ptr++; - -+ /* Note that we rely on the fact that the corresponding GNU and -+ DWARF constants are the same. */ - switch (macinfo_type) - { - /* A zero macinfo type indicates the end of the macro -@@ -14809,29 +14924,45 @@ - case 0: - break; - -- case DW_MACINFO_define: -- case DW_MACINFO_undef: -+ case DW_MACRO_GNU_define: -+ case DW_MACRO_GNU_undef: -+ case DW_MACRO_GNU_define_indirect: -+ case DW_MACRO_GNU_undef_indirect: - { - unsigned int bytes_read; - int line; - char *body; -+ int is_define; - -- line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- body = read_direct_string (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -+ line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ -+ if (macinfo_type == DW_MACRO_GNU_define -+ || macinfo_type == DW_MACRO_GNU_undef) -+ { -+ body = read_direct_string (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ } -+ else -+ { -+ LONGEST str_offset; -+ -+ str_offset = read_offset_1 (abfd, mac_ptr, offset_size); -+ mac_ptr += offset_size; - -+ body = read_indirect_string_at_offset (abfd, str_offset); -+ } -+ -+ is_define = (macinfo_type == DW_MACRO_GNU_define -+ || macinfo_type == DW_MACRO_GNU_define_indirect); - if (! current_file) - { - /* DWARF violation as no main source is present. */ - complaint (&symfile_complaints, - _("debug info with no main source gives macro %s " - "on line %d: %s"), -- macinfo_type == DW_MACINFO_define ? -- _("definition") : -- macinfo_type == DW_MACINFO_undef ? -- _("undefinition") : -- _("something-or-other"), line, body); -+ is_define ? _("definition") : _("undefinition"), -+ line, body); - break; - } - if ((line == 0 && !at_commandline) -@@ -14839,21 +14970,21 @@ - complaint (&symfile_complaints, - _("debug info gives %s macro %s with %s line %d: %s"), - at_commandline ? _("command-line") : _("in-file"), -- macinfo_type == DW_MACINFO_define ? -- _("definition") : -- macinfo_type == DW_MACINFO_undef ? -- _("undefinition") : -- _("something-or-other"), -+ is_define ? _("definition") : _("undefinition"), - line == 0 ? _("zero") : _("non-zero"), line, body); - -- if (macinfo_type == DW_MACINFO_define) -+ if (is_define) - parse_macro_definition (current_file, line, body); -- else if (macinfo_type == DW_MACINFO_undef) -- macro_undef (current_file, line, body); -+ else -+ { -+ gdb_assert (macinfo_type == DW_MACRO_GNU_undef -+ || macinfo_type == DW_MACRO_GNU_undef_indirect); -+ macro_undef (current_file, line, body); -+ } - } - break; - -- case DW_MACINFO_start_file: -+ case DW_MACRO_GNU_start_file: - { - unsigned int bytes_read; - int line, file; -@@ -14873,17 +15004,18 @@ - - if (at_commandline) - { -- /* This DW_MACINFO_start_file was executed in the pass one. */ -+ /* This DW_MACRO_GNU_start_file was executed in the -+ pass one. */ - at_commandline = 0; - } - else - current_file = macro_start_file (file, line, - current_file, comp_dir, -- lh, cu->objfile); -+ lh, objfile); - } - break; - -- case DW_MACINFO_end_file: -+ case DW_MACRO_GNU_end_file: - if (! current_file) - complaint (&symfile_complaints, - _("macro debug info has an unmatched " -@@ -14893,7 +15025,7 @@ - current_file = current_file->included_by; - if (! current_file) - { -- enum dwarf_macinfo_record_type next_type; -+ enum dwarf_macro_record_type next_type; - - /* GCC circa March 2002 doesn't produce the zero - type byte marking the end of the compilation -@@ -14903,7 +15035,7 @@ - /* Do we at least have room for a macinfo type byte? */ - if (mac_ptr >= mac_end) - { -- dwarf2_macros_too_long_complaint (); -+ dwarf2_macros_too_long_complaint (section); - return; - } - -@@ -14920,23 +15052,199 @@ - } - break; - -+ case DW_MACRO_GNU_transparent_include: -+ { -+ LONGEST offset; -+ -+ offset = read_offset_1 (abfd, mac_ptr, offset_size); -+ mac_ptr += offset_size; -+ -+ dwarf_decode_macro_bytes (abfd, -+ section->buffer + offset, -+ mac_end, current_file, -+ lh, comp_dir, -+ section, section_is_gnu, -+ offset_size, objfile); -+ } -+ break; -+ - case DW_MACINFO_vendor_ext: -- { -- unsigned int bytes_read; -- int constant; -+ if (!section_is_gnu) -+ { -+ unsigned int bytes_read; -+ int constant; - -- constant = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- read_direct_string (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -+ constant = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ read_direct_string (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; - -- /* We don't recognize any vendor extensions. */ -- } -- break; -+ /* We don't recognize any vendor extensions. */ -+ break; -+ } -+ /* FALLTHROUGH */ -+ -+ default: -+ mac_ptr = skip_unknown_opcode (macinfo_type, opcode_definitions, -+ mac_ptr, abfd, offset_size, -+ section); -+ if (mac_ptr == NULL) -+ return; -+ break; - } - } while (macinfo_type != 0); - } - -+static void -+dwarf_decode_macros (struct line_header *lh, unsigned int offset, -+ char *comp_dir, bfd *abfd, -+ struct dwarf2_cu *cu, -+ struct dwarf2_section_info *section, -+ int section_is_gnu) -+{ -+ gdb_byte *mac_ptr, *mac_end; -+ struct macro_source_file *current_file = 0; -+ enum dwarf_macro_record_type macinfo_type; -+ unsigned int offset_size = cu->header.offset_size; -+ gdb_byte *opcode_definitions[256]; -+ -+ dwarf2_read_section (dwarf2_per_objfile->objfile, section); -+ if (section->buffer == NULL) -+ { -+ complaint (&symfile_complaints, _("missing %s section"), -+ section->asection->name); -+ return; -+ } -+ -+ /* First pass: Find the name of the base filename. -+ This filename is needed in order to process all macros whose definition -+ (or undefinition) comes from the command line. These macros are defined -+ before the first DW_MACINFO_start_file entry, and yet still need to be -+ associated to the base file. -+ -+ To determine the base file name, we scan the macro definitions until we -+ reach the first DW_MACINFO_start_file entry. We then initialize -+ CURRENT_FILE accordingly so that any macro definition found before the -+ first DW_MACINFO_start_file can still be associated to the base file. */ -+ -+ mac_ptr = section->buffer + offset; -+ mac_end = section->buffer + section->size; -+ -+ mac_ptr = dwarf_parse_macro_header (opcode_definitions, abfd, mac_ptr, -+ &offset_size, section_is_gnu); -+ if (mac_ptr == NULL) -+ { -+ /* We already issued a complaint. */ -+ return; -+ } -+ -+ do -+ { -+ /* Do we at least have room for a macinfo type byte? */ -+ if (mac_ptr >= mac_end) -+ { -+ /* Complaint is printed during the second pass as GDB will probably -+ stop the first pass earlier upon finding -+ DW_MACINFO_start_file. */ -+ break; -+ } -+ -+ macinfo_type = read_1_byte (abfd, mac_ptr); -+ mac_ptr++; -+ -+ /* Note that we rely on the fact that the corresponding GNU and -+ DWARF constants are the same. */ -+ switch (macinfo_type) -+ { -+ /* A zero macinfo type indicates the end of the macro -+ information. */ -+ case 0: -+ break; -+ -+ case DW_MACRO_GNU_define: -+ case DW_MACRO_GNU_undef: -+ /* Only skip the data by MAC_PTR. */ -+ { -+ unsigned int bytes_read; -+ -+ read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ read_direct_string (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ } -+ break; -+ -+ case DW_MACRO_GNU_start_file: -+ { -+ unsigned int bytes_read; -+ int line, file; -+ -+ line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ -+ current_file = macro_start_file (file, line, current_file, -+ comp_dir, lh, cu->objfile); -+ } -+ break; -+ -+ case DW_MACRO_GNU_end_file: -+ /* No data to skip by MAC_PTR. */ -+ break; -+ -+ case DW_MACRO_GNU_define_indirect: -+ case DW_MACRO_GNU_undef_indirect: -+ { -+ unsigned int bytes_read; -+ -+ read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ mac_ptr += offset_size; -+ } -+ break; -+ -+ case DW_MACRO_GNU_transparent_include: -+ /* Note that, according to the spec, a transparent include -+ chain cannot call DW_MACRO_GNU_start_file. So, we can just -+ skip this opcode. */ -+ mac_ptr += offset_size; -+ break; -+ -+ case DW_MACINFO_vendor_ext: -+ /* Only skip the data by MAC_PTR. */ -+ if (!section_is_gnu) -+ { -+ unsigned int bytes_read; -+ -+ read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ read_direct_string (abfd, mac_ptr, &bytes_read); -+ mac_ptr += bytes_read; -+ } -+ /* FALLTHROUGH */ -+ -+ default: -+ mac_ptr = skip_unknown_opcode (macinfo_type, opcode_definitions, -+ mac_ptr, abfd, offset_size, -+ section); -+ if (mac_ptr == NULL) -+ return; -+ break; -+ } -+ } while (macinfo_type != 0 && current_file == NULL); -+ -+ /* Second pass: Process all entries. -+ -+ Use the AT_COMMAND_LINE flag to determine whether we are still processing -+ command-line macro definitions/undefinitions. This flag is unset when we -+ reach the first DW_MACINFO_start_file entry. */ -+ -+ dwarf_decode_macro_bytes (abfd, section->buffer + offset, mac_end, -+ current_file, lh, comp_dir, section, section_is_gnu, -+ offset_size, cu->objfile); -+} -+ - /* Check if the attribute's form is a DW_FORM_block* - if so return true else false. */ - static int -@@ -15663,6 +15971,7 @@ - munmap_section_buffer (&data->line); - munmap_section_buffer (&data->loc); - munmap_section_buffer (&data->macinfo); -+ munmap_section_buffer (&data->macro); - munmap_section_buffer (&data->str); - munmap_section_buffer (&data->ranges); - munmap_section_buffer (&data->frame); ---- src/gdb/symfile.h 2011/06/10 21:48:04 1.93 -+++ src/gdb/symfile.h 2011/07/26 17:04:23 1.94 -@@ -582,6 +582,7 @@ - struct dwarf2_section_names line; - struct dwarf2_section_names loc; - struct dwarf2_section_names macinfo; -+ struct dwarf2_section_names macro; - struct dwarf2_section_names str; - struct dwarf2_section_names ranges; - struct dwarf2_section_names types; - - - -Re: FYI: implement new DWARF macro proposal -http://sourceware.org/ml/gdb-patches/2011-07/msg00759.html -http://sourceware.org/ml/gdb-cvs/2011-07/msg00224.html - -### src/gdb/ChangeLog 2011/07/26 21:09:05 1.13229 -### src/gdb/ChangeLog 2011/07/27 14:45:36 1.13230 -## -1,3 +1,10 @@ -+2011-07-27 Tom Tromey -+ -+ * xcoffread.c (dwarf2_xcoff_names): Add 'macro' and 'sentinel' -+ entries. -+ * symfile.h (struct dwarf2_debug_sections) : New field. -+ * dwarf2read.c (dwarf2_elf_names): Add sentinel entry. -+ - 2011-07-26 Sterling Augustine - - * cli/cli-dump.c (dump_binary_file): Change parameter type to ---- src/gdb/dwarf2read.c 2011/07/26 17:04:23 1.555 -+++ src/gdb/dwarf2read.c 2011/07/27 14:45:37 1.556 -@@ -271,7 +271,8 @@ - { ".debug_types", ".zdebug_types" }, - { ".debug_frame", ".zdebug_frame" }, - { ".eh_frame", NULL }, -- { ".gdb_index", ".zgdb_index" } -+ { ".gdb_index", ".zgdb_index" }, -+ 23 - }; - - /* local data types */ ---- src/gdb/symfile.h 2011/07/26 17:04:23 1.94 -+++ src/gdb/symfile.h 2011/07/27 14:45:37 1.95 -@@ -589,6 +589,9 @@ - struct dwarf2_section_names frame; - struct dwarf2_section_names eh_frame; - struct dwarf2_section_names gdb_index; -+ /* This field has no meaning, but exists solely to catch changes to -+ this structure which are not reflected in some instance. */ -+ int sentinel; - }; - - extern int dwarf2_has_info (struct objfile *, ---- src/gdb/xcoffread.c 2011/06/07 12:31:07 1.89 -+++ src/gdb/xcoffread.c 2011/07/27 14:45:37 1.90 -@@ -160,12 +160,14 @@ - { ".dwline", NULL }, - { ".dwloc", NULL }, - { NULL, NULL }, /* debug_macinfo */ -+ { NULL, NULL }, /* debug_macro */ - { ".dwstr", NULL }, - { ".dwrnges", NULL }, - { NULL, NULL }, /* debug_types */ - { ".dwframe", NULL }, - { NULL, NULL }, /* eh_frame */ -- { NULL, NULL } /* gdb_index */ -+ { NULL, NULL }, /* gdb_index */ -+ 23 - }; - - static void - - - -[patch][python] Fix sigsegv when a printer fails to return a value and string_print is set. -http://sourceware.org/ml/gdb-patches/2011-07/msg00719.html -http://sourceware.org/ml/gdb-cvs/2011-07/msg00234.html - -### src/gdb/ChangeLog 2011/07/27 19:31:30 1.13236 -### src/gdb/ChangeLog 2011/07/28 10:36:37 1.13237 -## -1,3 +1,8 @@ -+2011-07-28 Phil Muldoon -+ -+ * varobj.c (value_get_print_value): Move hint check later into the -+ function. Comment function. Free thevalue before reusing it. -+ - 2011-07-27 Jan Kratochvil - Pedro Alves - ---- src/gdb/varobj.c 2011/07/18 09:21:43 1.180 -+++ src/gdb/varobj.c 2011/07/28 10:36:40 1.181 -@@ -2610,25 +2610,21 @@ - - if (PyObject_HasAttr (value_formatter, gdbpy_to_string_cst)) - { -- char *hint; - struct value *replacement; - PyObject *output = NULL; - -- hint = gdbpy_get_display_hint (value_formatter); -- if (hint) -- { -- if (!strcmp (hint, "string")) -- string_print = 1; -- xfree (hint); -- } -- - output = apply_varobj_pretty_printer (value_formatter, - &replacement, - stb); -+ -+ /* If we have string like output ... */ - if (output) - { - make_cleanup_py_decref (output); - -+ /* If this is a lazy string, extract it. For lazy -+ strings we always print as a string, so set -+ string_print. */ - if (gdbpy_is_lazy_string (output)) - { - gdbpy_extract_lazy_string (output, &str_addr, &type, -@@ -2638,12 +2634,27 @@ - } - else - { -+ /* If it is a regular (non-lazy) string, extract -+ it and copy the contents into THEVALUE. If the -+ hint says to print it as a string, set -+ string_print. Otherwise just return the extracted -+ string as a value. */ -+ - PyObject *py_str - = python_string_to_target_python_string (output); - - if (py_str) - { - char *s = PyString_AsString (py_str); -+ char *hint; -+ -+ hint = gdbpy_get_display_hint (value_formatter); -+ if (hint) -+ { -+ if (!strcmp (hint, "string")) -+ string_print = 1; -+ xfree (hint); -+ } - - len = PyString_Size (py_str); - thevalue = xmemdup (s, len + 1, len + 1); -@@ -2662,6 +2673,9 @@ - gdbpy_print_stack (); - } - } -+ /* If the printer returned a replacement value, set VALUE -+ to REPLACEMENT. If there is not a replacement value, -+ just use the value passed to this function. */ - if (replacement) - value = replacement; - } -@@ -2672,12 +2686,18 @@ - get_formatted_print_options (&opts, format_code[(int) format]); - opts.deref_ref = 0; - opts.raw = 1; -+ -+ /* If the THEVALUE has contents, it is a regular string. */ - if (thevalue) - LA_PRINT_STRING (stb, type, thevalue, len, encoding, 0, &opts); - else if (string_print) -+ /* Otherwise, if string_print is set, and it is not a regular -+ string, it is a lazy string. */ - val_print_string (type, encoding, str_addr, len, stb, &opts); - else -+ /* All other cases. */ - common_val_print (value, stb, 0, &opts, current_language); -+ - thevalue = ui_file_xstrdup (stb, NULL); - - do_cleanups (old_chain); -### src/gdb/testsuite/ChangeLog 2011/07/27 21:18:39 1.2816 -### src/gdb/testsuite/ChangeLog 2011/07/28 10:36:40 1.2817 -## -1,3 +1,10 @@ -+2011-07-28 Phil Muldoon -+ -+ * gdb.python/py-mi.exp: Test printers returning string hint, and -+ also not returning a value. -+ * gdb.python/py-prettyprint.c: Add testcase for above. -+ * gdb.python/py-prettyprint.py: Add test printer for above. -+ - 2011-07-27 Jan Kratochvil - - * gdb.dwarf2/dw2-simple-locdesc.S: Change DWARF version to 3. ---- src/gdb/testsuite/gdb.python/py-mi.exp 2011/07/26 18:38:55 1.13 -+++ src/gdb/testsuite/gdb.python/py-mi.exp 2011/07/28 10:36:40 1.14 -@@ -284,6 +284,13 @@ mi_list_varobj_children nstype2 { - { {nstype2.} {} 6 {char \[6\]} } - } "list children after setting exception flag" - -+mi_create_varobj me me \ -+ "create me varobj" -+ -+mi_gdb_test "-var-evaluate-expression me" \ -+ "\\^done,value=\".*\"" \ -+ "evaluate me varobj" -+ - # C++ MI tests - gdb_exit - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ ---- src/gdb/testsuite/gdb.python/py-prettyprint.c 2011/04/29 12:45:46 1.12 -+++ src/gdb/testsuite/gdb.python/py-prettyprint.c 2011/07/28 10:36:40 1.13 -@@ -149,6 +149,11 @@ - - typedef struct justchildren nostring_type; - -+struct memory_error -+{ -+ const char *s; -+}; -+ - struct container - { - string name; -@@ -227,6 +232,7 @@ - /* Clearing by being `static' could invoke an other GDB C++ bug. */ - struct nullstr nullstr; - nostring_type nstype, nstype2; -+ struct memory_error me; - struct ns ns, ns2; - struct lazystring estring, estring2; - struct hint_error hint_error; -@@ -234,6 +240,8 @@ - nstype.elements = narray; - nstype.len = 0; - -+ me.s = "blah"; -+ - init_ss(&ss, 1, 2); - init_ss(ssa+0, 3, 4); - init_ss(ssa+1, 5, 6); ---- src/gdb/testsuite/gdb.python/py-prettyprint.py 2011/04/11 17:40:41 1.11 -+++ src/gdb/testsuite/gdb.python/py-prettyprint.py 2011/07/28 10:36:40 1.12 -@@ -17,6 +17,7 @@ - # printers. - - import re -+import gdb - - # Test returning a Value from a printer. - class string_print: -@@ -186,6 +187,18 @@ - yield 's', self.val['s'] - yield 'x', self.val['x'] - -+class MemoryErrorString: -+ "Raise an error" -+ -+ def __init__(self, val): -+ self.val = val -+ -+ def to_string(self): -+ raise gdb.MemoryError ("Cannot access memory."); -+ -+ def display_hint (self): -+ return 'string' -+ - def lookup_function (val): - "Look-up and return a pretty-printer that can print val." - -@@ -261,6 +274,8 @@ - pretty_printers_dict[re.compile ('^struct hint_error$')] = pp_hint_error - pretty_printers_dict[re.compile ('^hint_error$')] = pp_hint_error - -+ pretty_printers_dict[re.compile ('^memory_error$')] = MemoryErrorString -+ - pretty_printers_dict = {} - - register_pretty_printers () - - - -commit 84be2b4d0a55c95697c9ecc72bb31c2fbd316127 -Author: ian -Date: Tue Jul 26 14:28:23 2011 +0000 - - * cp-demangle.c (d_print_init): Initialize pack_index field. - (d_print_comp): Check for NULL template argument. - * testsuite/demangle-expected: Add test case. - - - git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176791 138bc75d-0d04-0410-961f-82ee72b054a4 - -### a/libiberty/ChangeLog -### b/libiberty/ChangeLog -## -1,3 +1,9 @@ -+2011-07-26 Ian Lance Taylor -+ -+ * cp-demangle.c (d_print_init): Initialize pack_index field. -+ (d_print_comp): Check for NULL template argument. -+ * testsuite/demangle-expected: Add test case. -+ - 2011-07-22 Gerald Pfeifer - - PR target/49817 ---- a/libiberty/cp-demangle.c -+++ b/libiberty/cp-demangle.c -@@ -1,5 +1,5 @@ - /* Demangler for g++ V3 ABI. -- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 - Free Software Foundation, Inc. - Written by Ian Lance Taylor . - -@@ -3306,6 +3306,7 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback, - dpi->last_char = '\0'; - dpi->templates = NULL; - dpi->modifiers = NULL; -+ dpi->pack_index = 0; - dpi->flush_count = 0; - - dpi->callback = callback; -@@ -3893,6 +3894,13 @@ d_print_comp (struct d_print_info *dpi, int options, - struct demangle_component *a = d_lookup_template_argument (dpi, sub); - if (a && a->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) - a = d_index_template_argument (a, dpi->pack_index); -+ -+ if (a == NULL) -+ { -+ d_print_error (dpi); -+ return; -+ } -+ - sub = a; - } - ---- a/libiberty/testsuite/demangle-expected -+++ b/libiberty/testsuite/demangle-expected -@@ -4010,6 +4010,12 @@ K<1, &S::m>::f() - _ZN1KILi1EXadL_ZN1S1mEEEE1fEv - K<1, &S::m>::f() - # -+# Used to crash -- binutils PR 13030. -+--format=gnu-v3 -+_ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_ -+_ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_ -+_ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_ -+# - # Ada (GNAT) tests. - # - # Simple test. - - - -http://sourceware.org/ml/gdb-cvs/2011-08/msg00047.html - -### src/gdb/ChangeLog 2011/08/08 21:41:12 1.13259 -### src/gdb/ChangeLog 2011/08/09 12:45:39 1.13260 -## -1,3 +1,13 @@ -+2011-08-09 Phil Muldoon -+ -+ * python/lib/gdb/__init__.py: Auto-load files in command and -+ function directories. -+ * python/python.c (finish_python_initialization): Use -+ os.path.join. -+ * python/lib/gdb/command/pretty_printers.py: Self register -+ command. -+ * NEWS: Document auto-loading. -+ - 2011-08-08 Jan Kratochvil - - * dwarf2loc.c (dwarf2_evaluate_loc_desc_full) ---- src/gdb/NEWS 2011/07/26 20:57:53 1.446 -+++ src/gdb/NEWS 2011/08/09 12:45:39 1.447 -@@ -23,6 +23,11 @@ - ** A prompt subsitution hook (prompt_hook) is now available to the - Python API. - -+ ** Python commands and convenience-functions located in -+ 'data-directory'/python/gdb/command and -+ 'data-directory'/python/gdb/function are now automatically loaded -+ on GDB start-up. -+ - * libthread-db-search-path now supports two special values: $sdir and $pdir. - $sdir specifies the default system locations of shared libraries. - $pdir specifies the directory where the libpthread used by the application -### src/gdb/doc/ChangeLog 2011/07/26 16:59:23 1.1202 -### src/gdb/doc/ChangeLog 2011/08/09 12:45:39 1.1203 -## -1,3 +1,8 @@ -+2011-08-09 Phil Muldoon -+ -+ * gdb.texinfo (Python): Document command and function -+ auto-loading. -+ - 2011-07-26 Jan Kratochvil - Eli Zaretskii - ---- src/gdb/doc/gdb.texinfo 2011/07/26 20:57:54 1.851 -+++ src/gdb/doc/gdb.texinfo 2011/08/09 12:45:39 1.852 -@@ -20845,6 +20845,12 @@ - is automatically added to the Python Search Path in order to allow - the Python interpreter to locate all scripts installed at this location. - -+Additionally, @value{GDBN} commands and convenience functions which -+are written in Python and are located in the -+@file{@var{data-directory}/python/gdb/command} or -+@file{@var{data-directory}/python/gdb/function} directories are -+automatically imported when @value{GDBN} starts. -+ - @menu - * Python Commands:: Accessing Python from @value{GDBN}. - * Python API:: Accessing @value{GDBN} from Python. ---- src/gdb/python/python.c 2011/07/22 09:22:50 1.68 -+++ src/gdb/python/python.c 2011/08/09 12:45:40 1.69 -@@ -1302,13 +1302,13 @@ - sys.path.insert (0, gdb.PYTHONDIR)\n\ - \n\ - # Tell python where to find submodules of gdb.\n\ -- gdb.__path__ = [gdb.PYTHONDIR + '/gdb']\n\ -+ gdb.__path__ = [os.path.join (gdb.PYTHONDIR, 'gdb')]\n\ - \n\ - # The gdb module is implemented in C rather than in Python. As a result,\n\ - # the associated __init.py__ script is not not executed by default when\n\ - # the gdb module gets imported. Execute that script manually if it\n\ - # exists.\n\ -- ipy = gdb.PYTHONDIR + '/gdb/__init__.py'\n\ -+ ipy = os.path.join (gdb.PYTHONDIR, 'gdb', '__init__.py')\n\ - if os.path.exists (ipy):\n\ - execfile (ipy)\n\ - \n\ ---- src/gdb/python/lib/gdb/__init__.py 2011/01/01 15:33:26 1.3 -+++ src/gdb/python/lib/gdb/__init__.py 2011/08/09 12:45:40 1.4 -@@ -13,6 +13,29 @@ - # You should have received a copy of the GNU General Public License - # along with this program. If not, see . - --import gdb.command.pretty_printers -+import traceback - --gdb.command.pretty_printers.register_pretty_printer_commands() -+# Auto-load all functions/commands. -+ -+# Modules to auto-load, and the paths where those modules exist. -+ -+module_dict = { -+ 'gdb.function': os.path.join(gdb.PYTHONDIR, 'gdb', 'function'), -+ 'gdb.command': os.path.join(gdb.PYTHONDIR, 'gdb', 'command') -+} -+ -+# Iterate the dictionary, collating the Python files in each module -+# path. Construct the module name, and import. -+ -+for module, location in module_dict.iteritems(): -+ if os.path.exists(location): -+ py_files = filter(lambda x: x.endswith('.py') and x != '__init__.py', -+ os.listdir(location)) -+ -+ for py_file in py_files: -+ # Construct from foo.py, gdb.module.foo -+ py_file = module + '.' + py_file[:-3] -+ try: -+ exec('import ' + py_file) -+ except: -+ print >> sys.stderr, traceback.format_exc() ---- src/gdb/python/lib/gdb/command/pretty_printers.py 2011/01/01 15:33:27 1.4 -+++ src/gdb/python/lib/gdb/command/pretty_printers.py 2011/08/09 12:45:40 1.5 -@@ -368,3 +368,5 @@ - InfoPrettyPrinter() - EnablePrettyPrinter() - DisablePrettyPrinter() -+ -+register_pretty_printer_commands() - - - -http://sourceware.org/ml/gdb-patches/2011-08/msg00505.html -Subject: fix "info os processes" race -> crash (ext-run.exp racy FAIL) -http://sourceware.org/ml/gdb-cvs/2011-08/msg00116.html - -### src/gdb/ChangeLog 2011/08/26 17:58:57 1.13281 -### src/gdb/ChangeLog 2011/08/26 18:58:02 1.13282 -## -1,3 +1,8 @@ -+2011-08-26 Pedro Alves -+ -+ * common/linux-osdata.c (get_cores_used_by_process): Don't assume -+ opening /proc/PID/task always succeeds. -+ - 2011-08-26 Aleksandar Ristovski - - * linespec.c (symtab_from_filename): Check for the end of string. ---- src/gdb/common/linux-osdata.c 2011/07/21 23:46:09 1.1 -+++ src/gdb/common/linux-osdata.c 2011/08/26 18:58:04 1.2 -@@ -259,27 +259,29 @@ - - sprintf (taskdir, "/proc/%d/task", pid); - dir = opendir (taskdir); -- -- while ((dp = readdir (dir)) != NULL) -+ if (dir) - { -- pid_t tid; -- int core; -+ while ((dp = readdir (dir)) != NULL) -+ { -+ pid_t tid; -+ int core; - -- if (!isdigit (dp->d_name[0]) -- || NAMELEN (dp) > sizeof ("4294967295") - 1) -- continue; -+ if (!isdigit (dp->d_name[0]) -+ || NAMELEN (dp) > sizeof ("4294967295") - 1) -+ continue; - -- tid = atoi (dp->d_name); -- core = linux_common_core_of_thread (ptid_build (pid, tid, 0)); -+ tid = atoi (dp->d_name); -+ core = linux_common_core_of_thread (ptid_build (pid, tid, 0)); - -- if (core >= 0) -- { -- ++cores[core]; -- ++task_count; -+ if (core >= 0) -+ { -+ ++cores[core]; -+ ++task_count; -+ } - } -- } - -- closedir (dir); -+ closedir (dir); -+ } - - return task_count; - } - - - -Fix for https://bugzilla.redhat.com/show_bug.cgi?id=750341 -http://sourceware.org/ml/gdb-patches/2011-10/msg00570.html - - -http://sourceware.org/ml/gdb-cvs/2011-10/msg00154.html - -### src/gdb/ChangeLog 2011/10/20 13:34:13 1.13446 -### src/gdb/ChangeLog 2011/10/20 20:06:11 1.13447 -## -1,3 +1,15 @@ -+2011-10-20 Aleksandar Ristovski -+ -+ * cp-namespace.c (cp_scan_for_anonymous_namespaces): Changed function -+ arguments by adding OBJFILE. Instead of getting objfile from -+ symbol's symtab, use new argument OBJFILE. -+ * cp-support.h (cp_scan_for_anonymous_namespaces): Changed function -+ arguments by adding OBJFILE. -+ * gdb/dwarf2read.c (new_symbol_full): Change call to -+ cp_scan_for_anonymous_namespaces to match new signature. -+ * gdb/stabsread.c (define_symbol): Change call to -+ cp_scan_for_anonymous_namespaces to match new signature. -+ - 2011-10-20 Phil Muldoon - - PR python/13308 ---- src/gdb/cp-namespace.c 2011/06/29 22:05:15 1.54 -+++ src/gdb/cp-namespace.c 2011/10/20 20:06:13 1.55 -@@ -53,7 +53,8 @@ - anonymous namespace; if so, add an appropriate using directive. */ - - void --cp_scan_for_anonymous_namespaces (const struct symbol *symbol) -+cp_scan_for_anonymous_namespaces (const struct symbol *const symbol, -+ struct objfile *const objfile) - { - if (SYMBOL_DEMANGLED_NAME (symbol) != NULL) - { -@@ -96,7 +97,7 @@ - namespace given by the previous component if there is - one, or to the global namespace if there isn't. */ - cp_add_using_directive (dest, src, NULL, NULL, NULL, -- &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack); -+ &objfile->objfile_obstack); - } - /* The "+ 2" is for the "::". */ - previous_component = next_component + 2; ---- src/gdb/cp-support.h 2011/08/18 16:17:38 1.45 -+++ src/gdb/cp-support.h 2011/10/20 20:06:13 1.46 -@@ -197,7 +197,8 @@ - const char *processing_current_prefix, - int processing_has_namespace_info); - --extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol); -+extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol, -+ struct objfile *objfile); - - extern struct symbol *cp_lookup_symbol_nonlocal (const char *name, - const struct block *block, ---- src/gdb/dwarf2read.c 2011/10/20 01:11:34 1.576 -+++ src/gdb/dwarf2read.c 2011/10/20 20:06:13 1.577 -@@ -11992,7 +11992,7 @@ - namespaces based on the demangled name. */ - if (!processing_has_namespace_info - && cu->language == language_cplus) -- cp_scan_for_anonymous_namespaces (sym); -+ cp_scan_for_anonymous_namespaces (sym, objfile); - } - return (sym); - } ---- src/gdb/stabsread.c 2011/05/18 16:30:36 1.138 -+++ src/gdb/stabsread.c 2011/10/20 20:06:14 1.139 -@@ -729,7 +729,7 @@ - SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile); - - if (SYMBOL_LANGUAGE (sym) == language_cplus) -- cp_scan_for_anonymous_namespaces (sym); -+ cp_scan_for_anonymous_namespaces (sym, objfile); - - } - p++; diff --git a/gdb-vla-frame-set.patch b/gdb-vla-frame-set.patch deleted file mode 100644 index 87ddca1..0000000 --- a/gdb-vla-frame-set.patch +++ /dev/null @@ -1,91 +0,0 @@ -commit 51dab9e418741ac7065cd5a6ec9b57285e90227c -https://bugzilla.redhat.com/show_bug.cgi?id=738482 - ---- a/gdb/printcmd.c -+++ b/gdb/printcmd.c -@@ -1981,6 +1981,10 @@ print_variable_and_value (const char *name, struct symbol *var, - struct value_print_options opts; - - val = read_var_value (var, frame); -+ -+ make_cleanup_restore_selected_frame (); -+ select_frame (frame); -+ - get_user_print_options (&opts); - common_val_print (val, stream, indent, &opts, current_language); - } ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.c -@@ -0,0 +1,31 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2011 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 . */ -+ -+#include -+ -+int -+main (int argc, char **argv) -+{ -+ char s[2 + argc]; -+ void (*f) (char *) = 0; -+ -+ memset (s, 0, sizeof (s)); -+ s[0] = 'X'; -+ -+ f (s); -+ return 0; -+} ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.exp -@@ -0,0 +1,38 @@ -+# Copyright 2011 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 . -+ -+set testfile vla-frame -+set executable ${testfile} -+ -+if { [prepare_for_testing ${testfile}.exp ${executable}] } { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+set test "continue" -+gdb_test_multiple $test $test { -+ -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ untested ${testfile}.exp -+ return -+ } -+} -+ -+gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*" diff --git a/gdb.spec b/gdb.spec index 552c76c..4df3ac3 100644 --- a/gdb.spec +++ b/gdb.spec @@ -23,11 +23,11 @@ Name: gdb%{?_with_debug:-debug} # 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: 7.3.50.20110722 +Version: 7.4.50.20120103 # 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. -Release: 11%{?_with_upstream:.upstream}%{?dist} +Release: 1%{?_with_upstream:.upstream}%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain Group: Development/Debuggers @@ -108,11 +108,6 @@ Patch2: gdb-6.3-rh-testversion-20041202.patch #=ia64 Patch3: gdb-6.3-rh-testlibunwind-20041202.patch -# Use convert_from_func_ptr_addr on the solib breakpoint address; -# simplifies and makes more consistent the logic. -#=maybepush+ppc: Write new testcase. -Patch104: gdb-6.3-ppcdotsolib-20041022.patch - # Better parse 64-bit PPC system call prologues. #=maybepush+ppc: Write new testcase. Patch105: gdb-6.3-ppc64syscall-20040622.patch @@ -158,12 +153,6 @@ Patch136: gdb-6.3-test-movedir-20050125.patch #=ia64 Patch140: gdb-6.3-gcore-thread-20050204.patch -# Stop while intentionally stepping and the thread exit is met. -#=push -Patch141: gdb-6.6-step-thread-exit.patch -#=push -Patch259: gdb-6.3-step-thread-exit-20050211-test.patch - # Test sibling threads to set threaded watchpoints for x86 and x86-64 #=fedoratest Patch145: gdb-6.3-threaded-watchpoints2-20050225.patch @@ -260,7 +249,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch # Backported fixups post the source tarball. #Xdrop: Just backports. -Patch232: gdb-upstream.patch +#Patch232: gdb-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). #=fedoratest+ppc @@ -358,10 +347,6 @@ Patch317: gdb-6.8-sparc64-silence-memcpy-check.patch #=fedoratest Patch320: gdb-6.5-section-num-fixup-test.patch -# Create a single binary `gdb' autodetecting --tui by its argv[0]. -#=push+work: IIRC Tom told argv[0] should not be used by GNU programs, also drop libgdb.a. -Patch326: gdb-6.8-tui-singlebinary.patch - # Fix PRPSINFO in the core files dumped by gcore (BZ 254229). #=push Patch329: gdb-6.8-bz254229-gcore-prpsinfo.patch @@ -371,13 +356,9 @@ Patch329: gdb-6.8-bz254229-gcore-prpsinfo.patch Patch330: gdb-6.8-bz436037-reg-no-longer-active.patch # Make the GDB quit processing non-abortable to cleanup everything properly. -#=push: Useful only after gdb-6.8-attach-signalled-detach-stopped.patch . +#=push: It was useful only after gdb-6.8-attach-signalled-detach-stopped.patch . Patch331: gdb-6.8-quit-never-aborts.patch -# Fix attaching to stopped processes and/or pending signals. -#=push+work -Patch337: gdb-6.8-attach-signalled-detach-stopped.patch - # Test the watchpoints conditionals works. #=fedoratest Patch343: gdb-6.8-watchpoint-conditionals-test.patch @@ -513,10 +494,6 @@ Patch547: gdb-test-dw2-aranges.patch # =fedoratest Patch548: gdb-test-expr-cumulative-archer.patch -# Workaround gcc-4.6 stdarg false prologue end (GDB PR 12435 + GCC PR 47471). -# =push -Patch556: gdb-gcc46-stdarg-prologue.patch - # Toolchain on sparc is slightly broken and debuginfo files are generated # with non 64bit aligned tables/offsets. # See for example readelf -S ../Xvnc.debug. @@ -530,32 +507,19 @@ Patch556: gdb-gcc46-stdarg-prologue.patch # rebuild to fix it, we need to be able to use gdb :) Patch579: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch -# Improve GDB performance on inferior dlopen calls (Gary Benson, BZ 698001). -Patch617: gdb-dlopen-skip_inline_frames-perf.patch - # Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432). -Patch618: gdb-dlopen-stap-probe.patch +#FIXME:Patch618: gdb-dlopen-stap-probe.patch Patch619: gdb-dlopen-stap-probe-test.patch # Work around PR libc/13097 "linux-vdso.so.1" warning message. Patch627: gdb-glibc-vdso-workaround.patch -# [TUI] Fix stepi on stripped code. -Patch628: gdb-tui-strip-stepi.patch - -# [vla] Fix VLA arrays displayed in `bt full' (BZ 738482). -Patch629: gdb-vla-frame-set.patch - -# Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches. -Patch630: gdb-implptr-64bit-1of2.patch -Patch631: gdb-implptr-64bit-2of2.patch - -# Fix internal error on some optimized-out values. -Patch632: gdb-optimized-out-internal-error.patch - # Hack for proper PIE run of the testsuite. Patch634: gdb-runtest-pie-override.patch +# Fix zero registers core files w/gcc-4.7. +Patch638: gdb-gcc47-gcore-zero.patch + BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa} # --without-system-readline # Requires: readline%{?_isa} @@ -715,12 +679,11 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %if 0%{!?_with_upstream:1} -%patch232 -p1 +#patch232 -p1 %patch349 -p1 %patch1 -p1 %patch3 -p1 -%patch104 -p1 %patch105 -p1 %patch111 -p1 %patch112 -p1 @@ -730,8 +693,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch133 -p1 %patch136 -p1 %patch140 -p1 -%patch141 -p1 -%patch259 -p1 %patch145 -p1 %patch153 -p1 %patch157 -p1 @@ -779,11 +740,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch315 -p1 %patch317 -p1 %patch320 -p1 -%patch326 -p1 %patch329 -p1 %patch330 -p1 %patch331 -p1 -%patch337 -p1 %patch343 -p1 %patch348 -p1 %patch360 -p1 @@ -817,18 +776,12 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch542 -p1 %patch547 -p1 %patch548 -p1 -%patch556 -p1 %patch579 -p1 -%patch617 -p1 -%patch618 -p1 +#FIXME:patch618 -p1 %patch619 -p1 %patch627 -p1 -%patch628 -p1 -%patch629 -p1 -%patch630 -p1 -%patch631 -p1 -%patch632 -p1 %patch634 -p1 +%patch638 -p1 %patch393 -p1 %patch335 -p1 @@ -1106,12 +1059,6 @@ make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT cp $RPM_BUILD_DIR/%{gdb_src}/gdb/gdb_gcore.sh $RPM_BUILD_ROOT%{_bindir}/gcore chmod 755 $RPM_BUILD_ROOT%{_bindir}/gcore -# Remove the gdb/gdbtui binaries duplicity. -test -x $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui -ln -sf gdb $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui -cmp $RPM_BUILD_ROOT%{_mandir}/*/gdb.1 $RPM_BUILD_ROOT%{_mandir}/*/gdbtui.1 -ln -sf gdb.1 $RPM_BUILD_ROOT%{_mandir}/*/gdbtui.1 - mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d sed 's#%%{_sysconfdir}#%{_sysconfdir}#g' <%{SOURCE4} >$RPM_BUILD_ROOT%{_sysconfdir}/gdbinit @@ -1215,11 +1162,9 @@ fi %doc COPYING3 COPYING COPYING.LIB README NEWS %{_bindir}/gcore %{_bindir}/gdb -%{_bindir}/gdbtui %{_sysconfdir}/gdbinit %{_sysconfdir}/gdbinit.d %{_mandir}/*/gdb.1* -%{_mandir}/*/gdbtui.1* %if 0%{!?_with_upstream:1} %{_bindir}/gstack %{_mandir}/*/gstack.1* @@ -1252,6 +1197,9 @@ fi %{_infodir}/gdb.info* %changelog +* Tue Jan 3 2012 Jan Kratochvil - 7.4.50.20120103-1.fc17 +- Rebase to FSF GDB 7.4.50.20120103. + * Mon Nov 28 2011 Jan Kratochvil - 7.3.50.20110722-11.fc17 - No longer build bundled libstdc++ pretty printers on RHELs >= 7. diff --git a/sources b/sources index 9330457..b3fa2a6 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ 04e5c4b1b9e633422cc48990fe61958d libstdc++-v3-python-r155978.tar.bz2 -c555493053a309c8aa20592ea956f9e5 gdb-7.3.50.20110722.tar.bz2 +ed61ae196483c89c0c485c4497d9f815 gdb-7.4.50.20120103.tar.bz2