Compare commits
62 Commits
Author | SHA1 | Date |
---|---|---|
Jan Kratochvil | d44fa831fe | |
Jan Kratochvil | 7f9b2cbd74 | |
Jan Kratochvil | 1bbb88d597 | |
Jan Kratochvil | be6e797e00 | |
Jan Kratochvil | 1e4b7d3ea6 | |
Jan Kratochvil | 881338babd | |
Jan Kratochvil | 995b9dcf6c | |
Jan Kratochvil | 89365c2014 | |
Jan Kratochvil | 5bf2ffefc9 | |
Jan Kratochvil | 33f3958adb | |
Jan Kratochvil | 1faf245e87 | |
Jan Kratochvil | e073d8b9a5 | |
Jan Kratochvil | be30c45c53 | |
Jan Kratochvil | a20260859f | |
Jan Kratochvil | dedd61bd27 | |
Jan Kratochvil | 35705aecc8 | |
Jan Kratochvil | 310918247e | |
Jan Kratochvil | 9d05126f64 | |
Jan Kratochvil | 5bf3960e62 | |
Jan Kratochvil | 18d95bdf87 | |
Jan Kratochvil | dcb7514655 | |
Jan Kratochvil | 5b1f1bc461 | |
Jan Kratochvil | 68f2220e75 | |
Jan Kratochvil | 4ac282d93b | |
Jan Kratochvil | 79184ebd8a | |
Jan Kratochvil | e7956a16bb | |
Jan Kratochvil | a30b292533 | |
Jan Kratochvil | f6c5ba8706 | |
Jan Kratochvil | 0c33c37fb6 | |
Jan Kratochvil | 23452f19a6 | |
Jan Kratochvil | a83f173eeb | |
Jan Kratochvil | 93f3b46c0d | |
Jan Kratochvil | 7c0a903149 | |
Jan Kratochvil | 23eda4b29e | |
Jan Kratochvil | 56cabb98f1 | |
Jan Kratochvil | df661e30f9 | |
Jan Kratochvil | aeb6a62df2 | |
Jan Kratochvil | 8e50e08ea7 | |
Jan Kratochvil | a161ab2c00 | |
Jan Kratochvil | c45f9b5276 | |
Jan Kratochvil | e811d669fc | |
Jan Kratochvil | 20ca7f0fe4 | |
Jan Kratochvil | a0db7fa0a1 | |
Jan Kratochvil | 6431dd6312 | |
Jan Kratochvil | e542160e6c | |
Jan Kratochvil | 584a39808a | |
Jan Kratochvil | 5eaef129d9 | |
Jan Kratochvil | 74d8b422e5 | |
Jan Kratochvil | 630696c0f6 | |
Jan Kratochvil | 49707ab865 | |
Jan Kratochvil | 7b8c13a3ff | |
Jan Kratochvil | 941489ae9f | |
Jan Kratochvil | a7131289b9 | |
Dennis Gilmore | f6b4d6946b | |
Jan Kratochvil | fd71495700 | |
Jan Kratochvil | 562d933af5 | |
Dan Horák | 66fd671afb | |
Jan Kratochvil | d7181112aa | |
Jan Kratochvil | e36d664785 | |
Jan Kratochvil | a8ba821c57 | |
Jan Kratochvil | dbdd4476b8 | |
Jan Kratochvil | fc20e6331a |
|
@ -1 +1,2 @@
|
|||
gdb-7.1.90.20100721.tar.bz2
|
||||
gdb-7.2.tar.bz2
|
||||
libstdc++-v3-python-r155978.tar.bz2
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
to install and uninstall.
|
||||
* gstack.sh, gstack.1: New files.
|
||||
|
||||
diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
|
||||
--- gdb-7.0.1-empty/gdb/Makefile.in 2010-04-07 20:36:04.000000000 +0200
|
||||
+++ gdb-7.0.1/gdb/Makefile.in 2010-04-07 20:36:42.000000000 +0200
|
||||
@@ -989,7 +989,7 @@ install: all install-only
|
||||
Index: gdb-7.2/gdb/Makefile.in
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/Makefile.in 2010-09-03 09:37:55.000000000 +0200
|
||||
+++ gdb-7.2/gdb/Makefile.in 2010-09-03 09:38:45.000000000 +0200
|
||||
@@ -1010,7 +1010,7 @@ install: all install-only
|
||||
|
||||
# The "install-only" target also installs the syscalls' XML files in
|
||||
# the system.
|
||||
|
@ -16,10 +17,11 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
|
|||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e "$$t"` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -1021,9 +1021,26 @@ install-tui:
|
||||
$(DESTDIR)$(man1dir) ; \
|
||||
$(INSTALL_DATA) $(srcdir)/gdb.1 \
|
||||
$(DESTDIR)$(man1dir)/$$transformed_name.1
|
||||
@@ -1046,7 +1046,25 @@ install-tui:
|
||||
install-python:
|
||||
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
|
||||
|
||||
-uninstall: force $(CONFIG_UNINSTALL)
|
||||
+GSTACK=gstack
|
||||
+.PHONY: install-gstack
|
||||
+install-gstack:
|
||||
|
@ -37,14 +39,12 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
|
|||
+ $(DESTDIR)$(man1dir) ; \
|
||||
+ : $(INSTALL_DATA) $(srcdir)/gstack.1 \
|
||||
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
|
||||
|
||||
|
||||
-uninstall: force $(CONFIG_UNINSTALL)
|
||||
+
|
||||
+uninstall: force uninstall-gstack $(CONFIG_UNINSTALL)
|
||||
transformed_name=`t='$(program_transform_name)'; \
|
||||
echo gdb | sed -e $$t` ; \
|
||||
if test "x$$transformed_name" = x; then \
|
||||
@@ -1045,6 +1062,17 @@ uninstall-tui:
|
||||
@@ -1068,6 +1086,17 @@ uninstall-tui:
|
||||
fi ; \
|
||||
rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
|
||||
$(DESTDIR)$(man1dir)/$$transformed_name.1
|
||||
|
@ -62,9 +62,10 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
|
|||
|
||||
# The C++ name parser can be built standalone for testing.
|
||||
test-cp-name-parser.o: cp-name-parser.c
|
||||
diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
|
||||
--- gdb-7.0.1-empty/gdb/gstack.sh 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ gdb-7.0.1/gdb/gstack.sh 2010-04-07 20:36:47.000000000 +0200
|
||||
Index: gdb-7.2/gdb/gstack.sh
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/gstack.sh 2010-09-03 09:38:12.000000000 +0200
|
||||
@@ -0,0 +1,48 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
|
@ -114,8 +115,10 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
|
|||
+ -e 's/^\((gdb) \)*//' \
|
||||
+ -e '/^#/p' \
|
||||
+ -e '/^Thread/p'
|
||||
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
|
||||
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.exp 2010-04-07 21:53:57.000000000 +0200
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.base/gstack.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.base/gstack.exp 2010-09-03 09:38:12.000000000 +0200
|
||||
@@ -0,0 +1,71 @@
|
||||
+# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
|
@ -188,8 +191,10 @@ diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
|
|||
+gdb_exit
|
||||
+
|
||||
+remote_exec host "kill -9 $pid"
|
||||
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
|
||||
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.c 2010-04-07 21:46:52.000000000 +0200
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.base/gstack.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.base/gstack.c 2010-09-03 09:38:12.000000000 +0200
|
||||
@@ -0,0 +1,43 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
Index: gdb-7.1.90.20100721/gdb/doc/gdb.texinfo
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/doc/gdb.texinfo 2010-07-22 11:57:09.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/doc/gdb.texinfo 2010-07-22 11:57:34.000000000 +0200
|
||||
--- gdb-7.1.90.20100721.orig/gdb/doc/gdb.texinfo 2010-07-23 20:58:52.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/doc/gdb.texinfo 2010-07-23 20:59:15.000000000 +0200
|
||||
@@ -998,6 +998,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.
|
||||
|
@ -30,8 +30,8 @@ Index: gdb-7.1.90.20100721/gdb/doc/gdb.texinfo
|
|||
@node Mode Options
|
||||
Index: gdb-7.1.90.20100721/gdb/main.c
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/main.c 2010-07-22 11:57:10.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/main.c 2010-07-22 11:57:49.000000000 +0200
|
||||
--- gdb-7.1.90.20100721.orig/gdb/main.c 2010-07-23 20:58:55.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/main.c 2010-07-23 20:59:15.000000000 +0200
|
||||
@@ -391,6 +391,7 @@ captured_main (void *data)
|
||||
{"xdb", no_argument, &xdb_commands, 1},
|
||||
{"dbx", no_argument, &dbx_commands, 1},
|
||||
|
@ -50,8 +50,8 @@ Index: gdb-7.1.90.20100721/gdb/main.c
|
|||
--se=FILE Use FILE as symbol file and executable file.\n\
|
||||
Index: gdb-7.1.90.20100721/gdb/symfile.c
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/symfile.c 2010-07-22 11:57:09.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/symfile.c 2010-07-22 11:57:34.000000000 +0200
|
||||
--- gdb-7.1.90.20100721.orig/gdb/symfile.c 2010-07-23 20:58:52.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/symfile.c 2010-07-23 20:59:15.000000000 +0200
|
||||
@@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup (
|
||||
|
||||
/* Global variables owned by this file */
|
||||
|
@ -62,17 +62,17 @@ Index: gdb-7.1.90.20100721/gdb/symfile.c
|
|||
|
||||
Index: gdb-7.1.90.20100721/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/dwarf2read.c 2010-07-22 11:57:10.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/dwarf2read.c 2010-07-22 11:58:05.000000000 +0200
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "psympriv.h"
|
||||
--- gdb-7.1.90.20100721.orig/gdb/dwarf2read.c 2010-07-23 20:58:53.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/dwarf2read.c 2010-07-23 20:59:26.000000000 +0200
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "exceptions.h"
|
||||
#include "gdb_stat.h"
|
||||
#include "completer.h"
|
||||
+#include "top.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "gdb_string.h"
|
||||
@@ -1282,8 +1283,9 @@ dwarf2_has_info (struct objfile *objfile
|
||||
@@ -1283,8 +1284,9 @@ dwarf2_has_info (struct objfile *objfile
|
||||
bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
|
||||
dwarf2_per_objfile->objfile = objfile;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ Index: gdb-7.1.90.20100721/gdb/dwarf2read.c
|
|||
Index: gdb-7.1.90.20100721/gdb/top.h
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/top.h 2010-04-07 18:54:39.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/top.h 2010-07-22 11:57:34.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/top.h 2010-07-23 20:59:15.000000000 +0200
|
||||
@@ -61,6 +61,7 @@ extern void set_prompt (char *);
|
||||
|
||||
/* From random places. */
|
||||
|
|
|
@ -19,6 +19,8 @@ will get:
|
|||
Attached suggestion patch how to deal with the most common "errno" symbol
|
||||
for the most common under-ggdb3 compiled programs.
|
||||
|
||||
Original patch hooked into target_translate_tls_address. But its inferior
|
||||
call invalidates `struct frame *' in the callers - RH BZ 690908.
|
||||
|
||||
|
||||
2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
@ -30,114 +32,55 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
|
|||
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
|
||||
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
|
||||
|
||||
Index: gdb-7.0.50.20100128/gdb/gdbtypes.c
|
||||
Index: gdb-7.2/gdb/printcmd.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100128.orig/gdb/gdbtypes.c 2010-01-28 12:52:17.000000000 +0100
|
||||
+++ gdb-7.0.50.20100128/gdb/gdbtypes.c 2010-01-28 12:52:48.000000000 +0100
|
||||
@@ -3978,6 +3978,9 @@ gdbtypes_post_init (struct gdbarch *gdba
|
||||
= arch_type (gdbarch, TYPE_CODE_INTERNAL_FUNCTION, 0,
|
||||
"<internal function>");
|
||||
--- gdb-7.2.orig/gdb/printcmd.c 2011-03-29 10:55:32.000000000 +0200
|
||||
+++ gdb-7.2/gdb/printcmd.c 2011-03-29 10:56:00.000000000 +0200
|
||||
@@ -947,10 +947,10 @@ validate_format (struct format_data fmt,
|
||||
static void
|
||||
print_command_1 (char *exp, int inspect, int voidprint)
|
||||
{
|
||||
- struct expression *expr;
|
||||
struct cleanup *old_chain = 0;
|
||||
char format = 0;
|
||||
- struct value *val;
|
||||
+ /* False GCC warning due to the TRY_CATCH. */
|
||||
+ struct value *val = NULL;
|
||||
struct format_data fmt;
|
||||
int cleanup = 0;
|
||||
|
||||
+ builtin_type->nodebug_text_symbol_errno_location
|
||||
+ = lookup_function_type (lookup_pointer_type (builtin_type->builtin_int));
|
||||
+
|
||||
return builtin_type;
|
||||
}
|
||||
@@ -971,10 +971,25 @@ print_command_1 (char *exp, int inspect,
|
||||
|
||||
Index: gdb-7.0.50.20100128/gdb/gdbtypes.h
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100128.orig/gdb/gdbtypes.h 2010-01-28 12:52:17.000000000 +0100
|
||||
+++ gdb-7.0.50.20100128/gdb/gdbtypes.h 2010-01-28 12:52:48.000000000 +0100
|
||||
@@ -1245,6 +1245,8 @@ struct builtin_type
|
||||
|
||||
/* This type is used to represent a GDB internal function. */
|
||||
struct type *internal_fn;
|
||||
if (exp && *exp)
|
||||
{
|
||||
+ struct expression *expr;
|
||||
+ volatile struct gdb_exception except;
|
||||
+
|
||||
+ struct type *nodebug_text_symbol_errno_location;
|
||||
};
|
||||
|
||||
/* Return the type table for the specified architecture. */
|
||||
Index: gdb-7.0.50.20100128/gdb/parse.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100128.orig/gdb/parse.c 2010-01-28 12:52:19.000000000 +0100
|
||||
+++ gdb-7.0.50.20100128/gdb/parse.c 2010-01-28 12:53:20.000000000 +0100
|
||||
@@ -509,7 +509,11 @@ write_exp_msymbol (struct minimal_symbol
|
||||
case mst_text:
|
||||
case mst_file_text:
|
||||
case mst_solib_trampoline:
|
||||
- write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
|
||||
+ if (builtin_type (gdbarch)->nodebug_text_symbol_errno_location != NULL
|
||||
+ && strcmp (SYMBOL_LINKAGE_NAME (msymbol), "__errno_location") == 0)
|
||||
+ write_exp_elt_type (builtin_type (gdbarch)->nodebug_text_symbol_errno_location);
|
||||
+ else
|
||||
+ write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
|
||||
break;
|
||||
|
||||
case mst_text_gnu_ifunc:
|
||||
Index: gdb-7.0.50.20100128/gdb/target.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100128.orig/gdb/target.c 2010-01-28 12:52:29.000000000 +0100
|
||||
+++ gdb-7.0.50.20100128/gdb/target.c 2010-01-28 12:52:48.000000000 +0100
|
||||
@@ -1000,6 +1000,25 @@ pop_all_targets (int quitting)
|
||||
pop_all_targets_above (dummy_stratum, quitting);
|
||||
}
|
||||
|
||||
+static int
|
||||
+resolve_errno (void *arg)
|
||||
+{
|
||||
+ CORE_ADDR *arg_addr = arg;
|
||||
+ struct expression *expr;
|
||||
+ struct cleanup *old_chain = 0;
|
||||
+ struct value *val;
|
||||
+
|
||||
+ expr = parse_expression ("__errno_location()");
|
||||
+ old_chain = make_cleanup (free_current_contents, &expr);
|
||||
+ val = evaluate_expression (expr);
|
||||
+ *arg_addr = value_as_address (val);
|
||||
+ release_value (val);
|
||||
+ value_free (val);
|
||||
+ do_cleanups (old_chain);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Using the objfile specified in OBJFILE, find the address for the
|
||||
current thread's thread-local storage with offset OFFSET. */
|
||||
CORE_ADDR
|
||||
@@ -1090,7 +1109,28 @@ target_translate_tls_address (struct obj
|
||||
/* It wouldn't be wrong here to try a gdbarch method, too; finding
|
||||
TLS is an ABI-specific thing. But we don't do that yet. */
|
||||
else
|
||||
- error (_("Cannot find thread-local variables on this target"));
|
||||
+ {
|
||||
+ struct minimal_symbol *msymbol;
|
||||
+
|
||||
+ msymbol = lookup_minimal_symbol ("errno", NULL, NULL);
|
||||
+ if (msymbol != NULL
|
||||
+ && SYMBOL_VALUE_ADDRESS (msymbol) == offset
|
||||
+ && (SYMBOL_OBJ_SECTION (msymbol)->objfile == objfile
|
||||
+ || (objfile->separate_debug_objfile != NULL
|
||||
+ && SYMBOL_OBJ_SECTION (msymbol)->objfile
|
||||
+ == objfile->separate_debug_objfile)
|
||||
+ || (objfile->separate_debug_objfile_backlink != NULL
|
||||
+ && SYMBOL_OBJ_SECTION (msymbol)->objfile
|
||||
+ == objfile->separate_debug_objfile_backlink)))
|
||||
expr = parse_expression (exp);
|
||||
- old_chain = make_cleanup (free_current_contents, &expr);
|
||||
+ old_chain = make_cleanup (xfree, expr);
|
||||
cleanup = 1;
|
||||
- val = evaluate_expression (expr);
|
||||
+ TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||
+ {
|
||||
+ if (!catch_errors (resolve_errno, (void *) &addr, "",
|
||||
+ RETURN_MASK_ALL))
|
||||
+ error (_("TLS symbol `errno' not resolved for non-TLS program."
|
||||
+ " You should compile the program with `gcc -pthread'."));
|
||||
+ val = evaluate_expression (expr);
|
||||
+ }
|
||||
+ else
|
||||
+ error (_("Cannot find thread-local variables on this target"));
|
||||
+ }
|
||||
|
||||
return addr;
|
||||
}
|
||||
Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c
|
||||
+ if (except.reason < 0)
|
||||
+ {
|
||||
+ if (strcmp (exp, "errno") != 0)
|
||||
+ throw_exception (except);
|
||||
+
|
||||
+ expr = parse_expression ("*((int *(*) (void)) __errno_location) ()");
|
||||
+ make_cleanup (xfree, expr);
|
||||
+ val = evaluate_expression (expr);
|
||||
+ }
|
||||
}
|
||||
else
|
||||
val = access_value_history (0);
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2010-01-28 12:52:48.000000000 +0100
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2011-03-29 10:55:35.000000000 +0200
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
|
@ -167,10 +110,10 @@ Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c
|
|||
+
|
||||
+ return 0; /* breakpoint */
|
||||
+}
|
||||
Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2010-01-28 12:52:48.000000000 +0100
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2011-03-29 10:55:35.000000000 +0200
|
||||
@@ -0,0 +1,60 @@
|
||||
+# Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
--- ./gdb/elfread.c 2010-10-14 17:07:45.000000000 +0200
|
||||
+++ ./gdb/elfread.c 2010-10-14 17:06:30.000000000 +0200
|
||||
@@ -1382,6 +1382,18 @@ build_id_to_filename (struct build_id *b
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
+/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031
|
||||
+ librpm must not exit() an application on SIGINT
|
||||
+
|
||||
+ Enable or disable a signal handler. SIGNUM: signal to enable (or disable
|
||||
+ if negative). HANDLER: sa_sigaction handler (or NULL to use
|
||||
+ rpmsqHandler()). Returns: no. of refs, -1 on error. */
|
||||
+int
|
||||
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
|
||||
and avoid their duplicities during a single inferior run. */
|
||||
|
||||
--- ./gdb/proc-service.list 2010-05-28 20:50:30.000000000 +0200
|
||||
+++ ./gdb/proc-service.list 2010-10-14 17:06:30.000000000 +0200
|
||||
@@ -37,4 +37,7 @@
|
||||
ps_pstop;
|
||||
ps_ptread;
|
||||
ps_ptwrite;
|
||||
+
|
||||
+ /* gdb-6.6-buildid-locate-rpm.patch */
|
||||
+ rpmsqEnable;
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
Index: gdb-7.1.90.20100721/gdb/event-top.c
|
||||
Index: gdb-7.2/gdb/event-top.c
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/event-top.c 2010-06-26 08:44:47.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/event-top.c 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/event-top.c 2010-06-26 08:44:47.000000000 +0200
|
||||
+++ gdb-7.2/gdb/event-top.c 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "cli/cli-script.h" /* for reset_command_nest_depth */
|
||||
#include "main.h"
|
||||
|
@ -28,10 +28,10 @@ Index: gdb-7.1.90.20100721/gdb/event-top.c
|
|||
/* Each interpreter has its own rules on displaying the command
|
||||
prompt. */
|
||||
if (!current_interp_display_prompt_p ())
|
||||
Index: gdb-7.1.90.20100721/gdb/elfread.c
|
||||
Index: gdb-7.2/gdb/elfread.c
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/elfread.c 2010-07-22 11:58:14.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/elfread.c 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/elfread.c 2010-10-06 22:39:32.000000000 +0200
|
||||
+++ gdb-7.2/gdb/elfread.c 2010-10-06 22:39:52.000000000 +0200
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "gdbcore.h"
|
||||
#include "gdbcmd.h"
|
||||
|
@ -40,7 +40,7 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
|
|||
|
||||
extern void _initialize_elfread (void);
|
||||
|
||||
@@ -1371,8 +1372,353 @@ build_id_to_filename (struct build_id *b
|
||||
@@ -1371,8 +1372,361 @@ build_id_to_filename (struct build_id *b
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -113,9 +113,17 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
|
|||
+# define rpmtsInitIterator_p rpmtsInitIterator
|
||||
+#endif /* !DLOPEN_LIBRPM */
|
||||
+
|
||||
+ if (filename == NULL)
|
||||
+ gdb_assert (filename != NULL);
|
||||
+
|
||||
+ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (filename[0] != '/')
|
||||
+ {
|
||||
+ warning (_("Ignoring non-absolute filename: <%s>"), filename);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (!rpm_init_done)
|
||||
+ {
|
||||
+ static int init_tried;
|
||||
|
@ -395,7 +403,7 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
|
|||
avoidance. */
|
||||
|
||||
struct missing_filepair
|
||||
@@ -1426,11 +1772,17 @@ missing_filepair_change (void)
|
||||
@@ -1426,11 +1780,17 @@ missing_filepair_change (void)
|
||||
/* All their memory came just from missing_filepair_OBSTACK. */
|
||||
missing_filepair_hash = NULL;
|
||||
}
|
||||
|
@ -413,7 +421,7 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
|
|||
missing_filepair_change ();
|
||||
}
|
||||
|
||||
@@ -1497,14 +1849,34 @@ debug_print_missing (const char *binary,
|
||||
@@ -1497,14 +1857,35 @@ debug_print_missing (const char *binary,
|
||||
|
||||
*slot = missing_filepair;
|
||||
|
||||
|
@ -439,7 +447,8 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
|
|||
+ }
|
||||
+ }
|
||||
+ if (missing_exec != MISSING_EXEC_ENLISTED)
|
||||
+ if (missing_rpm_enlist (binary) == 0 && missing_rpm_enlist (debug) == 0)
|
||||
+ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0)
|
||||
+ && (debug == NULL || missing_rpm_enlist (debug) == 0))
|
||||
+#endif /* HAVE_LIBRPM */
|
||||
+ {
|
||||
+ /* We do not collect and flush these messages as each such message
|
||||
|
@ -455,22 +464,23 @@ Index: gdb-7.1.90.20100721/gdb/elfread.c
|
|||
}
|
||||
|
||||
static char *
|
||||
Index: gdb-7.1.90.20100721/gdb/symfile.h
|
||||
Index: gdb-7.2/gdb/symfile.h
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/symfile.h 2010-07-22 11:58:14.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/symfile.h 2010-07-22 11:58:24.000000000 +0200
|
||||
@@ -577,6 +577,7 @@ extern struct build_id *build_id_addr_ge
|
||||
--- gdb-7.2.orig/gdb/symfile.h 2010-10-06 22:39:32.000000000 +0200
|
||||
+++ gdb-7.2/gdb/symfile.h 2010-10-06 22:39:52.000000000 +0200
|
||||
@@ -577,6 +577,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);
|
||||
+extern void debug_flush_missing (void);
|
||||
+#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file")
|
||||
|
||||
/* From dwarf2read.c */
|
||||
|
||||
Index: gdb-7.1.90.20100721/gdb/testsuite/lib/gdb.exp
|
||||
Index: gdb-7.2/gdb/testsuite/lib/gdb.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/testsuite/lib/gdb.exp 2010-07-22 11:58:14.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/testsuite/lib/gdb.exp 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200
|
||||
+++ gdb-7.2/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -1359,7 +1359,7 @@ proc default_gdb_start { } {
|
||||
warning "Couldn't set the width to 0."
|
||||
}
|
||||
|
@ -480,10 +490,10 @@ Index: gdb-7.1.90.20100721/gdb/testsuite/lib/gdb.exp
|
|||
send_gdb "set build-id-verbose 0\n"
|
||||
gdb_expect 10 {
|
||||
-re "$gdb_prompt $" {
|
||||
Index: gdb-7.1.90.20100721/gdb/testsuite/lib/mi-support.exp
|
||||
Index: gdb-7.2/gdb/testsuite/lib/mi-support.exp
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/testsuite/lib/mi-support.exp 2010-07-22 11:58:14.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/testsuite/lib/mi-support.exp 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200
|
||||
+++ gdb-7.2/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
|
||||
}
|
||||
}
|
||||
|
@ -493,10 +503,10 @@ Index: gdb-7.1.90.20100721/gdb/testsuite/lib/mi-support.exp
|
|||
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.1.90.20100721/gdb/tui/tui-interp.c
|
||||
Index: gdb-7.2/gdb/tui/tui-interp.c
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/tui/tui-interp.c 2010-05-18 00:21:43.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/tui/tui-interp.c 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/tui/tui-interp.c 2010-05-18 00:21:43.000000000 +0200
|
||||
+++ gdb-7.2/gdb/tui/tui-interp.c 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "tui/tui.h"
|
||||
#include "tui/tui-io.h"
|
||||
|
@ -514,10 +524,10 @@ Index: gdb-7.1.90.20100721/gdb/tui/tui-interp.c
|
|||
/* 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.1.90.20100721/gdb/aclocal.m4
|
||||
Index: gdb-7.2/gdb/aclocal.m4
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/aclocal.m4 2010-05-23 02:56:59.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/aclocal.m4 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/aclocal.m4 2010-05-23 02:56:59.000000000 +0200
|
||||
+++ gdb-7.2/gdb/aclocal.m4 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -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'.])])
|
||||
|
@ -681,10 +691,10 @@ Index: gdb-7.1.90.20100721/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.1.90.20100721/gdb/config.in
|
||||
Index: gdb-7.2/gdb/config.in
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/config.in 2010-07-22 11:57:09.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/config.in 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/config.in 2010-10-06 22:39:31.000000000 +0200
|
||||
+++ gdb-7.2/gdb/config.in 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -46,6 +46,9 @@
|
||||
/* Define to BFD's default target vector. */
|
||||
#undef DEFAULT_BFD_VEC
|
||||
|
@ -705,10 +715,10 @@ Index: gdb-7.1.90.20100721/gdb/config.in
|
|||
/* Define if libunwind library is being used. */
|
||||
#undef HAVE_LIBUNWIND
|
||||
|
||||
Index: gdb-7.1.90.20100721/gdb/configure
|
||||
Index: gdb-7.2/gdb/configure
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/configure 2010-07-22 11:57:09.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/configure 2010-07-22 11:59:13.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/configure 2010-10-06 22:39:31.000000000 +0200
|
||||
+++ gdb-7.2/gdb/configure 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -679,6 +679,9 @@ REPORT_BUGS_TO
|
||||
PKGVERSION
|
||||
TARGET_OBS
|
||||
|
@ -1242,10 +1252,10 @@ Index: gdb-7.1.90.20100721/gdb/configure
|
|||
|
||||
|
||||
|
||||
Index: gdb-7.1.90.20100721/gdb/configure.ac
|
||||
Index: gdb-7.2/gdb/configure.ac
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/configure.ac 2010-07-22 11:57:09.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/configure.ac 2010-07-22 11:59:04.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/configure.ac 2010-10-06 22:39:31.000000000 +0200
|
||||
+++ gdb-7.2/gdb/configure.ac 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -152,6 +152,198 @@ else
|
||||
fi
|
||||
AC_SUBST(pythondir)
|
||||
|
@ -1445,10 +1455,10 @@ Index: gdb-7.1.90.20100721/gdb/configure.ac
|
|||
|
||||
AC_CONFIG_SUBDIRS(doc testsuite)
|
||||
|
||||
Index: gdb-7.1.90.20100721/gdb/acinclude.m4
|
||||
Index: gdb-7.2/gdb/acinclude.m4
|
||||
===================================================================
|
||||
--- gdb-7.1.90.20100721.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200
|
||||
+++ gdb-7.1.90.20100721/gdb/acinclude.m4 2010-07-22 11:58:24.000000000 +0200
|
||||
--- gdb-7.2.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200
|
||||
+++ gdb-7.2/gdb/acinclude.m4 2010-10-06 22:39:32.000000000 +0200
|
||||
@@ -1,3 +1,5 @@
|
||||
+# serial 1
|
||||
+
|
||||
|
@ -1464,3 +1474,16 @@ Index: gdb-7.1.90.20100721/gdb/acinclude.m4
|
|||
# @defmac AC_PROG_CC_STDC
|
||||
# @maindex PROG_CC_STDC
|
||||
# @ovindex CC
|
||||
Index: gdb-7.2/gdb/corelow.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/corelow.c 2010-10-06 22:39:39.000000000 +0200
|
||||
+++ gdb-7.2/gdb/corelow.c 2010-10-06 22:39:52.000000000 +0200
|
||||
@@ -331,7 +331,7 @@ build_id_locate_exec (int from_tty)
|
||||
symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
|
||||
}
|
||||
else
|
||||
- debug_print_missing (_("the main executable file"), build_id_filename);
|
||||
+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename);
|
||||
|
||||
do_cleanups (back_to);
|
||||
|
||||
|
|
|
@ -79,6 +79,35 @@ Index: gdb-7.0.50.20100115/gdb/linux-nat.c
|
|||
}
|
||||
|
||||
/* Convert a native/host siginfo object, into/from the siginfo in the
|
||||
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 22:19:27.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 22:19:55.000000000 +0100
|
||||
@@ -1768,8 +1768,22 @@ 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);
|
||||
+ /* 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;
|
||||
}
|
||||
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
|
||||
|
|
|
@ -2,11 +2,12 @@ Index: gdb-7.1.90.20100711/bfd/elf-bfd.h
|
|||
===================================================================
|
||||
--- gdb-7.1.90.20100711.orig/bfd/elf-bfd.h 2010-06-27 06:07:51.000000000 +0200
|
||||
+++ gdb-7.1.90.20100711/bfd/elf-bfd.h 2010-07-12 23:00:04.000000000 +0200
|
||||
@@ -2171,8 +2171,9 @@ extern Elf_Internal_Phdr * _bfd_elf_find
|
||||
@@ -2171,8 +2171,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
|
||||
/* Exported interface for writing elf corefile notes. */
|
||||
extern char *elfcore_write_note
|
||||
(bfd *, char *, int *, const char *, int, const void *, int);
|
||||
+#include <sys/procfs.h>
|
||||
+struct elf_prpsinfo;
|
||||
+typedef struct elf_prpsinfo prpsinfo_t;
|
||||
extern char *elfcore_write_prpsinfo
|
||||
- (bfd *, char *, int *, const char *, const char *);
|
||||
+ (bfd *, char *, int *, const prpsinfo_t *);
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
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 <aristovski@qnx.com>
|
||||
+
|
||||
+ * 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 <pmuldoon@redhat.com>
|
||||
|
||||
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
|
||||
@@ -75,7 +75,8 @@ static void maintenance_cplus_namespace
|
||||
#define ANONYMOUS_NAMESPACE_LEN 21
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -114,7 +115,7 @@ cp_scan_for_anonymous_namespaces (const
|
||||
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,
|
||||
- &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
|
||||
@@ -712,7 +712,7 @@ define_symbol (CORE_ADDR valu, char *str
|
||||
memcpy (name, string, p - string);
|
||||
name[p - string] = '\0';
|
||||
new_name = cp_canonicalize_string (name);
|
||||
- cp_scan_for_anonymous_namespaces (sym);
|
||||
+ cp_scan_for_anonymous_namespaces (sym, objfile);
|
||||
}
|
||||
if (new_name != NULL)
|
||||
{
|
|
@ -0,0 +1,241 @@
|
|||
--- ./gdb/defs.h 2011-01-15 20:02:32.000000000 +0100
|
||||
+++ ./gdb/defs.h 2011-01-15 20:10:17.000000000 +0100
|
||||
@@ -396,6 +396,8 @@ extern struct cleanup *make_cleanup_rest
|
||||
extern struct cleanup *
|
||||
set_batch_flag_and_make_cleanup_restore_page_info (void);
|
||||
|
||||
+extern struct cleanup *make_cleanup_restore_selected_frame (void);
|
||||
+
|
||||
extern char *gdb_realpath (const char *);
|
||||
extern char *xfullpath (const char *);
|
||||
|
||||
--- ./gdb/dwarf2loc.c 2011-01-15 20:02:32.000000000 +0100
|
||||
+++ ./gdb/dwarf2loc.c 2011-01-15 20:10:17.000000000 +0100
|
||||
@@ -1059,7 +1059,7 @@ dwarf2_evaluate_loc_desc (struct type *t
|
||||
{
|
||||
struct value *retval;
|
||||
struct dwarf_expr_context *ctx;
|
||||
- struct cleanup *old_chain = make_cleanup (null_cleanup, 0);
|
||||
+ struct cleanup *old_chain;
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
@@ -1069,6 +1069,8 @@ dwarf2_evaluate_loc_desc (struct type *t
|
||||
return retval;
|
||||
}
|
||||
|
||||
+ old_chain = make_cleanup (null_cleanup, 0);
|
||||
+
|
||||
ctx = dwarf_expr_prep_ctx (frame, data, size, per_cu);
|
||||
|
||||
if (ctx->num_pieces > 0)
|
||||
@@ -1104,6 +1106,10 @@ dwarf2_evaluate_loc_desc (struct type *t
|
||||
CORE_ADDR address = dwarf_expr_fetch_address (ctx, 0);
|
||||
int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
|
||||
|
||||
+ /* Frame may be needed for check_typedef of TYPE_DYNAMIC. */
|
||||
+ make_cleanup_restore_selected_frame ();
|
||||
+ select_frame (frame);
|
||||
+
|
||||
/* object_address_set called here is required in ALLOCATE_VALUE's
|
||||
CHECK_TYPEDEF for the object's possible
|
||||
DW_OP_push_object_address. */
|
||||
--- ./gdb/dwarf2read.c 2011-01-15 20:02:38.000000000 +0100
|
||||
+++ ./gdb/dwarf2read.c 2011-01-15 20:10:17.000000000 +0100
|
||||
@@ -7933,7 +7933,9 @@ read_subrange_type (struct die_info *die
|
||||
high = dwarf2_get_attr_constant_value (attr, 0);
|
||||
else
|
||||
{
|
||||
- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
|
||||
+ /* Ada expects an empty array on no boundary attributes. */
|
||||
+ if (cu->language != language_ada)
|
||||
+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
|
||||
high = low - 1;
|
||||
}
|
||||
if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
|
||||
--- ./gdb/stack.c 2011-01-15 20:02:32.000000000 +0100
|
||||
+++ ./gdb/stack.c 2011-01-15 20:10:17.000000000 +0100
|
||||
@@ -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
|
||||
--- ./gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 2011-01-15 20:03:20.000000000 +0100
|
||||
@@ -0,0 +1,24 @@
|
||||
+! Copyright 2010 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.
|
||||
+!
|
||||
+! Ihis file is the Fortran source file for dynamic.exp.
|
||||
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
|
||||
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+subroutine bar
|
||||
+ real :: dummy
|
||||
+ dummy = 1
|
||||
+end subroutine bar
|
||||
--- ./gdb/testsuite/gdb.fortran/dynamic-other-frame.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.fortran/dynamic-other-frame.exp 2011-01-15 20:03:20.000000000 +0100
|
||||
@@ -0,0 +1,37 @@
|
||||
+# Copyright 2010 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.
|
||||
+
|
||||
+set testfile "dynamic-other-frame"
|
||||
+set srcfile1 ${testfile}.f90
|
||||
+set srcfile2 ${testfile}-stub.f90
|
||||
+set objfile2 ${objdir}/${subdir}/${testfile}-stub.o
|
||||
+set executable ${testfile}
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f77}] != ""
|
||||
+ || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f77}] != "" } {
|
||||
+ untested "Couldn't compile ${srcfile1} or ${srcfile2}"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart ${executable}
|
||||
+
|
||||
+if ![runto bar_] then {
|
||||
+ perror "couldn't run to bar_"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_test "bt" {foo \(string='hello'.*}
|
||||
--- ./gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 2011-01-15 20:03:20.000000000 +0100
|
||||
@@ -0,0 +1,36 @@
|
||||
+! Copyright 2010 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.
|
||||
+!
|
||||
+! Ihis file is the Fortran source file for dynamic.exp.
|
||||
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
|
||||
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+subroutine foo (string)
|
||||
+ interface
|
||||
+ subroutine bar
|
||||
+ end subroutine
|
||||
+ end interface
|
||||
+ character string*(*)
|
||||
+ call bar ! stop-here
|
||||
+end subroutine foo
|
||||
+program test
|
||||
+ interface
|
||||
+ subroutine foo (string)
|
||||
+ character string*(*)
|
||||
+ end subroutine
|
||||
+ end interface
|
||||
+ call foo ('hello')
|
||||
+end
|
||||
--- ./gdb/testsuite/gdb.opt/fortran-string.exp 2011-01-15 20:02:32.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.opt/fortran-string.exp 2011-01-15 20:10:17.000000000 +0100
|
||||
@@ -29,13 +29,11 @@ if { [prepare_for_testing ${test}.exp ${
|
||||
return -1
|
||||
}
|
||||
|
||||
-if ![runto MAIN__] then {
|
||||
+if ![runto $srcfile:[gdb_get_line_number "s = s"]] then {
|
||||
perror "couldn't run to breakpoint MAIN__"
|
||||
continue
|
||||
}
|
||||
|
||||
-gdb_breakpoint [gdb_get_line_number "s = s"]
|
||||
-gdb_continue_to_breakpoint "s = s"
|
||||
gdb_test "frame" ".*s='foo'.*"
|
||||
gdb_test "ptype s" "type = character\\*3"
|
||||
gdb_test "p s" "\\$\[0-9\]* = 'foo'"
|
||||
--- ./gdb/utils.c 2011-01-15 20:02:38.000000000 +0100
|
||||
+++ ./gdb/utils.c 2011-01-15 20:10:17.000000000 +0100
|
||||
@@ -2179,6 +2179,36 @@ set_batch_flag_and_make_cleanup_restore_
|
||||
return back_to;
|
||||
}
|
||||
|
||||
+/* Helper for make_cleanup_restore_page_info. */
|
||||
+
|
||||
+static void
|
||||
+do_restore_selected_frame_cleanup (void *arg)
|
||||
+{
|
||||
+ struct frame_id *frame_idp = arg;
|
||||
+
|
||||
+ select_frame (frame_find_by_id (*frame_idp));
|
||||
+
|
||||
+ xfree (frame_idp);
|
||||
+}
|
||||
+
|
||||
+/* Provide cleanup for restoring currently selected frame. Use frame_id for
|
||||
+ the case the current frame becomes stale in the meantime. */
|
||||
+
|
||||
+struct cleanup *
|
||||
+make_cleanup_restore_selected_frame (void)
|
||||
+{
|
||||
+ struct frame_id *frame_idp;
|
||||
+
|
||||
+ /* get_selected_frame->get_current_frame would error otherwise. */
|
||||
+ if (!has_stack_frames ())
|
||||
+ return make_cleanup (null_cleanup, NULL);
|
||||
+
|
||||
+ frame_idp = xmalloc (sizeof (*frame_idp));
|
||||
+ *frame_idp = get_frame_id (get_selected_frame (NULL));
|
||||
+
|
||||
+ return make_cleanup (do_restore_selected_frame_cleanup, frame_idp);
|
||||
+}
|
||||
+
|
||||
/* Set the screen size based on LINES_PER_PAGE and CHARS_PER_LINE. */
|
||||
|
||||
static void
|
|
@ -0,0 +1,90 @@
|
|||
From 3f323125c4c8d9c4c00cb8941149ac36443dac26 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 18 Feb 2011 00:17:35 +0100
|
||||
Subject: [PATCH 1/2] Fix subranges bug http://sourceware.org/bugzilla/show_bug.cgi?id=9395#c5
|
||||
reported by Joachim Protze.
|
||||
|
||||
---
|
||||
gdb/eval.c | 1 +
|
||||
gdb/testsuite/gdb.fortran/subrange.exp | 31 ++++++++++++++++++++-----------
|
||||
gdb/testsuite/gdb.fortran/subrange.f90 | 7 ++++++-
|
||||
3 files changed, 27 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/gdb/eval.c b/gdb/eval.c
|
||||
index f21ae38..6f37f2c 100644
|
||||
--- a/gdb/eval.c
|
||||
+++ b/gdb/eval.c
|
||||
@@ -563,6 +563,7 @@ value_f90_subarray (struct value *array, struct expression *exp, int *pos,
|
||||
value_byte_address = (TYPE_DATA_LOCATION_ADDR (type)
|
||||
+ value_offset (array));
|
||||
TYPE_DATA_LOCATION_IS_ADDR (type) = 0;
|
||||
+ TYPE_DATA_LOCATION_DWARF_BLOCK (type) = NULL;
|
||||
}
|
||||
else
|
||||
value_byte_address = value_address (array);
|
||||
diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp
|
||||
index 55598f9..be372c1 100644
|
||||
--- a/gdb/testsuite/gdb.fortran/subrange.exp
|
||||
+++ b/gdb/testsuite/gdb.fortran/subrange.exp
|
||||
@@ -34,17 +34,26 @@ set int4 "(int4|integer\\(kind=4\\))"
|
||||
gdb_breakpoint [gdb_get_line_number "break-static"]
|
||||
gdb_continue_to_breakpoint "break-static" ".*break-static.*"
|
||||
|
||||
-gdb_test "p a (2, 2:3)" { = \(22, 32\)}
|
||||
-gdb_test "p a (2:3, 3)" { = \(32, 33\)}
|
||||
-gdb_test "p a (1, 2:)" { = \(21, 31\)}
|
||||
-gdb_test "p a (2, :2)" { = \(12, 22\)}
|
||||
-gdb_test "p a (3, 2:2)" { = \(23\)}
|
||||
-gdb_test "ptype a (3, 2:2)" " = $int4 \\(2:2\\)"
|
||||
-gdb_test "p a (4, :)" { = \(14, 24, 34\)}
|
||||
-gdb_test "p a (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
|
||||
-gdb_test "ptype a (:, :)" " = $int4 \\(4,3\\)"
|
||||
-gdb_test "p a (:)" "Wrong number of subscripts"
|
||||
-gdb_test "p a (:, :, :)" "Wrong number of subscripts"
|
||||
+foreach var {a alloc ptr} {
|
||||
+ global pf_prefix
|
||||
+ set old_prefix $pf_prefix
|
||||
+ lappend pf_prefix "$var:"
|
||||
+
|
||||
+ gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
|
||||
+ gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
|
||||
+ gdb_test "p $var (1, 2:)" { = \(21, 31\)}
|
||||
+ gdb_test "p $var (2, :2)" { = \(12, 22\)}
|
||||
+ gdb_test "p $var (3, 2:2)" { = \(23\)}
|
||||
+ gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
|
||||
+ gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
|
||||
+ gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
|
||||
+ gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
|
||||
+ gdb_test "p $var (:)" "Wrong number of subscripts"
|
||||
+ gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
|
||||
+
|
||||
+ set pf_prefix $old_prefix
|
||||
+}
|
||||
+
|
||||
gdb_test_no_output {set $a=a}
|
||||
delete_breakpoints
|
||||
gdb_unload
|
||||
diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90
|
||||
index fe33c2c..4747ea9 100644
|
||||
--- a/gdb/testsuite/gdb.fortran/subrange.f90
|
||||
+++ b/gdb/testsuite/gdb.fortran/subrange.f90
|
||||
@@ -14,10 +14,15 @@
|
||||
! along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
program test
|
||||
- integer :: a (4, 3)
|
||||
+ integer, target :: a (4, 3)
|
||||
+ integer, allocatable :: alloc (:, :)
|
||||
+ integer, pointer :: ptr (:, :)
|
||||
do 1 i = 1, 4
|
||||
do 1 j = 1, 3
|
||||
a (i, j) = j * 10 + i
|
||||
1 continue
|
||||
+ allocate (alloc (4, 3))
|
||||
+ alloc = a
|
||||
+ ptr => a
|
||||
write (*,*) a ! break-static
|
||||
end
|
||||
--
|
||||
1.7.4
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From 678cbb7340d8edfa92ce6de931d8d4e9c3b86c06 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri, 18 Feb 2011 00:46:12 +0100
|
||||
Subject: [PATCH 2/2] Fix the remaining two FAILing subrange testcases.
|
||||
|
||||
---
|
||||
gdb/dwarf2read.c | 14 ++++++++------
|
||||
gdb/eval.c | 5 ++++-
|
||||
2 files changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
index 89d15d1..a9099be 100644
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -7416,6 +7416,14 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
for (i = ndim - 1; i >= 0; i--)
|
||||
type = create_single_array_dimension (type, range_types[i], die, cu);
|
||||
|
||||
+ /* Data locations should be set only for the outermost dimension as they
|
||||
+ would be confusing for the dereferenced offset on the inner ones. */
|
||||
+ attr = dwarf2_attr (die, DW_AT_data_location, cu);
|
||||
+ if (attr_form_is_block (attr))
|
||||
+ TYPE_DATA_LOCATION_DWARF_BLOCK (type)
|
||||
+ = dwarf2_attr_to_locexpr_baton (attr, cu);
|
||||
+ gdb_assert (!TYPE_DATA_LOCATION_IS_ADDR (type));
|
||||
+
|
||||
/* Understand Dwarf2 support for vector types (like they occur on
|
||||
the PowerPC w/ AltiVec). Gcc just adds another attribute to the
|
||||
array type. This is not part of the Dwarf2/3 standard yet, but a
|
||||
@@ -15072,12 +15080,6 @@ fetch_die_type_attrs (struct die_info *die, struct type *type,
|
||||
{
|
||||
struct attribute *attr;
|
||||
|
||||
- attr = dwarf2_attr (die, DW_AT_data_location, cu);
|
||||
- if (attr_form_is_block (attr))
|
||||
- TYPE_DATA_LOCATION_DWARF_BLOCK (type) = dwarf2_attr_to_locexpr_baton (attr,
|
||||
- cu);
|
||||
- gdb_assert (!TYPE_DATA_LOCATION_IS_ADDR (type));
|
||||
-
|
||||
attr = dwarf2_attr (die, DW_AT_allocated, cu);
|
||||
if (attr_form_is_block (attr))
|
||||
TYPE_ALLOCATED (type) = dwarf2_attr_to_locexpr_baton (attr, cu);
|
||||
diff --git a/gdb/eval.c b/gdb/eval.c
|
||||
index 6f37f2c..f4ccc89 100644
|
||||
--- a/gdb/eval.c
|
||||
+++ b/gdb/eval.c
|
||||
@@ -566,7 +566,10 @@ value_f90_subarray (struct value *array, struct expression *exp, int *pos,
|
||||
TYPE_DATA_LOCATION_DWARF_BLOCK (type) = NULL;
|
||||
}
|
||||
else
|
||||
- value_byte_address = value_address (array);
|
||||
+ {
|
||||
+ gdb_assert (TYPE_DATA_LOCATION_DWARF_BLOCK (type) == NULL);
|
||||
+ value_byte_address = value_address (array);
|
||||
+ }
|
||||
|
||||
new_array_type = type;
|
||||
|
||||
--
|
||||
1.7.4
|
||||
|
|
@ -0,0 +1,504 @@
|
|||
--- ./gdb/eval.c 2011-01-15 20:02:32.000000000 +0100
|
||||
+++ ./gdb/eval.c 2011-01-15 20:30:07.000000000 +0100
|
||||
@@ -506,27 +506,198 @@ init_array_element (struct value *array,
|
||||
}
|
||||
|
||||
static struct value *
|
||||
-value_f90_subarray (struct value *array,
|
||||
- struct expression *exp, int *pos, enum noside noside)
|
||||
+value_f90_subarray (struct value *array, struct expression *exp, int *pos,
|
||||
+ int nargs, enum noside noside)
|
||||
{
|
||||
- int pc = (*pos) + 1;
|
||||
- LONGEST low_bound, high_bound;
|
||||
- struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array)));
|
||||
- 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 being iterated for each dimension. */
|
||||
+ struct type *type;
|
||||
+
|
||||
+ /* Pointer in the last holder to the type of current dimension. */
|
||||
+ struct type **typep = &new_array_type;
|
||||
+
|
||||
+ struct subscript_index
|
||||
+ {
|
||||
+ enum { SUBSCRIPT_RANGE, SUBSCRIPT_NUMBER } kind;
|
||||
+ union
|
||||
+ {
|
||||
+ struct subscript_range
|
||||
+ {
|
||||
+ enum f90_range_type f90_range_type;
|
||||
+ LONGEST low_bound, high_bound;
|
||||
+ }
|
||||
+ range;
|
||||
+ LONGEST number;
|
||||
+ };
|
||||
+ }
|
||||
+ *subscript_array;
|
||||
+ int i;
|
||||
+ struct cleanup *old_chain;
|
||||
+ CORE_ADDR value_byte_address, value_byte_offset = 0;
|
||||
+ htab_t copied_types;
|
||||
+ struct value *saved_array;
|
||||
+
|
||||
+ old_chain = make_cleanup (null_cleanup, 0);
|
||||
+ object_address_set (value_raw_address (array));
|
||||
+
|
||||
+ if (value_optimized_out (array)
|
||||
+ || (VALUE_LVAL (array) != not_lval
|
||||
+ && VALUE_LVAL (array) != lval_memory
|
||||
+ && VALUE_LVAL (array) != lval_internalvar_component
|
||||
+ && VALUE_LVAL (array) != lval_internalvar))
|
||||
+ error (_("value being subranged must be in memory"));
|
||||
+ type = check_typedef (value_type (array));
|
||||
+ f_object_address_data_valid_or_error (type);
|
||||
+
|
||||
+ copied_types = create_copied_types_hash (NULL);
|
||||
+ type = copy_type_recursive (type, copied_types);
|
||||
+ htab_delete (copied_types);
|
||||
+
|
||||
+ if (nargs != calc_f77_array_dims (type))
|
||||
+ error (_("Wrong number of subscripts"));
|
||||
+
|
||||
+ if (TYPE_DATA_LOCATION_IS_ADDR (type))
|
||||
+ {
|
||||
+ value_byte_address = (TYPE_DATA_LOCATION_ADDR (type)
|
||||
+ + value_offset (array));
|
||||
+ TYPE_DATA_LOCATION_IS_ADDR (type) = 0;
|
||||
+ }
|
||||
else
|
||||
- low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
||||
+ value_byte_address = value_address (array);
|
||||
|
||||
- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT)
|
||||
- high_bound = TYPE_HIGH_BOUND (range);
|
||||
+ new_array_type = type;
|
||||
+
|
||||
+ subscript_array = alloca (sizeof (*subscript_array) * nargs);
|
||||
+
|
||||
+ gdb_assert (nargs > 0);
|
||||
+
|
||||
+ /* Now that we know we have a legal array subscript expression
|
||||
+ let us actually find out where this element exists in the array. */
|
||||
+
|
||||
+ /* Take array indices left to right. */
|
||||
+ for (i = 0; i < nargs; i++)
|
||||
+ {
|
||||
+ struct subscript_index *index = &subscript_array[i];
|
||||
+
|
||||
+ if (exp->elts[*pos].opcode == OP_F90_RANGE)
|
||||
+ {
|
||||
+ int pc = (*pos) + 1;
|
||||
+ struct subscript_range *range;
|
||||
+
|
||||
+ index->kind = SUBSCRIPT_RANGE;
|
||||
+ range = &index->range;
|
||||
+
|
||||
+ *pos += 3;
|
||||
+ range->f90_range_type = longest_to_int (exp->elts[pc].longconst);
|
||||
+
|
||||
+ if (range->f90_range_type == HIGH_BOUND_DEFAULT
|
||||
+ || range->f90_range_type == NONE_BOUND_DEFAULT)
|
||||
+ range->low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
+ pos, noside));
|
||||
+
|
||||
+ if (range->f90_range_type == LOW_BOUND_DEFAULT
|
||||
+ || range->f90_range_type == NONE_BOUND_DEFAULT)
|
||||
+ range->high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp,
|
||||
+ pos, noside));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ struct value *val;
|
||||
+
|
||||
+ index->kind = SUBSCRIPT_NUMBER;
|
||||
+
|
||||
+ /* Evaluate each subscript; it must be a legal integer in F77. */
|
||||
+ val = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
+ index->number = value_as_long (val);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Internal type of array is arranged right to left. */
|
||||
+ for (i = nargs - 1; i >= 0; i--)
|
||||
+ {
|
||||
+ struct subscript_index *index = &subscript_array[i];
|
||||
+ struct type *range_type = TYPE_INDEX_TYPE (type);
|
||||
+
|
||||
+ switch (index->kind)
|
||||
+ {
|
||||
+ case SUBSCRIPT_RANGE:
|
||||
+ {
|
||||
+ struct subscript_range *range = &index->range;
|
||||
+ CORE_ADDR byte_offset;
|
||||
+
|
||||
+ if (range->f90_range_type == LOW_BOUND_DEFAULT
|
||||
+ || range->f90_range_type == BOTH_BOUND_DEFAULT)
|
||||
+ range->low_bound = TYPE_LOW_BOUND (range_type);
|
||||
+
|
||||
+ if (range->f90_range_type == HIGH_BOUND_DEFAULT
|
||||
+ || range->f90_range_type == BOTH_BOUND_DEFAULT)
|
||||
+ range->high_bound = TYPE_HIGH_BOUND (range_type);
|
||||
+
|
||||
+ if (range->low_bound < TYPE_LOW_BOUND (range_type)
|
||||
+ || (!TYPE_HIGH_BOUND_UNDEFINED (range_type)
|
||||
+ && range->high_bound > TYPE_HIGH_BOUND (range_type)))
|
||||
+ error (_("slice out of range"));
|
||||
+
|
||||
+ byte_offset = ((range->low_bound - TYPE_LOW_BOUND (range_type))
|
||||
+ * TYPE_ARRAY_BYTE_STRIDE_VALUE (type));
|
||||
+ TYPE_LOW_BOUND (range_type) = range->low_bound;
|
||||
+ TYPE_HIGH_BOUND (range_type) = range->high_bound;
|
||||
+ if (range->f90_range_type == LOW_BOUND_DEFAULT
|
||||
+ || range->f90_range_type == NONE_BOUND_DEFAULT)
|
||||
+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 0;
|
||||
+
|
||||
+ typep = &TYPE_TARGET_TYPE (type);
|
||||
+ value_byte_offset += byte_offset;
|
||||
+ type = TYPE_TARGET_TYPE (type);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case SUBSCRIPT_NUMBER:
|
||||
+ {
|
||||
+ CORE_ADDR byte_offset;
|
||||
+
|
||||
+ if (index->number < TYPE_LOW_BOUND (range_type)
|
||||
+ || (!TYPE_HIGH_BOUND_UNDEFINED (range_type)
|
||||
+ && index->number > TYPE_HIGH_BOUND (range_type)))
|
||||
+ error (_("no such vector element"));
|
||||
+
|
||||
+ byte_offset = ((index->number - TYPE_LOW_BOUND (range_type))
|
||||
+ * TYPE_ARRAY_BYTE_STRIDE_VALUE (type));
|
||||
+
|
||||
+ type = TYPE_TARGET_TYPE (type);
|
||||
+ *typep = type;
|
||||
+ value_byte_offset += byte_offset;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ check_typedef (new_array_type);
|
||||
+ saved_array = array;
|
||||
+ array = allocate_value_lazy (new_array_type);
|
||||
+ VALUE_LVAL (array) = VALUE_LVAL (saved_array);
|
||||
+ if (VALUE_LVAL (saved_array) == lval_internalvar_component)
|
||||
+ VALUE_LVAL (array) = lval_internalvar;
|
||||
else
|
||||
- high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
||||
+ VALUE_LVAL (array) = VALUE_LVAL (saved_array);
|
||||
+ 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);
|
||||
+
|
||||
+ memcpy (value_contents_writeable (array),
|
||||
+ value_contents (saved_array) + value_byte_offset,
|
||||
+ TYPE_LENGTH (new_array_type));
|
||||
+ }
|
||||
+
|
||||
+ do_cleanups (old_chain);
|
||||
+ return array;
|
||||
}
|
||||
|
||||
|
||||
@@ -1829,19 +2000,8 @@ evaluate_subexp_standard (struct type *e
|
||||
switch (code)
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
|
||||
- return value_f90_subarray (arg1, exp, pos, noside);
|
||||
- else
|
||||
- goto multi_f77_subscript;
|
||||
-
|
||||
case TYPE_CODE_STRING:
|
||||
- if (exp->elts[*pos].opcode == OP_F90_RANGE)
|
||||
- return value_f90_subarray (arg1, exp, pos, noside);
|
||||
- else
|
||||
- {
|
||||
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
- return value_subscript (arg1, value_as_long (arg2));
|
||||
- }
|
||||
+ return value_f90_subarray (arg1, exp, pos, nargs, noside);
|
||||
|
||||
case TYPE_CODE_PTR:
|
||||
case TYPE_CODE_FUNC:
|
||||
@@ -2257,104 +2417,6 @@ evaluate_subexp_standard (struct type *e
|
||||
}
|
||||
return (arg1);
|
||||
|
||||
- multi_f77_subscript:
|
||||
- {
|
||||
- int subscript_array[MAX_FORTRAN_DIMS];
|
||||
- int array_size_array[MAX_FORTRAN_DIMS];
|
||||
- int byte_stride_array[MAX_FORTRAN_DIMS];
|
||||
- int ndimensions = 1, i;
|
||||
- struct type *tmp_type;
|
||||
- int offset_item; /* The array offset where the item lives */
|
||||
- CORE_ADDR offset_byte; /* byte_stride based offset */
|
||||
- unsigned element_size;
|
||||
-
|
||||
- if (nargs > MAX_FORTRAN_DIMS)
|
||||
- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
|
||||
-
|
||||
- old_chain = make_cleanup (null_cleanup, 0);
|
||||
- object_address_set (value_raw_address (arg1));
|
||||
-
|
||||
- tmp_type = check_typedef (value_type (arg1));
|
||||
- ndimensions = calc_f77_array_dims (type);
|
||||
-
|
||||
- if (nargs != ndimensions)
|
||||
- error (_("Wrong number of subscripts"));
|
||||
-
|
||||
- gdb_assert (nargs > 0);
|
||||
-
|
||||
- /* Now that we know we have a legal array subscript expression
|
||||
- let us actually find out where this element exists in the array. */
|
||||
-
|
||||
- offset_item = 0;
|
||||
- /* Take array indices left to right */
|
||||
- for (i = 0; i < nargs; i++)
|
||||
- {
|
||||
- /* Evaluate each subscript, It must be a legal integer in F77 */
|
||||
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
-
|
||||
- /* Fill in the subscript and array size arrays */
|
||||
-
|
||||
- subscript_array[i] = value_as_long (arg2);
|
||||
- }
|
||||
-
|
||||
- /* Internal type of array is arranged right to left */
|
||||
- for (i = 0; i < nargs; i++)
|
||||
- {
|
||||
- upper = f77_get_upperbound (tmp_type);
|
||||
- lower = f77_get_lowerbound (tmp_type);
|
||||
-
|
||||
- byte_stride_array[nargs - i - 1] =
|
||||
- TYPE_ARRAY_BYTE_STRIDE_VALUE (tmp_type);
|
||||
-
|
||||
- array_size_array[nargs - i - 1] = upper - lower + 1;
|
||||
-
|
||||
- /* Zero-normalize subscripts so that offsetting will work. */
|
||||
-
|
||||
- subscript_array[nargs - i - 1] -= lower;
|
||||
-
|
||||
- /* If we are at the bottom of a multidimensional
|
||||
- array type then keep a ptr to the last ARRAY
|
||||
- type around for use when calling value_subscript()
|
||||
- below. This is done because we pretend to value_subscript
|
||||
- that we actually have a one-dimensional array
|
||||
- of base element type that we apply a simple
|
||||
- offset to. */
|
||||
-
|
||||
- if (i < nargs - 1)
|
||||
- tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
|
||||
- }
|
||||
-
|
||||
- /* Kept for the f77_get_upperbound / f77_get_lowerbound calls above. */
|
||||
- do_cleanups (old_chain);
|
||||
-
|
||||
- /* Now let us calculate the offset for this item */
|
||||
-
|
||||
- offset_item = 0;
|
||||
- offset_byte = 0;
|
||||
-
|
||||
- for (i = ndimensions - 1; i >= 0; --i)
|
||||
- {
|
||||
- offset_item *= array_size_array[i];
|
||||
- if (byte_stride_array[i] == 0)
|
||||
- offset_item += subscript_array[i];
|
||||
- else
|
||||
- offset_byte += subscript_array[i] * byte_stride_array[i];
|
||||
- }
|
||||
-
|
||||
- element_size = TYPE_LENGTH (TYPE_TARGET_TYPE (tmp_type));
|
||||
- offset_byte += offset_item * element_size;
|
||||
-
|
||||
- /* Let us now play a dirty trick: we will take arg1
|
||||
- which is a value node pointing to the topmost level
|
||||
- of the multidimensional array-set and pretend
|
||||
- that it is actually a array of the final element
|
||||
- type, this will ensure that value_subscript()
|
||||
- returns the correct type value */
|
||||
-
|
||||
- deprecated_set_value_type (arg1, tmp_type);
|
||||
- return value_subscripted_rvalue (arg1, offset_byte);
|
||||
- }
|
||||
-
|
||||
case BINOP_LOGICAL_AND:
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
@@ -3090,18 +3152,25 @@ parse_and_eval_type (char *p, int length
|
||||
int
|
||||
calc_f77_array_dims (struct type *array_type)
|
||||
{
|
||||
- int ndimen = 1;
|
||||
- struct type *tmp_type;
|
||||
+ switch (TYPE_CODE (array_type))
|
||||
+ {
|
||||
+ case TYPE_CODE_STRING:
|
||||
+ return 1;
|
||||
|
||||
- if ((TYPE_CODE (array_type) != TYPE_CODE_ARRAY))
|
||||
- error (_("Can't get dimensions for a non-array type"));
|
||||
+ case TYPE_CODE_ARRAY:
|
||||
+ {
|
||||
+ int ndimen = 1;
|
||||
|
||||
- tmp_type = array_type;
|
||||
+ while ((array_type = TYPE_TARGET_TYPE (array_type)))
|
||||
+ {
|
||||
+ if (TYPE_CODE (array_type) == TYPE_CODE_ARRAY)
|
||||
+ ++ndimen;
|
||||
+ }
|
||||
+ return ndimen;
|
||||
+ }
|
||||
|
||||
- while ((tmp_type = TYPE_TARGET_TYPE (tmp_type)))
|
||||
- {
|
||||
- if (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY)
|
||||
- ++ndimen;
|
||||
+ default:
|
||||
+ error (_("Can't get dimensions for a non-array/non-string type"));
|
||||
}
|
||||
- return ndimen;
|
||||
+
|
||||
}
|
||||
--- ./gdb/f-exp.y 2010-06-03 00:41:55.000000000 +0200
|
||||
+++ ./gdb/f-exp.y 2011-01-15 20:03:20.000000000 +0100
|
||||
@@ -293,7 +293,9 @@ arglist : subrange
|
||||
{ arglist_len = 1; }
|
||||
;
|
||||
|
||||
-arglist : arglist ',' exp %prec ABOVE_COMMA
|
||||
+arglist : arglist ',' exp %prec ABOVE_COMMA
|
||||
+ { arglist_len++; }
|
||||
+ | arglist ',' subrange %prec ABOVE_COMMA
|
||||
{ arglist_len++; }
|
||||
;
|
||||
|
||||
--- ./gdb/gdbtypes.c 2011-01-15 20:02:38.000000000 +0100
|
||||
+++ ./gdb/gdbtypes.c 2011-01-15 20:45:55.000000000 +0100
|
||||
@@ -3478,6 +3477,16 @@ copy_type_recursive_1 (struct objfile *o
|
||||
copy_type_recursive_1 (objfile,
|
||||
TYPE_VPTR_BASETYPE (type),
|
||||
copied_types);
|
||||
+
|
||||
+ if (TYPE_CODE (new_type) == TYPE_CODE_ARRAY)
|
||||
+ {
|
||||
+ struct type *new_index_type = TYPE_INDEX_TYPE (new_type);
|
||||
+
|
||||
+ if (TYPE_BYTE_STRIDE (new_index_type) == 0)
|
||||
+ TYPE_BYTE_STRIDE (new_index_type)
|
||||
+ = TYPE_LENGTH (TYPE_TARGET_TYPE (new_type));
|
||||
+ }
|
||||
+
|
||||
/* Maybe copy the type_specific bits.
|
||||
|
||||
NOTE drow/2005-12-09: We do not copy the C++-specific bits like
|
||||
--- ./gdb/testsuite/gdb.fortran/subrange.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.fortran/subrange.exp 2011-01-15 20:03:20.000000000 +0100
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [skip_fortran_tests] } { return -1 }
|
||||
+
|
||||
+set testfile "subrange"
|
||||
+set srcfile ${testfile}.f90
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto MAIN__] {
|
||||
+ perror "Couldn't run to MAIN__"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# Depending on the compiler version being used, the name of the 4-byte integer
|
||||
+# and real types can be printed differently. For instance, gfortran-4.1 uses
|
||||
+# "int4" whereas gfortran-4.3 uses "int(kind=4)".
|
||||
+set int4 "(int4|integer\\(kind=4\\))"
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "break-static"]
|
||||
+gdb_continue_to_breakpoint "break-static" ".*break-static.*"
|
||||
+
|
||||
+gdb_test "p a (2, 2:3)" { = \(22, 32\)}
|
||||
+gdb_test "p a (2:3, 3)" { = \(32, 33\)}
|
||||
+gdb_test "p a (1, 2:)" { = \(21, 31\)}
|
||||
+gdb_test "p a (2, :2)" { = \(12, 22\)}
|
||||
+gdb_test "p a (3, 2:2)" { = \(23\)}
|
||||
+gdb_test "ptype a (3, 2:2)" " = $int4 \\(2:2\\)"
|
||||
+gdb_test "p a (4, :)" { = \(14, 24, 34\)}
|
||||
+gdb_test "p a (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
|
||||
+gdb_test "ptype a (:, :)" " = $int4 \\(4,3\\)"
|
||||
+gdb_test "p a (:)" "Wrong number of subscripts"
|
||||
+gdb_test "p a (:, :, :)" "Wrong number of subscripts"
|
||||
+gdb_test_no_output {set $a=a}
|
||||
+delete_breakpoints
|
||||
+gdb_unload
|
||||
+gdb_test {p $a (3, 2:2)} { = \(23\)}
|
||||
--- ./gdb/testsuite/gdb.fortran/subrange.f90 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.fortran/subrange.f90 2011-01-15 20:03:20.000000000 +0100
|
||||
@@ -0,0 +1,23 @@
|
||||
+! 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+program test
|
||||
+ integer :: a (4, 3)
|
||||
+ do 1 i = 1, 4
|
||||
+ do 1 j = 1, 3
|
||||
+ a (i, j) = j * 10 + i
|
||||
+1 continue
|
||||
+ write (*,*) a ! break-static
|
||||
+end
|
||||
--- ./gdb/testsuite/lib/gdb.exp 2011-01-15 20:02:38.000000000 +0100
|
||||
+++ ./gdb/testsuite/lib/gdb.exp 2011-01-15 20:03:20.000000000 +0100
|
||||
@@ -149,6 +149,11 @@ proc gdb_unload {} {
|
||||
verbose "\t\tKilling previous program being debugged"
|
||||
exp_continue
|
||||
}
|
||||
+ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\
|
||||
+ { send_gdb "y\n"
|
||||
+ verbose "\t\tUnloading symbols for program being debugged"
|
||||
+ exp_continue
|
||||
+ }
|
||||
-re "Discard symbol table from .*y or n.*$" {
|
||||
send_gdb "y\n"
|
||||
exp_continue
|
286
gdb-archer.patch
286
gdb-archer.patch
|
@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
|
|||
http://sourceware.org/gdb/wiki/ArcherBranchManagement
|
||||
|
||||
GIT snapshot:
|
||||
commit 202f4d0e3af8d8a8d7c0b408d9e0a8cb69f912b6
|
||||
commit 74fff58d0076fe97c6c99d65fa58126315266646
|
||||
|
||||
branch `archer' - the merge of branches:
|
||||
archer-jankratochvil-vla
|
||||
|
@ -15,7 +15,7 @@ archer-tromey-optional-psymtab (cherry-picked from post-7.2 master)
|
|||
|
||||
|
||||
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
|
||||
index 6dbb284..6133da3 100644
|
||||
index f07bc8b..3703dca 100644
|
||||
--- a/gdb/Makefile.in
|
||||
+++ b/gdb/Makefile.in
|
||||
@@ -169,6 +169,12 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
|
||||
|
@ -57,7 +57,7 @@ index 6dbb284..6133da3 100644
|
|||
|
||||
# Header files that already have srcdir in them, or which are in objdir.
|
||||
|
||||
@@ -1299,6 +1305,12 @@ stamp-h: $(srcdir)/config.in config.status
|
||||
@@ -1301,6 +1307,12 @@ stamp-h: $(srcdir)/config.in config.status
|
||||
CONFIG_LINKS= \
|
||||
$(SHELL) config.status
|
||||
|
||||
|
@ -70,7 +70,7 @@ index 6dbb284..6133da3 100644
|
|||
config.status: $(srcdir)/configure configure.tgt configure.host
|
||||
$(SHELL) config.status --recheck
|
||||
|
||||
@@ -2022,6 +2034,10 @@ py-function.o: $(srcdir)/python/py-function.c
|
||||
@@ -2024,6 +2036,10 @@ py-function.o: $(srcdir)/python/py-function.c
|
||||
$(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c
|
||||
$(POSTCOMPILE)
|
||||
|
||||
|
@ -81,7 +81,7 @@ index 6dbb284..6133da3 100644
|
|||
py-inferior.o: $(srcdir)/python/py-inferior.c
|
||||
$(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-inferior.c
|
||||
$(POSTCOMPILE)
|
||||
@@ -2070,6 +2086,36 @@ py-value.o: $(srcdir)/python/py-value.c
|
||||
@@ -2072,6 +2088,36 @@ py-value.o: $(srcdir)/python/py-value.c
|
||||
$(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-value.c
|
||||
$(POSTCOMPILE)
|
||||
|
||||
|
@ -289,7 +289,7 @@ index 0348bf4..f01d0ee 100644
|
|||
|
||||
/* Return the innermost stack frame executing inside of BLOCK,
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
index 4affe0a..584c68e 100644
|
||||
index 6a6864c..5df336d 100644
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -62,6 +62,7 @@
|
||||
|
@ -1349,7 +1349,7 @@ index 1fc457d..f4c846a 100644
|
|||
#undef PYTHON_PATH_RELOCATABLE
|
||||
|
||||
diff --git a/gdb/configure b/gdb/configure
|
||||
index 94eb9b9..e49da08 100755
|
||||
index 041ffc1..8243abb 100755
|
||||
--- a/gdb/configure
|
||||
+++ b/gdb/configure
|
||||
@@ -679,6 +679,8 @@ REPORT_BUGS_TO
|
||||
|
@ -1454,17 +1454,16 @@ index 94eb9b9..e49da08 100755
|
|||
|
||||
|
||||
subdirs="$subdirs doc testsuite"
|
||||
@@ -10881,6 +10955,8 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h
|
||||
CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
|
||||
@@ -10919,6 +10993,7 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h
|
||||
CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
|
||||
CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
|
||||
+ CONFIG_INSTALL="$CONFIG_INSTALL install-python"
|
||||
CONFIG_INSTALL="$CONFIG_INSTALL install-python"
|
||||
+ CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python"
|
||||
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
|
||||
|
||||
# Flags needed to compile Python code (taken from python-config --cflags).
|
||||
diff --git a/gdb/configure.ac b/gdb/configure.ac
|
||||
index 9300544..380473a 100644
|
||||
index b69c3b6..4e89558 100644
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -108,6 +108,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat
|
||||
|
@ -1519,31 +1518,16 @@ index 9300544..380473a 100644
|
|||
AC_CONFIG_SUBDIRS(doc testsuite)
|
||||
|
||||
# Check whether to support alternative target configurations
|
||||
@@ -828,6 +873,8 @@ if test "${have_libpython}" != no; then
|
||||
CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
|
||||
@@ -833,6 +878,7 @@ if test "${have_libpython}" != no; then
|
||||
CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
|
||||
CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
|
||||
+ CONFIG_INSTALL="$CONFIG_INSTALL install-python"
|
||||
CONFIG_INSTALL="$CONFIG_INSTALL install-python"
|
||||
+ CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python"
|
||||
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
|
||||
|
||||
# Flags needed to compile Python code (taken from python-config --cflags).
|
||||
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
|
||||
index 04f1683..a2a6e30 100644
|
||||
--- a/gdb/doc/ChangeLog
|
||||
+++ b/gdb/doc/ChangeLog
|
||||
@@ -1,5 +1,9 @@
|
||||
2010-07-13 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
+ * gdb.texinfo (Index Files): New node.
|
||||
+
|
||||
+2010-07-13 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
* gdb.texinfo (GDB/MI Variable Objects): Remove extra 'for'.
|
||||
|
||||
2010-07-01 Pedro Alves <pedro@codesourcery.com>
|
||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||
index 1297175..c030b65 100644
|
||||
index 65d4899..96767b0 100644
|
||||
--- a/gdb/doc/gdb.texinfo
|
||||
+++ b/gdb/doc/gdb.texinfo
|
||||
@@ -1162,6 +1162,16 @@ for remote debugging.
|
||||
|
@ -1563,7 +1547,7 @@ index 1297175..c030b65 100644
|
|||
@c resolve the situation of these eventually
|
||||
@item -tui
|
||||
@cindex @code{--tui}
|
||||
@@ -14282,6 +14292,7 @@ program. To debug a core dump of a previous run, you must also tell
|
||||
@@ -14308,6 +14318,7 @@ program. To debug a core dump of a previous run, you must also tell
|
||||
@menu
|
||||
* Files:: Commands to specify files
|
||||
* Separate Debug Files:: Debugging information in separate files
|
||||
|
@ -1571,7 +1555,7 @@ index 1297175..c030b65 100644
|
|||
* Symbol Errors:: Errors reading symbol files
|
||||
* Data Files:: GDB data files
|
||||
@end menu
|
||||
@@ -15171,6 +15182,46 @@ gnu_debuglink_crc32 (unsigned long crc,
|
||||
@@ -15197,6 +15208,46 @@ gnu_debuglink_crc32 (unsigned long crc,
|
||||
This computation does not apply to the ``build ID'' method.
|
||||
|
||||
|
||||
|
@ -1618,7 +1602,7 @@ index 1297175..c030b65 100644
|
|||
@node Symbol Errors
|
||||
@section Errors Reading Symbol Files
|
||||
|
||||
@@ -20310,8 +20361,6 @@ containing @code{end}. For example:
|
||||
@@ -20349,8 +20400,6 @@ containing @code{end}. For example:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) python
|
||||
|
@ -1627,7 +1611,7 @@ index 1297175..c030b65 100644
|
|||
>print 23
|
||||
>end
|
||||
23
|
||||
@@ -20324,6 +20373,14 @@ in a Python script. This can be controlled using @code{maint set
|
||||
@@ -20363,6 +20412,14 @@ in a Python script. This can be controlled using @code{maint set
|
||||
python print-stack}: if @code{on}, the default, then Python stack
|
||||
printing is enabled; if @code{off}, then Python stack printing is
|
||||
disabled.
|
||||
|
@ -1642,7 +1626,7 @@ index 1297175..c030b65 100644
|
|||
@end table
|
||||
|
||||
It is also possible to execute a Python script from the @value{GDBN}
|
||||
@@ -20345,6 +20402,14 @@ and thus is always available.
|
||||
@@ -20384,6 +20441,14 @@ and thus is always available.
|
||||
@cindex python api
|
||||
@cindex programming in python
|
||||
|
||||
|
@ -1657,7 +1641,7 @@ index 1297175..c030b65 100644
|
|||
@cindex python stdout
|
||||
@cindex python pagination
|
||||
At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
|
||||
@@ -20356,7 +20421,7 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
|
||||
@@ -20395,7 +20460,7 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
|
||||
@menu
|
||||
* Basic Python:: Basic Python Functions.
|
||||
* Exception Handling::
|
||||
|
@ -1666,7 +1650,7 @@ index 1297175..c030b65 100644
|
|||
* Types In Python:: Python representation of types.
|
||||
* Pretty Printing API:: Pretty-printing values.
|
||||
* Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
|
||||
@@ -20415,6 +20480,12 @@ Return a sequence holding all of @value{GDBN}'s breakpoints.
|
||||
@@ -20456,6 +20521,12 @@ Return a sequence holding all of @value{GDBN}'s breakpoints.
|
||||
@xref{Breakpoints In Python}, for more information.
|
||||
@end defun
|
||||
|
||||
|
@ -1679,7 +1663,7 @@ index 1297175..c030b65 100644
|
|||
@findex gdb.parameter
|
||||
@defun parameter parameter
|
||||
Return the value of a @value{GDBN} parameter. @var{parameter} is a
|
||||
@@ -20431,6 +20502,7 @@ a Python value of the appropriate type, and returned.
|
||||
@@ -20472,6 +20543,7 @@ a Python value of the appropriate type, and returned.
|
||||
@defun history number
|
||||
Return a value from @value{GDBN}'s value history (@pxref{Value
|
||||
History}). @var{number} indicates which history element to return.
|
||||
|
@ -1687,7 +1671,7 @@ index 1297175..c030b65 100644
|
|||
If @var{number} is negative, then @value{GDBN} will take its absolute value
|
||||
and count backward from the last element (i.e., the most recent element) to
|
||||
find the value to return. If @var{number} is zero, then @value{GDBN} will
|
||||
@@ -20455,6 +20527,21 @@ compute values, for example, it is the only way to get the value of a
|
||||
@@ -20496,6 +20568,21 @@ compute values, for example, it is the only way to get the value of a
|
||||
convenience variable (@pxref{Convenience Vars}) as a @code{gdb.Value}.
|
||||
@end defun
|
||||
|
||||
|
@ -1894,7 +1878,7 @@ index 61b8f00..d94c03c 100644
|
|||
/* The current depth of dwarf expression recursion, via DW_OP_call*,
|
||||
DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum
|
||||
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
|
||||
index 2a8e557..be74412 100644
|
||||
index f59bc40..7ff0ef9 100644
|
||||
--- a/gdb/dwarf2loc.c
|
||||
+++ b/gdb/dwarf2loc.c
|
||||
@@ -48,6 +48,12 @@ static void
|
||||
|
@ -2172,7 +2156,7 @@ index 2a8e557..be74412 100644
|
|||
retval = allocate_value (type);
|
||||
VALUE_LVAL (retval) = lval_memory;
|
||||
set_value_lazy (retval, 1);
|
||||
@@ -2586,11 +2744,51 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
|
||||
@@ -2590,11 +2748,51 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
|
||||
dlbaton->per_cu);
|
||||
}
|
||||
|
||||
|
@ -2246,19 +2230,20 @@ index 826bc45..1e7d8dc 100644
|
|||
|
||||
#endif /* dwarf2loc.h */
|
||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||
index 16381de..31a7d83 100644
|
||||
index 1e75235..d54e266 100644
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -51,6 +51,8 @@
|
||||
@@ -51,6 +51,9 @@
|
||||
#include "typeprint.h"
|
||||
#include "jv-lang.h"
|
||||
#include "psympriv.h"
|
||||
+#include "exceptions.h"
|
||||
+#include "gdb_stat.h"
|
||||
+#include "completer.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "gdb_string.h"
|
||||
@@ -129,6 +131,33 @@ struct dwarf2_section_info
|
||||
@@ -129,6 +132,33 @@ struct dwarf2_section_info
|
||||
int readin;
|
||||
};
|
||||
|
||||
|
@ -2292,7 +2277,7 @@ index 16381de..31a7d83 100644
|
|||
struct dwarf2_per_objfile
|
||||
{
|
||||
struct dwarf2_section_info info;
|
||||
@@ -141,6 +170,7 @@ struct dwarf2_per_objfile
|
||||
@@ -141,6 +171,7 @@ struct dwarf2_per_objfile
|
||||
struct dwarf2_section_info types;
|
||||
struct dwarf2_section_info frame;
|
||||
struct dwarf2_section_info eh_frame;
|
||||
|
@ -2300,7 +2285,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
/* Back link. */
|
||||
struct objfile *objfile;
|
||||
@@ -163,6 +193,12 @@ struct dwarf2_per_objfile
|
||||
@@ -163,6 +194,12 @@ struct dwarf2_per_objfile
|
||||
/* A flag indicating wether this objfile has a section loaded at a
|
||||
VMA of 0. */
|
||||
int has_section_at_zero;
|
||||
|
@ -2313,7 +2298,7 @@ index 16381de..31a7d83 100644
|
|||
};
|
||||
|
||||
static struct dwarf2_per_objfile *dwarf2_per_objfile;
|
||||
@@ -182,6 +218,7 @@ static struct dwarf2_per_objfile *dwarf2_per_objfile;
|
||||
@@ -182,6 +219,7 @@ static struct dwarf2_per_objfile *dwarf2_per_objfile;
|
||||
#define TYPES_SECTION "debug_types"
|
||||
#define FRAME_SECTION "debug_frame"
|
||||
#define EH_FRAME_SECTION "eh_frame"
|
||||
|
@ -2321,7 +2306,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
/* local data types */
|
||||
|
||||
@@ -307,6 +344,32 @@ struct dwarf2_cu
|
||||
@@ -307,6 +345,32 @@ struct dwarf2_cu
|
||||
unsigned int has_namespace_info : 1;
|
||||
};
|
||||
|
||||
|
@ -2354,7 +2339,7 @@ index 16381de..31a7d83 100644
|
|||
/* Persistent data held for a compilation unit, even when not
|
||||
processing it. We put a pointer to this structure in the
|
||||
read_symtab_private field of the psymtab. If we encounter
|
||||
@@ -347,10 +410,21 @@ struct dwarf2_per_cu_data
|
||||
@@ -347,10 +411,21 @@ struct dwarf2_per_cu_data
|
||||
it. */
|
||||
htab_t type_hash;
|
||||
|
||||
|
@ -2380,7 +2365,7 @@ index 16381de..31a7d83 100644
|
|||
};
|
||||
|
||||
/* Entry in the signatured_types hash table. */
|
||||
@@ -1083,6 +1157,9 @@ static int attr_form_is_section_offset (struct attribute *);
|
||||
@@ -1083,6 +1158,9 @@ static int attr_form_is_section_offset (struct attribute *);
|
||||
|
||||
static int attr_form_is_constant (struct attribute *);
|
||||
|
||||
|
@ -2390,7 +2375,7 @@ index 16381de..31a7d83 100644
|
|||
static void dwarf2_symbol_mark_computed (struct attribute *attr,
|
||||
struct symbol *sym,
|
||||
struct dwarf2_cu *cu);
|
||||
@@ -1113,6 +1190,9 @@ static void age_cached_comp_units (void);
|
||||
@@ -1113,6 +1191,9 @@ static void age_cached_comp_units (void);
|
||||
|
||||
static void free_one_cached_comp_unit (void *);
|
||||
|
||||
|
@ -2400,7 +2385,7 @@ index 16381de..31a7d83 100644
|
|||
static struct type *set_die_type (struct die_info *, struct type *,
|
||||
struct dwarf2_cu *);
|
||||
|
||||
@@ -1132,6 +1212,56 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
|
||||
@@ -1132,6 +1213,56 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
|
||||
|
||||
static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu);
|
||||
|
||||
|
@ -2457,7 +2442,7 @@ index 16381de..31a7d83 100644
|
|||
/* Try to locate the sections we need for DWARF 2 debugging
|
||||
information and return true if we have enough to do something. */
|
||||
|
||||
@@ -1230,6 +1360,11 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
|
||||
@@ -1230,6 +1361,11 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
|
||||
dwarf2_per_objfile->types.asection = sectp;
|
||||
dwarf2_per_objfile->types.size = bfd_get_section_size (sectp);
|
||||
}
|
||||
|
@ -2469,17 +2454,13 @@ index 16381de..31a7d83 100644
|
|||
|
||||
if ((bfd_get_section_flags (abfd, sectp) & SEC_LOAD)
|
||||
&& bfd_section_vma (abfd, sectp) == 0)
|
||||
@@ -1349,91 +1484,944 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
|
||||
}
|
||||
}
|
||||
@@ -1353,87 +1489,940 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
|
||||
if (pagesize == 0)
|
||||
pagesize = getpagesize ();
|
||||
|
||||
-#ifdef HAVE_MMAP
|
||||
- if (pagesize == 0)
|
||||
- pagesize = getpagesize ();
|
||||
+#ifdef HAVE_MMAP
|
||||
+ if (pagesize == 0)
|
||||
+ pagesize = getpagesize ();
|
||||
+
|
||||
- /* Only try to mmap sections which are large enough: we don't want to
|
||||
- waste space due to fragmentation. Also, only try mmap for sections
|
||||
- without relocations. */
|
||||
+ /* Only try to mmap sections which are large enough: we don't want to
|
||||
+ waste space due to fragmentation. Also, only try mmap for sections
|
||||
+ without relocations. */
|
||||
|
@ -3296,13 +3277,10 @@ index 16381de..31a7d83 100644
|
|||
+ offset_type iter;
|
||||
+ dw2_setup (objfile);
|
||||
|
||||
- /* Only try to mmap sections which are large enough: we don't want to
|
||||
- waste space due to fragmentation. Also, only try mmap for sections
|
||||
- without relocations. */
|
||||
- if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0)
|
||||
+ if (!dwarf2_per_objfile->index_table)
|
||||
+ return;
|
||||
|
||||
- if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0)
|
||||
+
|
||||
+ for (iter = 0;
|
||||
+ iter < dwarf2_per_objfile->index_table->index_table_slots;
|
||||
+ ++iter)
|
||||
|
@ -3479,7 +3457,15 @@ index 16381de..31a7d83 100644
|
|||
/* Build a partial symbol table. */
|
||||
|
||||
void
|
||||
@@ -1897,7 +2885,7 @@ process_psymtab_comp_unit (struct objfile *objfile,
|
||||
@@ -1699,6 +2688,7 @@ create_debug_types_hash_table (struct objfile *objfile)
|
||||
type_sig->signature = signature;
|
||||
type_sig->offset = offset;
|
||||
type_sig->type_offset = type_offset;
|
||||
+ type_sig->per_cu.objfile = objfile;
|
||||
|
||||
slot = htab_find_slot (types_htab, type_sig, INSERT);
|
||||
gdb_assert (slot != NULL);
|
||||
@@ -1897,7 +2887,7 @@ process_psymtab_comp_unit (struct objfile *objfile,
|
||||
/* Store the function that reads in the rest of the symbol table */
|
||||
pst->read_symtab = dwarf2_psymtab_to_symtab;
|
||||
|
||||
|
@ -3488,7 +3474,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
dwarf2_find_base_address (comp_unit_die, &cu);
|
||||
|
||||
@@ -2182,6 +3170,7 @@ create_all_comp_units (struct objfile *objfile)
|
||||
@@ -2182,6 +3172,7 @@ create_all_comp_units (struct objfile *objfile)
|
||||
memset (this_cu, 0, sizeof (*this_cu));
|
||||
this_cu->offset = offset;
|
||||
this_cu->length = length + initial_length_size;
|
||||
|
@ -3496,7 +3482,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
if (n_comp_units == n_allocated)
|
||||
{
|
||||
@@ -2613,7 +3602,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
|
||||
@@ -2613,7 +3604,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
|
||||
addrmap_set_empty (objfile->psymtabs_addrmap,
|
||||
pdi->lowpc + baseaddr,
|
||||
pdi->highpc - 1 + baseaddr,
|
||||
|
@ -3505,7 +3491,7 @@ index 16381de..31a7d83 100644
|
|||
}
|
||||
if (!pdi->is_declaration)
|
||||
/* Ignore subprogram DIEs that do not have a name, they are
|
||||
@@ -2885,7 +3874,6 @@ locate_pdi_sibling (struct partial_die_info *orig_pdi,
|
||||
@@ -2885,7 +3876,6 @@ locate_pdi_sibling (struct partial_die_info *orig_pdi,
|
||||
static void
|
||||
dwarf2_psymtab_to_symtab (struct partial_symtab *pst)
|
||||
{
|
||||
|
@ -3513,7 +3499,7 @@ index 16381de..31a7d83 100644
|
|||
if (pst != NULL)
|
||||
{
|
||||
if (pst->readin)
|
||||
@@ -2958,7 +3946,9 @@ process_queue (struct objfile *objfile)
|
||||
@@ -2958,7 +3948,9 @@ process_queue (struct objfile *objfile)
|
||||
may load a new CU, adding it to the end of the queue. */
|
||||
for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
|
||||
{
|
||||
|
@ -3524,7 +3510,7 @@ index 16381de..31a7d83 100644
|
|||
process_full_comp_unit (item->per_cu);
|
||||
|
||||
item->per_cu->queued = 0;
|
||||
@@ -3035,22 +4025,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
|
||||
@@ -3035,22 +4027,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3548,7 +3534,7 @@ index 16381de..31a7d83 100644
|
|||
}
|
||||
|
||||
/* Load the DIEs associated with PER_CU into memory. */
|
||||
@@ -3130,9 +4105,8 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu, struct objfile *objfile)
|
||||
@@ -3130,9 +4107,8 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu, struct objfile *objfile)
|
||||
static void
|
||||
process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
|
||||
{
|
||||
|
@ -3559,7 +3545,7 @@ index 16381de..31a7d83 100644
|
|||
CORE_ADDR lowpc, highpc;
|
||||
struct symtab *symtab;
|
||||
struct cleanup *back_to;
|
||||
@@ -3165,8 +4139,15 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
|
||||
@@ -3165,8 +4141,15 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
|
||||
{
|
||||
symtab->language = cu->language;
|
||||
}
|
||||
|
@ -3577,7 +3563,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
do_cleanups (back_to);
|
||||
}
|
||||
@@ -3559,6 +4540,46 @@ free_cu_line_header (void *arg)
|
||||
@@ -3557,6 +4540,46 @@ free_cu_line_header (void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3624,7 +3610,7 @@ index 16381de..31a7d83 100644
|
|||
read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
struct objfile *objfile = cu->objfile;
|
||||
@@ -3584,35 +4605,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -3582,35 +4605,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
lowpc += baseaddr;
|
||||
highpc += baseaddr;
|
||||
|
||||
|
@ -3661,7 +3647,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
attr = dwarf2_attr (die, DW_AT_language, cu);
|
||||
if (attr)
|
||||
@@ -5531,6 +6524,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -5529,6 +6524,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
new_symbol (die, this_type, cu);
|
||||
}
|
||||
|
||||
|
@ -3691,7 +3677,7 @@ index 16381de..31a7d83 100644
|
|||
/* 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. */
|
||||
@@ -5544,7 +6560,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -5542,7 +6560,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;
|
||||
|
@ -3700,7 +3686,7 @@ index 16381de..31a7d83 100644
|
|||
struct cleanup *back_to;
|
||||
char *name;
|
||||
|
||||
@@ -5597,17 +6613,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -5595,17 +6613,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
type = element_type;
|
||||
|
||||
if (read_array_order (die, cu) == DW_ORD_col_major)
|
||||
|
@ -3723,7 +3709,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
/* Understand Dwarf2 support for vector types (like they occur on
|
||||
the PowerPC w/ AltiVec). Gcc just adds another attribute to the
|
||||
@@ -6061,29 +7071,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -6059,29 +7071,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;
|
||||
|
@ -3852,7 +3838,7 @@ index 16381de..31a7d83 100644
|
|||
char_type = language_string_char_type (cu->language_defn, gdbarch);
|
||||
type = create_string_type (NULL, char_type, range_type);
|
||||
|
||||
@@ -6326,60 +7421,136 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -6324,60 +7421,136 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
struct type *base_type;
|
||||
struct type *range_type;
|
||||
struct attribute *attr;
|
||||
|
@ -4023,7 +4009,7 @@ index 16381de..31a7d83 100644
|
|||
}
|
||||
|
||||
/* Dwarf-2 specifications explicitly allows to create subrange types
|
||||
@@ -6421,20 +7592,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -6419,20 +7592,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4077,7 +4063,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
name = dwarf2_name (die, cu);
|
||||
if (name)
|
||||
@@ -8714,10 +9906,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
|
||||
@@ -8712,10 +9906,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
|
||||
|
@ -4092,7 +4078,7 @@ index 16381de..31a7d83 100644
|
|||
}
|
||||
|
||||
/* Given a pointer to a DWARF information entry, figure out if we need
|
||||
@@ -8748,6 +9942,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||
@@ -8746,6 +9942,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||
sizeof (struct symbol));
|
||||
OBJSTAT (objfile, n_syms++);
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
|
@ -4101,7 +4087,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
/* Cache this symbol's name and the name's demangled form (if any). */
|
||||
SYMBOL_LANGUAGE (sym) = cu->language;
|
||||
@@ -9379,6 +10575,9 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
|
||||
@@ -9375,6 +10573,9 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4111,7 +4097,7 @@ index 16381de..31a7d83 100644
|
|||
return this_type;
|
||||
}
|
||||
|
||||
@@ -11983,67 +13182,102 @@ attr_form_is_constant (struct attribute *attr)
|
||||
@@ -11979,67 +13180,102 @@ attr_form_is_constant (struct attribute *attr)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4263,7 +4249,7 @@ index 16381de..31a7d83 100644
|
|||
}
|
||||
}
|
||||
|
||||
@@ -12054,7 +13288,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
|
||||
@@ -12050,7 +13286,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
|
||||
struct objfile *
|
||||
dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu)
|
||||
{
|
||||
|
@ -4272,7 +4258,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
/* Return the master objfile, so that we can report and look up the
|
||||
correct file containing this variable. */
|
||||
@@ -12074,7 +13308,7 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
|
||||
@@ -12070,7 +13306,7 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu)
|
||||
else
|
||||
{
|
||||
/* If the CU is not currently read in, we re-read its header. */
|
||||
|
@ -4281,7 +4267,7 @@ index 16381de..31a7d83 100644
|
|||
struct dwarf2_per_objfile *per_objfile
|
||||
= objfile_data (objfile, dwarf2_objfile_data_key);
|
||||
gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
|
||||
@@ -12096,7 +13330,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
|
||||
@@ -12092,7 +13328,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
|
||||
else
|
||||
{
|
||||
/* If the CU is not currently read in, we re-read its header. */
|
||||
|
@ -4290,7 +4276,7 @@ index 16381de..31a7d83 100644
|
|||
struct dwarf2_per_objfile *per_objfile
|
||||
= objfile_data (objfile, dwarf2_objfile_data_key);
|
||||
gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset;
|
||||
@@ -12116,7 +13350,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
|
||||
@@ -12112,7 +13348,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu)
|
||||
CORE_ADDR
|
||||
dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu)
|
||||
{
|
||||
|
@ -4299,7 +4285,7 @@ index 16381de..31a7d83 100644
|
|||
|
||||
return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
||||
}
|
||||
@@ -12338,6 +13572,30 @@ dwarf2_free_objfile (struct objfile *objfile)
|
||||
@@ -12334,6 +13570,30 @@ dwarf2_free_objfile (struct objfile *objfile)
|
||||
/* Cached DIE trees use xmalloc and the comp_unit_obstack. */
|
||||
free_cached_comp_units (NULL);
|
||||
|
||||
|
@ -4330,7 +4316,7 @@ index 16381de..31a7d83 100644
|
|||
/* Everything else should be on the objfile obstack. */
|
||||
}
|
||||
|
||||
@@ -12372,6 +13630,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
|
||||
@@ -12368,6 +13628,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
|
||||
return ofs_lhs->offset == ofs_rhs->offset;
|
||||
}
|
||||
|
||||
|
@ -4362,7 +4348,7 @@ index 16381de..31a7d83 100644
|
|||
/* Set the type associated with DIE to TYPE. Save it in CU's hash
|
||||
table if necessary. For convenience, return TYPE.
|
||||
|
||||
@@ -12395,6 +13678,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||
@@ -12391,6 +13676,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||
{
|
||||
struct dwarf2_offset_and_type **slot, ofs;
|
||||
|
||||
|
@ -4371,8 +4357,8 @@ index 16381de..31a7d83 100644
|
|||
/* 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
|
||||
@@ -12592,8 +13877,567 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
|
||||
munmap_section_buffer (&data->loc);
|
||||
@@ -12591,8 +13878,567 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
|
||||
munmap_section_buffer (&data->types);
|
||||
munmap_section_buffer (&data->frame);
|
||||
munmap_section_buffer (&data->eh_frame);
|
||||
+ munmap_section_buffer (&data->gdb_index);
|
||||
|
@ -4537,8 +4523,8 @@ index 16381de..31a7d83 100644
|
|||
+ return &symtab->data[index];
|
||||
+ index = (index + step) & (symtab->size - 1);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
}
|
||||
|
||||
+/* Expand SYMTAB's hash table. */
|
||||
+static void
|
||||
+hash_expand (struct mapped_symtab *symtab)
|
||||
|
@ -4907,7 +4893,7 @@ index 16381de..31a7d83 100644
|
|||
+ struct objfile *objfile;
|
||||
+
|
||||
+ if (!arg || !*arg)
|
||||
+ error (_("usage: maintenance save-gdb-index DIRECTORY"));
|
||||
+ error (_("usage: save gdb-index DIRECTORY"));
|
||||
+
|
||||
+ ALL_OBJFILES (objfile)
|
||||
+ {
|
||||
|
@ -4932,21 +4918,31 @@ index 16381de..31a7d83 100644
|
|||
+ objfile->name);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
int dwarf2_always_disassemble;
|
||||
|
||||
static void
|
||||
@@ -12657,4 +14501,8 @@ The value is the maximum depth to print."),
|
||||
@@ -12609,6 +14455,8 @@ void _initialize_dwarf2_read (void);
|
||||
void
|
||||
_initialize_dwarf2_read (void)
|
||||
{
|
||||
+ struct cmd_list_element *c;
|
||||
+
|
||||
dwarf2_objfile_data_key
|
||||
= register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free);
|
||||
|
||||
@@ -12656,4 +14504,9 @@ The value is the maximum depth to print."),
|
||||
NULL,
|
||||
NULL,
|
||||
&setdebuglist, &showdebuglist);
|
||||
+
|
||||
+ add_cmd ("gdb-index", class_files, save_gdb_index_command,
|
||||
+ _("Save a .gdb-index file"),
|
||||
+ &save_cmdlist);
|
||||
+ c = add_cmd ("gdb-index", class_files, save_gdb_index_command,
|
||||
+ _("Save a .gdb-index file"),
|
||||
+ &save_cmdlist);
|
||||
+ set_cmd_completer (c, filename_completer);
|
||||
}
|
||||
diff --git a/gdb/elfread.c b/gdb/elfread.c
|
||||
index 8c00938..a250c58 100644
|
||||
|
@ -6113,7 +6109,7 @@ index e0ca12c..de6311a 100644
|
|||
else
|
||||
{
|
||||
diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h
|
||||
index 6a230c0..d87a813 100644
|
||||
index 78151dd..da11686 100644
|
||||
--- a/gdb/gdbcmd.h
|
||||
+++ b/gdb/gdbcmd.h
|
||||
@@ -124,6 +124,10 @@ extern struct cmd_list_element *setchecklist;
|
||||
|
@ -6125,8 +6121,8 @@ index 6a230c0..d87a813 100644
|
|||
+extern struct cmd_list_element *save_cmdlist;
|
||||
+
|
||||
extern void execute_command (char *, int);
|
||||
extern char *execute_command_to_string (char *p, int from_tty);
|
||||
|
||||
enum command_control_type execute_control_command (struct command_line *);
|
||||
diff --git a/gdb/gdbinit.in b/gdb/gdbinit.in
|
||||
index ffb7f53..a2e7e94 100644
|
||||
--- a/gdb/gdbinit.in
|
||||
|
@ -7708,7 +7704,7 @@ index 5abec68..e309277 100644
|
|||
|
||||
extern void notice_new_inferior (ptid_t, int, int);
|
||||
diff --git a/gdb/infrun.c b/gdb/infrun.c
|
||||
index 57f2ab8..5762a7f 100644
|
||||
index 54b1d9f..58d045a 100644
|
||||
--- a/gdb/infrun.c
|
||||
+++ b/gdb/infrun.c
|
||||
@@ -45,6 +45,8 @@
|
||||
|
@ -8592,7 +8588,7 @@ index bb79ae1..fbbd600 100644
|
|||
+
|
||||
#endif /* PARSER_DEFS_H */
|
||||
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
|
||||
index e8d96f6..8bf097c 100644
|
||||
index 18ddee7..652b02a 100644
|
||||
--- a/gdb/ppc-linux-nat.c
|
||||
+++ b/gdb/ppc-linux-nat.c
|
||||
@@ -2010,6 +2010,24 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
|
||||
|
@ -8675,7 +8671,7 @@ index 5ffa099..58d9c79 100644
|
|||
+ observer_attach_mark_used (print_types_mark_used);
|
||||
}
|
||||
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
|
||||
index 367cf1e..c120894 100644
|
||||
index 97a4eec..fce19c9 100644
|
||||
--- a/gdb/psymtab.c
|
||||
+++ b/gdb/psymtab.c
|
||||
@@ -421,6 +421,14 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile,
|
||||
|
@ -10341,7 +10337,7 @@ index 2b8d301..0af99c8 100644
|
|||
|
||||
extern PyObject *gdbpy_gdberror_exc;
|
||||
diff --git a/gdb/python/python.c b/gdb/python/python.c
|
||||
index 6680126..2eee31f 100644
|
||||
index 7346fba..34708c4 100644
|
||||
--- a/gdb/python/python.c
|
||||
+++ b/gdb/python/python.c
|
||||
@@ -28,6 +28,7 @@
|
||||
|
@ -10370,7 +10366,7 @@ index 6680126..2eee31f 100644
|
|||
|
||||
static PyMethodDef GdbMethods[];
|
||||
|
||||
@@ -413,6 +421,105 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
@@ -374,6 +382,105 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
@ -10476,7 +10472,7 @@ index 6680126..2eee31f 100644
|
|||
/* Parse a string and evaluate it as an expression. */
|
||||
static PyObject *
|
||||
gdbpy_parse_and_eval (PyObject *self, PyObject *args)
|
||||
@@ -453,6 +560,114 @@ source_python_script (FILE *stream, const char *file)
|
||||
@@ -414,6 +521,114 @@ source_python_script (FILE *stream, const char *file)
|
||||
|
||||
|
||||
|
||||
|
@ -10591,7 +10587,7 @@ index 6680126..2eee31f 100644
|
|||
/* Printing. */
|
||||
|
||||
/* A python function to write a single string using gdb's filtered
|
||||
@@ -498,6 +713,53 @@ gdbpy_print_stack (void)
|
||||
@@ -459,6 +674,53 @@ gdbpy_print_stack (void)
|
||||
|
||||
/* Return the current Progspace.
|
||||
There always is one. */
|
||||
|
@ -10645,7 +10641,7 @@ index 6680126..2eee31f 100644
|
|||
|
||||
static PyObject *
|
||||
gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
|
||||
@@ -759,6 +1021,7 @@ Enables or disables printing of Python stack traces."),
|
||||
@@ -720,6 +982,7 @@ Enables or disables printing of Python stack traces."),
|
||||
gdbpy_initialize_lazy_string ();
|
||||
gdbpy_initialize_thread ();
|
||||
gdbpy_initialize_inferior ();
|
||||
|
@ -10653,7 +10649,7 @@ index 6680126..2eee31f 100644
|
|||
|
||||
PyRun_SimpleString ("import gdb");
|
||||
PyRun_SimpleString ("gdb.pretty_printers = []");
|
||||
@@ -826,6 +1089,8 @@ static PyMethodDef GdbMethods[] =
|
||||
@@ -787,6 +1050,8 @@ static PyMethodDef GdbMethods[] =
|
||||
"Get a value from history" },
|
||||
{ "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS,
|
||||
"Execute a gdb command" },
|
||||
|
@ -10662,13 +10658,13 @@ index 6680126..2eee31f 100644
|
|||
{ "parameter", gdbpy_parameter, METH_VARARGS,
|
||||
"Return a gdb parameter's value" },
|
||||
|
||||
@@ -864,11 +1129,21 @@ a boolean indicating if name is a field of the current implied argument\n\
|
||||
@@ -825,11 +1090,21 @@ a boolean indicating if name is a field of the current implied argument\n\
|
||||
`this' (when the current language is object-oriented)." },
|
||||
{ "block_for_pc", gdbpy_block_for_pc, METH_VARARGS,
|
||||
"Return the block containing the given pc value, or None." },
|
||||
+ { "solib_address (Long) -> String.\n\
|
||||
+ { "solib_address", gdbpy_solib_address, METH_VARARGS,
|
||||
+ "solib_address (Long) -> String.\n\
|
||||
+Return the name of the shared library holding a given address, or None." },
|
||||
+
|
||||
+ { "decode_line", gdbpy_decode_line, METH_VARARGS,
|
||||
+ "Decode a string argument the way that 'break' or 'edit' does.\n\
|
||||
+Return a tuple holding the file name (or None) and line number (or None).\n\
|
||||
|
@ -10712,7 +10708,7 @@ index 1f135d4..489838d 100644
|
|||
|
||||
/* Given an executable's ABFD and target, compute the entry-point
|
||||
diff --git a/gdb/symfile.c b/gdb/symfile.c
|
||||
index ab51fa4..babe9cf 100644
|
||||
index 42f7ae3..371db0d 100644
|
||||
--- a/gdb/symfile.c
|
||||
+++ b/gdb/symfile.c
|
||||
@@ -1059,6 +1059,9 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
|
||||
|
@ -10734,7 +10730,7 @@ index ab51fa4..babe9cf 100644
|
|||
{
|
||||
if (from_tty || info_verbose)
|
||||
{
|
||||
@@ -1535,7 +1538,7 @@ symbol_file_command (char *args, int from_tty)
|
||||
@@ -1533,7 +1536,7 @@ symbol_file_command (char *args, int from_tty)
|
||||
void
|
||||
set_initial_language (void)
|
||||
{
|
||||
|
@ -10743,7 +10739,7 @@ index ab51fa4..babe9cf 100644
|
|||
enum language lang = language_unknown;
|
||||
|
||||
filename = find_main_filename ();
|
||||
@@ -2662,7 +2665,7 @@ init_filename_language_table (void)
|
||||
@@ -2660,7 +2663,7 @@ init_filename_language_table (void)
|
||||
}
|
||||
|
||||
enum language
|
||||
|
@ -10804,7 +10800,7 @@ index 62e6b97..00dc613 100644
|
|||
ms_type = 'S';
|
||||
break;
|
||||
diff --git a/gdb/symtab.c b/gdb/symtab.c
|
||||
index 9472c24..c3b1792 100644
|
||||
index 2c4c9e4..28f0450 100644
|
||||
--- a/gdb/symtab.c
|
||||
+++ b/gdb/symtab.c
|
||||
@@ -1295,16 +1295,25 @@ lookup_symbol_aux_symtabs (int block_index, const char *name,
|
||||
|
@ -10973,7 +10969,7 @@ index bedc10a..dc284e4 100644
|
|||
/* symtab.c */
|
||||
|
||||
diff --git a/gdb/target.c b/gdb/target.c
|
||||
index 862df4e..a8f1bdd 100644
|
||||
index 4cabcbd..34b3b60 100644
|
||||
--- a/gdb/target.c
|
||||
+++ b/gdb/target.c
|
||||
@@ -123,6 +123,8 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int,
|
||||
|
@ -11003,7 +10999,7 @@ index 862df4e..a8f1bdd 100644
|
|||
de_fault (to_stopped_by_watchpoint,
|
||||
(int (*) (void))
|
||||
return_zero);
|
||||
@@ -3441,6 +3447,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
|
||||
@@ -3440,6 +3446,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type,
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -11023,7 +11019,7 @@ index 862df4e..a8f1bdd 100644
|
|||
static void
|
||||
debug_to_terminal_init (void)
|
||||
{
|
||||
@@ -3688,6 +3707,7 @@ setup_target_debug (void)
|
||||
@@ -3687,6 +3706,7 @@ setup_target_debug (void)
|
||||
current_target.to_remove_hw_breakpoint = debug_to_remove_hw_breakpoint;
|
||||
current_target.to_insert_watchpoint = debug_to_insert_watchpoint;
|
||||
current_target.to_remove_watchpoint = debug_to_remove_watchpoint;
|
||||
|
@ -14210,7 +14206,7 @@ index 0000000..226dc5d
|
|||
+ call foo (g, h)
|
||||
+end
|
||||
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
index 1aed252..593aa55 100644
|
||||
index fc8bccc..e053813 100644
|
||||
--- a/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
@@ -92,6 +92,10 @@ proc do_steps_and_nexts {} {
|
||||
|
@ -14846,6 +14842,36 @@ index a24bc11..e3043bc 100644
|
|||
|
||||
# The following test recompiles the binary to test either C or C++
|
||||
# values.
|
||||
diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
new file mode 100644
|
||||
index 0000000..70319ff
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
|
||||
@@ -0,0 +1,24 @@
|
||||
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=634108
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+
|
||||
+# Skip all tests if Python scripting is not enabled.
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+gdb_test "python print gdb.solib_address(-1)" "None" "gdb.solib_address exists"
|
||||
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c b/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c
|
||||
new file mode 100644
|
||||
index 0000000..4dc308b
|
||||
|
@ -15390,7 +15416,7 @@ index 0000000..1dc93ab
|
|||
+ test child FOLLOW_CHILD
|
||||
+}
|
||||
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||
index b5b3362..d916e94 100644
|
||||
index 20e2fb7..b27d25c 100644
|
||||
--- a/gdb/testsuite/lib/gdb.exp
|
||||
+++ b/gdb/testsuite/lib/gdb.exp
|
||||
@@ -27,6 +27,7 @@ if {$tool == ""} {
|
||||
|
@ -15496,7 +15522,7 @@ index 0000000..b8e9836
|
|||
+ return 0
|
||||
+}
|
||||
diff --git a/gdb/thread.c b/gdb/thread.c
|
||||
index 2fdc7f9..2a5d0f1 100644
|
||||
index 0b291ba..ae3e4ff 100644
|
||||
--- a/gdb/thread.c
|
||||
+++ b/gdb/thread.c
|
||||
@@ -90,6 +90,16 @@ delete_step_resume_breakpoint (struct thread_info *tp)
|
||||
|
@ -15530,7 +15556,7 @@ index 2fdc7f9..2a5d0f1 100644
|
|||
|
||||
discard_all_intermediate_continuations_thread (tp);
|
||||
diff --git a/gdb/top.c b/gdb/top.c
|
||||
index 93447fe..d6875a7 100644
|
||||
index b29e68d..8edac70 100644
|
||||
--- a/gdb/top.c
|
||||
+++ b/gdb/top.c
|
||||
@@ -337,6 +337,7 @@ void
|
||||
|
|
|
@ -11,6 +11,47 @@ Index: gdb-7.1.90.20100711/gdb/config/i386/linux64.mh
|
|||
NAT_CDEPS = $(srcdir)/proc-service.list
|
||||
|
||||
# The dynamically loaded libthread_db needs access to symbols in the
|
||||
--- gdb-7.2/gdb/config/i386/linux.mh-orig 2010-06-11 14:08:51.000000000 +0200
|
||||
+++ gdb-7.2/gdb/config/i386/linux.mh 2011-03-18 12:00:32.000000000 +0100
|
||||
@@ -1,6 +1,6 @@
|
||||
# Host: Intel 386 running GNU/Linux.
|
||||
|
||||
-NAT_FILE= config/nm-linux.h
|
||||
+NAT_FILE= nm-linux.h
|
||||
NATDEPFILES= inf-ptrace.o fork-child.o \
|
||||
i386-nat.o i386-linux-nat.o \
|
||||
proc-service.o linux-thread-db.o \
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.1.90.20100711/gdb/config/i386/nm-linux.h 2010-07-13 19:02:28.000000000 +0200
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* Native support for GNU/Linux i386.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#ifndef NM_LINUX_H
|
||||
+#define NM_LINUX_H
|
||||
+
|
||||
+#include "config/nm-linux.h"
|
||||
+
|
||||
+/* Red Hat backward compatibility with gdb-6.8. */
|
||||
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
|
||||
+
|
||||
+#endif /* NM_LINUX64_H */
|
||||
Index: gdb-7.1.90.20100711/gdb/config/i386/nm-linux64.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
--- a/gdb/gdb_gcore.sh
|
||||
+++ b/gdb/gdb_gcore.sh
|
||||
@@ -64,6 +64,9 @@ for pid in $*
|
||||
do
|
||||
# Write gdb script for pid $pid.
|
||||
cat >>$tmpfile <<EOF
|
||||
+set pagination off
|
||||
+set width 0
|
||||
+set height 0
|
||||
attach $pid
|
||||
gcore $name.$pid
|
||||
detach
|
|
@ -0,0 +1,69 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html
|
||||
Subject: [rfc patch] nomem: internal_error -> error
|
||||
|
||||
Hi,
|
||||
|
||||
unfortunately I see this problem reproducible only with the
|
||||
archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]).
|
||||
OTOH this branch I hopefully submit in some form for FSF GDB later.
|
||||
|
||||
In this case (a general problem but tested for example on Fedora 13 i686):
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char a[argc];
|
||||
return a[0];
|
||||
}
|
||||
|
||||
(gdb) start
|
||||
(gdb) print a
|
||||
../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes.
|
||||
|
||||
It is apparently because boundary for the variable `a' is not initialized
|
||||
there. Users notice it due to Eclipse-CDT trying to automatically display all
|
||||
the local variables on each step.
|
||||
|
||||
|
||||
Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
||||
But is anone aware of the reasons to use internal_error there?
|
||||
I find simple error as a perfectly reasonable there.
|
||||
(history only tracks it since the initial import)
|
||||
|
||||
IIRC this idea has been discussed with Tom Tromey, not sure of its origin.
|
||||
|
||||
I understand it may be offtopic for FSF GDB but from some GDB crashes I am not
|
||||
sure if it can happen only due to the VLA variables.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-06-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* utils.c (nomem): Change internal_error to error.
|
||||
|
||||
--- a/gdb/utils.c
|
||||
+++ b/gdb/utils.c
|
||||
@@ -1265,15 +1265,9 @@ void
|
||||
nomem (long size)
|
||||
{
|
||||
if (size > 0)
|
||||
- {
|
||||
- internal_error (__FILE__, __LINE__,
|
||||
- _("virtual memory exhausted: can't allocate %ld bytes."),
|
||||
- size);
|
||||
- }
|
||||
+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
|
||||
else
|
||||
- {
|
||||
- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
|
||||
- }
|
||||
+ error (_("virtual memory exhausted."));
|
||||
}
|
||||
|
||||
/* The xmalloc() (libiberty.h) family of memory management routines.
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-08/msg00559.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00199.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/08/31 18:08:42 1.12129
|
||||
### src/gdb/ChangeLog 2010/08/31 18:11:48 1.12130
|
||||
## -1,5 +1,14 @@
|
||||
2010-08-31 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
+ Make linux_get_siginfo_type `type *' unique.
|
||||
+ * linux-tdep.c (linux_gdbarch_data_handle, struct linux_gdbarch_data)
|
||||
+ (init_linux_gdbarch_data, get_linux_gdbarch_data): New.
|
||||
+ (linux_get_siginfo_type): New variable linux_gdbarch_data. Initialize
|
||||
+ it. Use linux_gdbarch_data->siginfo_type as a persistent storage.
|
||||
+ (_initialize_linux_tdep): New.
|
||||
+
|
||||
+2010-08-31 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
Code cleanup.
|
||||
* defs.h (find_memory_region_ftype): New typedef.
|
||||
(exec_set_find_memory_regions): Use it.
|
||||
Index: gdb-7.2/gdb/linux-tdep.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linux-tdep.c 2010-09-25 15:30:50.000000000 +0200
|
||||
+++ gdb-7.2/gdb/linux-tdep.c 2010-09-25 15:31:54.000000000 +0200
|
||||
@@ -26,18 +26,42 @@
|
||||
#include "value.h"
|
||||
#include "infcall.h"
|
||||
|
||||
+static struct gdbarch_data *linux_gdbarch_data_handle;
|
||||
+
|
||||
+struct linux_gdbarch_data
|
||||
+ {
|
||||
+ struct type *siginfo_type;
|
||||
+ };
|
||||
+
|
||||
+static void *
|
||||
+init_linux_gdbarch_data (struct gdbarch *gdbarch)
|
||||
+{
|
||||
+ return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct linux_gdbarch_data);
|
||||
+}
|
||||
+
|
||||
+static struct linux_gdbarch_data *
|
||||
+get_linux_gdbarch_data (struct gdbarch *gdbarch)
|
||||
+{
|
||||
+ return gdbarch_data (gdbarch, linux_gdbarch_data_handle);
|
||||
+}
|
||||
+
|
||||
/* This function is suitable for architectures that don't
|
||||
extend/override the standard siginfo structure. */
|
||||
|
||||
struct type *
|
||||
linux_get_siginfo_type (struct gdbarch *gdbarch)
|
||||
{
|
||||
+ struct linux_gdbarch_data *linux_gdbarch_data;
|
||||
struct type *int_type, *uint_type, *long_type, *void_ptr_type;
|
||||
struct type *uid_type, *pid_type;
|
||||
struct type *sigval_type, *clock_type;
|
||||
struct type *siginfo_type, *sifields_type;
|
||||
struct type *type;
|
||||
|
||||
+ linux_gdbarch_data = get_linux_gdbarch_data (gdbarch);
|
||||
+ if (linux_gdbarch_data->siginfo_type != NULL)
|
||||
+ return linux_gdbarch_data->siginfo_type;
|
||||
+
|
||||
int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
|
||||
0, "int");
|
||||
uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
|
||||
@@ -137,6 +161,8 @@ linux_get_siginfo_type (struct gdbarch *
|
||||
"_sifields", sifields_type,
|
||||
TYPE_LENGTH (long_type));
|
||||
|
||||
+ linux_gdbarch_data->siginfo_type = siginfo_type;
|
||||
+
|
||||
return siginfo_type;
|
||||
}
|
||||
|
||||
@@ -154,3 +180,10 @@ linux_has_shared_address_space (void)
|
||||
|
||||
return target_is_uclinux;
|
||||
}
|
||||
+
|
||||
+void
|
||||
+_initialize_linux_tdep (void)
|
||||
+{
|
||||
+ linux_gdbarch_data_handle =
|
||||
+ gdbarch_data_register_post_init (init_linux_gdbarch_data);
|
||||
+}
|
|
@ -0,0 +1,139 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00430.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00152.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/24 11:15:51 1.12199
|
||||
### src/gdb/ChangeLog 2010/09/24 13:41:42 1.12200
|
||||
## -1,5 +1,12 @@
|
||||
2010-09-24 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
+ * amd64-linux-nat.c (compat_siginfo_from_siginfo)
|
||||
+ (siginfo_from_compat_siginfo): Also copy si_pid and si_uid when
|
||||
+ si_code is < 0. Check for si_code == SI_TIMER before checking for
|
||||
+ si_code < 0.
|
||||
+
|
||||
+2010-09-24 Pedro Alves <pedro@codesourcery.com>
|
||||
+
|
||||
* objfiles.h (ALL_OBJSECTIONS): Handle breaks in the inner loop.
|
||||
|
||||
2010-09-22 Joel Brobecker <brobecker@adacore.com>
|
||||
--- src/gdb/amd64-linux-nat.c 2010/04/22 20:02:55 1.32
|
||||
+++ src/gdb/amd64-linux-nat.c 2010/09/24 13:41:43 1.33
|
||||
@@ -574,8 +574,10 @@
|
||||
to->si_errno = from->si_errno;
|
||||
to->si_code = from->si_code;
|
||||
|
||||
- if (to->si_code < 0)
|
||||
+ if (to->si_code == SI_TIMER)
|
||||
{
|
||||
+ to->cpt_si_timerid = from->si_timerid;
|
||||
+ to->cpt_si_overrun = from->si_overrun;
|
||||
to->cpt_si_ptr = (intptr_t) from->si_ptr;
|
||||
}
|
||||
else if (to->si_code == SI_USER)
|
||||
@@ -583,10 +585,10 @@
|
||||
to->cpt_si_pid = from->si_pid;
|
||||
to->cpt_si_uid = from->si_uid;
|
||||
}
|
||||
- else if (to->si_code == SI_TIMER)
|
||||
+ else if (to->si_code < 0)
|
||||
{
|
||||
- to->cpt_si_timerid = from->si_timerid;
|
||||
- to->cpt_si_overrun = from->si_overrun;
|
||||
+ to->cpt_si_pid = from->si_pid;
|
||||
+ to->cpt_si_uid = from->si_uid;
|
||||
to->cpt_si_ptr = (intptr_t) from->si_ptr;
|
||||
}
|
||||
else
|
||||
@@ -628,8 +630,10 @@
|
||||
to->si_errno = from->si_errno;
|
||||
to->si_code = from->si_code;
|
||||
|
||||
- if (to->si_code < 0)
|
||||
+ if (to->si_code == SI_TIMER)
|
||||
{
|
||||
+ to->si_timerid = from->cpt_si_timerid;
|
||||
+ to->si_overrun = from->cpt_si_overrun;
|
||||
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
|
||||
}
|
||||
else if (to->si_code == SI_USER)
|
||||
@@ -637,10 +641,10 @@
|
||||
to->si_pid = from->cpt_si_pid;
|
||||
to->si_uid = from->cpt_si_uid;
|
||||
}
|
||||
- else if (to->si_code == SI_TIMER)
|
||||
+ if (to->si_code < 0)
|
||||
{
|
||||
- to->si_timerid = from->cpt_si_timerid;
|
||||
- to->si_overrun = from->cpt_si_overrun;
|
||||
+ to->si_pid = from->cpt_si_pid;
|
||||
+ to->si_uid = from->cpt_si_uid;
|
||||
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
|
||||
}
|
||||
else
|
||||
### src/gdb/gdbserver/ChangeLog 2010/09/13 19:11:03 1.431
|
||||
### src/gdb/gdbserver/ChangeLog 2010/09/24 13:41:43 1.432
|
||||
## -1,3 +1,10 @@
|
||||
+2010-09-24 Pedro Alves <pedro@codesourcery.com>
|
||||
+
|
||||
+ * linux-x86-low.c (compat_siginfo_from_siginfo)
|
||||
+ (siginfo_from_compat_siginfo): Also copy si_pid and si_uid when
|
||||
+ si_code is < 0. Check for si_code == SI_TIMER before checking for
|
||||
+ si_code < 0.
|
||||
+
|
||||
2010-09-13 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* lynx-i386-low.c: New file.
|
||||
--- src/gdb/gdbserver/linux-x86-low.c 2010/08/27 00:16:48 1.23
|
||||
+++ src/gdb/gdbserver/linux-x86-low.c 2010/09/24 13:41:43 1.24
|
||||
@@ -792,8 +792,10 @@
|
||||
to->si_errno = from->si_errno;
|
||||
to->si_code = from->si_code;
|
||||
|
||||
- if (to->si_code < 0)
|
||||
+ if (to->si_code == SI_TIMER)
|
||||
{
|
||||
+ to->cpt_si_timerid = from->si_timerid;
|
||||
+ to->cpt_si_overrun = from->si_overrun;
|
||||
to->cpt_si_ptr = (intptr_t) from->si_ptr;
|
||||
}
|
||||
else if (to->si_code == SI_USER)
|
||||
@@ -801,10 +803,10 @@
|
||||
to->cpt_si_pid = from->si_pid;
|
||||
to->cpt_si_uid = from->si_uid;
|
||||
}
|
||||
- else if (to->si_code == SI_TIMER)
|
||||
+ else if (to->si_code < 0)
|
||||
{
|
||||
- to->cpt_si_timerid = from->si_timerid;
|
||||
- to->cpt_si_overrun = from->si_overrun;
|
||||
+ to->cpt_si_pid = from->si_pid;
|
||||
+ to->cpt_si_uid = from->si_uid;
|
||||
to->cpt_si_ptr = (intptr_t) from->si_ptr;
|
||||
}
|
||||
else
|
||||
@@ -846,8 +848,10 @@
|
||||
to->si_errno = from->si_errno;
|
||||
to->si_code = from->si_code;
|
||||
|
||||
- if (to->si_code < 0)
|
||||
+ if (to->si_code == SI_TIMER)
|
||||
{
|
||||
+ to->si_timerid = from->cpt_si_timerid;
|
||||
+ to->si_overrun = from->cpt_si_overrun;
|
||||
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
|
||||
}
|
||||
else if (to->si_code == SI_USER)
|
||||
@@ -855,10 +859,10 @@
|
||||
to->si_pid = from->cpt_si_pid;
|
||||
to->si_uid = from->cpt_si_uid;
|
||||
}
|
||||
- else if (to->si_code == SI_TIMER)
|
||||
+ else if (to->si_code < 0)
|
||||
{
|
||||
- to->si_timerid = from->cpt_si_timerid;
|
||||
- to->si_overrun = from->cpt_si_overrun;
|
||||
+ to->si_pid = from->cpt_si_pid;
|
||||
+ to->si_uid = from->cpt_si_uid;
|
||||
to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
|
||||
}
|
||||
else
|
|
@ -0,0 +1,259 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00438.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00156.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/24 16:11:44 1.12203
|
||||
### src/gdb/ChangeLog 2010/09/24 18:35:20 1.12204
|
||||
## -1,3 +1,16 @@
|
||||
+2010-09-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix lost siginfo_t for inferior calls.
|
||||
+ * infrun.c
|
||||
+ (struct inferior_thread_state) <siginfo_gdbarch, siginfo_data>: New.
|
||||
+ (save_inferior_thread_state): New variables regcache, gdbarch and
|
||||
+ siginfo_data. Initialize SIGINFO_DATA if gdbarch_get_siginfo_type_p.
|
||||
+ Move INF_STATE allocation later, pre-clear it. Initialize REGISTERS
|
||||
+ using REGCACHE.
|
||||
+ (restore_inferior_thread_state): New variables regcache and gdbarch.
|
||||
+ Restore SIGINFO_DATA for matching GDBARCH. Restore REGISTERS using
|
||||
+ REGCACHE. Free also SIGINFO_DATA.
|
||||
+
|
||||
2010-09-24 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* dwarf2read.c (dw2_expand_symtabs_matching): Add missing
|
||||
--- src/gdb/infrun.c 2010/09/06 14:22:07 1.450
|
||||
+++ src/gdb/infrun.c 2010/09/24 18:35:27 1.451
|
||||
@@ -6037,18 +6037,57 @@
|
||||
enum target_signal stop_signal;
|
||||
CORE_ADDR stop_pc;
|
||||
struct regcache *registers;
|
||||
+
|
||||
+ /* Format of SIGINFO or NULL if it is not present. */
|
||||
+ struct gdbarch *siginfo_gdbarch;
|
||||
+
|
||||
+ /* The inferior format depends on SIGINFO_GDBARCH and it has a length of
|
||||
+ TYPE_LENGTH (gdbarch_get_siginfo_type ()). For different gdbarch the
|
||||
+ content would be invalid. */
|
||||
+ gdb_byte *siginfo_data;
|
||||
};
|
||||
|
||||
struct inferior_thread_state *
|
||||
save_inferior_thread_state (void)
|
||||
{
|
||||
- struct inferior_thread_state *inf_state = XMALLOC (struct inferior_thread_state);
|
||||
+ struct inferior_thread_state *inf_state;
|
||||
struct thread_info *tp = inferior_thread ();
|
||||
+ struct regcache *regcache = get_current_regcache ();
|
||||
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
+ gdb_byte *siginfo_data = NULL;
|
||||
+
|
||||
+ if (gdbarch_get_siginfo_type_p (gdbarch))
|
||||
+ {
|
||||
+ struct type *type = gdbarch_get_siginfo_type (gdbarch);
|
||||
+ size_t len = TYPE_LENGTH (type);
|
||||
+ struct cleanup *back_to;
|
||||
+
|
||||
+ siginfo_data = xmalloc (len);
|
||||
+ back_to = make_cleanup (xfree, siginfo_data);
|
||||
+
|
||||
+ if (target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
|
||||
+ siginfo_data, 0, len) == len)
|
||||
+ discard_cleanups (back_to);
|
||||
+ else
|
||||
+ {
|
||||
+ /* Errors ignored. */
|
||||
+ do_cleanups (back_to);
|
||||
+ siginfo_data = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ inf_state = XZALLOC (struct inferior_thread_state);
|
||||
+
|
||||
+ if (siginfo_data)
|
||||
+ {
|
||||
+ inf_state->siginfo_gdbarch = gdbarch;
|
||||
+ inf_state->siginfo_data = siginfo_data;
|
||||
+ }
|
||||
|
||||
inf_state->stop_signal = tp->stop_signal;
|
||||
inf_state->stop_pc = stop_pc;
|
||||
|
||||
- inf_state->registers = regcache_dup (get_current_regcache ());
|
||||
+ inf_state->registers = regcache_dup (regcache);
|
||||
|
||||
return inf_state;
|
||||
}
|
||||
@@ -6059,16 +6098,29 @@
|
||||
restore_inferior_thread_state (struct inferior_thread_state *inf_state)
|
||||
{
|
||||
struct thread_info *tp = inferior_thread ();
|
||||
+ struct regcache *regcache = get_current_regcache ();
|
||||
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
||||
|
||||
tp->stop_signal = inf_state->stop_signal;
|
||||
stop_pc = inf_state->stop_pc;
|
||||
|
||||
+ if (inf_state->siginfo_gdbarch == gdbarch)
|
||||
+ {
|
||||
+ struct type *type = gdbarch_get_siginfo_type (gdbarch);
|
||||
+ size_t len = TYPE_LENGTH (type);
|
||||
+
|
||||
+ /* Errors ignored. */
|
||||
+ target_write (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL,
|
||||
+ inf_state->siginfo_data, 0, len);
|
||||
+ }
|
||||
+
|
||||
/* The inferior can be gone if the user types "print exit(0)"
|
||||
(and perhaps other times). */
|
||||
if (target_has_execution)
|
||||
/* NB: The register write goes through to the target. */
|
||||
- regcache_cpy (get_current_regcache (), inf_state->registers);
|
||||
+ regcache_cpy (regcache, inf_state->registers);
|
||||
regcache_xfree (inf_state->registers);
|
||||
+ xfree (inf_state->siginfo_data);
|
||||
xfree (inf_state);
|
||||
}
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/22 20:08:04 1.2456
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/24 18:35:28 1.2457
|
||||
## -1,3 +1,9 @@
|
||||
+2010-09-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix lost siginfo_t for inferior calls.
|
||||
+ * gdb.base/siginfo-infcall.exp: New file.
|
||||
+ * gdb.base/siginfo-infcall.c: New file.
|
||||
+
|
||||
2010-09-22 Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
* gdb.dwarf2/dw2-const.S: Minor (space) reformatting.
|
||||
--- src/gdb/testsuite/gdb.base/siginfo-infcall.c
|
||||
+++ src/gdb/testsuite/gdb.base/siginfo-infcall.c 2010-09-25 13:25:25.007169000 +0000
|
||||
@@ -0,0 +1,79 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <signal.h>
|
||||
+#include <assert.h>
|
||||
+#include <string.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#ifndef SA_SIGINFO
|
||||
+# error "SA_SIGINFO is required for this test"
|
||||
+#endif
|
||||
+
|
||||
+static int
|
||||
+callme (void)
|
||||
+{
|
||||
+ return 42;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+pass (void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fail (void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+handler (int sig, siginfo_t *siginfo, void *context)
|
||||
+{
|
||||
+ assert (sig == SIGUSR1);
|
||||
+ assert (siginfo->si_signo == SIGUSR1);
|
||||
+ if (siginfo->si_pid == getpid ())
|
||||
+ pass ();
|
||||
+ else
|
||||
+ fail ();
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ struct sigaction sa;
|
||||
+ int i;
|
||||
+
|
||||
+ callme ();
|
||||
+
|
||||
+ memset (&sa, 0, sizeof (sa));
|
||||
+ sa.sa_sigaction = handler;
|
||||
+ sa.sa_flags = SA_SIGINFO;
|
||||
+
|
||||
+ i = sigemptyset (&sa.sa_mask);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = sigaction (SIGUSR1, &sa, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = raise (SIGUSR1);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ sleep (600);
|
||||
+ return 0;
|
||||
+}
|
||||
--- src/gdb/testsuite/gdb.base/siginfo-infcall.exp
|
||||
+++ src/gdb/testsuite/gdb.base/siginfo-infcall.exp 2010-09-25 13:25:25.357724000 +0000
|
||||
@@ -0,0 +1,47 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if [target_info exists gdb,nosignals] {
|
||||
+ verbose "Skipping siginfo-infcall.exp because of nosignals."
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile siginfo-infcall
|
||||
+set srcfile ${testfile}.c
|
||||
+set executable ${testfile}
|
||||
+if { [prepare_for_testing ${testfile}.exp $executable] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint "pass"
|
||||
+gdb_breakpoint "fail"
|
||||
+
|
||||
+gdb_test "continue" "Program received signal SIGUSR1, .*" "continue to SIGUSR1"
|
||||
+
|
||||
+gdb_test "p callme ()" " = 42"
|
||||
+
|
||||
+set test "continue to the handler"
|
||||
+gdb_test_multiple "continue" $test {
|
||||
+ -re "Breakpoint \[0-9\]+,\[^\r\n\]* pass .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Breakpoint \[0-9\]+,\[^\r\n\]* fail .*\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+}
|
|
@ -0,0 +1,992 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00360.html
|
||||
Subject: [patch 3/4]#3 linux-nat: Do not respawn signals
|
||||
|
||||
Hi,
|
||||
|
||||
linux-nat.c is fixed to never respawn signals; possibly keeping SIGSTOP
|
||||
pending, as is done in current in FSF gdbserver and as suggested by Pedro:
|
||||
http://sourceware.org/ml/gdb-patches/2010-08/msg00544.html
|
||||
|
||||
The last linux-nat.c removed patch chunk comes from the initial implementation
|
||||
by Mark Kettenis:
|
||||
[PATCH] New Linux threads support
|
||||
http://sourceware.org/ml/gdb-patches/2000-09/msg00020.html
|
||||
92280a75e017683bf8e4f339f4f85640b0700509
|
||||
It gets in part reimplemented into the new stop_wait_callback <if (lp->step)>
|
||||
part and partially just not needed as currently GDB never drops the signals as
|
||||
it does not PTRACE_CONT the thread; signal is kept for processing:
|
||||
"RC: Not resuming sibling %s (has pending)\n"
|
||||
|
||||
In stop_wait_callback I believe breakpoints cancellation is not needed here,
|
||||
it would be done later.
|
||||
|
||||
|
||||
The testcase sigstep-threads.exp was written to catch a regression-like
|
||||
appearance then the new <if (lp->step)> part of stop_wait_callback gets
|
||||
removed. Still the tecase fails even with FSF HEAD:
|
||||
|
||||
32 var++; /* step-1 */
|
||||
(gdb) step
|
||||
Program received signal SIGUSR1, User defined signal 1.
|
||||
Program received signal SIGUSR1, User defined signal 1.
|
||||
31 { /* step-0 */
|
||||
|
||||
There is no reason why it shouldn't stop on line 33, between line 32 and line
|
||||
33 no signal would occur. Stepping of the current thread should not be
|
||||
affected by whatever happens in the other threads as select_event_lwp has:
|
||||
/* Give preference to any LWP that is being single-stepped. */
|
||||
|
||||
There is a problem that with FSF HEAD GDB does PTRACE_SINGLESTEP for thread A,
|
||||
PTRACE_CONT for thread B (because of set scheduler-locking off), thread B hits
|
||||
SIGUSR1, so GDB tkills thread A with SIGSTOP and it can receive SIGSTOP for
|
||||
thread A before the SIGTRAP for completed PTRACE_SINGLESTEP. At that moment
|
||||
select_event_lwp. forgets it was stepping thread A because there is no pending
|
||||
SIGTRAP event. currently_stepping still remembers thread A was stepping so it
|
||||
will later stop but as thread A was PTRACE_CONT-ed in the meantime it is too
|
||||
late.
|
||||
|
||||
There is the new <if (lp->step)> part of stop_wait_callback to always track
|
||||
thread A is stepping. Due to different scheduling without this part the
|
||||
changed GDB would very rarely stop in this testcase otherwise, making it look
|
||||
as a regression.
|
||||
|
||||
I have some another patch I may post separately as if multiple signals happen
|
||||
besides SIGTRAP GDB still may switch from thread A away (as not considering it
|
||||
stepping) to thread B for SIGUSR and accidentally PTRACE_CONT thread A.
|
||||
But I do not find this as a prerequisite for this patchset.
|
||||
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-09-20 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* linux-nat.c (stop_wait_callback): New gdb_assert. Remove signals
|
||||
respawning; keep TP with SIGNALLED. New debugging message "SWC:
|
||||
Delayed SIGSTOP caught for %s.". Catch next signal if SIGSTOP has
|
||||
been caught and LP->STEP is set.
|
||||
(linux_nat_wait_1) <lp && lp->signalled>: Remove.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-09-20 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/siginfo-threads.exp: New file.
|
||||
* gdb.threads/siginfo-threads.c: New file.
|
||||
* gdb.threads/sigstep-threads.exp: New file.
|
||||
* gdb.threads/sigstep-threads.c: New file.
|
||||
|
||||
Index: gdb-7.2/gdb/linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linux-nat.c 2010-09-25 15:30:54.000000000 +0200
|
||||
+++ gdb-7.2/gdb/linux-nat.c 2010-09-25 15:37:23.000000000 +0200
|
||||
@@ -2702,6 +2702,8 @@ stop_wait_callback (struct lwp_info *lp,
|
||||
{
|
||||
int status;
|
||||
|
||||
+ gdb_assert (lp->resumed);
|
||||
+
|
||||
status = wait_lwp (lp);
|
||||
if (status == 0)
|
||||
return 0;
|
||||
@@ -2726,110 +2728,61 @@ stop_wait_callback (struct lwp_info *lp,
|
||||
|
||||
if (WSTOPSIG (status) != SIGSTOP)
|
||||
{
|
||||
- if (WSTOPSIG (status) == SIGTRAP)
|
||||
- {
|
||||
- /* If a LWP other than the LWP that we're reporting an
|
||||
- event for has hit a GDB breakpoint (as opposed to
|
||||
- some random trap signal), then just arrange for it to
|
||||
- hit it again later. We don't keep the SIGTRAP status
|
||||
- and don't forward the SIGTRAP signal to the LWP. We
|
||||
- will handle the current event, eventually we will
|
||||
- resume all LWPs, and this one will get its breakpoint
|
||||
- trap again.
|
||||
-
|
||||
- If we do not do this, then we run the risk that the
|
||||
- user will delete or disable the breakpoint, but the
|
||||
- thread will have already tripped on it. */
|
||||
-
|
||||
- /* Save the trap's siginfo in case we need it later. */
|
||||
- save_siginfo (lp);
|
||||
-
|
||||
- save_sigtrap (lp);
|
||||
-
|
||||
- /* Now resume this LWP and get the SIGSTOP event. */
|
||||
- errno = 0;
|
||||
- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
|
||||
- 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");
|
||||
-
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "SWC: Candidate SIGTRAP event in %s\n",
|
||||
- target_pid_to_str (lp->ptid));
|
||||
- }
|
||||
- /* 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);
|
||||
+ /* The thread was stopped with a signal other than SIGSTOP. */
|
||||
|
||||
- /* Hold the SIGTRAP for handling by linux_nat_wait. If
|
||||
- there's another event, throw it back into the
|
||||
- queue. */
|
||||
- if (lp->status)
|
||||
- {
|
||||
- if (debug_linux_nat)
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "SWC: kill %s, %s\n",
|
||||
- target_pid_to_str (lp->ptid),
|
||||
- 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;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* The thread was stopped with a signal other than
|
||||
- SIGSTOP, and didn't accidentally trip a breakpoint. */
|
||||
+ save_sigtrap (lp);
|
||||
|
||||
- if (debug_linux_nat)
|
||||
- {
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "SWC: Pending event %s in %s\n",
|
||||
- status_to_str ((int) status),
|
||||
- target_pid_to_str (lp->ptid));
|
||||
- }
|
||||
- /* Now resume this LWP and get the SIGSTOP event. */
|
||||
- errno = 0;
|
||||
- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
|
||||
- if (debug_linux_nat)
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
|
||||
- target_pid_to_str (lp->ptid),
|
||||
- errno ? safe_strerror (errno) : "OK");
|
||||
-
|
||||
- /* 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);
|
||||
+ if (debug_linux_nat)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "SWC: Pending event %s in %s\n",
|
||||
+ status_to_str ((int) status),
|
||||
+ target_pid_to_str (lp->ptid));
|
||||
|
||||
- /* If the lp->status field is still empty, use it to
|
||||
- hold this event. If not, then this event must be
|
||||
- returned to the event queue of the LWP. */
|
||||
- if (lp->status)
|
||||
- {
|
||||
- if (debug_linux_nat)
|
||||
- {
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "SWC: kill %s, %s\n",
|
||||
- target_pid_to_str (lp->ptid),
|
||||
- status_to_str ((int) status));
|
||||
- }
|
||||
- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
|
||||
- }
|
||||
- else
|
||||
- lp->status = status;
|
||||
- return 0;
|
||||
- }
|
||||
+ /* Save the sigtrap event. */
|
||||
+ lp->status = status;
|
||||
+ gdb_assert (! lp->stopped);
|
||||
+ gdb_assert (lp->signalled);
|
||||
+ lp->stopped = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We caught the SIGSTOP that we intended to catch, so
|
||||
there's no SIGSTOP pending. */
|
||||
- lp->stopped = 1;
|
||||
+
|
||||
+ if (debug_linux_nat)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "SWC: Delayed SIGSTOP caught for %s.\n",
|
||||
+ target_pid_to_str (lp->ptid));
|
||||
+
|
||||
+ if (lp->step)
|
||||
+ {
|
||||
+ /* LP->STATUS is 0 here. That means SIGTRAP from
|
||||
+ PTRACE_SINGLESTEP still has to be delivered for this inferior
|
||||
+ stop. Catching the SIGTRAP event is important to prevent
|
||||
+ starvation in select_event_lwp. */
|
||||
+
|
||||
+ registers_changed ();
|
||||
+ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
|
||||
+ 1, TARGET_SIGNAL_0);
|
||||
+ if (debug_linux_nat)
|
||||
+ fprintf_unfiltered (gdb_stdlog,
|
||||
+ "SWC: %s %s, 0, 0 (discard SIGSTOP)\n",
|
||||
+ "PTRACE_SINGLESTEP",
|
||||
+ target_pid_to_str (lp->ptid));
|
||||
+
|
||||
+ lp->stopped = 0;
|
||||
+ gdb_assert (lp->resumed);
|
||||
+ stop_wait_callback (lp, NULL);
|
||||
+ gdb_assert (lp->stopped);
|
||||
+ }
|
||||
+ else
|
||||
+ lp->stopped = 1;
|
||||
+
|
||||
+ /* Reset SIGNALLED only after the stop_wait_callback call above as
|
||||
+ it does gdb_assert on SIGNALLED. */
|
||||
lp->signalled = 0;
|
||||
}
|
||||
}
|
||||
@@ -3416,52 +3369,6 @@ retry:
|
||||
lp = NULL;
|
||||
}
|
||||
|
||||
- if (lp && lp->signalled)
|
||||
- {
|
||||
- /* A pending SIGSTOP may interfere with the normal stream of
|
||||
- events. In a typical case where interference is a problem,
|
||||
- we have a SIGSTOP signal pending for LWP A while
|
||||
- single-stepping it, encounter an event in LWP B, and take the
|
||||
- pending SIGSTOP while trying to stop LWP A. After processing
|
||||
- the event in LWP B, LWP A is continued, and we'll never see
|
||||
- the SIGTRAP associated with the last time we were
|
||||
- single-stepping LWP A. */
|
||||
-
|
||||
- /* Resume the thread. It should halt immediately returning the
|
||||
- pending SIGSTOP. */
|
||||
- registers_changed ();
|
||||
- linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
|
||||
- lp->step, TARGET_SIGNAL_0);
|
||||
- if (debug_linux_nat)
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
|
||||
- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
|
||||
- target_pid_to_str (lp->ptid));
|
||||
- lp->stopped = 0;
|
||||
- gdb_assert (lp->resumed);
|
||||
-
|
||||
- /* Catch the pending SIGSTOP. */
|
||||
- status = lp->status;
|
||||
- lp->status = 0;
|
||||
-
|
||||
- stop_wait_callback (lp, NULL);
|
||||
-
|
||||
- /* If the lp->status field isn't empty, we caught another signal
|
||||
- while flushing the SIGSTOP. Return it back to the event
|
||||
- queue of the LWP, as we already have an event to handle. */
|
||||
- if (lp->status)
|
||||
- {
|
||||
- if (debug_linux_nat)
|
||||
- fprintf_unfiltered (gdb_stdlog,
|
||||
- "LLW: kill %s, %s\n",
|
||||
- target_pid_to_str (lp->ptid),
|
||||
- status_to_str (lp->status));
|
||||
- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
|
||||
- }
|
||||
-
|
||||
- lp->status = status;
|
||||
- }
|
||||
-
|
||||
if (!target_can_async_p ())
|
||||
{
|
||||
/* Causes SIGINT to be passed on to the attached process. */
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.c 2010-09-25 15:32:32.000000000 +0200
|
||||
@@ -0,0 +1,447 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#define _GNU_SOURCE
|
||||
+#include <pthread.h>
|
||||
+#include <stdio.h>
|
||||
+#include <limits.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <assert.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <signal.h>
|
||||
+#include <unistd.h>
|
||||
+#include <asm/unistd.h>
|
||||
+
|
||||
+#define gettid() syscall (__NR_gettid)
|
||||
+#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, tgid, tid, sig)
|
||||
+
|
||||
+/* Terminate always in the main task, it can lock up with SIGSTOPped GDB
|
||||
+ otherwise. */
|
||||
+#define TIMEOUT (gettid () == getpid() ? 10 : 15)
|
||||
+
|
||||
+static pid_t thread1_tid;
|
||||
+static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER;
|
||||
+static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
|
||||
+static int thread1_sigusr1_hit;
|
||||
+static int thread1_sigusr2_hit;
|
||||
+
|
||||
+static pid_t thread2_tid;
|
||||
+static pthread_cond_t thread2_tid_cond = PTHREAD_COND_INITIALIZER;
|
||||
+static pthread_mutex_t thread2_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
|
||||
+static int thread2_sigusr1_hit;
|
||||
+static int thread2_sigusr2_hit;
|
||||
+
|
||||
+static pthread_mutex_t terminate_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
|
||||
+
|
||||
+/* Do not use alarm as it would create a ptrace event which would hang up us if
|
||||
+ we are being traced by GDB which we stopped ourselves. */
|
||||
+
|
||||
+static void timed_mutex_lock (pthread_mutex_t *mutex)
|
||||
+{
|
||||
+ int i;
|
||||
+ struct timespec start, now;
|
||||
+
|
||||
+ i = clock_gettime (CLOCK_MONOTONIC, &start);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ i = pthread_mutex_trylock (mutex);
|
||||
+ if (i == 0)
|
||||
+ return;
|
||||
+ assert (i == EBUSY);
|
||||
+
|
||||
+ i = clock_gettime (CLOCK_MONOTONIC, &now);
|
||||
+ assert (i == 0);
|
||||
+ assert (now.tv_sec >= start.tv_sec);
|
||||
+ }
|
||||
+ while (now.tv_sec - start.tv_sec < TIMEOUT);
|
||||
+
|
||||
+ fprintf (stderr, "Timed out waiting for internal lock!\n");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+handler (int signo, siginfo_t *siginfo, void *exception)
|
||||
+{
|
||||
+ int *varp;
|
||||
+
|
||||
+ assert (siginfo->si_signo == signo);
|
||||
+ assert (siginfo->si_code == SI_TKILL);
|
||||
+ assert (siginfo->si_pid == getpid ());
|
||||
+
|
||||
+ if (gettid () == thread1_tid)
|
||||
+ {
|
||||
+ if (signo == SIGUSR1)
|
||||
+ varp = &thread1_sigusr1_hit;
|
||||
+ else if (signo == SIGUSR2)
|
||||
+ varp = &thread1_sigusr2_hit;
|
||||
+ else
|
||||
+ assert (0);
|
||||
+ }
|
||||
+ else if (gettid () == thread2_tid)
|
||||
+ {
|
||||
+ if (signo == SIGUSR1)
|
||||
+ varp = &thread2_sigusr1_hit;
|
||||
+ else if (signo == SIGUSR2)
|
||||
+ varp = &thread2_sigusr2_hit;
|
||||
+ else
|
||||
+ assert (0);
|
||||
+ }
|
||||
+ else
|
||||
+ assert (0);
|
||||
+
|
||||
+ if (*varp)
|
||||
+ {
|
||||
+ fprintf (stderr, "Signal %d for TID %lu has been already hit!\n", signo,
|
||||
+ (unsigned long) gettid ());
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ *varp = 1;
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+thread1_func (void *unused)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ timed_mutex_lock (&thread1_tid_mutex);
|
||||
+
|
||||
+ /* THREAD1_TID_MUTEX must be already locked to avoid race. */
|
||||
+ thread1_tid = gettid ();
|
||||
+
|
||||
+ i = pthread_cond_signal (&thread1_tid_cond);
|
||||
+ assert (i == 0);
|
||||
+ i = pthread_mutex_unlock (&thread1_tid_mutex);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ /* Be sure the "t (tracing stop)" test can proceed for both threads. */
|
||||
+ timed_mutex_lock (&terminate_mutex);
|
||||
+ i = pthread_mutex_unlock (&terminate_mutex);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ if (! thread1_sigusr1_hit)
|
||||
+ {
|
||||
+ fprintf (stderr, "Thread 1 signal SIGUSR1 not hit!\n");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ if (! thread1_sigusr2_hit)
|
||||
+ {
|
||||
+ fprintf (stderr, "Thread 1 signal SIGUSR2 not hit!\n");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+thread2_func (void *unused)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ timed_mutex_lock (&thread2_tid_mutex);
|
||||
+
|
||||
+ /* THREAD2_TID_MUTEX must be already locked to avoid race. */
|
||||
+ thread2_tid = gettid ();
|
||||
+
|
||||
+ i = pthread_cond_signal (&thread2_tid_cond);
|
||||
+ assert (i == 0);
|
||||
+ i = pthread_mutex_unlock (&thread2_tid_mutex);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ /* Be sure the "t (tracing stop)" test can proceed for both threads. */
|
||||
+ timed_mutex_lock (&terminate_mutex);
|
||||
+ i = pthread_mutex_unlock (&terminate_mutex);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ if (! thread2_sigusr1_hit)
|
||||
+ {
|
||||
+ fprintf (stderr, "Thread 2 signal SIGUSR1 not hit!\n");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ if (! thread2_sigusr2_hit)
|
||||
+ {
|
||||
+ fprintf (stderr, "Thread 2 signal SIGUSR2 not hit!\n");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static const char *
|
||||
+proc_string (const char *filename, const char *line)
|
||||
+{
|
||||
+ FILE *f;
|
||||
+ static char buf[LINE_MAX];
|
||||
+ size_t line_len = strlen (line);
|
||||
+
|
||||
+ f = fopen (filename, "r");
|
||||
+ if (f == NULL)
|
||||
+ {
|
||||
+ fprintf (stderr, "fopen (\"%s\") for \"%s\": %s\n", filename, line,
|
||||
+ strerror (errno));
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ while (errno = 0, fgets (buf, sizeof (buf), f))
|
||||
+ {
|
||||
+ char *s;
|
||||
+
|
||||
+ s = strchr (buf, '\n');
|
||||
+ assert (s != NULL);
|
||||
+ *s = 0;
|
||||
+
|
||||
+ if (strncmp (buf, line, line_len) != 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (fclose (f))
|
||||
+ {
|
||||
+ fprintf (stderr, "fclose (\"%s\") for \"%s\": %s\n", filename, line,
|
||||
+ strerror (errno));
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ return &buf[line_len];
|
||||
+ }
|
||||
+ if (errno != 0)
|
||||
+ {
|
||||
+ fprintf (stderr, "fgets (\"%s\": %s\n", filename, strerror (errno));
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ fprintf (stderr, "\"%s\": No line \"%s\" found.\n", filename, line);
|
||||
+ exit (EXIT_FAILURE);
|
||||
+}
|
||||
+
|
||||
+static unsigned long
|
||||
+proc_ulong (const char *filename, const char *line)
|
||||
+{
|
||||
+ const char *s = proc_string (filename, line);
|
||||
+ long retval;
|
||||
+ char *end;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ retval = strtol (s, &end, 10);
|
||||
+ if (retval < 0 || retval >= LONG_MAX || (end && *end))
|
||||
+ {
|
||||
+ fprintf (stderr, "\"%s\":\"%s\": %ld, %s\n", filename, line, retval,
|
||||
+ strerror (errno));
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+state_wait (pid_t process, const char *wanted)
|
||||
+{
|
||||
+ char *filename;
|
||||
+ int i;
|
||||
+ struct timespec start, now;
|
||||
+ const char *state;
|
||||
+
|
||||
+ i = asprintf (&filename, "/proc/%lu/status", (unsigned long) process);
|
||||
+ assert (i > 0);
|
||||
+
|
||||
+ i = clock_gettime (CLOCK_MONOTONIC, &start);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ state = proc_string (filename, "State:\t");
|
||||
+
|
||||
+ /* torvalds/linux-2.6.git 464763cf1c6df632dccc8f2f4c7e50163154a2c0
|
||||
+ has changed "T (tracing stop)" to "t (tracing stop)". Make the GDB
|
||||
+ testcase backward compatible with older Linux kernels. */
|
||||
+ if (strcmp (state, "T (tracing stop)") == 0)
|
||||
+ state = "t (tracing stop)";
|
||||
+
|
||||
+ if (strcmp (state, wanted) == 0)
|
||||
+ {
|
||||
+ free (filename);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (sched_yield ())
|
||||
+ {
|
||||
+ perror ("sched_yield()");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ i = clock_gettime (CLOCK_MONOTONIC, &now);
|
||||
+ assert (i == 0);
|
||||
+ assert (now.tv_sec >= start.tv_sec);
|
||||
+ }
|
||||
+ while (now.tv_sec - start.tv_sec < TIMEOUT);
|
||||
+
|
||||
+ fprintf (stderr, "Timed out waiting for PID %lu \"%s\" (now it is \"%s\")!\n",
|
||||
+ (unsigned long) process, wanted, state);
|
||||
+ exit (EXIT_FAILURE);
|
||||
+}
|
||||
+
|
||||
+static volatile pid_t tracer = 0;
|
||||
+static pthread_t thread1, thread2;
|
||||
+
|
||||
+static void
|
||||
+cleanup (void)
|
||||
+{
|
||||
+ printf ("Resuming GDB PID %lu.\n", (unsigned long) tracer);
|
||||
+
|
||||
+ if (tracer)
|
||||
+ {
|
||||
+ int i;
|
||||
+ int tracer_save = tracer;
|
||||
+
|
||||
+ tracer = 0;
|
||||
+
|
||||
+ i = kill (tracer_save, SIGCONT);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ int i;
|
||||
+ int standalone = 0;
|
||||
+ struct sigaction act;
|
||||
+
|
||||
+ if (argc == 2 && strcmp (argv[1], "-s") == 0)
|
||||
+ standalone = 1;
|
||||
+ else
|
||||
+ assert (argc == 1);
|
||||
+
|
||||
+ setbuf (stdout, NULL);
|
||||
+
|
||||
+ timed_mutex_lock (&thread1_tid_mutex);
|
||||
+ timed_mutex_lock (&thread2_tid_mutex);
|
||||
+
|
||||
+ timed_mutex_lock (&terminate_mutex);
|
||||
+
|
||||
+ errno = 0;
|
||||
+ memset (&act, 0, sizeof (act));
|
||||
+ act.sa_sigaction = handler;
|
||||
+ act.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||
+ i = sigemptyset (&act.sa_mask);
|
||||
+ assert_perror (errno);
|
||||
+ assert (i == 0);
|
||||
+ i = sigaction (SIGUSR1, &act, NULL);
|
||||
+ assert_perror (errno);
|
||||
+ assert (i == 0);
|
||||
+ i = sigaction (SIGUSR2, &act, NULL);
|
||||
+ assert_perror (errno);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = pthread_create (&thread1, NULL, thread1_func, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = pthread_create (&thread2, NULL, thread2_func, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ if (!standalone)
|
||||
+ {
|
||||
+ tracer = proc_ulong ("/proc/self/status", "TracerPid:\t");
|
||||
+ if (tracer == 0)
|
||||
+ {
|
||||
+ fprintf (stderr, "The testcase must be run by GDB!\n");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ if (tracer != getppid ())
|
||||
+ {
|
||||
+ fprintf (stderr, "The testcase parent must be our GDB tracer!\n");
|
||||
+ exit (EXIT_FAILURE);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* SIGCONT our debugger in the case of our crash as we would deadlock
|
||||
+ otherwise. */
|
||||
+
|
||||
+ atexit (cleanup);
|
||||
+
|
||||
+ printf ("Stopping GDB PID %lu.\n", (unsigned long) tracer);
|
||||
+
|
||||
+ if (tracer)
|
||||
+ {
|
||||
+ i = kill (tracer, SIGSTOP);
|
||||
+ assert (i == 0);
|
||||
+ state_wait (tracer, "T (stopped)");
|
||||
+ }
|
||||
+
|
||||
+ /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so
|
||||
+ they could not trigger the signals before GDB gets unstopped later.
|
||||
+ Threads get resumed at pthread_cond_wait below. Use `while' loops for
|
||||
+ protection against spurious pthread_cond_wait wakeups. */
|
||||
+
|
||||
+ printf ("Waiting till the threads initialize their TIDs.\n");
|
||||
+
|
||||
+ while (thread1_tid == 0)
|
||||
+ {
|
||||
+ i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+
|
||||
+ while (thread2_tid == 0)
|
||||
+ {
|
||||
+ i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+
|
||||
+ printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n",
|
||||
+ (unsigned long) thread1_tid, (unsigned long) thread2_tid,
|
||||
+ (unsigned long) getpid ());
|
||||
+
|
||||
+ errno = 0;
|
||||
+ i = tgkill (getpid (), thread1_tid, SIGUSR1);
|
||||
+ assert_perror (errno);
|
||||
+ assert (i == 0);
|
||||
+ i = tgkill (getpid (), thread1_tid, SIGUSR2);
|
||||
+ assert_perror (errno);
|
||||
+ assert (i == 0);
|
||||
+ i = tgkill (getpid (), thread2_tid, SIGUSR1);
|
||||
+ assert_perror (errno);
|
||||
+ assert (i == 0);
|
||||
+ i = tgkill (getpid (), thread2_tid, SIGUSR2);
|
||||
+ assert_perror (errno);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ printf ("Waiting till the threads get trapped by the signals.\n");
|
||||
+
|
||||
+ if (tracer)
|
||||
+ {
|
||||
+ /* s390x-unknown-linux-gnu will fail with "R (running)". */
|
||||
+
|
||||
+ state_wait (thread1_tid, "t (tracing stop)");
|
||||
+
|
||||
+ state_wait (thread2_tid, "t (tracing stop)");
|
||||
+ }
|
||||
+
|
||||
+ cleanup ();
|
||||
+
|
||||
+ printf ("Joining the threads.\n");
|
||||
+
|
||||
+ i = pthread_mutex_unlock (&terminate_mutex);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = pthread_join (thread1, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = pthread_join (thread2, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ printf ("Exiting.\n"); /* break-at-exit */
|
||||
+
|
||||
+ return EXIT_SUCCESS;
|
||||
+}
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.exp 2010-09-25 15:32:32.000000000 +0200
|
||||
@@ -0,0 +1,94 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile "siginfo-threads"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $testfile
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# `nostop noprint pass' could in some cases report false PASS due to the
|
||||
+# (preempt 'handle') code path.
|
||||
+
|
||||
+gdb_test "handle SIGUSR1 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
|
||||
+gdb_test "handle SIGUSR2 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "break-at-exit"]
|
||||
+
|
||||
+set test "get pid"
|
||||
+gdb_test_multiple "p getpid ()" $test {
|
||||
+ -re " = (\[0-9\]+)\r\n$gdb_prompt $" {
|
||||
+ set pid $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+for {set sigcount 0} {$sigcount < 4} {incr sigcount} {
|
||||
+ set test "catch signal $sigcount"
|
||||
+ set sigusr ""
|
||||
+ gdb_test_multiple "continue" $test {
|
||||
+ -re "Program received signal SIGUSR(\[12\]), User defined signal \[12\]\\.\r\n.*\r\n$gdb_prompt $" {
|
||||
+ set sigusr $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+ if {$sigusr == ""} {
|
||||
+ return -1
|
||||
+ }
|
||||
+
|
||||
+ set test "signal $sigcount si_signo"
|
||||
+ if {$sigusr == 1} {
|
||||
+ set signo 10
|
||||
+ } else {
|
||||
+ set signo 12
|
||||
+ }
|
||||
+ gdb_test_multiple {p $_siginfo.si_signo} $test {
|
||||
+ -re " = $signo\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "signal $sigcount si_code is SI_TKILL"
|
||||
+ gdb_test_multiple {p $_siginfo.si_code} $test {
|
||||
+ -re " = -6\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ set test "signal $sigcount si_pid"
|
||||
+ gdb_test_multiple {p $_siginfo._sifields._kill.si_pid} $test {
|
||||
+ -re " = $pid\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*"
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.c 2010-09-25 15:32:32.000000000 +0200
|
||||
@@ -0,0 +1,54 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <signal.h>
|
||||
+
|
||||
+#include <asm/unistd.h>
|
||||
+#include <unistd.h>
|
||||
+#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, (tgid), (tid), (sig))
|
||||
+#define gettid() syscall (__NR_gettid)
|
||||
+
|
||||
+static volatile int var;
|
||||
+
|
||||
+static void
|
||||
+handler (int signo) /* step-0 */
|
||||
+{ /* step-0 */
|
||||
+ var++; /* step-1 */
|
||||
+ tgkill (getpid (), gettid (), SIGUSR1); /* step-2 */
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+start (void *arg)
|
||||
+{
|
||||
+ signal (SIGUSR1, handler);
|
||||
+ tgkill (getpid (), gettid (), SIGUSR1);
|
||||
+ assert (0);
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ pthread_t thread;
|
||||
+
|
||||
+ pthread_create (&thread, NULL, start, NULL);
|
||||
+ start (NULL); /* main-start */
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.exp 2010-09-25 15:32:32.000000000 +0200
|
||||
@@ -0,0 +1,74 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile sigstep-threads
|
||||
+set srcfile ${testfile}.c
|
||||
+set executable ${testfile}
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+# `noprint' would not test the full logic of GDB.
|
||||
+gdb_test "handle SIGUSR1 nostop print pass" "\r\nSIGUSR1\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
|
||||
+
|
||||
+gdb_test_no_output "set scheduler-locking off"
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "step-1"]
|
||||
+gdb_test_no_output {set $step1=$bpnum}
|
||||
+gdb_continue_to_breakpoint "step-1" ".* step-1 .*"
|
||||
+gdb_test_no_output {disable $step1}
|
||||
+
|
||||
+# 1 as we are now stopped at the `step-1' label.
|
||||
+set step_at 1
|
||||
+for {set i 0} {$i < 100} {incr i} {
|
||||
+ set test "step $i"
|
||||
+ # Presume this step failed - as in the case of a timeout.
|
||||
+ set failed 1
|
||||
+ gdb_test_multiple "step" $test {
|
||||
+ -re "\r\nProgram received signal SIGUSR1, User defined signal 1.\r\n" {
|
||||
+ exp_continue -continue_timer
|
||||
+ }
|
||||
+ -re "step-(\[012\]).*\r\n$gdb_prompt $" {
|
||||
+ set now $expect_out(1,string)
|
||||
+ if {$step_at == 2 && $now == 1} {
|
||||
+ set failed 0
|
||||
+ } elseif {$step_at == 1 && $now == 2} {
|
||||
+ set failed 0
|
||||
+ # Continue over the re-signalling back to the handle entry.
|
||||
+ gdb_test_no_output {enable $step1} ""
|
||||
+ gdb_test "continue" " step-1 .*" ""
|
||||
+ set now 1
|
||||
+ gdb_test_no_output {disable $step1} ""
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ set step_at $now
|
||||
+ }
|
||||
+ }
|
||||
+ if $failed {
|
||||
+ return
|
||||
+ }
|
||||
+}
|
||||
+# We can never reliably say the racy problematic case has been tested.
|
||||
+pass "step"
|
|
@ -0,0 +1,141 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html
|
||||
Subject: [patch 4/4]#3 Remove redundant lp->siginfo
|
||||
|
||||
Hi,
|
||||
|
||||
this is a simplification which should not affect GDB behavior. As linux-nat
|
||||
now stops on each received signal without any reordering of them then
|
||||
PTRACE_GETSIGINFO is enough to access siginfo, without any need to copy it in
|
||||
advance.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-09-20 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* linux-nat.c (resume_callback) <lp->stopped && lp->status == 0>
|
||||
(linux_nat_resume): Remove LP->SIGINFO clearing.
|
||||
(save_siginfo): Remove.
|
||||
(stop_wait_callback) <WSTOPSIG (status) != SIGSTOP>
|
||||
(linux_nat_filter_event) <linux_nat_status_is_event (status)>: Remove
|
||||
the save_siginfo call.
|
||||
(resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing.
|
||||
(linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
|
||||
* linux-nat.h (struct lwp_info) <siginfo>: Remove.
|
||||
|
||||
Index: gdb-7.2/gdb/linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linux-nat.c 2010-09-25 15:37:23.000000000 +0200
|
||||
+++ gdb-7.2/gdb/linux-nat.c 2010-09-25 15:38:18.000000000 +0200
|
||||
@@ -1851,7 +1851,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));
|
||||
|
||||
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)
|
||||
@@ -2483,22 +2481,6 @@ wait_lwp (struct lwp_info *lp)
|
||||
return status;
|
||||
}
|
||||
|
||||
-/* Save the most recent siginfo for LP. This is currently only called
|
||||
- for SIGTRAP; some ports use the si_addr field for
|
||||
- target_stopped_data_address. In the future, it may also be used to
|
||||
- restore the siginfo of requeued signals. */
|
||||
-
|
||||
-static void
|
||||
-save_siginfo (struct lwp_info *lp)
|
||||
-{
|
||||
- errno = 0;
|
||||
- ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
|
||||
- (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
|
||||
-
|
||||
- if (errno != 0)
|
||||
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
|
||||
-}
|
||||
-
|
||||
/* Send a SIGSTOP to LP. */
|
||||
|
||||
static int
|
||||
@@ -2730,9 +2712,6 @@ stop_wait_callback (struct lwp_info *lp,
|
||||
{
|
||||
/* The thread was stopped with a signal other than SIGSTOP. */
|
||||
|
||||
- /* Save the trap's siginfo in case we need it later. */
|
||||
- save_siginfo (lp);
|
||||
-
|
||||
save_sigtrap (lp);
|
||||
|
||||
if (debug_linux_nat)
|
||||
@@ -3102,12 +3081,7 @@ linux_nat_filter_event (int lwpid, int s
|
||||
}
|
||||
|
||||
if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP)
|
||||
- {
|
||||
- /* Save the trap's siginfo in case we need it later. */
|
||||
- save_siginfo (lp);
|
||||
-
|
||||
- save_sigtrap (lp);
|
||||
- }
|
||||
+ save_sigtrap (lp);
|
||||
|
||||
/* Check if the thread has exited. */
|
||||
if ((WIFEXITED (status) || WIFSIGNALED (status))
|
||||
@@ -3706,7 +3680,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;
|
||||
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
|
||||
lp->stopped_by_watchpoint = 0;
|
||||
}
|
||||
|
||||
@@ -5878,11 +5851,19 @@ linux_nat_set_siginfo_fixup (struct targ
|
||||
struct siginfo *
|
||||
linux_nat_get_siginfo (ptid_t ptid)
|
||||
{
|
||||
- struct lwp_info *lp = find_lwp_pid (ptid);
|
||||
+ static struct siginfo siginfo;
|
||||
+ int pid;
|
||||
|
||||
- gdb_assert (lp != NULL);
|
||||
+ pid = GET_LWP (ptid);
|
||||
+ if (pid == 0)
|
||||
+ pid = GET_PID (ptid);
|
||||
+
|
||||
+ errno = 0;
|
||||
+ ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
|
||||
+ if (errno != 0)
|
||||
+ memset (&siginfo, 0, sizeof (siginfo));
|
||||
|
||||
- return &lp->siginfo;
|
||||
+ return &siginfo;
|
||||
}
|
||||
|
||||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||
Index: gdb-7.2/gdb/linux-nat.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linux-nat.h 2010-09-25 15:30:50.000000000 +0200
|
||||
+++ gdb-7.2/gdb/linux-nat.h 2010-09-25 15:37:57.000000000 +0200
|
||||
@@ -58,10 +58,6 @@ struct lwp_info
|
||||
/* The kind of stepping of this LWP. */
|
||||
enum resume_step step;
|
||||
|
||||
- /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
|
||||
- be the address of a hardware watchpoint. */
|
||||
- struct siginfo siginfo;
|
||||
-
|
||||
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
|
||||
watchpoint trap. */
|
||||
int stopped_by_watchpoint;
|
|
@ -0,0 +1,169 @@
|
|||
gdb:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=623749
|
||||
kernel:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=636937
|
||||
|
||||
http://sourceware.org/ml/gdb-patches/2010-09/msg00395.html
|
||||
Subject: Re: [patch] Fix gcore writer for -Wl,-z,relro (PR corefiles/11804)
|
||||
|
||||
gdb/testsuite/
|
||||
2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix gcore writer for -Wl,-z,relro.
|
||||
* gdb.base/gcore-relro.exp: New file.
|
||||
* gdb.base/gcore-relro-main.c: New file.
|
||||
* gdb.base/gcore-relro-lib.c: New file.
|
||||
|
||||
--- ./gdb/gcore.c 2010-09-23 20:14:56.000000000 +0200
|
||||
+++ ./gdb/gcore.c 2010-09-23 20:37:56.000000000 +0200
|
||||
@@ -401,6 +401,7 @@ gcore_create_callback (CORE_ADDR vaddr,
|
||||
|
||||
if (write == 0 && !solib_keep_data_in_core (vaddr, size))
|
||||
{
|
||||
+#if 0 /* https://bugzilla.redhat.com/show_bug.cgi?id=636937 */
|
||||
/* See if this region of memory lies inside a known file on disk.
|
||||
If so, we can avoid copying its contents by clearing SEC_LOAD. */
|
||||
struct objfile *objfile;
|
||||
@@ -433,6 +434,7 @@ gcore_create_callback (CORE_ADDR vaddr,
|
||||
}
|
||||
|
||||
keep:
|
||||
+#endif
|
||||
flags |= SEC_READONLY;
|
||||
}
|
||||
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-relro-lib.c
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+void
|
||||
+lib (void)
|
||||
+{
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-relro-main.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+extern void lib (void);
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ lib ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gcore-relro.exp
|
||||
@@ -0,0 +1,80 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if {[skip_shlib_tests]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "gcore-relro"
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set srclibfile ${testfile}-lib.c
|
||||
+set libfile ${objdir}/${subdir}/${testfile}-lib.so
|
||||
+set objfile ${objdir}/${subdir}/${testfile}-main.o
|
||||
+set executable ${testfile}-main
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+set gcorefile ${objdir}/${subdir}/${executable}.gcore
|
||||
+
|
||||
+if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} {debug}] != ""
|
||||
+ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+set opts [list debug shlib=${libfile} additional_flags=-Wl,-z,relro]
|
||||
+if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
|
||||
+ unsupported "-Wl,-z,relro compilation failed"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+gdb_load_shlibs $libfile
|
||||
+
|
||||
+# Does this gdb support gcore?
|
||||
+set test "help gcore"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
|
||||
+ # gcore command not supported -- nothing to test here.
|
||||
+ unsupported "gdb does not support gcore on this target"
|
||||
+ return -1;
|
||||
+ }
|
||||
+ -re "Save a core file .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { ![runto lib] } then {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set escapedfilename [string_to_regexp ${gcorefile}]
|
||||
+
|
||||
+set test "save a corefile"
|
||||
+gdb_test_multiple "gcore ${gcorefile}" $test {
|
||||
+ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Can't create a corefile\r\n$gdb_prompt $" {
|
||||
+ unsupported $test
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Now restart gdb and load the corefile.
|
||||
+
|
||||
+clean_restart $executable
|
||||
+gdb_load_shlibs $libfile
|
||||
+
|
||||
+gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
|
||||
+
|
||||
+gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
|
|
@ -0,0 +1,280 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00440.html
|
||||
Subject: [patch] Fix infinite loop crash on self-referencing class
|
||||
|
||||
Hi,
|
||||
|
||||
class C { static C s; }; is a problem for GDB as it references itself and it
|
||||
can crash. Downstream Bug:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=627432
|
||||
|
||||
#3 0x00000000005b2cc5 in gnuv3_pass_by_reference (type=0x1044d3c8) at ../../gdb/gnu-v3-abi.c:840
|
||||
#4 0x00000000005b2cc5 in gnuv3_pass_by_reference (type=0x1044d3c8) at ../../gdb/gnu-v3-abi.c:840
|
||||
[...]
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
||||
|
||||
FYI the .cc file is not reproducible on - and only on - Fedora 14 GCC, filed:
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=637315
|
||||
|
||||
I would even check it in in some time.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-09-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix GDB crash on inferior calls with self-referencing classes.
|
||||
* gnu-v3-abi.c (gnuv3_pass_by_reference): Do not call itself on static
|
||||
member fields.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-09-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix GDB crash on inferior calls with self-referencing classes.
|
||||
* gdb.dwarf2/dw2-cp-infcall-ref-static.exp: New file.
|
||||
* gdb.dwarf2/dw2-cp-infcall-ref-static-main.c: New file.
|
||||
* gdb.dwarf2/dw2-cp-infcall-ref-static.S: New file.
|
||||
|
||||
--- a/gdb/gnu-v3-abi.c
|
||||
+++ b/gdb/gnu-v3-abi.c
|
||||
@@ -835,9 +835,10 @@ gnuv3_pass_by_reference (struct type *type)
|
||||
by reference, so does this class. Similarly for members, which
|
||||
are constructed whenever this class is. We do not need to worry
|
||||
about recursive loops here, since we are only looking at members
|
||||
- of complete class type. */
|
||||
+ of complete class type. Also ignore any static members. */
|
||||
for (fieldnum = 0; fieldnum < TYPE_NFIELDS (type); fieldnum++)
|
||||
- if (gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum)))
|
||||
+ if (TYPE_FIELD_LOC_KIND (type, fieldnum) == FIELD_LOC_KIND_BITPOS
|
||||
+ && gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum)))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c
|
||||
@@ -0,0 +1,51 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* class C
|
||||
+ {
|
||||
+ public:
|
||||
+ static C s;
|
||||
+ };
|
||||
+ C C::s;
|
||||
+ C f()
|
||||
+ {
|
||||
+ return C::s;
|
||||
+ } */
|
||||
+
|
||||
+asm (".globl cu_text_start");
|
||||
+asm ("cu_text_start:");
|
||||
+
|
||||
+asm (".globl f_start");
|
||||
+asm ("f_start:");
|
||||
+
|
||||
+void
|
||||
+f (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+asm (".globl f_end");
|
||||
+asm ("f_end:");
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ f ();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+asm (".globl cu_text_end");
|
||||
+asm ("cu_text_end:");
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S
|
||||
@@ -0,0 +1,115 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* Debug information */
|
||||
+
|
||||
+ .section .debug_info
|
||||
+.Lcu1_begin:
|
||||
+ /* CU header */
|
||||
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
|
||||
+.Lcu1_start:
|
||||
+ .2byte 2 /* DWARF Version */
|
||||
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
|
||||
+ .byte 4 /* Pointer size */
|
||||
+
|
||||
+ /* CU die */
|
||||
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
|
||||
+ .4byte cu_text_start /* DW_AT_low_pc */
|
||||
+ .4byte cu_text_end /* DW_AT_high_pc */
|
||||
+ .ascii "file1.txt\0" /* DW_AT_name */
|
||||
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
|
||||
+ .byte 4 /* DW_AT_language (DW_LANG_C_plus_plus) */
|
||||
+
|
||||
+.Ltype_class:
|
||||
+ .uleb128 3 /* Abbrev: DW_TAG_class_type */
|
||||
+ .ascii "C\0" /* DW_AT_name */
|
||||
+
|
||||
+ .uleb128 4 /* Abbrev: DW_TAG_member */
|
||||
+ .ascii "s\0" /* DW_AT_name */
|
||||
+ .4byte .Ltype_class-.Lcu1_begin /* DW_AT_type */
|
||||
+ .byte 1 /* DW_AT_declaration */
|
||||
+ .byte 1 /* DW_AT_external */
|
||||
+
|
||||
+ .byte 0 /* End of children of DW_TAG_class_type */
|
||||
+
|
||||
+ .uleb128 5 /* Abbrev: DW_TAG_subprogram */
|
||||
+ .ascii "f\0" /* DW_AT_name */
|
||||
+ .4byte .Ltype_class-.Lcu1_begin /* DW_AT_type */
|
||||
+ .4byte f_start /* DW_AT_low_pc */
|
||||
+ .4byte f_end /* DW_AT_high_pc */
|
||||
+
|
||||
+ .byte 0 /* End of children of CU */
|
||||
+
|
||||
+.Lcu1_end:
|
||||
+
|
||||
+/* Abbrev table */
|
||||
+ .section .debug_abbrev
|
||||
+.Labbrev1_begin:
|
||||
+ .uleb128 1 /* Abbrev code */
|
||||
+ .uleb128 0x11 /* DW_TAG_compile_unit */
|
||||
+ .byte 1 /* has_children */
|
||||
+ .uleb128 0x11 /* DW_AT_low_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x12 /* DW_AT_high_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x25 /* DW_AT_producer */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x13 /* DW_AT_language */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 3 /* Abbrev code */
|
||||
+ .uleb128 0x2 /* DW_TAG_class_type */
|
||||
+ .byte 1 /* has_children */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 4 /* Abbrev code */
|
||||
+ .uleb128 0xd /* DW_TAG_member */
|
||||
+ .byte 0 /* has_children */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .uleb128 0x3c /* DW_AT_declaration */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .uleb128 0x3f /* DW_AT_external */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 5 /* Abbrev code */
|
||||
+ .uleb128 0x2e /* DW_TAG_subprogram */
|
||||
+ .byte 0 /* has_children */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .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 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
|
||||
@@ -0,0 +1,49 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Check that GDB can call C++ functions whose parameters or return values have
|
||||
+# type containing a static member of the same type.
|
||||
+
|
||||
+# Still no C++ compiler is used.
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*]
|
||||
+ && ![istarget arm-*-eabi*]
|
||||
+ && ![istarget powerpc-*-eabi*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-cp-infcall-ref-static"
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}-main.c ${testfile}.S] {}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# main is not provided by DWARF.
|
||||
+gdb_test_no_output "set language c++"
|
||||
+
|
||||
+# There are no mangled names in DWARF to suggest the v3 ABI.
|
||||
+gdb_test_no_output "set cp-abi gnu-v3"
|
||||
+
|
||||
+# GDB could crash. There is no DW_AT_location so it is <optimized out>.
|
||||
+gdb_test "p f()" { = {static s = <optimized out>}}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
https://bugzilla.redhat.com/show_bug.cgi?id=631158
|
||||
http://sourceware.org/ml/gdb-patches/2010-09/msg00229.html
|
||||
Subject: [patch] PR 11992 "Regression: C++ this scope sometimes does not work"
|
||||
|
||||
--- gdb-7.2/gdb/c-exp.y.orig 2010-08-19 17:50:00.000000000 +0200
|
||||
+++ gdb-7.2/gdb/c-exp.y 2010-09-11 20:30:15.000000000 +0200
|
||||
@@ -2422,6 +2422,7 @@ classify_name (struct block *block)
|
||||
|
||||
if (sym == NULL
|
||||
&& parse_language->la_language == language_cplus
|
||||
+ && !is_a_field_of_this
|
||||
&& !lookup_minimal_symbol (copy, NULL, NULL))
|
||||
return UNKNOWN_CPP_NAME;
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00183.html
|
||||
Subject: [patch] .gdb_index: Do not crash on NOBITS
|
||||
|
||||
Hi,
|
||||
|
||||
elfutils-0.148 still do not contain patch of its GIT
|
||||
804e9ca4d644e64a6125307cbf0a0b89477d7611 where the .gdb_index section has been
|
||||
also split into the separate debug info file.
|
||||
|
||||
Due to it binaries split using elfutils-0.148 contain
|
||||
[38] .gdb_index NOBITS 0000000000000000 0000338c
|
||||
instead of expected
|
||||
[28] .gdb_index PROGBITS 0000000000000000 0000211c
|
||||
|
||||
and due to it GDB while reading the file can error() by:
|
||||
Reading symbols from x.debug...Dwarf Error: Can't read DWARF data from 'x.debug'
|
||||
|
||||
which should not be fatal but due to some other bugs therein it can crash GDB.
|
||||
|
||||
The wrong separate debug info file is for example:
|
||||
http://kojipkgs.fedoraproject.org/packages/glibc/2.12.90/10/x86_64/glibc-debuginfo-2.12.90-10.x86_64.rpm
|
||||
/usr/lib/debug/lib64/libutil-2.12.90.so.debug
|
||||
|
||||
OK to check-in?
|
||||
|
||||
It does not attempt to use .gdb_index from the main binary, it will just
|
||||
disable .gdb_index usage on these binaries.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00062.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/08 19:09:42 1.12162
|
||||
### src/gdb/ChangeLog 2010/09/08 19:49:28 1.12163
|
||||
## -1,3 +1,7 @@
|
||||
+2010-09-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * dwarf2read.c (dwarf2_read_index): Return on no SEC_HAS_CONTENTS.
|
||||
+
|
||||
2010-09-08 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* dwarf2read.c (read_structure_type): Move processing of
|
||||
--- src/gdb/dwarf2read.c 2010/09/08 19:09:42 1.452
|
||||
+++ src/gdb/dwarf2read.c 2010/09/08 19:49:28 1.453
|
||||
@@ -1904,6 +1904,13 @@
|
||||
if (dwarf2_per_objfile->gdb_index.asection == NULL
|
||||
|| dwarf2_per_objfile->gdb_index.size == 0)
|
||||
return 0;
|
||||
+
|
||||
+ /* Older elfutils strip versions could keep the section in the main
|
||||
+ executable while splitting it for the separate debug info file. */
|
||||
+ if ((bfd_get_file_flags (dwarf2_per_objfile->gdb_index.asection)
|
||||
+ & SEC_HAS_CONTENTS) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index);
|
||||
|
||||
addr = dwarf2_per_objfile->gdb_index.buffer;
|
|
@ -0,0 +1,61 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00365.html
|
||||
Subject: [patch] python: load *-gdb.py for shlibs during attach
|
||||
|
||||
Hi,
|
||||
|
||||
currently if you attach to or load a core file for executable, its -gdb.py
|
||||
script is loaded. But none -gdb.py for the shared libraries.
|
||||
|
||||
Spawned or with the fix (libstdc++-gdb.py):
|
||||
#1 0x00000000004007b5 in f (s="a") at 1.C:4
|
||||
^ is std::string
|
||||
|
||||
Attached/core without the fix:
|
||||
#1 0x00000000004007b5 in f (s=...) at 1.C:4
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
||||
|
||||
Mostly obvious, I will check it in later.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* main.c: Include objfiles.h.
|
||||
(captured_main): New variable objfile. Call
|
||||
load_auto_scripts_for_objfile for ALL_OBJFILES.
|
||||
|
||||
--- ./gdb/main.c 2010-09-22 10:51:32.000000000 +0200
|
||||
+++ ./gdb/main.c 2010-09-22 10:50:44.000000000 +0200
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "source.h"
|
||||
#include "cli/cli-cmds.h"
|
||||
#include "python/python.h"
|
||||
+#include "objfiles.h"
|
||||
|
||||
/* The selected interpreter. This will be used as a set command
|
||||
variable, so it should always be malloc'ed - since
|
||||
@@ -323,6 +324,7 @@ captured_main (void *data)
|
||||
|
||||
int i;
|
||||
int save_auto_load;
|
||||
+ struct objfile *objfile;
|
||||
|
||||
struct cleanup *pre_stat_chain = make_command_stats_cleanup (0);
|
||||
|
||||
@@ -957,8 +959,8 @@ Can't attach to process and specify a co
|
||||
We wait until now because it is common to add to the source search
|
||||
path in local_gdbinit. */
|
||||
gdbpy_global_auto_load = save_auto_load;
|
||||
- if (symfile_objfile != NULL)
|
||||
- load_auto_scripts_for_objfile (symfile_objfile);
|
||||
+ ALL_OBJFILES (objfile)
|
||||
+ load_auto_scripts_for_objfile (objfile);
|
||||
|
||||
for (i = 0; i < ncmd; i++)
|
||||
{
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
commit 30fedadf224a8c119575fcc8a6ced51f0d4aee9f
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Wed Sep 29 01:25:39 2010 +0200
|
||||
|
||||
Fix the crash.
|
||||
|
||||
commit d101ce597f2d6143e9f023a4444352bceffb2679
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Wed Sep 29 00:42:37 2010 +0200
|
||||
|
||||
New testcase for: https://bugzilla.redhat.com/show_bug.cgi?id=637770
|
||||
|
||||
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
|
||||
index de51231..18b7868 100644
|
||||
--- a/gdb/breakpoint.c
|
||||
+++ b/gdb/breakpoint.c
|
||||
@@ -10560,6 +10560,11 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *,
|
||||
/* FUNCTION can be also delete_breakpoint. */
|
||||
next_related_b = related_breakpoint->related_breakpoint;
|
||||
function (related_breakpoint, data);
|
||||
+
|
||||
+ /* For delete_breakpoint of the last entry of the ring we
|
||||
+ were traversing we would never get back to B. */
|
||||
+ if (next_related_b == related_breakpoint)
|
||||
+ break;
|
||||
related_breakpoint = next_related_b;
|
||||
}
|
||||
while (related_breakpoint != b);
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.c b/gdb/testsuite/gdb.base/watchpoint-delete.c
|
||||
new file mode 100644
|
||||
index 0000000..031ef92
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-delete.c
|
||||
@@ -0,0 +1,33 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+void
|
||||
+func (void)
|
||||
+{
|
||||
+ volatile int x = 0;
|
||||
+
|
||||
+ x++; /* break-here */
|
||||
+ x++;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ func ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.exp b/gdb/testsuite/gdb.base/watchpoint-delete.exp
|
||||
new file mode 100644
|
||||
index 0000000..45bc650
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/watchpoint-delete.exp
|
||||
@@ -0,0 +1,38 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile "watchpoint-delete"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# It is more compatible this way.
|
||||
+gdb_test_no_output "set can-use-hw-watchpoints 0"
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Ensure there is a parent frame to create related bp_watchpoint_scope.
|
||||
+gdb_breakpoint [gdb_get_line_number "break-here"]
|
||||
+gdb_continue_to_breakpoint "break-here" ".* break-here .*"
|
||||
+
|
||||
+gdb_test "watch x" {Watchpoint [0-9]+: x}
|
||||
+
|
||||
+gdb_test_no_output {delete $bpnum}
|
|
@ -0,0 +1,85 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00192.html
|
||||
Subject: [patch] Fix ELF stale reference [Re: [patch] .gdb_index: Do not crash on NOBITS]
|
||||
|
||||
On Wed, 08 Sep 2010 21:40:12 +0200, Tom Tromey wrote:
|
||||
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
|
||||
>
|
||||
> Jan> which should not be fatal but due to some other bugs therein it can
|
||||
> Jan> crash GDB.
|
||||
>
|
||||
> I am curious about these other bugs.
|
||||
|
||||
+ /* Memory gets permanently referenced from ABFD after
|
||||
+ bfd_get_synthetic_symtab so it must not get freed before ABFD gets.
|
||||
+ It happens only in the case when elf_slurp_reloc_table sees
|
||||
+ asection->relocation NULL. Determining which section is asection is
|
||||
+ done by _bfd_elf_get_synthetic_symtab which is all a bfd
|
||||
+ implementation detail, though. */
|
||||
|
||||
That is from:
|
||||
|
||||
#0 in elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count=1170, relents, symbols, dynamic=1) at elfcode.h:1482
|
||||
#1 in bfd_elf64_slurp_reloc_table (abfd, asect, symbols, dynamic=1) at elfcode.h:1563
|
||||
#2 in _bfd_elf_get_synthetic_symtab (abfd, symcount=0, syms, dynsymcount=1792, dynsyms, ret) at elf.c:9269
|
||||
#3 in elf_symfile_read (objfile, symfile_flags=6) at elfread.c:809
|
||||
|
||||
Where
|
||||
elfcode.h:elf_slurp_reloc_table_from_section
|
||||
contains
|
||||
ps = symbols + ELF_R_SYM (rela.r_info) - 1;
|
||||
relent->sym_ptr_ptr = ps;
|
||||
|
||||
`symbols' here is elf_symfile_read's `dyn_symbol_table'. `dyn_symbol_table'
|
||||
got immediately xfree'd but the freed memory remained referenced by
|
||||
asect->relocation (containing the RELENT memory above, stored there by
|
||||
elf_slurp_reloc_table).
|
||||
|
||||
asect->relocation probably does not get used if ABFD is not being read-in the
|
||||
second time, which happens only if OBJFILE is being created the second time,
|
||||
which happens due to the error call in the previous mail.
|
||||
|
||||
|
||||
I was curious there elf_symfile_read uses 0 for COPY_NAMES in a similar case:
|
||||
elf_symtab_read (objfile, ST_REGULAR, symcount, symbol_table, 0);
|
||||
where SYMBOL_TABLE is also immediately xfreed. But that seems to be correct as
|
||||
elf_slurp_symbol_table uses
|
||||
symbase = (elf_symbol_type *) bfd_zalloc (abfd, amt);
|
||||
for the content where later elfread.c's SYMBOL_TABLE points to. Only the
|
||||
pointers get xfreed which is OK.
|
||||
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-09-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix stale memory references.
|
||||
* elfread.c: Include libbfd.h.
|
||||
(elf_symfile_read): Replace xmalloc by bfd_alloc, drop xfree, new
|
||||
comment.
|
||||
|
||||
--- a/gdb/elfread.c
|
||||
+++ b/gdb/elfread.c
|
||||
@@ -792,8 +793,14 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
|
||||
|
||||
if (storage_needed > 0)
|
||||
{
|
||||
- dyn_symbol_table = (asymbol **) xmalloc (storage_needed);
|
||||
- make_cleanup (xfree, dyn_symbol_table);
|
||||
+ /* Memory gets permanently referenced from ABFD after
|
||||
+ bfd_get_synthetic_symtab so it must not get freed before ABFD gets.
|
||||
+ It happens only in the case when elf_slurp_reloc_table sees
|
||||
+ asection->relocation NULL. Determining which section is asection is
|
||||
+ done by _bfd_elf_get_synthetic_symtab which is all a bfd
|
||||
+ implementation detail, though. */
|
||||
+
|
||||
+ dyn_symbol_table = bfd_alloc (abfd, storage_needed);
|
||||
dynsymcount = bfd_canonicalize_dynamic_symtab (objfile->obfd,
|
||||
dyn_symbol_table);
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
https://bugzilla.redhat.com/show_bug.cgi?id=653644
|
||||
[commit] Fix .gdb_index memory corruption
|
||||
http://sourceware.org/ml/gdb-patches/2010-11/msg00216.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-11/msg00080.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/11/16 17:38:34 1.12313
|
||||
### src/gdb/ChangeLog 2010/11/16 22:04:51 1.12314
|
||||
## -1,3 +1,8 @@
|
||||
+2010-11-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * dwarf2read.c (dw2_forget_cached_source_info): Clear the FULL_NAMES
|
||||
+ elements after xfree.
|
||||
+
|
||||
2010-11-16 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* gdb-add-index.sh: Really remove.
|
||||
--- gdb-7.2/gdb/dwarf2read.c.orig 2010-11-18 05:28:59.000000000 +0100
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2010-11-18 05:30:17.000000000 +0100
|
||||
@@ -2084,7 +2084,10 @@ dw2_forget_cached_source_info (struct ob
|
||||
int j;
|
||||
|
||||
for (j = 0; j < cu->v.quick->lines->num_file_names; ++j)
|
||||
- xfree ((void *) cu->v.quick->full_names[j]);
|
||||
+ {
|
||||
+ xfree ((void *) cu->v.quick->full_names[j]);
|
||||
+ cu->v.quick->full_names[j] = NULL;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-02/msg00679.html
|
||||
Subject: Re: [patch 1/3] Code cleanup: gdb.threads/gcore-thread.exp
|
||||
|
||||
On Thu, 24 Feb 2011 08:20:09 +0100, Joel Brobecker wrote:
|
||||
> Just a thought: Do we really need to worry about restoring
|
||||
> the timeout at the end of the testcase, given that this is
|
||||
> automatically done at the start of each testcase (see gdb.exp:
|
||||
> gdb_init)?
|
||||
|
||||
I see now:
|
||||
Re: [RFA/testsuite] Reset the timeout duration at the start of each testcase.
|
||||
http://sourceware.org/ml/gdb-patches/2010-02/msg00202.html
|
||||
commit 501c57da40fd27c8036a5fc995f750b0559272ad
|
||||
|
||||
Patch updated.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/testsuite/
|
||||
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/gcore-thread.exp ($testfile): Match it the .exp
|
||||
filename.
|
||||
($srcfile): Preserve the original value.
|
||||
($testfile): Match it the .exp filename.
|
||||
($corefile): New variable. Substitute it around.
|
||||
Use clean_restart.
|
||||
($prev_timeout): Remove.
|
||||
(load_core): Move core loading into this proc.
|
||||
Fix restore of $timeout if load_core fails.
|
||||
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:56:04.000000000 +0100
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:56:57.000000000 +0100
|
||||
@@ -21,11 +21,11 @@ if $tracelevel then {
|
||||
strace $tracelevel
|
||||
}
|
||||
|
||||
-
|
||||
# Single-threaded test case
|
||||
-set testfile "pthreads"
|
||||
-set srcfile ${testfile}.c
|
||||
-set binfile ${objdir}/${subdir}/gcore-${testfile}
|
||||
+set testfile "gcore-thread"
|
||||
+set srcfile pthreads.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+set corefile ${objdir}/${subdir}/${testfile}.test
|
||||
|
||||
if [istarget "*-*-linux"] then {
|
||||
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
@@ -41,10 +41,7 @@ if {[gdb_compile_pthreads "${srcdir}/${s
|
||||
|
||||
# Start with a fresh gdb.
|
||||
|
||||
-gdb_exit
|
||||
-gdb_start
|
||||
-gdb_reinitialize_dir $srcdir/$subdir
|
||||
-gdb_load ${binfile}
|
||||
+clean_restart ${testfile}
|
||||
|
||||
# regexp for "horizontal" text (i.e. doesn't include newline or
|
||||
# carriage return)
|
||||
@@ -66,7 +63,6 @@ proc pthread_self {name} {
|
||||
return ""
|
||||
}
|
||||
|
||||
-set prev_timeout $timeout
|
||||
set timeout 30
|
||||
|
||||
gdb_test_multiple "help gcore" "help gcore" {
|
||||
@@ -109,10 +105,9 @@ gdb_breakpoint "thread2"
|
||||
gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
|
||||
set thread2_self [pthread_self thread2]
|
||||
|
||||
-set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
|
||||
+set escapedfilename [string_to_regexp $corefile]
|
||||
# Drop corefile
|
||||
-gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
|
||||
- "save a corefile" \
|
||||
+gdb_test_multiple "gcore $corefile" "save a corefile" \
|
||||
{
|
||||
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||
pass "save a corefile"
|
||||
@@ -131,31 +126,38 @@ if {!$core_supported} {
|
||||
return -1
|
||||
}
|
||||
|
||||
+
|
||||
# Now restart gdb and load the corefile.
|
||||
-gdb_exit
|
||||
-gdb_start
|
||||
-gdb_reinitialize_dir $srcdir/$subdir
|
||||
-gdb_load ${binfile}
|
||||
-
|
||||
-gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \
|
||||
- "re-load generated corefile" {
|
||||
- -re ".* is not a core dump:.*$gdb_prompt $" {
|
||||
- fail "re-load generated corefile (bad file format)"
|
||||
- # No use proceeding from here.
|
||||
- return;
|
||||
- }
|
||||
- -re ".*: No such file or directory.*$gdb_prompt $" {
|
||||
- fail "re-load generated corefile (file not found)"
|
||||
- # No use proceeding from here.
|
||||
- return;
|
||||
- }
|
||||
- -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
|
||||
- fail "re-load generated corefile (incomplete note section)"
|
||||
- }
|
||||
- -re "Core was generated by .*$gdb_prompt $" {
|
||||
- pass "re-load generated corefile"
|
||||
+clean_restart ${testfile}
|
||||
+
|
||||
+proc load_core { corefile } {
|
||||
+ global gdb_prompt
|
||||
+
|
||||
+ gdb_test_multiple "core $corefile" \
|
||||
+ "re-load generated corefile" {
|
||||
+ -re " is not a core dump:.*\r\n$gdb_prompt $" {
|
||||
+ fail "re-load generated corefile (bad file format)"
|
||||
+ # No use proceeding from here.
|
||||
+ return 0;
|
||||
+ }
|
||||
+ -re ": No such file or directory.*\r\n$gdb_prompt $" {
|
||||
+ fail "re-load generated corefile (file not found)"
|
||||
+ # No use proceeding from here.
|
||||
+ return 0;
|
||||
+ }
|
||||
+ -re "Couldn't find .* registers in core file.*\r\n$gdb_prompt $" {
|
||||
+ fail "re-load generated corefile (incomplete note section)"
|
||||
+ }
|
||||
+ -re "Core was generated by .*\r\n$gdb_prompt $" {
|
||||
+ pass "re-load generated corefile"
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
+ return 1
|
||||
+}
|
||||
+
|
||||
+if ![load_core $corefile] {
|
||||
+ return
|
||||
+}
|
||||
|
||||
# FIXME: now what can we test about the thread state?
|
||||
# We do not know for certain that there should be at least
|
||||
@@ -181,5 +183,3 @@ if [istarget "*-*-linux*"] then {
|
||||
gdb_test "info threads" "Thread $thread1_self .*" "thread1 pthread_self found"
|
||||
gdb_test "info threads" "Thread $thread2_self .*" "thread2 pthread_self found"
|
||||
}
|
||||
-
|
||||
-set timeout $prev_timeout
|
|
@ -0,0 +1,105 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-02/msg00680.html
|
||||
Subject: [patch 2/3] Fix threading internal error on corrupted memory [rediff]
|
||||
|
||||
[rediff]
|
||||
|
||||
gdb/
|
||||
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* linux-thread-db.c (find_new_threads_callback): Exit on zero TI_TID
|
||||
even if !TARGET_HAS_EXECUTION.
|
||||
|
||||
gdb/testsuite/
|
||||
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/gcore-thread.exp ($core0file): New variable.
|
||||
(clear __stack_user.next, clear stack_used.next)
|
||||
(save a zeroed-threads corefile): New test.
|
||||
Call core_load for $core0file.
|
||||
(zeroed-threads cannot be listed): New test.
|
||||
|
||||
Index: gdb-7.2/gdb/linux-thread-db.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linux-thread-db.c 2011-02-24 09:56:04.000000000 +0100
|
||||
+++ gdb-7.2/gdb/linux-thread-db.c 2011-02-24 09:57:12.000000000 +0100
|
||||
@@ -1321,7 +1321,7 @@ find_new_threads_callback (const td_thrh
|
||||
if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE)
|
||||
return 0; /* A zombie -- ignore. */
|
||||
|
||||
- if (ti.ti_tid == 0 && target_has_execution)
|
||||
+ if (ti.ti_tid == 0)
|
||||
{
|
||||
/* A thread ID of zero means that this is the main thread, but
|
||||
glibc has not yet initialized thread-local storage and the
|
||||
@@ -1333,10 +1333,13 @@ find_new_threads_callback (const td_thrh
|
||||
need this glibc bug workaround. */
|
||||
info->need_stale_parent_threads_check = 0;
|
||||
|
||||
- err = info->td_thr_event_enable_p (th_p, 1);
|
||||
- if (err != TD_OK)
|
||||
- error (_("Cannot enable thread event reporting for LWP %d: %s"),
|
||||
- (int) ti.ti_lid, thread_db_err_str (err));
|
||||
+ if (target_has_execution)
|
||||
+ {
|
||||
+ err = info->td_thr_event_enable_p (th_p, 1);
|
||||
+ if (err != TD_OK)
|
||||
+ error (_("Cannot enable thread event reporting for LWP %d: %s"),
|
||||
+ (int) ti.ti_lid, thread_db_err_str (err));
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:56:57.000000000 +0100
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:57:27.000000000 +0100
|
||||
@@ -26,6 +26,7 @@ set testfile "gcore-thread"
|
||||
set srcfile pthreads.c
|
||||
set binfile ${objdir}/${subdir}/${testfile}
|
||||
set corefile ${objdir}/${subdir}/${testfile}.test
|
||||
+set core0file ${objdir}/${subdir}/${testfile}0.test
|
||||
|
||||
if [istarget "*-*-linux"] then {
|
||||
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
@@ -127,6 +128,29 @@ if {!$core_supported} {
|
||||
}
|
||||
|
||||
|
||||
+# Test the uninitialized thread list.
|
||||
+# Provide the case of glibc td_thr_get_info handling of:
|
||||
+# /* Special case for the main thread before initialization. */
|
||||
+
|
||||
+foreach symbol {__stack_user stack_used} {
|
||||
+ set test "clear ${symbol}.next"
|
||||
+ gdb_test_multiple "p *(void **) &${symbol} = 0" $test {
|
||||
+ -re " = \\(void \\*\\) 0x0\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "No symbol \"${symbol}\" in current context\\.\r\n$gdb_prompt $" {
|
||||
+ xfail $test
|
||||
+ # Do not do the verification.
|
||||
+ set core0file ""
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if {"$core0file" != ""} {
|
||||
+ gdb_test "gcore $core0file" "Saved corefile .*" "save a zeroed-threads corefile"
|
||||
+}
|
||||
+
|
||||
+
|
||||
# Now restart gdb and load the corefile.
|
||||
clean_restart ${testfile}
|
||||
|
||||
@@ -183,3 +207,11 @@ if [istarget "*-*-linux*"] then {
|
||||
gdb_test "info threads" "Thread $thread1_self .*" "thread1 pthread_self found"
|
||||
gdb_test "info threads" "Thread $thread2_self .*" "thread2 pthread_self found"
|
||||
}
|
||||
+
|
||||
+
|
||||
+# Test the uninitialized thread list.
|
||||
+
|
||||
+if {"$core0file" != "" && [load_core $core0file]} {
|
||||
+
|
||||
+ gdb_test "info threads" "Cannot find new threads: .*" "zeroed-threads cannot be listed"
|
||||
+}
|
|
@ -0,0 +1,99 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-02/msg00675.html
|
||||
Subject: [patch 3/3] Display core reasons even during thread error
|
||||
|
||||
Hi,
|
||||
|
||||
this is mostly unrelated. But after the patch 2/3 it will still FAIL:
|
||||
Loaded symbols for /lib64/ld-linux-x86-64.so.2
|
||||
Cannot find new threads: debugger service failed
|
||||
(gdb) FAIL: gdb.threads/gcore-thread.exp: re-load generated corefile
|
||||
|
||||
as it is a common bug I dislike for years I have fixed it here:
|
||||
Loaded symbols for /lib64/ld-linux-x86-64.so.2
|
||||
Cannot find new threads: debugger service failed
|
||||
Core was generated by `.../gdb/testsuite/gdb.threads/gcore-thread'.
|
||||
Program terminated with signal 5, Trace/breakpoint trap.
|
||||
#0 thread2 (arg=0xdeadbeef) at ./gdb.threads/pthreads.c:91
|
||||
91 int k = 0;
|
||||
(gdb) PASS: gdb.threads/gcore-thread.exp: re-load generated corefile
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* corelow.c: Include wrapper.h.
|
||||
(core_open): Call now gdb_target_find_new_threads.
|
||||
* wrapper.c: Include target.h.
|
||||
(gdb_target_find_new_threads): New.
|
||||
* wrapper.h (gdb_target_find_new_threads): New declaration.
|
||||
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "auxv.h"
|
||||
#include "elf/common.h"
|
||||
#include "gdbcmd.h"
|
||||
+#include "wrapper.h"
|
||||
|
||||
|
||||
#ifndef O_LARGEFILE
|
||||
@@ -428,7 +429,7 @@ core_open (char *filename, int from_tty)
|
||||
may be a thread_stratum target loaded on top of target core by
|
||||
now. The layer above should claim threads found in the BFD
|
||||
sections. */
|
||||
- target_find_new_threads ();
|
||||
+ gdb_target_find_new_threads ();
|
||||
|
||||
p = bfd_core_file_failing_command (core_bfd);
|
||||
if (p)
|
||||
--- a/gdb/wrapper.c
|
||||
+++ b/gdb/wrapper.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "exceptions.h"
|
||||
#include "wrapper.h"
|
||||
#include "ui-out.h"
|
||||
+#include "target.h"
|
||||
|
||||
int
|
||||
gdb_parse_exp_1 (char **stringptr, struct block *block, int comma,
|
||||
@@ -161,3 +162,24 @@ gdb_value_struct_elt (struct ui_out *uiout, struct value **result,
|
||||
return GDB_RC_FAIL;
|
||||
return GDB_RC_OK;
|
||||
}
|
||||
+
|
||||
+/* Call target_find_new_threads without throwing exception. Exception is
|
||||
+ printed if it got thrown. */
|
||||
+
|
||||
+int
|
||||
+gdb_target_find_new_threads (void)
|
||||
+{
|
||||
+ volatile struct gdb_exception except;
|
||||
+
|
||||
+ TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||
+ {
|
||||
+ target_find_new_threads ();
|
||||
+ }
|
||||
+
|
||||
+ if (except.reason < 0)
|
||||
+ {
|
||||
+ exception_print (gdb_stderr, except);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return 1;
|
||||
+}
|
||||
--- a/gdb/wrapper.h
|
||||
+++ b/gdb/wrapper.h
|
||||
@@ -48,4 +48,6 @@ extern int gdb_value_ind (struct value *val, struct value ** rval);
|
||||
|
||||
extern int gdb_parse_and_eval_type (char *, int, struct type **);
|
||||
|
||||
+extern int gdb_target_find_new_threads (void);
|
||||
+
|
||||
#endif /* wrapper.h */
|
||||
|
|
@ -0,0 +1,898 @@
|
|||
http://sourceware.org/ml/binutils-cvs/2010-08/msg00105.html
|
||||
|
||||
### src/bfd/ChangeLog 2010/08/13 20:50:25 1.5106
|
||||
### src/bfd/ChangeLog 2010/08/18 12:24:02 1.5107
|
||||
## -1,3 +1,89 @@
|
||||
+2010-08-18 Pedro Alves <pedro@codesourcery.com>
|
||||
+
|
||||
+ PR corefile/8210
|
||||
+
|
||||
+ * bfd-in2.h: Regenerate.
|
||||
+ * corefile.c (bfd_core_file_pid): New.
|
||||
+
|
||||
+ * targets.c (BFD_JUMP_TABLE_CORE): Add NAME##_core_file_pid.
|
||||
+ (struct bfd_target) <_core_file_pid>: New.
|
||||
+
|
||||
+ * libbfd-in.h (_bfd_nocore_core_file_pid): Declare.
|
||||
+ * libbfd.c (_bfd_nocore_core_file_pid): New.
|
||||
+
|
||||
+ * elf-bfd.h (bfd_elf32_core_file_pid, bfd_elf64_core_file_pid):
|
||||
+ Declare.
|
||||
+ * elfcode.h (elf_core_file_pid): New define.
|
||||
+ * elfcore.h (elf_core_file_pid): New function.
|
||||
+
|
||||
+ * elf.c (elfcore_make_pid): Rewrite.
|
||||
+ (elfcore_grok_prstatus): Only set core_pid if not set yet.
|
||||
+ (elfcore_grok_prstatus) [!HAVE_PRSTATUS_T_PR_WHO]: Fallback to
|
||||
+ getting the lwpid from prstat.pr_pid.
|
||||
+
|
||||
+ * elf64-x86-64.c (elf64_x86_64_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ (elf64_x86_64_grok_psinfo): Extract the the main process's PID,
|
||||
+ and store it in elf_tdata's core_pid field.
|
||||
+ * elf32-i386.c (elf_i386_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ (elf_i386_grok_psinfo): Extract the the main process's PID, and
|
||||
+ store it in elf_tdata's core_pid field.
|
||||
+
|
||||
+ * elf32-am33lin.c (elf32_am33lin_grok_prstatus): Write the LWPID
|
||||
+ to elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-arm.c (elf32_arm_nabi_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-cris.c (cris_elf_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-frv.c (elf32_frv_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-hppa.c (elf32_hppa_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-ppc.c (ppc_elf_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-s390.c (elf_s390_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-score.c (s3_bfd_score_elf_grok_prstatus): Write the LWPID
|
||||
+ to elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-score7.c (s7_bfd_score_elf_grok_prstatus): Write the LWPID
|
||||
+ to elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-sh.c (elf32_shlin_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf32-xtensa.c (elf_xtensa_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf64-hppa.c (elf64_hppa_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf64-mips.c (elf64_mips_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elf64-ppc.c (ppc64_elf_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+ * elfn32-mips.c (elf32_mips_grok_prstatus): Write the LWPID to
|
||||
+ elf_tdata's core_lwpid instead of to core_pid.
|
||||
+
|
||||
+ * plugin.c (bfd_plugin_core_file_pid): New function.
|
||||
+ * aout-target.h (MY_core_file_pid): Define.
|
||||
+ * aout-tic30.c (MY_core_file_pid, MY_core_file_p): New defines.
|
||||
+ * coff-rs6000.c (coff_core_file_pid): New define.
|
||||
+ (rs6000coff_vec, pmac_xcoff_vec): Use BFD_JUMP_TABLE_CORE.
|
||||
+ * coff64-rs6000.c (coff_core_file_pid): New define.
|
||||
+ (rs6000coff64_vec): Use BFD_JUMP_TABLE_CORE.
|
||||
+ (xcoff64_core_file_pid): New define.
|
||||
+ (aix5coff64_vec): Use BFD_JUMP_TABLE_CORE.
|
||||
+ * mach-o-target.c (bfd_mach_o_core_file_pid): New define.
|
||||
+ * aix386-core.c (aix386_core_file_pid): New define.
|
||||
+ * hppabsd-core.c (hppabsd_core_core_file_pid): New define.
|
||||
+ * hpux-core.c (hpux_core_core_file_pid): New define.
|
||||
+ * irix-core.c (irix_core_core_file_pid): New define.
|
||||
+ * lynx-core.c (lynx_core_file_pid): New define.
|
||||
+ * osf-core.c (osf_core_core_file_pid): New define.
|
||||
+ * ptrace-core.c (ptrace_unix_core_file_pid): New define.
|
||||
+ * sco5-core.c (sco5_core_file_pid): New define.
|
||||
+ * xcoff-target.h (coff_core_file_pid): New define.
|
||||
+ * netbsd-core.c (netbsd_core_core_file_pid): New define.
|
||||
+
|
||||
2010-08-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR ld/11913
|
||||
Index: gdb-7.2/bfd/aix386-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/aix386-core.c 2009-09-02 09:18:35.000000000 +0200
|
||||
+++ gdb-7.2/bfd/aix386-core.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -211,6 +211,8 @@ aix386_core_file_failing_signal (abfd)
|
||||
|
||||
#define aix386_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
|
||||
+#define aix386_core_file_pid _bfd_nocore_core_file_pid
|
||||
+
|
||||
/* If somebody calls any byte-swapping routines, shoot them. */
|
||||
|
||||
static void
|
||||
Index: gdb-7.2/bfd/aout-target.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/aout-target.h 2010-03-24 16:41:58.000000000 +0100
|
||||
+++ gdb-7.2/bfd/aout-target.h 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -401,6 +401,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd
|
||||
#define MY_core_file_matches_executable_p \
|
||||
_bfd_nocore_core_file_matches_executable_p
|
||||
#endif
|
||||
+#ifndef MY_core_file_pid
|
||||
+#define MY_core_file_pid _bfd_nocore_core_file_pid
|
||||
+#endif
|
||||
#ifndef MY_core_file_p
|
||||
#define MY_core_file_p _bfd_dummy_target
|
||||
#endif
|
||||
Index: gdb-7.2/bfd/aout-tic30.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/aout-tic30.c 2010-03-24 16:41:58.000000000 +0100
|
||||
+++ gdb-7.2/bfd/aout-tic30.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -859,6 +859,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
|
||||
#define MY_core_file_matches_executable_p \
|
||||
_bfd_nocore_core_file_matches_executable_p
|
||||
#endif
|
||||
+#ifndef MY_core_file_pid
|
||||
+#define MY_core_file_pid _bfd_nocore_core_file_pid
|
||||
+#endif
|
||||
#ifndef MY_core_file_p
|
||||
#define MY_core_file_p _bfd_dummy_target
|
||||
#endif
|
||||
Index: gdb-7.2/bfd/bfd-in2.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/bfd-in2.h 2010-06-29 06:17:20.000000000 +0200
|
||||
+++ gdb-7.2/bfd/bfd-in2.h 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -5344,6 +5344,8 @@ const char *bfd_core_file_failing_comman
|
||||
|
||||
int bfd_core_file_failing_signal (bfd *abfd);
|
||||
|
||||
+int bfd_core_file_pid (bfd *abfd);
|
||||
+
|
||||
bfd_boolean core_file_matches_executable_p
|
||||
(bfd *core_bfd, bfd *exec_bfd);
|
||||
|
||||
@@ -5540,11 +5542,13 @@ typedef struct bfd_target
|
||||
#define BFD_JUMP_TABLE_CORE(NAME) \
|
||||
NAME##_core_file_failing_command, \
|
||||
NAME##_core_file_failing_signal, \
|
||||
- NAME##_core_file_matches_executable_p
|
||||
+ NAME##_core_file_matches_executable_p, \
|
||||
+ NAME##_core_file_pid
|
||||
|
||||
char * (*_core_file_failing_command) (bfd *);
|
||||
int (*_core_file_failing_signal) (bfd *);
|
||||
bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
|
||||
+ int (*_core_file_pid) (bfd *);
|
||||
|
||||
/* Archive entry points. */
|
||||
#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
|
||||
Index: gdb-7.2/bfd/coff-rs6000.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/coff-rs6000.c 2010-06-27 06:07:51.000000000 +0200
|
||||
+++ gdb-7.2/bfd/coff-rs6000.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -112,6 +112,8 @@ extern int rs6000coff_core_file_failing_
|
||||
rs6000coff_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p \
|
||||
rs6000coff_core_file_matches_executable_p
|
||||
+#define coff_core_file_pid \
|
||||
+ _bfd_nocore_core_file_pid
|
||||
#else
|
||||
#define CORE_FILE_P _bfd_dummy_target
|
||||
#define coff_core_file_failing_command \
|
||||
@@ -120,6 +122,8 @@ extern int rs6000coff_core_file_failing_
|
||||
_bfd_nocore_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p \
|
||||
_bfd_nocore_core_file_matches_executable_p
|
||||
+#define coff_core_file_pid \
|
||||
+ _bfd_nocore_core_file_pid
|
||||
#endif
|
||||
#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
|
||||
#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
|
||||
@@ -4182,9 +4186,7 @@ const bfd_target rs6000coff_vec =
|
||||
_bfd_generic_bfd_print_private_bfd_data,
|
||||
|
||||
/* Core */
|
||||
- coff_core_file_failing_command,
|
||||
- coff_core_file_failing_signal,
|
||||
- coff_core_file_matches_executable_p,
|
||||
+ BFD_JUMP_TABLE_CORE (coff),
|
||||
|
||||
/* Archive */
|
||||
_bfd_xcoff_slurp_armap,
|
||||
@@ -4437,9 +4439,7 @@ const bfd_target pmac_xcoff_vec =
|
||||
_bfd_generic_bfd_print_private_bfd_data,
|
||||
|
||||
/* Core */
|
||||
- coff_core_file_failing_command,
|
||||
- coff_core_file_failing_signal,
|
||||
- coff_core_file_matches_executable_p,
|
||||
+ BFD_JUMP_TABLE_CORE (coff),
|
||||
|
||||
/* Archive */
|
||||
_bfd_xcoff_slurp_armap,
|
||||
Index: gdb-7.2/bfd/coff64-rs6000.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/coff64-rs6000.c 2010-03-24 16:41:58.000000000 +0100
|
||||
+++ gdb-7.2/bfd/coff64-rs6000.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -256,6 +256,8 @@ extern int rs6000coff_core_file_failing_
|
||||
rs6000coff_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p \
|
||||
rs6000coff_core_file_matches_executable_p
|
||||
+#define coff_core_file_pid \
|
||||
+ _bfd_nocore_core_file_pid
|
||||
#else
|
||||
#define CORE_FILE_P _bfd_dummy_target
|
||||
#define coff_core_file_failing_command \
|
||||
@@ -264,6 +266,8 @@ extern int rs6000coff_core_file_failing_
|
||||
_bfd_nocore_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p \
|
||||
_bfd_nocore_core_file_matches_executable_p
|
||||
+#define coff_core_file_pid \
|
||||
+ _bfd_nocore_core_file_pid
|
||||
#endif
|
||||
#define coff_SWAP_sym_in _bfd_xcoff64_swap_sym_in
|
||||
#define coff_SWAP_sym_out _bfd_xcoff64_swap_sym_out
|
||||
@@ -2753,9 +2757,7 @@ const bfd_target rs6000coff64_vec =
|
||||
_bfd_generic_bfd_print_private_bfd_data,
|
||||
|
||||
/* Core */
|
||||
- coff_core_file_failing_command,
|
||||
- coff_core_file_failing_signal,
|
||||
- coff_core_file_matches_executable_p,
|
||||
+ BFD_JUMP_TABLE_CORE (coff),
|
||||
|
||||
/* Archive */
|
||||
xcoff64_slurp_armap,
|
||||
@@ -2835,6 +2837,8 @@ extern char *xcoff64_core_file_failing_c
|
||||
PARAMS ((bfd *));
|
||||
extern int xcoff64_core_file_failing_signal
|
||||
PARAMS ((bfd *));
|
||||
+#define xcoff64_core_file_pid \
|
||||
+ _bfd_nocore_core_file_pid
|
||||
|
||||
/* AIX 5 */
|
||||
static const struct xcoff_backend_data_rec bfd_xcoff_aix5_backend_data =
|
||||
@@ -3009,9 +3013,7 @@ const bfd_target aix5coff64_vec =
|
||||
_bfd_generic_bfd_print_private_bfd_data,
|
||||
|
||||
/* Core */
|
||||
- xcoff64_core_file_failing_command,
|
||||
- xcoff64_core_file_failing_signal,
|
||||
- xcoff64_core_file_matches_executable_p,
|
||||
+ BFD_JUMP_TABLE_CORE (xcoff64),
|
||||
|
||||
/* Archive */
|
||||
xcoff64_slurp_armap,
|
||||
Index: gdb-7.2/bfd/corefile.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/corefile.c 2007-07-03 16:26:40.000000000 +0200
|
||||
+++ gdb-7.2/bfd/corefile.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -84,6 +84,31 @@ bfd_core_file_failing_signal (bfd *abfd)
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
+ bfd_core_file_pid
|
||||
+
|
||||
+SYNOPSIS
|
||||
+ int bfd_core_file_pid (bfd *abfd);
|
||||
+
|
||||
+DESCRIPTION
|
||||
+
|
||||
+ Returns the PID of the process the core dump the BFD
|
||||
+ @var{abfd} is attached to was generated from.
|
||||
+*/
|
||||
+
|
||||
+int
|
||||
+bfd_core_file_pid (bfd *abfd)
|
||||
+{
|
||||
+ if (abfd->format != bfd_core)
|
||||
+ {
|
||||
+ bfd_set_error (bfd_error_invalid_operation);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return BFD_SEND (abfd, _core_file_pid, (abfd));
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+FUNCTION
|
||||
core_file_matches_executable_p
|
||||
|
||||
SYNOPSIS
|
||||
Index: gdb-7.2/bfd/elf-bfd.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf-bfd.h 2011-01-30 19:30:14.000000000 +0100
|
||||
+++ gdb-7.2/bfd/elf-bfd.h 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -1989,6 +1989,8 @@ extern int bfd_elf32_core_file_failing_s
|
||||
(bfd *);
|
||||
extern bfd_boolean bfd_elf32_core_file_matches_executable_p
|
||||
(bfd *, bfd *);
|
||||
+extern int bfd_elf32_core_file_pid
|
||||
+ (bfd *);
|
||||
|
||||
extern bfd_boolean bfd_elf32_swap_symbol_in
|
||||
(bfd *, const void *, const void *, Elf_Internal_Sym *);
|
||||
@@ -2033,6 +2035,8 @@ extern int bfd_elf64_core_file_failing_s
|
||||
(bfd *);
|
||||
extern bfd_boolean bfd_elf64_core_file_matches_executable_p
|
||||
(bfd *, bfd *);
|
||||
+extern int bfd_elf64_core_file_pid
|
||||
+ (bfd *);
|
||||
|
||||
extern bfd_boolean bfd_elf64_swap_symbol_in
|
||||
(bfd *, const void *, const void *, Elf_Internal_Sym *);
|
||||
Index: gdb-7.2/bfd/elf.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf.c 2011-01-30 19:30:14.000000000 +0100
|
||||
+++ gdb-7.2/bfd/elf.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -7513,13 +7513,19 @@ _bfd_elf_rel_vtable_reloc_fn
|
||||
# include <sys/procfs.h>
|
||||
#endif
|
||||
|
||||
-/* FIXME: this is kinda wrong, but it's what gdb wants. */
|
||||
+/* Return a PID that identifies a "thread" for threaded cores, or the
|
||||
+ PID of the main process for non-threaded cores. */
|
||||
|
||||
static int
|
||||
elfcore_make_pid (bfd *abfd)
|
||||
{
|
||||
- return ((elf_tdata (abfd)->core_lwpid << 16)
|
||||
- + (elf_tdata (abfd)->core_pid));
|
||||
+ int pid;
|
||||
+
|
||||
+ pid = elf_tdata (abfd)->core_lwpid;
|
||||
+ if (pid == 0)
|
||||
+ pid = elf_tdata (abfd)->core_pid;
|
||||
+
|
||||
+ return pid;
|
||||
}
|
||||
|
||||
/* If there isn't a section called NAME, make one, using
|
||||
@@ -7609,7 +7615,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In
|
||||
has already been set by another thread. */
|
||||
if (elf_tdata (abfd)->core_signal == 0)
|
||||
elf_tdata (abfd)->core_signal = prstat.pr_cursig;
|
||||
- elf_tdata (abfd)->core_pid = prstat.pr_pid;
|
||||
+ if (elf_tdata (abfd)->core_pid == 0)
|
||||
+ elf_tdata (abfd)->core_pid = prstat.pr_pid;
|
||||
|
||||
/* pr_who exists on:
|
||||
solaris 2.5+
|
||||
@@ -7619,6 +7626,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In
|
||||
*/
|
||||
#if defined (HAVE_PRSTATUS_T_PR_WHO)
|
||||
elf_tdata (abfd)->core_lwpid = prstat.pr_who;
|
||||
+#else
|
||||
+ elf_tdata (abfd)->core_lwpid = prstat.pr_pid;
|
||||
#endif
|
||||
}
|
||||
#if defined (HAVE_PRSTATUS32_T)
|
||||
@@ -7635,7 +7644,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In
|
||||
has already been set by another thread. */
|
||||
if (elf_tdata (abfd)->core_signal == 0)
|
||||
elf_tdata (abfd)->core_signal = prstat.pr_cursig;
|
||||
- elf_tdata (abfd)->core_pid = prstat.pr_pid;
|
||||
+ if (elf_tdata (abfd)->core_pid == 0)
|
||||
+ elf_tdata (abfd)->core_pid = prstat.pr_pid;
|
||||
|
||||
/* pr_who exists on:
|
||||
solaris 2.5+
|
||||
@@ -7645,6 +7655,8 @@ elfcore_grok_prstatus (bfd *abfd, Elf_In
|
||||
*/
|
||||
#if defined (HAVE_PRSTATUS32_T_PR_WHO)
|
||||
elf_tdata (abfd)->core_lwpid = prstat.pr_who;
|
||||
+#else
|
||||
+ elf_tdata (abfd)->core_lwpid = prstat.pr_pid;
|
||||
#endif
|
||||
}
|
||||
#endif /* HAVE_PRSTATUS32_T */
|
||||
Index: gdb-7.2/bfd/elf32-am33lin.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-am33lin.c 2007-07-03 16:26:40.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-am33lin.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -55,7 +55,7 @@ elf32_am33lin_grok_prstatus (bfd *abfd,
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-arm.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-arm.c 2010-06-27 06:07:51.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-arm.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -1829,7 +1829,7 @@ elf32_arm_nabi_grok_prstatus (bfd *abfd,
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-cris.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-cris.c 2010-06-27 06:07:51.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-cris.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -580,7 +580,7 @@ cris_elf_grok_prstatus (abfd, note)
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 70;
|
||||
@@ -599,7 +599,7 @@ cris_elf_grok_prstatus (abfd, note)
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 22);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 70;
|
||||
Index: gdb-7.2/bfd/elf32-frv.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-frv.c 2010-02-04 10:16:39.000000000 +0100
|
||||
+++ gdb-7.2/bfd/elf32-frv.c 2011-01-30 19:30:35.000000000 +0100
|
||||
@@ -6935,7 +6935,7 @@ elf32_frv_grok_prstatus (bfd *abfd, Elf_
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* `pr_pid' is at offset 24. */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* `pr_reg' is at offset 72. */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-hppa.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-hppa.c 2010-06-27 06:07:51.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-hppa.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -1736,7 +1736,7 @@ elf32_hppa_grok_prstatus (bfd *abfd, Elf
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-i386.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-i386.c 2010-04-30 20:27:31.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-i386.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -419,7 +419,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_I
|
||||
elf_tdata (abfd)->core_signal = bfd_get_32 (abfd, note->descdata + 20);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 28;
|
||||
@@ -437,7 +437,7 @@ elf_i386_grok_prstatus (bfd *abfd, Elf_I
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
@@ -475,6 +475,8 @@ elf_i386_grok_psinfo (bfd *abfd, Elf_Int
|
||||
return FALSE;
|
||||
|
||||
case 124: /* Linux/i386 elf_prpsinfo. */
|
||||
+ elf_tdata (abfd)->core_pid
|
||||
+ = bfd_get_32 (abfd, note->descdata + 12);
|
||||
elf_tdata (abfd)->core_program
|
||||
= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
|
||||
elf_tdata (abfd)->core_command
|
||||
Index: gdb-7.2/bfd/elf32-mips.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-mips.c 2009-09-02 09:18:36.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-mips.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -1507,7 +1507,7 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-ppc.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-ppc.c 2010-07-06 11:29:46.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-ppc.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -1858,7 +1858,7 @@ ppc_elf_grok_prstatus (bfd *abfd, Elf_In
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-s390.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-s390.c 2010-02-04 10:16:39.000000000 +0100
|
||||
+++ gdb-7.2/bfd/elf32-s390.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -3462,7 +3462,7 @@ elf_s390_grok_prstatus (abfd, note)
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-score.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-score.c 2010-06-27 06:07:51.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-score.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -3917,7 +3917,7 @@ s3_bfd_score_elf_grok_prstatus (bfd *abf
|
||||
elf_tdata (abfd)->core_signal = score_bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = score_bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = score_bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-score7.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-score7.c 2010-06-27 06:07:52.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-score7.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -3734,7 +3734,7 @@ s7_bfd_score_elf_grok_prstatus (bfd *abf
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-sh.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-sh.c 2010-06-27 06:07:52.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-sh.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -7438,7 +7438,7 @@ elf32_shlin_grok_prstatus (bfd *abfd, El
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf32-xtensa.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf32-xtensa.c 2010-06-27 06:07:53.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf32-xtensa.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -3802,7 +3802,7 @@ elf_xtensa_grok_prstatus (bfd *abfd, Elf
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/elf64-hppa.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf64-hppa.c 2010-06-27 06:07:53.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf64-hppa.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -2611,7 +2611,7 @@ elf64_hppa_grok_prstatus (bfd *abfd, Elf
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 112;
|
||||
Index: gdb-7.2/bfd/elf64-mips.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf64-mips.c 2010-03-24 16:41:59.000000000 +0100
|
||||
+++ gdb-7.2/bfd/elf64-mips.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -3083,7 +3083,7 @@ elf64_mips_grok_prstatus (bfd *abfd, Elf
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 112;
|
||||
Index: gdb-7.2/bfd/elf64-ppc.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf64-ppc.c 2010-07-01 11:48:26.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf64-ppc.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -2651,7 +2651,7 @@ ppc64_elf_grok_prstatus (bfd *abfd, Elf_
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 32);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 112;
|
||||
Index: gdb-7.2/bfd/elf64-x86-64.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elf64-x86-64.c 2010-04-30 20:27:31.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elf64-x86-64.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -308,7 +308,7 @@ elf64_x86_64_grok_prstatus (bfd *abfd, E
|
||||
= bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid
|
||||
+ elf_tdata (abfd)->core_lwpid
|
||||
= bfd_get_32 (abfd, note->descdata + 32);
|
||||
|
||||
/* pr_reg */
|
||||
@@ -332,6 +332,8 @@ elf64_x86_64_grok_psinfo (bfd *abfd, Elf
|
||||
return FALSE;
|
||||
|
||||
case 136: /* sizeof(struct elf_prpsinfo) on Linux/x86_64 */
|
||||
+ elf_tdata (abfd)->core_pid
|
||||
+ = bfd_get_32 (abfd, note->descdata + 24);
|
||||
elf_tdata (abfd)->core_program
|
||||
= _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
|
||||
elf_tdata (abfd)->core_command
|
||||
Index: gdb-7.2/bfd/elfcode.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elfcode.h 2010-05-26 09:37:36.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elfcode.h 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -87,6 +87,7 @@
|
||||
#define elf_core_file_failing_signal NAME(bfd_elf,core_file_failing_signal)
|
||||
#define elf_core_file_matches_executable_p \
|
||||
NAME(bfd_elf,core_file_matches_executable_p)
|
||||
+#define elf_core_file_pid NAME(bfd_elf,core_file_pid)
|
||||
#define elf_object_p NAME(bfd_elf,object_p)
|
||||
#define elf_core_file_p NAME(bfd_elf,core_file_p)
|
||||
#define elf_get_symtab_upper_bound NAME(bfd_elf,get_symtab_upper_bound)
|
||||
Index: gdb-7.2/bfd/elfcore.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elfcore.h 2010-01-19 14:50:55.000000000 +0100
|
||||
+++ gdb-7.2/bfd/elfcore.h 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -31,6 +31,12 @@ elf_core_file_failing_signal (bfd *abfd)
|
||||
return elf_tdata (abfd)->core_signal;
|
||||
}
|
||||
|
||||
+int
|
||||
+elf_core_file_pid (bfd *abfd)
|
||||
+{
|
||||
+ return elf_tdata (abfd)->core_pid;
|
||||
+}
|
||||
+
|
||||
bfd_boolean
|
||||
elf_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
|
||||
{
|
||||
Index: gdb-7.2/bfd/elfn32-mips.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/elfn32-mips.c 2009-09-02 09:18:36.000000000 +0200
|
||||
+++ gdb-7.2/bfd/elfn32-mips.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -2333,7 +2333,7 @@ elf32_mips_grok_prstatus (bfd *abfd, Elf
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
+ elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
Index: gdb-7.2/bfd/hppabsd-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/hppabsd-core.c 2007-07-03 16:26:42.000000000 +0200
|
||||
+++ gdb-7.2/bfd/hppabsd-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -59,6 +59,7 @@ static char *hppabsd_core_core_file_fail
|
||||
static int hppabsd_core_core_file_failing_signal
|
||||
PARAMS ((bfd *));
|
||||
#define hppabsd_core_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define hppabsd_core_core_file_pid _bfd_nocore_core_file_pid
|
||||
static void swap_abort
|
||||
PARAMS ((void));
|
||||
|
||||
Index: gdb-7.2/bfd/hpux-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/hpux-core.c 2009-09-02 09:18:37.000000000 +0200
|
||||
+++ gdb-7.2/bfd/hpux-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -103,6 +103,7 @@ struct hpux_core_struct
|
||||
#define core_kernel_thread_id(bfd) (core_hdr(bfd)->lwpid)
|
||||
#define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid)
|
||||
#define hpux_core_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define hpux_core_core_file_pid _bfd_nocore_core_file_pid
|
||||
|
||||
static asection *make_bfd_asection (bfd *, const char *, flagword,
|
||||
bfd_size_type, bfd_vma, unsigned int);
|
||||
Index: gdb-7.2/bfd/irix-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/irix-core.c 2009-09-02 09:18:37.000000000 +0200
|
||||
+++ gdb-7.2/bfd/irix-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -44,6 +44,7 @@ struct sgi_core_struct
|
||||
#define core_command(bfd) (core_hdr(bfd)->cmd)
|
||||
|
||||
#define irix_core_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define irix_core_core_file_pid _bfd_nocore_core_file_pid
|
||||
|
||||
static asection *make_bfd_asection
|
||||
(bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr);
|
||||
Index: gdb-7.2/bfd/libbfd-in.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/libbfd-in.h 2010-06-08 10:26:01.000000000 +0200
|
||||
+++ gdb-7.2/bfd/libbfd-in.h 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -270,6 +270,8 @@ extern int _bfd_nocore_core_file_failing
|
||||
(bfd *);
|
||||
extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
|
||||
(bfd *, bfd *);
|
||||
+extern int _bfd_nocore_core_file_pid
|
||||
+ (bfd *);
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
|
||||
file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
|
||||
Index: gdb-7.2/bfd/libbfd.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/libbfd.c 2009-12-11 14:42:04.000000000 +0100
|
||||
+++ gdb-7.2/bfd/libbfd.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -150,6 +150,16 @@ _bfd_nocore_core_file_failing_signal (bf
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* Routine to handle the core_file_pid entry point for targets without
|
||||
+ core file support. */
|
||||
+
|
||||
+int
|
||||
+_bfd_nocore_core_file_pid (bfd *ignore_abfd ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ bfd_set_error (bfd_error_invalid_operation);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
const bfd_target *
|
||||
_bfd_dummy_target (bfd *ignore_abfd ATTRIBUTE_UNUSED)
|
||||
{
|
||||
Index: gdb-7.2/bfd/libbfd.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/libbfd.h 2010-06-29 06:17:22.000000000 +0200
|
||||
+++ gdb-7.2/bfd/libbfd.h 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -275,6 +275,8 @@ extern int _bfd_nocore_core_file_failing
|
||||
(bfd *);
|
||||
extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
|
||||
(bfd *, bfd *);
|
||||
+extern int _bfd_nocore_core_file_pid
|
||||
+ (bfd *);
|
||||
|
||||
/* Routines to use for BFD_JUMP_TABLE_ARCHIVE when there is no archive
|
||||
file support. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive). */
|
||||
Index: gdb-7.2/bfd/lynx-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/lynx-core.c 2009-09-02 09:18:37.000000000 +0200
|
||||
+++ gdb-7.2/bfd/lynx-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -53,6 +53,7 @@ struct lynx_core_struct
|
||||
#define core_command(bfd) (core_hdr(bfd)->cmd)
|
||||
|
||||
#define lynx_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define lynx_core_file_pid _bfd_nocore_core_file_pid
|
||||
|
||||
/* Handle Lynx core dump file. */
|
||||
|
||||
Index: gdb-7.2/bfd/mach-o-target.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/mach-o-target.c 2010-03-24 16:41:59.000000000 +0100
|
||||
+++ gdb-7.2/bfd/mach-o-target.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -58,6 +58,7 @@
|
||||
#define bfd_mach_o_bfd_define_common_symbol bfd_generic_define_common_symbol
|
||||
#define bfd_mach_o_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
|
||||
#define bfd_mach_o_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define bfd_mach_o_core_file_pid _bfd_nocore_core_file_pid
|
||||
|
||||
#define bfd_mach_o_get_dynamic_symtab_upper_bound bfd_mach_o_get_symtab_upper_bound
|
||||
#define bfd_mach_o_canonicalize_dynamic_symtab bfd_mach_o_canonicalize_symtab
|
||||
Index: gdb-7.2/bfd/netbsd-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/netbsd-core.c 2007-07-03 16:26:42.000000000 +0200
|
||||
+++ gdb-7.2/bfd/netbsd-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -44,6 +44,7 @@
|
||||
#define SPARC64_WCOOKIE_OFFSET 832
|
||||
|
||||
#define netbsd_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define netbsd_core_core_file_pid _bfd_nocore_core_file_pid
|
||||
|
||||
struct netbsd_core_struct
|
||||
{
|
||||
Index: gdb-7.2/bfd/osf-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/osf-core.c 2009-09-02 09:18:37.000000000 +0200
|
||||
+++ gdb-7.2/bfd/osf-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -43,6 +43,7 @@ static char *osf_core_core_file_failing_
|
||||
static int osf_core_core_file_failing_signal
|
||||
PARAMS ((bfd *));
|
||||
#define osf_core_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define osf_core_core_file_pid _bfd_nocore_core_file_pid
|
||||
static void swap_abort
|
||||
PARAMS ((void));
|
||||
|
||||
Index: gdb-7.2/bfd/plugin.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/plugin.c 2010-03-17 09:50:36.000000000 +0100
|
||||
+++ gdb-7.2/bfd/plugin.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -319,6 +319,13 @@ bfd_plugin_core_file_failing_signal (bfd
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+bfd_plugin_core_file_pid (bfd *abfd ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ BFD_ASSERT (0);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static long
|
||||
bfd_plugin_get_symtab_upper_bound (bfd *abfd)
|
||||
{
|
||||
Index: gdb-7.2/bfd/ptrace-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/ptrace-core.c 2009-09-02 09:18:37.000000000 +0200
|
||||
+++ gdb-7.2/bfd/ptrace-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -53,6 +53,7 @@ const bfd_target *ptrace_unix_core_file_
|
||||
char * ptrace_unix_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
int ptrace_unix_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
#define ptrace_unix_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define ptrace_unix_core_file_pid _bfd_nocore_core_file_pid
|
||||
static void swap_abort PARAMS ((void));
|
||||
|
||||
const bfd_target *
|
||||
Index: gdb-7.2/bfd/sco5-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/sco5-core.c 2007-07-03 16:26:42.000000000 +0200
|
||||
+++ gdb-7.2/bfd/sco5-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -51,6 +51,7 @@ const bfd_target *sco5_core_file_p PARAM
|
||||
char *sco5_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
int sco5_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
#define sco5_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define sco5_core_file_pid _bfd_nocore_core_file_pid
|
||||
static void swap_abort PARAMS ((void));
|
||||
|
||||
static asection *
|
||||
Index: gdb-7.2/bfd/targets.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/targets.c 2010-06-29 06:17:22.000000000 +0200
|
||||
+++ gdb-7.2/bfd/targets.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -314,11 +314,13 @@ BFD_JUMP_TABLE macros.
|
||||
.#define BFD_JUMP_TABLE_CORE(NAME) \
|
||||
. NAME##_core_file_failing_command, \
|
||||
. NAME##_core_file_failing_signal, \
|
||||
-. NAME##_core_file_matches_executable_p
|
||||
+. NAME##_core_file_matches_executable_p, \
|
||||
+. NAME##_core_file_pid
|
||||
.
|
||||
. char * (*_core_file_failing_command) (bfd *);
|
||||
. int (*_core_file_failing_signal) (bfd *);
|
||||
. bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
|
||||
+. int (*_core_file_pid) (bfd *);
|
||||
.
|
||||
. {* Archive entry points. *}
|
||||
.#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
|
||||
Index: gdb-7.2/bfd/trad-core.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/trad-core.c 2007-07-15 08:33:34.000000000 +0200
|
||||
+++ gdb-7.2/bfd/trad-core.c 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -71,6 +71,7 @@ const bfd_target *trad_unix_core_file_p
|
||||
char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd));
|
||||
int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd));
|
||||
#define trad_unix_core_file_matches_executable_p generic_core_file_matches_executable_p
|
||||
+#define trad_unix_core_file_pid _bfd_nocore_core_file_pid
|
||||
static void swap_abort PARAMS ((void));
|
||||
|
||||
/* Handle 4.2-style (and perhaps also sysV-style) core dump file. */
|
||||
Index: gdb-7.2/bfd/xcoff-target.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/bfd/xcoff-target.h 2009-09-02 09:18:37.000000000 +0200
|
||||
+++ gdb-7.2/bfd/xcoff-target.h 2011-01-30 19:30:36.000000000 +0100
|
||||
@@ -51,6 +51,7 @@
|
||||
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
||||
#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p
|
||||
+#define coff_core_file_pid _bfd_nocore_core_file_pid
|
||||
#define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents
|
||||
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
||||
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
|
|
@ -0,0 +1,230 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00100.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/08/18 02:24:47 1.12092
|
||||
### src/gdb/ChangeLog 2010/08/18 12:24:08 1.12093
|
||||
## -1,3 +1,20 @@
|
||||
+2010-08-18 Pedro Alves <pedro@codesourcery.com>
|
||||
+
|
||||
+ PR corefile/8210
|
||||
+
|
||||
+ * corelow.c (add_to_thread_list): Don't use
|
||||
+ gdbarch_core_reg_section_encodes_pid. Use bfd_core_file_pid.
|
||||
+ (get_core_register_section): Don't use
|
||||
+ gdbarch_core_reg_section_encodes_pid.
|
||||
+
|
||||
+ * gdbarch.sh (core_reg_section_encodes_pid): Delete.
|
||||
+ * gdbarch.h, gdbarch.c: Regenerate.
|
||||
+ * amd64-sol2-tdep.c (amd64_sol2_init_abi): Don't set
|
||||
+ gdbarch_core_reg_section_encodes_pid.
|
||||
+ * i386-sol2-tdep.c (i386_sol2_init_abi): Ditto.
|
||||
+ * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Ditto.
|
||||
+ * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Ditto.
|
||||
+
|
||||
2010-08-18 Yao Qi <yao@codesourcery.com>
|
||||
|
||||
* MAINTAINERS : Add myself under Write After Approval.
|
||||
--- src/gdb/amd64-sol2-tdep.c 2010/01/01 07:31:29 1.11
|
||||
+++ src/gdb/amd64-sol2-tdep.c 2010/08/18 12:24:12 1.12
|
||||
@@ -114,10 +114,6 @@
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
(gdbarch, svr4_lp64_fetch_link_map_offsets);
|
||||
|
||||
- /* Solaris encodes the pid of the inferior in regset section
|
||||
- names. */
|
||||
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
|
||||
-
|
||||
/* How to print LWP PTIDs from core files. */
|
||||
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
|
||||
}
|
||||
--- src/gdb/corelow.c 2010/08/04 15:27:56 1.102
|
||||
+++ src/gdb/corelow.c 2010/08/18 12:24:12 1.103
|
||||
@@ -252,29 +252,15 @@
|
||||
|
||||
core_tid = atoi (bfd_section_name (abfd, asect) + 5);
|
||||
|
||||
- if (core_gdbarch
|
||||
- && gdbarch_core_reg_section_encodes_pid (core_gdbarch))
|
||||
- {
|
||||
- uint32_t merged_pid = core_tid;
|
||||
- pid = merged_pid & 0xffff;
|
||||
- lwpid = merged_pid >> 16;
|
||||
-
|
||||
- /* This can happen on solaris core, for example, if we don't
|
||||
- find a NT_PSTATUS note in the core, but do find NT_LWPSTATUS
|
||||
- notes. */
|
||||
- if (pid == 0)
|
||||
- {
|
||||
- core_has_fake_pid = 1;
|
||||
- pid = CORELOW_PID;
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
+ pid = bfd_core_file_pid (core_bfd);
|
||||
+ if (pid == 0)
|
||||
{
|
||||
core_has_fake_pid = 1;
|
||||
pid = CORELOW_PID;
|
||||
- lwpid = core_tid;
|
||||
}
|
||||
|
||||
+ lwpid = core_tid;
|
||||
+
|
||||
if (current_inferior ()->pid == 0)
|
||||
inferior_appeared (current_inferior (), pid);
|
||||
|
||||
@@ -520,21 +506,7 @@
|
||||
|
||||
xfree (section_name);
|
||||
|
||||
- if (core_gdbarch
|
||||
- && gdbarch_core_reg_section_encodes_pid (core_gdbarch))
|
||||
- {
|
||||
- uint32_t merged_pid;
|
||||
- int pid = ptid_get_pid (inferior_ptid);
|
||||
-
|
||||
- if (core_has_fake_pid)
|
||||
- pid = 0;
|
||||
-
|
||||
- merged_pid = ptid_get_lwp (inferior_ptid);
|
||||
- merged_pid = merged_pid << 16 | pid;
|
||||
-
|
||||
- section_name = xstrprintf ("%s/%s", name, plongest (merged_pid));
|
||||
- }
|
||||
- else if (ptid_get_lwp (inferior_ptid))
|
||||
+ if (ptid_get_lwp (inferior_ptid))
|
||||
section_name = xstrprintf ("%s/%ld", name, ptid_get_lwp (inferior_ptid));
|
||||
else
|
||||
section_name = xstrdup (name);
|
||||
--- src/gdb/gdbarch.c 2010/08/06 19:02:14 1.470
|
||||
+++ src/gdb/gdbarch.c 2010/08/18 12:24:12 1.471
|
||||
@@ -234,7 +234,6 @@
|
||||
gdbarch_register_reggroup_p_ftype *register_reggroup_p;
|
||||
gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
|
||||
gdbarch_regset_from_core_section_ftype *regset_from_core_section;
|
||||
- int core_reg_section_encodes_pid;
|
||||
struct core_regset_section * core_regset_sections;
|
||||
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
|
||||
gdbarch_core_pid_to_str_ftype *core_pid_to_str;
|
||||
@@ -385,7 +384,6 @@
|
||||
default_register_reggroup_p, /* register_reggroup_p */
|
||||
0, /* fetch_pointer_argument */
|
||||
0, /* regset_from_core_section */
|
||||
- 0, /* core_reg_section_encodes_pid */
|
||||
0, /* core_regset_sections */
|
||||
0, /* core_xfer_shared_libraries */
|
||||
0, /* core_pid_to_str */
|
||||
@@ -667,7 +665,6 @@
|
||||
/* Skip verify of register_reggroup_p, invalid_p == 0 */
|
||||
/* Skip verify of fetch_pointer_argument, has predicate */
|
||||
/* Skip verify of regset_from_core_section, has predicate */
|
||||
- /* Skip verify of core_reg_section_encodes_pid, invalid_p == 0 */
|
||||
/* Skip verify of core_xfer_shared_libraries, has predicate */
|
||||
/* Skip verify of core_pid_to_str, has predicate */
|
||||
/* Skip verify of gcore_bfd_target, has predicate */
|
||||
@@ -818,9 +815,6 @@
|
||||
"gdbarch_dump: core_read_description = <%s>\n",
|
||||
host_address_to_string (gdbarch->core_read_description));
|
||||
fprintf_unfiltered (file,
|
||||
- "gdbarch_dump: core_reg_section_encodes_pid = %s\n",
|
||||
- plongest (gdbarch->core_reg_section_encodes_pid));
|
||||
- fprintf_unfiltered (file,
|
||||
"gdbarch_dump: core_regset_sections = %s\n",
|
||||
host_address_to_string (gdbarch->core_regset_sections));
|
||||
fprintf_unfiltered (file,
|
||||
@@ -3095,23 +3089,6 @@
|
||||
gdbarch->regset_from_core_section = regset_from_core_section;
|
||||
}
|
||||
|
||||
-int
|
||||
-gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch)
|
||||
-{
|
||||
- gdb_assert (gdbarch != NULL);
|
||||
- /* Skip verify of core_reg_section_encodes_pid, invalid_p == 0 */
|
||||
- if (gdbarch_debug >= 2)
|
||||
- fprintf_unfiltered (gdb_stdlog, "gdbarch_core_reg_section_encodes_pid called\n");
|
||||
- return gdbarch->core_reg_section_encodes_pid;
|
||||
-}
|
||||
-
|
||||
-void
|
||||
-set_gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch,
|
||||
- int core_reg_section_encodes_pid)
|
||||
-{
|
||||
- gdbarch->core_reg_section_encodes_pid = core_reg_section_encodes_pid;
|
||||
-}
|
||||
-
|
||||
struct core_regset_section *
|
||||
gdbarch_core_regset_sections (struct gdbarch *gdbarch)
|
||||
{
|
||||
--- src/gdb/gdbarch.h 2010/08/06 19:02:14 1.419
|
||||
+++ src/gdb/gdbarch.h 2010/08/18 12:24:12 1.420
|
||||
@@ -666,15 +666,6 @@
|
||||
extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
|
||||
extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section);
|
||||
|
||||
-/* When creating core dumps, some systems encode the PID in addition
|
||||
- to the LWP id in core file register section names. In those cases, the
|
||||
- "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID]. This setting
|
||||
- is set to true for such architectures; false if "XXX" represents an LWP
|
||||
- or thread id with no special encoding. */
|
||||
-
|
||||
-extern int gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch);
|
||||
-extern void set_gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch, int core_reg_section_encodes_pid);
|
||||
-
|
||||
/* Supported register notes in a core file. */
|
||||
|
||||
extern struct core_regset_section * gdbarch_core_regset_sections (struct gdbarch *gdbarch);
|
||||
--- src/gdb/gdbarch.sh 2010/08/06 19:02:14 1.515
|
||||
+++ src/gdb/gdbarch.sh 2010/08/18 12:24:13 1.516
|
||||
@@ -612,13 +612,6 @@
|
||||
# name SECT_NAME and size SECT_SIZE.
|
||||
M:const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size
|
||||
|
||||
-# When creating core dumps, some systems encode the PID in addition
|
||||
-# to the LWP id in core file register section names. In those cases, the
|
||||
-# "XXX" in ".reg/XXX" is encoded as [LWPID << 16 | PID]. This setting
|
||||
-# is set to true for such architectures; false if "XXX" represents an LWP
|
||||
-# or thread id with no special encoding.
|
||||
-v:int:core_reg_section_encodes_pid:::0:0::0
|
||||
-
|
||||
# Supported register notes in a core file.
|
||||
v:struct core_regset_section *:core_regset_sections:const char *name, int len::::::host_address_to_string (gdbarch->core_regset_sections)
|
||||
|
||||
--- src/gdb/i386-sol2-tdep.c 2010/01/01 07:31:34 1.29
|
||||
+++ src/gdb/i386-sol2-tdep.c 2010/08/18 12:24:13 1.30
|
||||
@@ -136,10 +136,6 @@
|
||||
set_solib_svr4_fetch_link_map_offsets
|
||||
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||
|
||||
- /* Solaris encodes the pid of the inferior in regset section
|
||||
- names. */
|
||||
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
|
||||
-
|
||||
/* How to print LWP PTIDs from core files. */
|
||||
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
|
||||
}
|
||||
--- src/gdb/sparc-sol2-tdep.c 2010/01/01 07:31:42 1.21
|
||||
+++ src/gdb/sparc-sol2-tdep.c 2010/08/18 12:24:13 1.22
|
||||
@@ -232,10 +232,6 @@
|
||||
|
||||
frame_unwind_append_unwinder (gdbarch, &sparc32_sol2_sigtramp_frame_unwind);
|
||||
|
||||
- /* Solaris encodes the pid of the inferior in regset section
|
||||
- names. */
|
||||
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
|
||||
-
|
||||
/* How to print LWP PTIDs from core files. */
|
||||
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
|
||||
}
|
||||
--- src/gdb/sparc64-sol2-tdep.c 2010/01/01 07:31:42 1.20
|
||||
+++ src/gdb/sparc64-sol2-tdep.c 2010/08/18 12:24:13 1.21
|
||||
@@ -181,10 +181,6 @@
|
||||
/* Solaris has kernel-assisted single-stepping support. */
|
||||
set_gdbarch_software_single_step (gdbarch, NULL);
|
||||
|
||||
- /* Solaris encodes the pid of the inferior in regset section
|
||||
- names. */
|
||||
- set_gdbarch_core_reg_section_encodes_pid (gdbarch, 1);
|
||||
-
|
||||
/* How to print LWP PTIDs from core files. */
|
||||
set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00101.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/08/18 12:24:08 1.12093
|
||||
### src/gdb/ChangeLog 2010/08/18 12:25:48 1.12094
|
||||
## -2,6 +2,27 @@
|
||||
|
||||
PR corefile/8210
|
||||
|
||||
+ * linux-thread-db.c (add_thread_db_info): Skip glibc/BZ5983
|
||||
+ workaround on core files.
|
||||
+ (try_thread_db_load_1): Don't try enabling thread event reporting
|
||||
+ on core files.
|
||||
+ (thread_db_load): Allow thread_db on core files.
|
||||
+ (attach_thread): Don't check thread signals on core files, nor try
|
||||
+ really attaching to the thread, nor enabling thread event event
|
||||
+ reporting.
|
||||
+ (thread_db_detach): Don't try disabing thread event reporting or
|
||||
+ removing thread event breakpoints when debugging a core file.
|
||||
+ (find_new_threads_callback): Don't try enabling thread event
|
||||
+ reporting on core files.
|
||||
+ (thread_db_find_new_threads_2): Don't look for a stopped lwp when
|
||||
+ debugging a core file.
|
||||
+ (thread_db_find_new_threads): Don't update thread
|
||||
+ cores (processors) when debugging a core (dump).
|
||||
+
|
||||
+2010-08-18 Pedro Alves <pedro@codesourcery.com>
|
||||
+
|
||||
+ PR corefile/8210
|
||||
+
|
||||
* corelow.c (add_to_thread_list): Don't use
|
||||
gdbarch_core_reg_section_encodes_pid. Use bfd_core_file_pid.
|
||||
(get_core_register_section): Don't use
|
||||
--- src/gdb/linux-thread-db.c 2010/07/31 15:34:41 1.76
|
||||
+++ src/gdb/linux-thread-db.c 2010/08/18 12:25:49 1.77
|
||||
@@ -189,7 +189,11 @@
|
||||
info = xcalloc (1, sizeof (*info));
|
||||
info->pid = ptid_get_pid (inferior_ptid);
|
||||
info->handle = handle;
|
||||
- info->need_stale_parent_threads_check = 1;
|
||||
+
|
||||
+ /* The workaround works by reading from /proc/pid/status, so it is
|
||||
+ disabled for core files. */
|
||||
+ if (target_has_execution)
|
||||
+ info->need_stale_parent_threads_check = 1;
|
||||
|
||||
info->next = thread_db_list;
|
||||
thread_db_list = info;
|
||||
@@ -737,7 +741,9 @@
|
||||
if (thread_db_list->next == NULL)
|
||||
push_target (&thread_db_ops);
|
||||
|
||||
- enable_thread_event_reporting ();
|
||||
+ /* Enable event reporting, but not when debugging a core file. */
|
||||
+ if (target_has_execution)
|
||||
+ enable_thread_event_reporting ();
|
||||
|
||||
/* There appears to be a bug in glibc-2.3.6: calls to td_thr_get_info fail
|
||||
with TD_ERR for statically linked executables if td_thr_get_info is
|
||||
@@ -869,13 +875,13 @@
|
||||
if (info != NULL)
|
||||
return 1;
|
||||
|
||||
- /* Don't attempt to use thread_db on targets which can not run
|
||||
- (executables not running yet, core files) for now. */
|
||||
- if (!target_has_execution)
|
||||
+ /* Don't attempt to use thread_db on executables not running
|
||||
+ yet. */
|
||||
+ if (!target_has_registers)
|
||||
return 0;
|
||||
|
||||
/* Don't attempt to use thread_db for remote targets. */
|
||||
- if (!target_can_run (¤t_target))
|
||||
+ if (!(target_can_run (¤t_target) || core_bfd))
|
||||
return 0;
|
||||
|
||||
if (thread_db_load_search ())
|
||||
@@ -1030,13 +1036,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
- check_thread_signals ();
|
||||
+ if (target_has_execution)
|
||||
+ check_thread_signals ();
|
||||
|
||||
if (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE)
|
||||
return 0; /* A zombie thread -- do not attach. */
|
||||
|
||||
/* Under GNU/Linux, we have to attach to each and every thread. */
|
||||
- if (tp == NULL
|
||||
+ if (target_has_execution
|
||||
+ && tp == NULL
|
||||
&& lin_lwp_attach_lwp (BUILD_LWP (ti_p->ti_lid, GET_PID (ptid))) < 0)
|
||||
return 0;
|
||||
|
||||
@@ -1061,11 +1069,16 @@
|
||||
|
||||
info = get_thread_db_info (GET_PID (ptid));
|
||||
|
||||
- /* Enable thread event reporting for this thread. */
|
||||
- err = info->td_thr_event_enable_p (th_p, 1);
|
||||
- if (err != TD_OK)
|
||||
- error (_("Cannot enable thread event reporting for %s: %s"),
|
||||
- target_pid_to_str (ptid), thread_db_err_str (err));
|
||||
+ /* Enable thread event reporting for this thread, except when
|
||||
+ debugging a core file. */
|
||||
+ if (target_has_execution)
|
||||
+ {
|
||||
+ err = info->td_thr_event_enable_p (th_p, 1);
|
||||
+ if (err != TD_OK)
|
||||
+ error (_("Cannot enable thread event reporting for %s: %s"),
|
||||
+ target_pid_to_str (ptid), thread_db_err_str (err));
|
||||
+ }
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1097,14 +1110,17 @@
|
||||
|
||||
if (info)
|
||||
{
|
||||
- disable_thread_event_reporting (info);
|
||||
+ if (target_has_execution)
|
||||
+ {
|
||||
+ disable_thread_event_reporting (info);
|
||||
|
||||
- /* Delete the old thread event breakpoints. Note that unlike
|
||||
- when mourning, we can remove them here because there's still
|
||||
- a live inferior to poke at. In any case, GDB will not try to
|
||||
- insert anything in the inferior when removing a
|
||||
- breakpoint. */
|
||||
- remove_thread_event_breakpoints ();
|
||||
+ /* Delete the old thread event breakpoints. Note that
|
||||
+ unlike when mourning, we can remove them here because
|
||||
+ there's still a live inferior to poke at. In any case,
|
||||
+ GDB will not try to insert anything in the inferior when
|
||||
+ removing a breakpoint. */
|
||||
+ remove_thread_event_breakpoints ();
|
||||
+ }
|
||||
|
||||
delete_thread_db_info (GET_PID (inferior_ptid));
|
||||
}
|
||||
@@ -1317,7 +1333,7 @@
|
||||
if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE)
|
||||
return 0; /* A zombie -- ignore. */
|
||||
|
||||
- if (ti.ti_tid == 0)
|
||||
+ if (ti.ti_tid == 0 && target_has_execution)
|
||||
{
|
||||
/* A thread ID of zero means that this is the main thread, but
|
||||
glibc has not yet initialized thread-local storage and the
|
||||
@@ -1417,19 +1433,23 @@
|
||||
thread_db_find_new_threads_2 (ptid_t ptid, int until_no_new)
|
||||
{
|
||||
td_err_e err;
|
||||
- struct lwp_info *lp;
|
||||
struct thread_db_info *info;
|
||||
int pid = ptid_get_pid (ptid);
|
||||
int i, loop;
|
||||
|
||||
- /* In linux, we can only read memory through a stopped lwp. */
|
||||
- ALL_LWPS (lp, ptid)
|
||||
- if (lp->stopped && ptid_get_pid (lp->ptid) == pid)
|
||||
- break;
|
||||
+ if (target_has_execution)
|
||||
+ {
|
||||
+ struct lwp_info *lp;
|
||||
|
||||
- if (!lp)
|
||||
- /* There is no stopped thread. Bail out. */
|
||||
- return;
|
||||
+ /* In linux, we can only read memory through a stopped lwp. */
|
||||
+ ALL_LWPS (lp, ptid)
|
||||
+ if (lp->stopped && ptid_get_pid (lp->ptid) == pid)
|
||||
+ break;
|
||||
+
|
||||
+ if (!lp)
|
||||
+ /* There is no stopped thread. Bail out. */
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
info = get_thread_db_info (GET_PID (ptid));
|
||||
|
||||
@@ -1480,8 +1500,9 @@
|
||||
|
||||
thread_db_find_new_threads_1 (inferior_ptid);
|
||||
|
||||
- iterate_over_lwps (minus_one_ptid /* iterate over all */,
|
||||
- update_thread_core, NULL);
|
||||
+ if (target_has_execution)
|
||||
+ iterate_over_lwps (minus_one_ptid /* iterate over all */,
|
||||
+ update_thread_core, NULL);
|
||||
}
|
||||
|
||||
static char *
|
|
@ -0,0 +1,50 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00167.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/08/26 16:47:54 1.12117
|
||||
### src/gdb/ChangeLog 2010/08/26 19:47:22 1.12118
|
||||
## -1,3 +1,7 @@
|
||||
+2010-08-26 Pedro Alves <pedro@codesourcery.com>
|
||||
+
|
||||
+ * NEWS: Mention libthread_db debugging with core files.
|
||||
+
|
||||
2010-08-26 Doug Evans <dje@google.com>
|
||||
|
||||
* dwarf2read.c (dwarf2_build_include_psymtabs): Remove unnecessary
|
||||
Index: gdb-7.2/gdb/NEWS
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/NEWS 2010-09-03 01:37:25.000000000 +0200
|
||||
+++ gdb-7.2/gdb/NEWS 2011-01-30 19:32:06.000000000 +0100
|
||||
@@ -1,6 +1,33 @@
|
||||
What has changed in GDB?
|
||||
(Organized release by release)
|
||||
|
||||
+*** Changes since GDB 7.2
|
||||
+
|
||||
+* GDB now supports thread debugging of core dumps on GNU/Linux.
|
||||
+
|
||||
+ GDB now activates thread debugging using the libthread_db library
|
||||
+ when debugging GNU/Linux core dumps, similarly to when debugging
|
||||
+ live processes. As a result, when debugging a core dump file, GDB
|
||||
+ is now able to display pthread_t ids of threads. For example, "info
|
||||
+ threads" shows the same output as when debugging the process when it
|
||||
+ was live. In earlier releases, you'd see something like this:
|
||||
+
|
||||
+ (gdb) info threads
|
||||
+ * 1 LWP 6780 main () at main.c:10
|
||||
+
|
||||
+ While now you see this:
|
||||
+
|
||||
+ (gdb) info threads
|
||||
+ * 1 Thread 0x7f0f5712a700 (LWP 6780) main () at main.c:10
|
||||
+
|
||||
+ It is also now possible to inspect TLS variables when debugging core
|
||||
+ dumps.
|
||||
+
|
||||
+ When debugging a core dump generated on a machine other than the one
|
||||
+ used to run GDB, you may need to point GDB at the correct
|
||||
+ libthread_db library with the "set libthread-db-search-path"
|
||||
+ command. See the user manual for more details on this command.
|
||||
+
|
||||
*** Changes in GDB 7.2
|
||||
|
||||
* Shared library support for remote targets by default
|
|
@ -0,0 +1,81 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-01/msg00566.html
|
||||
Subject: [patch] testcase: PR 8210 corefiles threads
|
||||
|
||||
Hi,
|
||||
|
||||
PR 8210 did not provide a new testcase, here it is. I have limited the check
|
||||
only to *-*-linux* as other targets seem to identify the thread differently
|
||||
(untested outside of GNU/Linux).
|
||||
|
||||
I will check it in after a while, it seems safe to me.
|
||||
|
||||
Tested on x86_64-fedora14-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/testsuite/
|
||||
2011-01-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Test PR corefiles/8210.
|
||||
* gdb.threads/gcore-thread.exp (pthread_self): New.
|
||||
New variables main_self, thread1_self, thread2_self.
|
||||
(main pthread_self found, thread1 pthread_self found)
|
||||
(thread2 pthread_self found): New tests.
|
||||
|
||||
--- ./gdb/testsuite/gdb.threads/gcore-thread.exp 2010-06-02 21:58:21.000000000 +0200
|
||||
+++ ./gdb/testsuite/gdb.threads/gcore-thread.exp 2011-01-30 20:02:53.000000000 +0100
|
||||
@@ -53,6 +53,19 @@ set horiz "\[^\n\r\]*"
|
||||
# regexp for newline
|
||||
set nl "\[\r\n\]+"
|
||||
|
||||
+proc pthread_self {name} {
|
||||
+ global gdb_prompt
|
||||
+
|
||||
+ set test "print pthread_t of $name"
|
||||
+ gdb_test_multiple "p/x (*(pthread_t (*)(void)) pthread_self) ()" $test {
|
||||
+ -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ return $expect_out(1,string)
|
||||
+ }
|
||||
+ }
|
||||
+ return ""
|
||||
+}
|
||||
+
|
||||
set prev_timeout $timeout
|
||||
set timeout 30
|
||||
|
||||
@@ -82,15 +95,19 @@ gdb_test_multiple "info threads" "thread
|
||||
}
|
||||
}
|
||||
|
||||
+set main_self [pthread_self main]
|
||||
+
|
||||
# Make sure thread 1 is running
|
||||
delete_breakpoints
|
||||
gdb_breakpoint "thread1"
|
||||
gdb_test "continue" "Continuing.*Breakpoint.* thread1 .*" "thread 1 is running"
|
||||
+set thread1_self [pthread_self thread1]
|
||||
|
||||
# Make sure thread 2 is running
|
||||
delete_breakpoints
|
||||
gdb_breakpoint "thread2"
|
||||
gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
|
||||
+set thread2_self [pthread_self thread2]
|
||||
|
||||
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
|
||||
# Drop corefile
|
||||
@@ -159,4 +176,10 @@ gdb_test "info threads" ".* thread2 .*"
|
||||
gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
|
||||
"thread2 is current thread in corefile"
|
||||
|
||||
+if [istarget "*-*-linux*"] then {
|
||||
+ gdb_test "info threads" "Thread $main_self .*" "main pthread_self found"
|
||||
+ gdb_test "info threads" "Thread $thread1_self .*" "thread1 pthread_self found"
|
||||
+ gdb_test "info threads" "Thread $thread2_self .*" "thread2 pthread_self found"
|
||||
+}
|
||||
+
|
||||
set timeout $prev_timeout
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-01/msg00559.html
|
||||
http://sourceware.org/ml/gdb-cvs/2011-01/msg00192.html
|
||||
|
||||
### src/gdb/ChangeLog 2011/01/28 16:32:26 1.12516
|
||||
### src/gdb/ChangeLog 2011/01/29 10:30:19 1.12517
|
||||
## -1,3 +1,9 @@
|
||||
+2011-01-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix crash.
|
||||
+ * valops.c (compare_parameters): Verify TYPE_NFIELDS before
|
||||
+ touching TYPE_FIELD_ARTIFICIAL.
|
||||
+
|
||||
2011-01-28 Richard Earnshaw <rearnsha@arm.com>
|
||||
|
||||
* MAINTAINERS: Move myself from Responsible Maintainers to Authorized
|
||||
--- src/gdb/valops.c 2011/01/12 16:10:05 1.265
|
||||
+++ src/gdb/valops.c 2011/01/29 10:30:19 1.266
|
||||
@@ -3097,7 +3097,7 @@
|
||||
{
|
||||
int start = 0;
|
||||
|
||||
- if (TYPE_FIELD_ARTIFICIAL (t1, 0))
|
||||
+ if (TYPE_NFIELDS (t1) > 0 && TYPE_FIELD_ARTIFICIAL (t1, 0))
|
||||
++start;
|
||||
|
||||
/* If skipping artificial fields, find the first real field
|
||||
### src/gdb/testsuite/ChangeLog 2011/01/28 16:18:55 1.2563
|
||||
### src/gdb/testsuite/ChangeLog 2011/01/29 10:30:19 1.2564
|
||||
## -1,3 +1,8 @@
|
||||
+2011-01-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.cp/noparam.exp: New file.
|
||||
+ * gdb.cp/noparam.cc: New file.
|
||||
+
|
||||
2011-01-28 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* gdb.trace/tfile.exp: Test that with no traceframe selected,
|
||||
--- src/gdb/testsuite/gdb.cp/noparam.cc
|
||||
+++ src/gdb/testsuite/gdb.cp/noparam.cc 2011-01-30 20:52:48.767554000 +0000
|
||||
@@ -0,0 +1,29 @@
|
||||
+/* 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 <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+class C
|
||||
+{
|
||||
+public:
|
||||
+ static void m () {}
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ C::m ();
|
||||
+ return 0;
|
||||
+}
|
||||
--- src/gdb/testsuite/gdb.cp/noparam.exp
|
||||
+++ src/gdb/testsuite/gdb.cp/noparam.exp 2011-01-30 20:52:49.056124000 +0000
|
||||
@@ -0,0 +1,21 @@
|
||||
+# 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [prepare_for_testing noparam.exp "noparam" "noparam.cc" {debug c++}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Check if GDB does not crash.
|
||||
+gdb_test "p C::m (int)" "no member function matches that type instantiation"
|
|
@ -0,0 +1,418 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00519.html
|
||||
Subject: [patch] Fix inferior execl of new PIE x86_64
|
||||
|
||||
Hi,
|
||||
|
||||
gcc -o 1 1.c -Wall -g -fPIE -pie; gdb -nx ./1 -ex 'b main' -ex r -ex c
|
||||
|
||||
Starting program: .../gdb/1
|
||||
Breakpoint 1, main (argc=1, argv=0x7fffffffdff8) at 1.c:7
|
||||
7 setbuf (stdout, NULL);
|
||||
Continuing.
|
||||
re-exec
|
||||
process 28056 is executing new program: .../gdb/1
|
||||
Error in re-setting breakpoint 1: Cannot access memory at address 0x80c
|
||||
exit
|
||||
Program exited normally.
|
||||
(gdb) _
|
||||
|
||||
while it should be:
|
||||
|
||||
re-exec
|
||||
process 28095 is executing new program: .../gdb/1
|
||||
Breakpoint 1, main (argc=2, argv=0x7fffffffe008) at 1.c:7
|
||||
7 setbuf (stdout, NULL);
|
||||
(gdb) _
|
||||
|
||||
The error comes from:
|
||||
|
||||
throw_error <- memory_error <- read_memory <- read_memory_unsigned_integer <-
|
||||
amd64_analyze_prologue <- amd64_skip_prologue <- gdbarch_skip_prologue <-
|
||||
skip_prologue_sal <- find_function_start_sal <- symbol_found <- decode_variable
|
||||
<- decode_line_1 <- breakpoint_re_set_one <- catch_errors <- breakpoint_re_set
|
||||
<- clear_symtab_users <- new_symfile_objfile <-
|
||||
symbol_file_add_with_addrs_or_offsets <- symbol_file_add_from_bfd <-
|
||||
symbol_file_add <- symbol_file_add_main_1 <- symbol_file_add_main <-
|
||||
follow_exec
|
||||
|
||||
|
||||
I understand this hack is not nice, the correct way would be to unify more
|
||||
follow_exec with post_create_inferior. But I could break it for non-GNU/Linux
|
||||
targets a lot.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
for the demo above:
|
||||
------------------------------------------------------------------------------
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
setbuf (stdout, NULL);
|
||||
if (argc == 1)
|
||||
{
|
||||
puts ("re-exec");
|
||||
execl ("/proc/self/exe", argv[0], "foo", NULL);
|
||||
assert (0);
|
||||
}
|
||||
puts ("exit");
|
||||
return 0;
|
||||
}
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
gdb/
|
||||
2010-09-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* infrun.c (follow_exec): Replace symbol_file_add_main by
|
||||
symbol_file_add with SYMFILE_DEFER_BP_RESET, set_initial_language and
|
||||
breakpoint_re_set.
|
||||
* m32r-rom.c (m32r_load, m32r_upload_command): Use parameter 0 for
|
||||
clear_symtab_users.
|
||||
* objfiles.c (free_all_objfiles): Likewise.
|
||||
* remote-m32r-sdi.c (m32r_load): Likewise.
|
||||
* solib-som.c (som_solib_create_inferior_hook): Likewise.
|
||||
* symfile.c (new_symfile_objfile): New comment for add_flags. Call
|
||||
clear_symtab_users with ADD_FLAGS.
|
||||
(reread_symbols): Use parameter 0 for clear_symtab_users.
|
||||
(clear_symtab_users): New parameter add_flags. Do not call
|
||||
breakpoint_re_set if SYMFILE_DEFER_BP_RESET.
|
||||
(clear_symtab_users_cleanup): Use parameter 0 for clear_symtab_users.
|
||||
* symtab.h (clear_symtab_users): New parameter add_flags.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-09-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/pie-execl.exp: New file.
|
||||
* gdb.base/pie-execl.c: New file.
|
||||
|
||||
Index: gdb-7.2/gdb/infrun.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/infrun.c 2010-10-12 18:27:58.000000000 +0200
|
||||
+++ gdb-7.2/gdb/infrun.c 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -840,8 +840,15 @@ follow_exec (ptid_t pid, char *execd_pat
|
||||
/* That a.out is now the one to use. */
|
||||
exec_file_attach (execd_pathname, 0);
|
||||
|
||||
- /* Load the main file's symbols. */
|
||||
- symbol_file_add_main (execd_pathname, 0);
|
||||
+ /* SYMFILE_DEFER_BP_RESET is used as the proper displacement for PIE
|
||||
+ (Position Independent Executable) main symbol file will get applied by
|
||||
+ solib_create_inferior_hook below. breakpoint_re_set would fail to insert
|
||||
+ the breakpoints with the zero displacement. */
|
||||
+
|
||||
+ symbol_file_add (execd_pathname, SYMFILE_MAINLINE | SYMFILE_DEFER_BP_RESET,
|
||||
+ NULL, 0);
|
||||
+
|
||||
+ set_initial_language ();
|
||||
|
||||
#ifdef SOLIB_CREATE_INFERIOR_HOOK
|
||||
SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
|
||||
@@ -851,6 +858,8 @@ follow_exec (ptid_t pid, char *execd_pat
|
||||
|
||||
jit_inferior_created_hook ();
|
||||
|
||||
+ breakpoint_re_set ();
|
||||
+
|
||||
/* Reinsert all breakpoints. (Those which were symbolic have
|
||||
been reset to the proper address in the new a.out, thanks
|
||||
to symbol_file_command...) */
|
||||
Index: gdb-7.2/gdb/m32r-rom.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/m32r-rom.c 2010-01-01 08:31:37.000000000 +0100
|
||||
+++ gdb-7.2/gdb/m32r-rom.c 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -188,7 +188,7 @@ m32r_load (char *filename, int from_tty)
|
||||
the stack may not be valid, and things would get horribly
|
||||
confused... */
|
||||
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -551,7 +551,7 @@ m32r_upload_command (char *args, int fro
|
||||
the stack may not be valid, and things would get horribly
|
||||
confused... */
|
||||
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (0);
|
||||
}
|
||||
|
||||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||
Index: gdb-7.2/gdb/objfiles.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/objfiles.c 2010-10-12 18:27:56.000000000 +0200
|
||||
+++ gdb-7.2/gdb/objfiles.c 2010-10-12 18:29:39.000000000 +0200
|
||||
@@ -699,7 +699,7 @@ free_all_objfiles (void)
|
||||
{
|
||||
free_objfile (objfile);
|
||||
}
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (0);
|
||||
}
|
||||
|
||||
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
|
||||
Index: gdb-7.2/gdb/remote-m32r-sdi.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/remote-m32r-sdi.c 2010-07-07 18:15:16.000000000 +0200
|
||||
+++ gdb-7.2/gdb/remote-m32r-sdi.c 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -1377,7 +1377,7 @@ m32r_load (char *args, int from_tty)
|
||||
might be to call normal_stop, except that the stack may not be valid,
|
||||
and things would get horribly confused... */
|
||||
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (0);
|
||||
|
||||
if (!nostart)
|
||||
{
|
||||
Index: gdb-7.2/gdb/solib-som.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/solib-som.c 2010-05-17 01:49:58.000000000 +0200
|
||||
+++ gdb-7.2/gdb/solib-som.c 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -354,7 +354,7 @@ keep_going:
|
||||
/* Make the breakpoint at "_start" a shared library event breakpoint. */
|
||||
create_solib_event_breakpoint (target_gdbarch, anaddr);
|
||||
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (0);
|
||||
}
|
||||
|
||||
static void
|
||||
Index: gdb-7.2/gdb/symfile.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/symfile.c 2010-10-12 18:27:57.000000000 +0200
|
||||
+++ gdb-7.2/gdb/symfile.c 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -1036,7 +1036,7 @@ syms_from_objfile (struct objfile *objfi
|
||||
|
||||
/* Perform required actions after either reading in the initial
|
||||
symbols for a new objfile, or mapping in the symbols from a reusable
|
||||
- objfile. */
|
||||
+ objfile. ADD_FLAGS is a bitmask of enum symfile_add_flags. */
|
||||
|
||||
void
|
||||
new_symfile_objfile (struct objfile *objfile, int add_flags)
|
||||
@@ -1049,7 +1049,7 @@ new_symfile_objfile (struct objfile *obj
|
||||
/* OK, make it the "real" symbol file. */
|
||||
symfile_objfile = objfile;
|
||||
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (add_flags);
|
||||
}
|
||||
else if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
|
||||
{
|
||||
@@ -2527,7 +2527,7 @@ reread_symbols (void)
|
||||
/* Notify objfiles that we've modified objfile sections. */
|
||||
objfiles_changed ();
|
||||
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (0);
|
||||
/* At least one objfile has changed, so we can consider that
|
||||
the executable we're debugging has changed too. */
|
||||
observer_notify_executable_changed ();
|
||||
@@ -2745,10 +2745,10 @@ allocate_symtab (char *filename, struct
|
||||
|
||||
|
||||
/* Reset all data structures in gdb which may contain references to symbol
|
||||
- table data. */
|
||||
+ table data. ADD_FLAGS is a bitmask of enum symfile_add_flags. */
|
||||
|
||||
void
|
||||
-clear_symtab_users (void)
|
||||
+clear_symtab_users (int add_flags)
|
||||
{
|
||||
/* Someday, we should do better than this, by only blowing away
|
||||
the things that really need to be blown. */
|
||||
@@ -2758,7 +2758,8 @@ clear_symtab_users (void)
|
||||
clear_current_source_symtab_and_line ();
|
||||
|
||||
clear_displays ();
|
||||
- breakpoint_re_set ();
|
||||
+ if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
|
||||
+ breakpoint_re_set ();
|
||||
set_default_breakpoint (0, NULL, 0, 0, 0);
|
||||
clear_pc_function_cache ();
|
||||
observer_notify_new_objfile (NULL);
|
||||
@@ -2777,7 +2778,7 @@ clear_symtab_users (void)
|
||||
static void
|
||||
clear_symtab_users_cleanup (void *ignore)
|
||||
{
|
||||
- clear_symtab_users ();
|
||||
+ clear_symtab_users (0);
|
||||
}
|
||||
|
||||
/* OVERLAYS:
|
||||
Index: gdb-7.2/gdb/symtab.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/symtab.h 2010-10-12 18:27:56.000000000 +0200
|
||||
+++ gdb-7.2/gdb/symtab.h 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -1170,7 +1170,7 @@ extern void skip_prologue_sal (struct sy
|
||||
|
||||
/* symfile.c */
|
||||
|
||||
-extern void clear_symtab_users (void);
|
||||
+extern void clear_symtab_users (int add_flags);
|
||||
|
||||
extern enum language deduce_language_from_filename (const char *);
|
||||
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.base/pie-execl.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.base/pie-execl.c 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -0,0 +1,51 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+
|
||||
+static void pie_execl_marker (void);
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ setbuf (stdout, NULL);
|
||||
+
|
||||
+#if BIN == 1
|
||||
+ if (argc == 2)
|
||||
+ {
|
||||
+ printf ("pie-execl: re-exec: %s\n", argv[1]);
|
||||
+ execl (argv[1], argv[1], NULL);
|
||||
+ assert (0);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ pie_execl_marker ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* pie_execl_marker must be on a different address than in `pie-execl2.c'. */
|
||||
+
|
||||
+volatile int v;
|
||||
+
|
||||
+static void
|
||||
+pie_execl_marker (void)
|
||||
+{
|
||||
+ v = 1;
|
||||
+}
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.base/pie-execl.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.base/pie-execl.exp 2010-10-12 18:29:24.000000000 +0200
|
||||
@@ -0,0 +1,94 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# The problem was due to amd64_skip_prologue attempting to access inferior
|
||||
+# memory before the PIE (Position Independent Executable) gets relocated.
|
||||
+
|
||||
+if { ![istarget *-linux*]} {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "pie-execl"
|
||||
+set srcfile ${testfile}.c
|
||||
+set executable1 ${testfile}1
|
||||
+set executable2 ${testfile}2
|
||||
+set binfile1 ${objdir}/${subdir}/${executable1}
|
||||
+set binfile2 ${objdir}/${subdir}/${executable2}
|
||||
+
|
||||
+# Use conditional compilation according to `BIN' as GDB remembers the source
|
||||
+# file name of the breakpoint.
|
||||
+
|
||||
+set opts [list debug {additional_flags=-fPIE -pie}]
|
||||
+if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {additional_flags=-DBIN=1}]] == ""
|
||||
+ || [build_executable ${testfile}.exp $executable2 $srcfile [concat $opts {additional_flags=-DBIN=2}]] == ""} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart ${executable1}
|
||||
+
|
||||
+gdb_test_no_output "set args ${binfile2}"
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Do not stop on `main' after re-exec.
|
||||
+delete_breakpoints
|
||||
+
|
||||
+gdb_breakpoint "pie_execl_marker"
|
||||
+gdb_test "info breakpoints" ".*" ""
|
||||
+
|
||||
+set addr1 ""
|
||||
+set test "pie_execl_marker address first"
|
||||
+gdb_test_multiple "p/x &pie_execl_marker" $test {
|
||||
+ -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
||||
+ set addr1 $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+verbose -log "addr1 is $addr1"
|
||||
+
|
||||
+set test "continue"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "Error in re-setting breakpoint" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "Cannot access memory" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "pie-execl: re-exec.*executing new program.*\r\nBreakpoint \[0-9\]+,\[^\r\n\]* pie_execl_marker .*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test "info breakpoints" ".*" ""
|
||||
+
|
||||
+set addr2 ""
|
||||
+set test "pie_execl_marker address second"
|
||||
+gdb_test_multiple "p/x &pie_execl_marker" $test {
|
||||
+ -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
||||
+ set addr2 $expect_out(1,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+verbose -log "addr2 is $addr2"
|
||||
+
|
||||
+# Ensure we cannot get a false PASS and the inferior has really changed.
|
||||
+set test "pie_execl_marker address has changed"
|
||||
+if [string equal $addr1 $addr2] {
|
||||
+ fail $test
|
||||
+} else {
|
||||
+ pass $test
|
||||
+}
|
|
@ -0,0 +1,11 @@
|
|||
--- gdb-7.1.90.20100806/gdb/infcall.c.orig 2010-08-10 00:34:10.000000000 +0200
|
||||
+++ gdb-7.1.90.20100806/gdb/infcall.c 2010-08-10 00:36:03.000000000 +0200
|
||||
@@ -284,7 +284,7 @@ find_function_addr (struct value *functi
|
||||
struct type *ftype = check_typedef (value_type (function));
|
||||
struct gdbarch *gdbarch = get_type_arch (ftype);
|
||||
struct type *value_type = NULL;
|
||||
- CORE_ADDR funaddr;
|
||||
+ CORE_ADDR funaddr = 0; /* GCC false -fprofile-use warning. */
|
||||
|
||||
/* If it's a member function, just look at the function
|
||||
part of it. */
|
|
@ -109,7 +109,7 @@ index 0000000..c9a03b0
|
|||
+dir="${file%/*}"
|
||||
+
|
||||
+# We don't care if gdb gives an error.
|
||||
+gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir"
|
||||
+gdb -nx --batch-silent -ex "file $file" -ex "save gdb-index $dir"
|
||||
+
|
||||
+if test -f "${file}.gdb-index"; then
|
||||
+ objcopy --add-section .gdb_index="${file}.gdb-index" --set-section-flags .gdb_index=readonly "$file" "$file"
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00273.html
|
||||
Subject: [patch] .gdb_index: Fix Ada regression
|
||||
|
||||
Hi,
|
||||
|
||||
on a system with libraries using .gdb_index all the Ada testcases FAIL:
|
||||
|
||||
Running ./gdb.ada/print_pc.exp ...
|
||||
FAIL: gdb.ada/print_pc.exp: start inferior (GDB internal error)
|
||||
FAIL: gdb.ada/print_pc.exp: p /x $pc
|
||||
|
||||
dwarf2read.c:2374: internal-error: map_ada_symtabs called via index method
|
||||
|
||||
FAIl is on Fedora 14 snapshot using gcc-debuginfo-4.5.1-3.fc14.x86_64 file:
|
||||
/usr/lib/debug/lib64/libgcc_s-4.5.1-20100907.so.1.debug
|
||||
|
||||
The regressions get fixed on x86_64-fedora14snapshot-linux-gnu by the attached
|
||||
patch. No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
|
||||
|
||||
During my tests with `set language ada' I could not lookup non-Ada symbols
|
||||
anyway so I believe the patch is OK but sure it needs an Ada-wise review.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-09-14 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2read.c (dw2_map_ada_symtabs): Remove the internal_error.
|
||||
Update the comment.
|
||||
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -2369,10 +2369,9 @@ dw2_map_ada_symtabs (struct objfile *objfile,
|
||||
domain_enum namespace, int wild,
|
||||
void *data)
|
||||
{
|
||||
- /* For now, we don't support Ada, so this function can't be
|
||||
- reached. */
|
||||
- internal_error (__FILE__, __LINE__,
|
||||
- _("map_ada_symtabs called via index method"));
|
||||
+ /* For now, we don't support Ada. Still the function can be called if the
|
||||
+ current language is Ada for a non-Ada objfile using GNU index. As Ada
|
||||
+ does not look for non-Ada symbols this function should just return. */
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00434.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00155.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/24 14:47:52 1.12202
|
||||
### src/gdb/ChangeLog 2010/09/24 16:11:44 1.12203
|
||||
## -1,3 +1,9 @@
|
||||
+2010-09-24 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ * dwarf2read.c (dw2_expand_symtabs_matching): Add missing
|
||||
+ MAYBE_SWAPs.
|
||||
+ (dw2_map_symbol_names): Likewise.
|
||||
+
|
||||
2010-09-24 Sami Wagiaalla <swagiaal@redhat.com>
|
||||
|
||||
* valops.c (find_oload_champ_namespace_loop): replace incorrect
|
||||
--- src/gdb/dwarf2read.c 2010/09/22 19:22:44 1.460
|
||||
+++ src/gdb/dwarf2read.c 2010/09/24 16:11:46 1.461
|
||||
@@ -2382,10 +2382,12 @@
|
||||
{
|
||||
int i;
|
||||
offset_type iter;
|
||||
+ struct mapped_index *index;
|
||||
|
||||
dw2_setup (objfile);
|
||||
if (!dwarf2_per_objfile->index_table)
|
||||
return;
|
||||
+ index = dwarf2_per_objfile->index_table;
|
||||
|
||||
for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
@@ -2411,28 +2413,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
- for (iter = 0;
|
||||
- iter < dwarf2_per_objfile->index_table->index_table_slots;
|
||||
- ++iter)
|
||||
+ for (iter = 0; iter < index->index_table_slots; ++iter)
|
||||
{
|
||||
offset_type idx = 2 * iter;
|
||||
const char *name;
|
||||
offset_type *vec, vec_len, vec_idx;
|
||||
|
||||
- if (dwarf2_per_objfile->index_table->index_table[idx] == 0
|
||||
- && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0)
|
||||
+ if (index->index_table[idx] == 0 && index->index_table[idx + 1] == 0)
|
||||
continue;
|
||||
|
||||
- name = (dwarf2_per_objfile->index_table->constant_pool
|
||||
- + dwarf2_per_objfile->index_table->index_table[idx]);
|
||||
+ name = index->constant_pool + MAYBE_SWAP (index->index_table[idx]);
|
||||
|
||||
if (! (*name_matcher) (name, data))
|
||||
continue;
|
||||
|
||||
/* The name was matched, now expand corresponding CUs that were
|
||||
marked. */
|
||||
- vec = (offset_type *) (dwarf2_per_objfile->index_table->constant_pool
|
||||
- + dwarf2_per_objfile->index_table->index_table[idx + 1]);
|
||||
+ vec = (offset_type *) (index->constant_pool
|
||||
+ + MAYBE_SWAP (index->index_table[idx + 1]));
|
||||
vec_len = MAYBE_SWAP (vec[0]);
|
||||
for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
|
||||
{
|
||||
@@ -2476,25 +2474,24 @@
|
||||
void *data)
|
||||
{
|
||||
offset_type iter;
|
||||
+ struct mapped_index *index;
|
||||
+
|
||||
dw2_setup (objfile);
|
||||
|
||||
if (!dwarf2_per_objfile->index_table)
|
||||
return;
|
||||
+ index = dwarf2_per_objfile->index_table;
|
||||
|
||||
- for (iter = 0;
|
||||
- iter < dwarf2_per_objfile->index_table->index_table_slots;
|
||||
- ++iter)
|
||||
+ for (iter = 0; iter < index->index_table_slots; ++iter)
|
||||
{
|
||||
offset_type idx = 2 * iter;
|
||||
const char *name;
|
||||
offset_type *vec, vec_len, vec_idx;
|
||||
|
||||
- if (dwarf2_per_objfile->index_table->index_table[idx] == 0
|
||||
- && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0)
|
||||
+ if (index->index_table[idx] == 0 && index->index_table[idx + 1] == 0)
|
||||
continue;
|
||||
|
||||
- name = (dwarf2_per_objfile->index_table->constant_pool
|
||||
- + dwarf2_per_objfile->index_table->index_table[idx]);
|
||||
+ name = (index->constant_pool + MAYBE_SWAP (index->index_table[idx]));
|
||||
|
||||
(*fun) (name, data);
|
||||
}
|
|
@ -0,0 +1,689 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-07/msg00139.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/07/23 21:10:54 1.12013
|
||||
### src/gdb/ChangeLog 2010/07/23 22:15:13 1.12014
|
||||
## -1,3 +1,31 @@
|
||||
+2010-07-23 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ * dwarf2read.c (struct dwarf2_per_objfile) <n_type_comp_units,
|
||||
+ type_comp_units>: New fields.
|
||||
+ (dw2_get_cu): New function.
|
||||
+ (create_cus_from_index): Remove unused argument.
|
||||
+ (create_signatured_type_hash_from_index): New function.
|
||||
+ (create_addrmap_from_index): Update.
|
||||
+ (dwarf2_read_index): Handle version 2.
|
||||
+ (dw2_find_last_source_symtab, dw2_forget_cached_source_info)
|
||||
+ (dw2_lookup_symtab, dw2_do_expand_symtabs_matching)
|
||||
+ (dw2_print_stats, dw2_expand_all_symtabs)
|
||||
+ (dw2_expand_symtabs_with_filename, dw2_find_symbol_file)
|
||||
+ (dw2_expand_symtabs_matching, dw2_map_symbol_filenames): Update.
|
||||
+ (dwarf2_initialize_objfile): Call create_debug_types_hash_table.
|
||||
+ (allocate_signatured_type_hash_table): New function.
|
||||
+ (add_signatured_type_cu_to_list): Likewise.
|
||||
+ (create_debug_types_hash_table): Use them. Set type_comp_units.
|
||||
+ (read_signatured_type): Ensure section data is available.
|
||||
+ (add_address_entry): Don't record empty ranges.
|
||||
+ (struct signatured_type_index_data): New.
|
||||
+ (write_one_signatured_type): New function.
|
||||
+ (write_psymtabs_to_index): Write type CUs.
|
||||
+ (save_gdb_index_command): Update comment.
|
||||
+ (process_type_comp_unit): Move inititalization of
|
||||
+ from_debug_types...
|
||||
+ (create_debug_types_hash_table): ... here.
|
||||
+
|
||||
2010-07-23 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb_gcore.sh (tmpfile): Remove the variable, its initialization,
|
||||
Index: gdb-7.2/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/dwarf2read.c 2010-10-12 18:10:47.000000000 +0200
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2010-10-12 18:11:16.000000000 +0200
|
||||
@@ -184,6 +184,12 @@ struct dwarf2_per_objfile
|
||||
/* The number of compilation units in ALL_COMP_UNITS. */
|
||||
int n_comp_units;
|
||||
|
||||
+ /* The number of .debug_types-related CUs. */
|
||||
+ int n_type_comp_units;
|
||||
+
|
||||
+ /* The .debug_types-related CUs. */
|
||||
+ struct dwarf2_per_cu_data **type_comp_units;
|
||||
+
|
||||
/* A chain of compilation units that are currently read in, so that
|
||||
they can be freed later. */
|
||||
struct dwarf2_per_cu_data *read_in_chain;
|
||||
@@ -1226,6 +1232,8 @@ static struct type *set_die_type (struct
|
||||
|
||||
static void create_all_comp_units (struct objfile *);
|
||||
|
||||
+static int create_debug_types_hash_table (struct objfile *objfile);
|
||||
+
|
||||
static void load_full_comp_unit (struct dwarf2_per_cu_data *,
|
||||
struct objfile *);
|
||||
|
||||
@@ -1269,6 +1277,8 @@ static void init_cu_die_reader (struct d
|
||||
static const char *dwarf2_physname (char *name, struct die_info *die,
|
||||
struct dwarf2_cu *cu);
|
||||
|
||||
+static htab_t allocate_signatured_type_hash_table (struct objfile *objfile);
|
||||
+
|
||||
#if WORDS_BIGENDIAN
|
||||
|
||||
/* Convert VALUE between big- and little-endian. */
|
||||
@@ -1646,6 +1656,18 @@ dw2_instantiate_symtab (struct objfile *
|
||||
return per_cu->v.quick->symtab;
|
||||
}
|
||||
|
||||
+/* Return the CU given its index. */
|
||||
+static struct dwarf2_per_cu_data *
|
||||
+dw2_get_cu (int index)
|
||||
+{
|
||||
+ if (index >= dwarf2_per_objfile->n_comp_units)
|
||||
+ {
|
||||
+ index -= dwarf2_per_objfile->n_comp_units;
|
||||
+ return dwarf2_per_objfile->type_comp_units[index];
|
||||
+ }
|
||||
+ return dwarf2_per_objfile->all_comp_units[index];
|
||||
+}
|
||||
+
|
||||
/* A helper function that knows how to read a 64-bit value in a way
|
||||
that doesn't make gdb die. Returns 1 if the conversion went ok, 0
|
||||
otherwise. */
|
||||
@@ -1672,11 +1694,10 @@ extract_cu_value (const char *bytes, ULO
|
||||
the CU objects for this objfile. Return 0 if something went wrong,
|
||||
1 if everything went ok. */
|
||||
static int
|
||||
-create_cus_from_index (struct objfile *objfile, struct mapped_index *index,
|
||||
- const gdb_byte *cu_list, offset_type cu_list_elements)
|
||||
+create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list,
|
||||
+ offset_type cu_list_elements)
|
||||
{
|
||||
offset_type i;
|
||||
- const char *entry;
|
||||
|
||||
dwarf2_per_objfile->n_comp_units = cu_list_elements / 2;
|
||||
dwarf2_per_objfile->all_comp_units
|
||||
@@ -1707,6 +1728,58 @@ create_cus_from_index (struct objfile *o
|
||||
return 1;
|
||||
}
|
||||
|
||||
+/* Create the signatured type hash table from the index. */
|
||||
+static int
|
||||
+create_signatured_type_hash_from_index (struct objfile *objfile,
|
||||
+ const gdb_byte *bytes,
|
||||
+ offset_type elements)
|
||||
+{
|
||||
+ offset_type i;
|
||||
+ htab_t type_hash;
|
||||
+
|
||||
+ dwarf2_per_objfile->n_type_comp_units = elements / 3;
|
||||
+ dwarf2_per_objfile->type_comp_units
|
||||
+ = obstack_alloc (&objfile->objfile_obstack,
|
||||
+ dwarf2_per_objfile->n_type_comp_units
|
||||
+ * sizeof (struct dwarf2_per_cu_data *));
|
||||
+
|
||||
+ type_hash = allocate_signatured_type_hash_table (objfile);
|
||||
+
|
||||
+ for (i = 0; i < elements; i += 3)
|
||||
+ {
|
||||
+ struct signatured_type *type_sig;
|
||||
+ ULONGEST offset, type_offset, signature;
|
||||
+ void **slot;
|
||||
+
|
||||
+ if (!extract_cu_value (bytes, &offset)
|
||||
+ || !extract_cu_value (bytes + 8, &type_offset))
|
||||
+ return 0;
|
||||
+ signature = extract_unsigned_integer (bytes + 16, 8, BFD_ENDIAN_LITTLE);
|
||||
+ bytes += 3 * 8;
|
||||
+
|
||||
+ type_sig = OBSTACK_ZALLOC (&objfile->objfile_obstack,
|
||||
+ struct signatured_type);
|
||||
+ type_sig->signature = signature;
|
||||
+ type_sig->offset = offset;
|
||||
+ type_sig->type_offset = type_offset;
|
||||
+ type_sig->per_cu.from_debug_types = 1;
|
||||
+ type_sig->per_cu.offset = offset;
|
||||
+ type_sig->per_cu.objfile = objfile;
|
||||
+ type_sig->per_cu.v.quick
|
||||
+ = OBSTACK_ZALLOC (&objfile->objfile_obstack,
|
||||
+ struct dwarf2_per_cu_quick_data);
|
||||
+
|
||||
+ slot = htab_find_slot (type_hash, type_sig, INSERT);
|
||||
+ *slot = type_sig;
|
||||
+
|
||||
+ dwarf2_per_objfile->type_comp_units[i / 3] = &type_sig->per_cu;
|
||||
+ }
|
||||
+
|
||||
+ dwarf2_per_objfile->signatured_types = type_hash;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Read the address map data from the mapped index, and use it to
|
||||
populate the objfile's psymtabs_addrmap. */
|
||||
static void
|
||||
@@ -1738,7 +1811,7 @@ create_addrmap_from_index (struct objfil
|
||||
iter += 4;
|
||||
|
||||
addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1,
|
||||
- dwarf2_per_objfile->all_comp_units[cu_index]);
|
||||
+ dw2_get_cu (cu_index));
|
||||
}
|
||||
|
||||
objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map,
|
||||
@@ -1805,8 +1878,9 @@ dwarf2_read_index (struct objfile *objfi
|
||||
char *addr;
|
||||
struct mapped_index *map;
|
||||
offset_type *metadata;
|
||||
- const gdb_byte *cu_list;
|
||||
- offset_type cu_list_elements;
|
||||
+ const gdb_byte *cu_list, *types_list;
|
||||
+ offset_type version, cu_list_elements, types_list_elements;
|
||||
+ int i;
|
||||
|
||||
if (dwarf2_per_objfile->gdb_index.asection == NULL
|
||||
|| dwarf2_per_objfile->gdb_index.size == 0)
|
||||
@@ -1822,26 +1896,58 @@ dwarf2_read_index (struct objfile *objfi
|
||||
|
||||
addr = dwarf2_per_objfile->gdb_index.buffer;
|
||||
/* Version check. */
|
||||
- if (MAYBE_SWAP (*(offset_type *) addr) != 1)
|
||||
+ version = MAYBE_SWAP (*(offset_type *) addr);
|
||||
+ if (version == 1)
|
||||
+ {
|
||||
+ /* Index version 1 neglected to account for .debug_types. So,
|
||||
+ if we see .debug_types, we cannot use this index. */
|
||||
+ if (dwarf2_per_objfile->types.asection != NULL
|
||||
+ && dwarf2_per_objfile->types.size != 0)
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else if (version != 2)
|
||||
return 0;
|
||||
|
||||
map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
|
||||
map->total_size = dwarf2_per_objfile->gdb_index.size;
|
||||
|
||||
metadata = (offset_type *) (addr + sizeof (offset_type));
|
||||
- cu_list = addr + MAYBE_SWAP (metadata[0]);
|
||||
- cu_list_elements = ((MAYBE_SWAP (metadata[1]) - MAYBE_SWAP (metadata[0]))
|
||||
+
|
||||
+ i = 0;
|
||||
+ cu_list = addr + MAYBE_SWAP (metadata[i]);
|
||||
+ cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i]))
|
||||
/ 8);
|
||||
- map->address_table = addr + MAYBE_SWAP (metadata[1]);
|
||||
- map->address_table_size = (MAYBE_SWAP (metadata[2])
|
||||
- - MAYBE_SWAP (metadata[1]));
|
||||
- map->index_table = (offset_type *) (addr + MAYBE_SWAP (metadata[2]));
|
||||
- map->index_table_slots = ((MAYBE_SWAP (metadata[3])
|
||||
- - MAYBE_SWAP (metadata[2]))
|
||||
+ ++i;
|
||||
+
|
||||
+ if (version == 2)
|
||||
+ {
|
||||
+ types_list = addr + MAYBE_SWAP (metadata[i]);
|
||||
+ types_list_elements = ((MAYBE_SWAP (metadata[i + 1])
|
||||
+ - MAYBE_SWAP (metadata[i]))
|
||||
+ / 8);
|
||||
+ ++i;
|
||||
+ }
|
||||
+
|
||||
+ map->address_table = addr + MAYBE_SWAP (metadata[i]);
|
||||
+ map->address_table_size = (MAYBE_SWAP (metadata[i + 1])
|
||||
+ - MAYBE_SWAP (metadata[i]));
|
||||
+ ++i;
|
||||
+
|
||||
+ map->index_table = (offset_type *) (addr + MAYBE_SWAP (metadata[i]));
|
||||
+ map->index_table_slots = ((MAYBE_SWAP (metadata[i + 1])
|
||||
+ - MAYBE_SWAP (metadata[i]))
|
||||
/ (2 * sizeof (offset_type)));
|
||||
- map->constant_pool = addr + MAYBE_SWAP (metadata[3]);
|
||||
+ ++i;
|
||||
|
||||
- if (!create_cus_from_index (objfile, map, cu_list, cu_list_elements))
|
||||
+ map->constant_pool = addr + MAYBE_SWAP (metadata[i]);
|
||||
+
|
||||
+ if (!create_cus_from_index (objfile, cu_list, cu_list_elements))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (version == 2
|
||||
+ && types_list_elements
|
||||
+ && !create_signatured_type_hash_from_index (objfile, types_list,
|
||||
+ types_list_elements))
|
||||
return 0;
|
||||
|
||||
create_addrmap_from_index (objfile, map);
|
||||
@@ -1968,8 +2074,7 @@ dw2_find_last_source_symtab (struct objf
|
||||
int index;
|
||||
dw2_setup (objfile);
|
||||
index = dwarf2_per_objfile->n_comp_units - 1;
|
||||
- return dw2_instantiate_symtab (objfile,
|
||||
- dwarf2_per_objfile->all_comp_units[index]);
|
||||
+ return dw2_instantiate_symtab (objfile, dw2_get_cu (index));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1978,9 +2083,10 @@ dw2_forget_cached_source_info (struct ob
|
||||
int i;
|
||||
|
||||
dw2_setup (objfile);
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
if (cu->v.quick->full_names)
|
||||
{
|
||||
@@ -2002,10 +2108,11 @@ dw2_lookup_symtab (struct objfile *objfi
|
||||
struct dwarf2_per_cu_data *base_cu = NULL;
|
||||
|
||||
dw2_setup (objfile);
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
int j;
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
if (cu->v.quick->symtab)
|
||||
continue;
|
||||
@@ -2097,8 +2204,8 @@ dw2_do_expand_symtabs_matching (struct o
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
offset_type cu_index = MAYBE_SWAP (vec[i + 1]);
|
||||
- struct dwarf2_per_cu_data *cu;
|
||||
- cu = dwarf2_per_objfile->all_comp_units[cu_index];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (cu_index);
|
||||
+
|
||||
dw2_instantiate_symtab (objfile, cu);
|
||||
}
|
||||
}
|
||||
@@ -2120,9 +2227,10 @@ dw2_print_stats (struct objfile *objfile
|
||||
|
||||
dw2_setup (objfile);
|
||||
count = 0;
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
if (!cu->v.quick->symtab)
|
||||
++count;
|
||||
@@ -2156,9 +2264,11 @@ dw2_expand_all_symtabs (struct objfile *
|
||||
int i;
|
||||
|
||||
dw2_setup (objfile);
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
dw2_instantiate_symtab (objfile, cu);
|
||||
}
|
||||
@@ -2171,10 +2281,11 @@ dw2_expand_symtabs_with_filename (struct
|
||||
int i;
|
||||
|
||||
dw2_setup (objfile);
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
int j;
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
if (cu->v.quick->symtab)
|
||||
continue;
|
||||
@@ -2215,7 +2326,7 @@ dw2_find_symbol_file (struct objfile *ob
|
||||
should be rewritten so that it doesn't require a custom hook. It
|
||||
could just use the ordinary symbol tables. */
|
||||
/* vec[0] is the length, which must always be >0. */
|
||||
- cu = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[1])];
|
||||
+ cu = dw2_get_cu (MAYBE_SWAP (vec[1]));
|
||||
|
||||
dw2_require_line_header (objfile, cu);
|
||||
if (!cu->v.quick->lines)
|
||||
@@ -2253,10 +2364,11 @@ dw2_expand_symtabs_matching (struct objf
|
||||
if (!dwarf2_per_objfile->index_table)
|
||||
return;
|
||||
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
int j;
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
cu->v.quick->mark = 0;
|
||||
if (cu->v.quick->symtab)
|
||||
@@ -2301,8 +2413,9 @@ dw2_expand_symtabs_matching (struct objf
|
||||
vec_len = MAYBE_SWAP (vec[0]);
|
||||
for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
|
||||
{
|
||||
- struct dwarf2_per_cu_data *cu
|
||||
- = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[vec_idx + 1])];
|
||||
+ struct dwarf2_per_cu_data *cu;
|
||||
+
|
||||
+ cu = dw2_get_cu (MAYBE_SWAP (vec[vec_idx + 1]));
|
||||
if (cu->v.quick->mark)
|
||||
dw2_instantiate_symtab (objfile, cu);
|
||||
}
|
||||
@@ -2372,10 +2485,11 @@ dw2_map_symbol_filenames (struct objfile
|
||||
int i;
|
||||
|
||||
dw2_setup (objfile);
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
int j;
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
if (cu->v.quick->symtab)
|
||||
continue;
|
||||
@@ -2436,10 +2550,12 @@ dwarf2_initialize_objfile (struct objfil
|
||||
|
||||
dwarf2_per_objfile->using_index = 1;
|
||||
create_all_comp_units (objfile);
|
||||
+ create_debug_types_hash_table (objfile);
|
||||
|
||||
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units
|
||||
+ + dwarf2_per_objfile->n_type_comp_units); ++i)
|
||||
{
|
||||
- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i);
|
||||
|
||||
cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack,
|
||||
struct dwarf2_per_cu_quick_data);
|
||||
@@ -2653,6 +2769,34 @@ eq_type_signature (const void *item_lhs,
|
||||
return lhs->signature == rhs->signature;
|
||||
}
|
||||
|
||||
+/* Allocate a hash table for signatured types. */
|
||||
+
|
||||
+static htab_t
|
||||
+allocate_signatured_type_hash_table (struct objfile *objfile)
|
||||
+{
|
||||
+ return htab_create_alloc_ex (41,
|
||||
+ hash_type_signature,
|
||||
+ eq_type_signature,
|
||||
+ NULL,
|
||||
+ &objfile->objfile_obstack,
|
||||
+ hashtab_obstack_allocate,
|
||||
+ dummy_obstack_deallocate);
|
||||
+}
|
||||
+
|
||||
+/* A helper function to add a signatured type CU to a list. */
|
||||
+
|
||||
+static int
|
||||
+add_signatured_type_cu_to_list (void **slot, void *datum)
|
||||
+{
|
||||
+ struct signatured_type *sigt = *slot;
|
||||
+ struct dwarf2_per_cu_data ***datap = datum;
|
||||
+
|
||||
+ **datap = &sigt->per_cu;
|
||||
+ ++*datap;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Create the hash table of all entries in the .debug_types section.
|
||||
The result is zero if there is an error (e.g. missing .debug_types section),
|
||||
otherwise non-zero. */
|
||||
@@ -2662,6 +2806,7 @@ create_debug_types_hash_table (struct ob
|
||||
{
|
||||
gdb_byte *info_ptr;
|
||||
htab_t types_htab;
|
||||
+ struct dwarf2_per_cu_data **iter;
|
||||
|
||||
dwarf2_read_section (objfile, &dwarf2_per_objfile->types);
|
||||
info_ptr = dwarf2_per_objfile->types.buffer;
|
||||
@@ -2672,13 +2817,7 @@ create_debug_types_hash_table (struct ob
|
||||
return 0;
|
||||
}
|
||||
|
||||
- types_htab = htab_create_alloc_ex (41,
|
||||
- hash_type_signature,
|
||||
- eq_type_signature,
|
||||
- NULL,
|
||||
- &objfile->objfile_obstack,
|
||||
- hashtab_obstack_allocate,
|
||||
- dummy_obstack_deallocate);
|
||||
+ types_htab = allocate_signatured_type_hash_table (objfile);
|
||||
|
||||
if (dwarf2_die_debug)
|
||||
fprintf_unfiltered (gdb_stdlog, "Signatured types:\n");
|
||||
@@ -2726,6 +2865,7 @@ create_debug_types_hash_table (struct ob
|
||||
type_sig->offset = offset;
|
||||
type_sig->type_offset = type_offset;
|
||||
type_sig->per_cu.objfile = objfile;
|
||||
+ type_sig->per_cu.from_debug_types = 1;
|
||||
|
||||
slot = htab_find_slot (types_htab, type_sig, INSERT);
|
||||
gdb_assert (slot != NULL);
|
||||
@@ -2740,6 +2880,16 @@ create_debug_types_hash_table (struct ob
|
||||
|
||||
dwarf2_per_objfile->signatured_types = types_htab;
|
||||
|
||||
+ dwarf2_per_objfile->n_type_comp_units = htab_elements (types_htab);
|
||||
+ dwarf2_per_objfile->type_comp_units
|
||||
+ = obstack_alloc (&objfile->objfile_obstack,
|
||||
+ dwarf2_per_objfile->n_type_comp_units
|
||||
+ * sizeof (struct dwarf2_per_cu_data *));
|
||||
+ iter = &dwarf2_per_objfile->type_comp_units[0];
|
||||
+ htab_traverse_noresize (types_htab, add_signatured_type_cu_to_list, &iter);
|
||||
+ gdb_assert (iter - &dwarf2_per_objfile->type_comp_units[0]
|
||||
+ == dwarf2_per_objfile->n_type_comp_units);
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3008,7 +3158,6 @@ process_type_comp_unit (void **slot, voi
|
||||
struct dwarf2_per_cu_data *this_cu;
|
||||
|
||||
this_cu = &entry->per_cu;
|
||||
- this_cu->from_debug_types = 1;
|
||||
|
||||
gdb_assert (dwarf2_per_objfile->types.readin);
|
||||
process_psymtab_comp_unit (objfile, this_cu,
|
||||
@@ -12483,13 +12632,16 @@ static void
|
||||
read_signatured_type (struct objfile *objfile,
|
||||
struct signatured_type *type_sig)
|
||||
{
|
||||
- gdb_byte *types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset;
|
||||
+ gdb_byte *types_ptr;
|
||||
struct die_reader_specs reader_specs;
|
||||
struct dwarf2_cu *cu;
|
||||
ULONGEST signature;
|
||||
struct cleanup *back_to, *free_cu_cleanup;
|
||||
struct attribute *attr;
|
||||
|
||||
+ dwarf2_read_section (objfile, &dwarf2_per_objfile->types);
|
||||
+ types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset;
|
||||
+
|
||||
gdb_assert (type_sig->per_cu.cu == NULL);
|
||||
|
||||
cu = xmalloc (sizeof (struct dwarf2_cu));
|
||||
@@ -14402,6 +14554,10 @@ add_address_entry (struct objfile *objfi
|
||||
char addr[8];
|
||||
CORE_ADDR baseaddr;
|
||||
|
||||
+ /* Don't bother recording empty ranges. */
|
||||
+ if (pst->textlow == pst->texthigh)
|
||||
+ return;
|
||||
+
|
||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
||||
|
||||
store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, pst->textlow - baseaddr);
|
||||
@@ -14447,13 +14603,53 @@ unlink_if_set (void *p)
|
||||
unlink (*filename);
|
||||
}
|
||||
|
||||
+/* A helper struct used when iterating over debug_types. */
|
||||
+struct signatured_type_index_data
|
||||
+{
|
||||
+ struct objfile *objfile;
|
||||
+ struct mapped_symtab *symtab;
|
||||
+ struct obstack *types_list;
|
||||
+ int cu_index;
|
||||
+};
|
||||
+
|
||||
+/* A helper function that writes a single signatured_type to an
|
||||
+ obstack. */
|
||||
+static int
|
||||
+write_one_signatured_type (void **slot, void *d)
|
||||
+{
|
||||
+ struct signatured_type_index_data *info = d;
|
||||
+ struct signatured_type *entry = (struct signatured_type *) *slot;
|
||||
+ struct dwarf2_per_cu_data *cu = &entry->per_cu;
|
||||
+ struct partial_symtab *psymtab = cu->v.psymtab;
|
||||
+ gdb_byte val[8];
|
||||
+
|
||||
+ write_psymbols (info->symtab,
|
||||
+ info->objfile->global_psymbols.list + psymtab->globals_offset,
|
||||
+ psymtab->n_global_syms, info->cu_index);
|
||||
+ write_psymbols (info->symtab,
|
||||
+ info->objfile->static_psymbols.list + psymtab->statics_offset,
|
||||
+ psymtab->n_static_syms, info->cu_index);
|
||||
+
|
||||
+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->offset);
|
||||
+ obstack_grow (info->types_list, val, 8);
|
||||
+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->type_offset);
|
||||
+ obstack_grow (info->types_list, val, 8);
|
||||
+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->signature);
|
||||
+ obstack_grow (info->types_list, val, 8);
|
||||
+
|
||||
+ ++info->cu_index;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/* Create an index file for OBJFILE in the directory DIR. */
|
||||
static void
|
||||
write_psymtabs_to_index (struct objfile *objfile, const char *dir)
|
||||
{
|
||||
struct cleanup *cleanup;
|
||||
char *filename, *cleanup_filename;
|
||||
- struct obstack contents, addr_obstack, constant_pool, symtab_obstack, cu_list;
|
||||
+ struct obstack contents, addr_obstack, constant_pool, symtab_obstack;
|
||||
+ struct obstack cu_list, types_cu_list;
|
||||
int i;
|
||||
FILE *out_file;
|
||||
struct mapped_symtab *symtab;
|
||||
@@ -14489,6 +14685,12 @@ write_psymtabs_to_index (struct objfile
|
||||
obstack_init (&cu_list);
|
||||
make_cleanup_obstack_free (&cu_list);
|
||||
|
||||
+ obstack_init (&types_cu_list);
|
||||
+ make_cleanup_obstack_free (&types_cu_list);
|
||||
+
|
||||
+ /* The list is already sorted, so we don't need to do additional
|
||||
+ work here. Also, the debug_types entries do not appear in
|
||||
+ all_comp_units, but only in their own hash table. */
|
||||
for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
{
|
||||
struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
@@ -14510,6 +14712,19 @@ write_psymtabs_to_index (struct objfile
|
||||
obstack_grow (&cu_list, val, 8);
|
||||
}
|
||||
|
||||
+ /* Write out the .debug_type entries, if any. */
|
||||
+ if (dwarf2_per_objfile->signatured_types)
|
||||
+ {
|
||||
+ struct signatured_type_index_data sig_data;
|
||||
+
|
||||
+ sig_data.objfile = objfile;
|
||||
+ sig_data.symtab = symtab;
|
||||
+ sig_data.types_list = &types_cu_list;
|
||||
+ sig_data.cu_index = dwarf2_per_objfile->n_comp_units;
|
||||
+ htab_traverse_noresize (dwarf2_per_objfile->signatured_types,
|
||||
+ write_one_signatured_type, &sig_data);
|
||||
+ }
|
||||
+
|
||||
obstack_init (&constant_pool);
|
||||
make_cleanup_obstack_free (&constant_pool);
|
||||
obstack_init (&symtab_obstack);
|
||||
@@ -14518,11 +14733,11 @@ write_psymtabs_to_index (struct objfile
|
||||
|
||||
obstack_init (&contents);
|
||||
make_cleanup_obstack_free (&contents);
|
||||
- size_of_contents = 5 * sizeof (offset_type);
|
||||
+ size_of_contents = 6 * sizeof (offset_type);
|
||||
total_len = size_of_contents;
|
||||
|
||||
/* The version number. */
|
||||
- val = MAYBE_SWAP (1);
|
||||
+ val = MAYBE_SWAP (2);
|
||||
obstack_grow (&contents, &val, sizeof (val));
|
||||
|
||||
/* The offset of the CU list from the start of the file. */
|
||||
@@ -14530,6 +14745,11 @@ write_psymtabs_to_index (struct objfile
|
||||
obstack_grow (&contents, &val, sizeof (val));
|
||||
total_len += obstack_object_size (&cu_list);
|
||||
|
||||
+ /* The offset of the types CU list from the start of the file. */
|
||||
+ val = MAYBE_SWAP (total_len);
|
||||
+ obstack_grow (&contents, &val, sizeof (val));
|
||||
+ total_len += obstack_object_size (&types_cu_list);
|
||||
+
|
||||
/* The offset of the address table from the start of the file. */
|
||||
val = MAYBE_SWAP (total_len);
|
||||
obstack_grow (&contents, &val, sizeof (val));
|
||||
@@ -14549,6 +14769,7 @@ write_psymtabs_to_index (struct objfile
|
||||
|
||||
write_obstack (out_file, &contents);
|
||||
write_obstack (out_file, &cu_list);
|
||||
+ write_obstack (out_file, &types_cu_list);
|
||||
write_obstack (out_file, &addr_obstack);
|
||||
write_obstack (out_file, &symtab_obstack);
|
||||
write_obstack (out_file, &constant_pool);
|
||||
@@ -14573,18 +14794,33 @@ write_psymtabs_to_index (struct objfile
|
||||
|
||||
1. The file header. This is a sequence of values, of offset_type
|
||||
unless otherwise noted:
|
||||
- [0] The version number. Currently 1.
|
||||
+ [0] The version number. Currently 1 or 2. The differences are
|
||||
+ noted below. Version 1 did not account for .debug_types sections;
|
||||
+ the presence of a .debug_types section invalidates any version 1
|
||||
+ index that may exist.
|
||||
[1] The offset, from the start of the file, of the CU list.
|
||||
+ [1.5] In version 2, the offset, from the start of the file, of the
|
||||
+ types CU list. This offset does not appear in version 1. Note
|
||||
+ that this can be empty, in which case this offset will be equal to
|
||||
+ the next offset.
|
||||
[2] The offset, from the start of the file, of the address section.
|
||||
[3] The offset, from the start of the file, of the symbol table.
|
||||
[4] The offset, from the start of the file, of the constant pool.
|
||||
|
||||
2. The CU list. This is a sequence of pairs of 64-bit
|
||||
- little-endian values. The first element in each pair is the offset
|
||||
- of a CU in the .debug_info section. The second element in each
|
||||
- pair is the length of that CU. References to a CU elsewhere in the
|
||||
- map are done using a CU index, which is just the 0-based index into
|
||||
- this table.
|
||||
+ little-endian values, sorted by the CU offset. The first element
|
||||
+ in each pair is the offset of a CU in the .debug_info section. The
|
||||
+ second element in each pair is the length of that CU. References
|
||||
+ to a CU elsewhere in the map are done using a CU index, which is
|
||||
+ just the 0-based index into this table. Note that if there are
|
||||
+ type CUs, then conceptually CUs and type CUs form a single list for
|
||||
+ the purposes of CU indices.
|
||||
+
|
||||
+ 2.5 The types CU list. This does not appear in a version 1 index.
|
||||
+ This is a sequence of triplets of 64-bit little-endian values. In
|
||||
+ a triplet, the first value is the CU offset, the second value is
|
||||
+ the type offset in the CU, and the third value is the type
|
||||
+ signature. The types CU list is not sorted.
|
||||
|
||||
3. The address section. The address section consists of a sequence
|
||||
of address entries. Each address entry has three elements.
|
|
@ -0,0 +1,278 @@
|
|||
FYI: index pre-expansion fix
|
||||
http://sourceware.org/ml/gdb-patches/2010-09/msg00452.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00165.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/27 17:41:35 1.12206
|
||||
### src/gdb/ChangeLog 2010/09/27 18:42:35 1.12207
|
||||
## -1,5 +1,17 @@
|
||||
2010-09-27 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
+ * dwarf2read.c (dwarf2_read_index): Only allow version 3.
|
||||
+ (write_psymbols): Add 'psyms_seen' and 'is_static' arguments.
|
||||
+ Only emit a given psymbol once.
|
||||
+ (struct signatured_type_index_data) <psyms_seen>: New field.
|
||||
+ (write_one_signatured_type): Update.
|
||||
+ (cleanup_htab): New function.
|
||||
+ (write_psymtabs_to_index): Update. Create psyms_seen hash. Bump
|
||||
+ version to 3.
|
||||
+ (save_gdb_index_command): Update index documentation.
|
||||
+
|
||||
+2010-09-27 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
* bcache.c (expand_hash_table): Use hash_function, not hash.
|
||||
|
||||
2010-09-27 Tom Tromey <tromey@redhat.com>
|
||||
Index: gdb-7.2/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/dwarf2read.c 2010-10-12 18:11:27.000000000 +0200
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2010-10-12 18:12:03.000000000 +0200
|
||||
@@ -1897,15 +1897,10 @@ dwarf2_read_index (struct objfile *objfi
|
||||
addr = dwarf2_per_objfile->gdb_index.buffer;
|
||||
/* Version check. */
|
||||
version = MAYBE_SWAP (*(offset_type *) addr);
|
||||
- if (version == 1)
|
||||
- {
|
||||
- /* Index version 1 neglected to account for .debug_types. So,
|
||||
- if we see .debug_types, we cannot use this index. */
|
||||
- if (dwarf2_per_objfile->types.asection != NULL
|
||||
- && dwarf2_per_objfile->types.size != 0)
|
||||
- return 0;
|
||||
- }
|
||||
- else if (version != 2)
|
||||
+ /* Versions earlier than 3 emitted every copy of a psymbol. This
|
||||
+ causes the index to behave very poorly for certain requests. So,
|
||||
+ it seems better to just ignore such indices. */
|
||||
+ if (version < 3)
|
||||
return 0;
|
||||
|
||||
map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
|
||||
@@ -1919,14 +1914,11 @@ dwarf2_read_index (struct objfile *objfi
|
||||
/ 8);
|
||||
++i;
|
||||
|
||||
- if (version == 2)
|
||||
- {
|
||||
- types_list = addr + MAYBE_SWAP (metadata[i]);
|
||||
- types_list_elements = ((MAYBE_SWAP (metadata[i + 1])
|
||||
- - MAYBE_SWAP (metadata[i]))
|
||||
- / 8);
|
||||
- ++i;
|
||||
- }
|
||||
+ types_list = addr + MAYBE_SWAP (metadata[i]);
|
||||
+ types_list_elements = ((MAYBE_SWAP (metadata[i + 1])
|
||||
+ - MAYBE_SWAP (metadata[i]))
|
||||
+ / 8);
|
||||
+ ++i;
|
||||
|
||||
map->address_table = addr + MAYBE_SWAP (metadata[i]);
|
||||
map->address_table_size = (MAYBE_SWAP (metadata[i + 1])
|
||||
@@ -1944,8 +1936,7 @@ dwarf2_read_index (struct objfile *objfi
|
||||
if (!create_cus_from_index (objfile, cu_list, cu_list_elements))
|
||||
return 0;
|
||||
|
||||
- if (version == 2
|
||||
- && types_list_elements
|
||||
+ if (types_list_elements
|
||||
&& !create_signatured_type_hash_from_index (objfile, types_list,
|
||||
types_list_elements))
|
||||
return 0;
|
||||
@@ -14568,15 +14559,38 @@ add_address_entry (struct objfile *objfi
|
||||
/* Add a list of partial symbols to SYMTAB. */
|
||||
static void
|
||||
write_psymbols (struct mapped_symtab *symtab,
|
||||
+ htab_t psyms_seen,
|
||||
struct partial_symbol **psymp,
|
||||
int count,
|
||||
- offset_type cu_index)
|
||||
+ offset_type cu_index,
|
||||
+ int is_static)
|
||||
{
|
||||
for (; count-- > 0; ++psymp)
|
||||
{
|
||||
+ void **slot, *lookup;
|
||||
+
|
||||
if (SYMBOL_LANGUAGE (*psymp) == language_ada)
|
||||
error (_("Ada is not currently supported by the index"));
|
||||
- add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index);
|
||||
+
|
||||
+ /* We only want to add a given psymbol once. However, we also
|
||||
+ want to account for whether it is global or static. So, we
|
||||
+ may add it twice, using slightly different values. */
|
||||
+ if (is_static)
|
||||
+ {
|
||||
+ uintptr_t val = 1 | (uintptr_t) *psymp;
|
||||
+
|
||||
+ lookup = (void *) val;
|
||||
+ }
|
||||
+ else
|
||||
+ lookup = *psymp;
|
||||
+
|
||||
+ /* Only add a given psymbol once. */
|
||||
+ slot = htab_find_slot (psyms_seen, lookup, INSERT);
|
||||
+ if (!*slot)
|
||||
+ {
|
||||
+ *slot = lookup;
|
||||
+ add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14606,6 +14620,7 @@ struct signatured_type_index_data
|
||||
struct objfile *objfile;
|
||||
struct mapped_symtab *symtab;
|
||||
struct obstack *types_list;
|
||||
+ htab_t psyms_seen;
|
||||
int cu_index;
|
||||
};
|
||||
|
||||
@@ -14621,11 +14636,15 @@ write_one_signatured_type (void **slot,
|
||||
gdb_byte val[8];
|
||||
|
||||
write_psymbols (info->symtab,
|
||||
+ info->psyms_seen,
|
||||
info->objfile->global_psymbols.list + psymtab->globals_offset,
|
||||
- psymtab->n_global_syms, info->cu_index);
|
||||
+ psymtab->n_global_syms, info->cu_index,
|
||||
+ 0);
|
||||
write_psymbols (info->symtab,
|
||||
+ info->psyms_seen,
|
||||
info->objfile->static_psymbols.list + psymtab->statics_offset,
|
||||
- psymtab->n_static_syms, info->cu_index);
|
||||
+ psymtab->n_static_syms, info->cu_index,
|
||||
+ 1);
|
||||
|
||||
store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->offset);
|
||||
obstack_grow (info->types_list, val, 8);
|
||||
@@ -14639,6 +14658,14 @@ write_one_signatured_type (void **slot,
|
||||
return 1;
|
||||
}
|
||||
|
||||
+/* A cleanup function for an htab_t. */
|
||||
+
|
||||
+static void
|
||||
+cleanup_htab (void *arg)
|
||||
+{
|
||||
+ htab_delete (arg);
|
||||
+}
|
||||
+
|
||||
/* Create an index file for OBJFILE in the directory DIR. */
|
||||
static void
|
||||
write_psymtabs_to_index (struct objfile *objfile, const char *dir)
|
||||
@@ -14653,6 +14680,7 @@ write_psymtabs_to_index (struct objfile
|
||||
offset_type val, size_of_contents, total_len;
|
||||
struct stat st;
|
||||
char buf[8];
|
||||
+ htab_t psyms_seen;
|
||||
|
||||
if (!objfile->psymtabs)
|
||||
return;
|
||||
@@ -14685,6 +14713,10 @@ write_psymtabs_to_index (struct objfile
|
||||
obstack_init (&types_cu_list);
|
||||
make_cleanup_obstack_free (&types_cu_list);
|
||||
|
||||
+ psyms_seen = htab_create_alloc (100, htab_hash_pointer, htab_eq_pointer,
|
||||
+ NULL, xcalloc, xfree);
|
||||
+ make_cleanup (cleanup_htab, psyms_seen);
|
||||
+
|
||||
/* The list is already sorted, so we don't need to do additional
|
||||
work here. Also, the debug_types entries do not appear in
|
||||
all_comp_units, but only in their own hash table. */
|
||||
@@ -14695,11 +14727,15 @@ write_psymtabs_to_index (struct objfile
|
||||
gdb_byte val[8];
|
||||
|
||||
write_psymbols (symtab,
|
||||
+ psyms_seen,
|
||||
objfile->global_psymbols.list + psymtab->globals_offset,
|
||||
- psymtab->n_global_syms, i);
|
||||
+ psymtab->n_global_syms, i,
|
||||
+ 0);
|
||||
write_psymbols (symtab,
|
||||
+ psyms_seen,
|
||||
objfile->static_psymbols.list + psymtab->statics_offset,
|
||||
- psymtab->n_static_syms, i);
|
||||
+ psymtab->n_static_syms, i,
|
||||
+ 1);
|
||||
|
||||
add_address_entry (objfile, &addr_obstack, psymtab, i);
|
||||
|
||||
@@ -14717,6 +14753,7 @@ write_psymtabs_to_index (struct objfile
|
||||
sig_data.objfile = objfile;
|
||||
sig_data.symtab = symtab;
|
||||
sig_data.types_list = &types_cu_list;
|
||||
+ sig_data.psyms_seen = psyms_seen;
|
||||
sig_data.cu_index = dwarf2_per_objfile->n_comp_units;
|
||||
htab_traverse_noresize (dwarf2_per_objfile->signatured_types,
|
||||
write_one_signatured_type, &sig_data);
|
||||
@@ -14734,7 +14771,7 @@ write_psymtabs_to_index (struct objfile
|
||||
total_len = size_of_contents;
|
||||
|
||||
/* The version number. */
|
||||
- val = MAYBE_SWAP (2);
|
||||
+ val = MAYBE_SWAP (3);
|
||||
obstack_grow (&contents, &val, sizeof (val));
|
||||
|
||||
/* The offset of the CU list from the start of the file. */
|
||||
@@ -14791,18 +14828,16 @@ write_psymtabs_to_index (struct objfile
|
||||
|
||||
1. The file header. This is a sequence of values, of offset_type
|
||||
unless otherwise noted:
|
||||
- [0] The version number. Currently 1 or 2. The differences are
|
||||
- noted below. Version 1 did not account for .debug_types sections;
|
||||
- the presence of a .debug_types section invalidates any version 1
|
||||
- index that may exist.
|
||||
+
|
||||
+ [0] The version number, currently 3. Versions 1 and 2 are
|
||||
+ obsolete.
|
||||
[1] The offset, from the start of the file, of the CU list.
|
||||
- [1.5] In version 2, the offset, from the start of the file, of the
|
||||
- types CU list. This offset does not appear in version 1. Note
|
||||
- that this can be empty, in which case this offset will be equal to
|
||||
- the next offset.
|
||||
- [2] The offset, from the start of the file, of the address section.
|
||||
- [3] The offset, from the start of the file, of the symbol table.
|
||||
- [4] The offset, from the start of the file, of the constant pool.
|
||||
+ [2] The offset, from the start of the file, of the types CU list.
|
||||
+ Note that this section can be empty, in which case this offset will
|
||||
+ be equal to the next offset.
|
||||
+ [3] The offset, from the start of the file, of the address section.
|
||||
+ [4] The offset, from the start of the file, of the symbol table.
|
||||
+ [5] The offset, from the start of the file, of the constant pool.
|
||||
|
||||
2. The CU list. This is a sequence of pairs of 64-bit
|
||||
little-endian values, sorted by the CU offset. The first element
|
||||
@@ -14813,19 +14848,19 @@ write_psymtabs_to_index (struct objfile
|
||||
type CUs, then conceptually CUs and type CUs form a single list for
|
||||
the purposes of CU indices.
|
||||
|
||||
- 2.5 The types CU list. This does not appear in a version 1 index.
|
||||
- This is a sequence of triplets of 64-bit little-endian values. In
|
||||
- a triplet, the first value is the CU offset, the second value is
|
||||
- the type offset in the CU, and the third value is the type
|
||||
- signature. The types CU list is not sorted.
|
||||
+ 3. The types CU list. This is a sequence of triplets of 64-bit
|
||||
+ little-endian values. In a triplet, the first value is the CU
|
||||
+ offset, the second value is the type offset in the CU, and the
|
||||
+ third value is the type signature. The types CU list is not
|
||||
+ sorted.
|
||||
|
||||
- 3. The address section. The address section consists of a sequence
|
||||
+ 4. The address section. The address section consists of a sequence
|
||||
of address entries. Each address entry has three elements.
|
||||
[0] The low address. This is a 64-bit little-endian value.
|
||||
[1] The high address. This is a 64-bit little-endian value.
|
||||
[2] The CU index. This is an offset_type value.
|
||||
|
||||
- 4. The symbol table. This is a hash table. The size of the hash
|
||||
+ 5. The symbol table. This is a hash table. The size of the hash
|
||||
table is always a power of 2. The initial hash and the step are
|
||||
currently defined by the `find_slot' function.
|
||||
|
||||
@@ -14847,7 +14882,7 @@ write_psymtabs_to_index (struct objfile
|
||||
element in the hash table is used to indicate which CUs define the
|
||||
symbol.
|
||||
|
||||
- 5. The constant pool. This is simply a bunch of bytes. It is
|
||||
+ 6. The constant pool. This is simply a bunch of bytes. It is
|
||||
organized so that alignment is correct: CU vectors are stored
|
||||
first, followed by strings. */
|
||||
static void
|
|
@ -0,0 +1,237 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-12/msg00031.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/12/08 18:26:40 1.12364
|
||||
### src/gdb/ChangeLog 2010/12/08 19:03:34 1.12365
|
||||
## -1,5 +1,15 @@
|
||||
2010-12-08 Doug Evans <dje@google.com>
|
||||
|
||||
+ PR symtab/12302
|
||||
+ * dwarf2read.c (struct psymtab_cu_index_map): New struct.
|
||||
+ (hash_psymtab_cu_index, eq_psymtab_cu_index): New functions.
|
||||
+ (struct addrmap_index_data): New struct.
|
||||
+ (add_address_entry): Remove arg `pst', new args `start', `end'.
|
||||
+ (add_address_entry_worker, write_address_map): New functions.
|
||||
+ (write_psymtabs_to_index): Address table generation moved to
|
||||
+ write_address_map. Build a table mapping psymtab to CU index
|
||||
+ to pass to it.
|
||||
+
|
||||
* dwarf2read.c (write_psymtabs_to_index): When stat fails, pass file
|
||||
name to perror.
|
||||
|
||||
Index: gdb-7.2/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/dwarf2read.c 2011-01-25 18:48:52.000000000 +0100
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2011-01-25 18:56:43.000000000 +0100
|
||||
@@ -14662,30 +14662,129 @@ write_hash_table (struct mapped_symtab *
|
||||
htab_delete (index_table);
|
||||
}
|
||||
|
||||
-/* Write an address entry to ADDR_OBSTACK. The addresses are taken
|
||||
- from PST; CU_INDEX is the index of the CU in the vector of all
|
||||
- CUs. */
|
||||
+/* Struct to map psymtab to CU index in the index file. */
|
||||
+struct psymtab_cu_index_map
|
||||
+{
|
||||
+ struct partial_symtab *psymtab;
|
||||
+ unsigned int cu_index;
|
||||
+};
|
||||
+
|
||||
+static hashval_t
|
||||
+hash_psymtab_cu_index (const void *item)
|
||||
+{
|
||||
+ const struct psymtab_cu_index_map *map = item;
|
||||
+
|
||||
+ return htab_hash_pointer (map->psymtab);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+eq_psymtab_cu_index (const void *item_lhs, const void *item_rhs)
|
||||
+{
|
||||
+ const struct psymtab_cu_index_map *lhs = item_lhs;
|
||||
+ const struct psymtab_cu_index_map *rhs = item_rhs;
|
||||
+
|
||||
+ return lhs->psymtab == rhs->psymtab;
|
||||
+}
|
||||
+
|
||||
+/* Helper struct for building the address table. */
|
||||
+struct addrmap_index_data
|
||||
+{
|
||||
+ struct objfile *objfile;
|
||||
+ struct obstack *addr_obstack;
|
||||
+ htab_t cu_index_htab;
|
||||
+
|
||||
+ /* Non-zero if the previous_* fields are valid.
|
||||
+ We can't write an entry until we see the next entry (since it is only then
|
||||
+ that we know the end of the entry). */
|
||||
+ int previous_valid;
|
||||
+ /* Index of the CU in the table of all CUs in the index file. */
|
||||
+ unsigned int previous_cu_index;
|
||||
+ /* Start address of the CU. */
|
||||
+ CORE_ADDR previous_cu_start;
|
||||
+};
|
||||
+
|
||||
+/* Write an address entry to OBSTACK. */
|
||||
+
|
||||
static void
|
||||
-add_address_entry (struct objfile *objfile,
|
||||
- struct obstack *addr_obstack, struct partial_symtab *pst,
|
||||
- unsigned int cu_index)
|
||||
+add_address_entry (struct objfile *objfile, struct obstack *obstack,
|
||||
+ CORE_ADDR start, CORE_ADDR end, unsigned int cu_index)
|
||||
{
|
||||
- offset_type offset;
|
||||
+ offset_type cu_index_to_write;
|
||||
char addr[8];
|
||||
CORE_ADDR baseaddr;
|
||||
|
||||
- /* Don't bother recording empty ranges. */
|
||||
- if (pst->textlow == pst->texthigh)
|
||||
- return;
|
||||
-
|
||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
||||
|
||||
- store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, pst->textlow - baseaddr);
|
||||
- obstack_grow (addr_obstack, addr, 8);
|
||||
- store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, pst->texthigh - baseaddr);
|
||||
- obstack_grow (addr_obstack, addr, 8);
|
||||
- offset = MAYBE_SWAP (cu_index);
|
||||
- obstack_grow (addr_obstack, &offset, sizeof (offset_type));
|
||||
+ store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, start - baseaddr);
|
||||
+ obstack_grow (obstack, addr, 8);
|
||||
+ store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, end - baseaddr);
|
||||
+ obstack_grow (obstack, addr, 8);
|
||||
+ cu_index_to_write = MAYBE_SWAP (cu_index);
|
||||
+ obstack_grow (obstack, &cu_index_to_write, sizeof (offset_type));
|
||||
+}
|
||||
+
|
||||
+/* Worker function for traversing an addrmap to build the address table. */
|
||||
+
|
||||
+static int
|
||||
+add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj)
|
||||
+{
|
||||
+ struct addrmap_index_data *data = datap;
|
||||
+ struct partial_symtab *pst = obj;
|
||||
+ offset_type cu_index;
|
||||
+ void **slot;
|
||||
+
|
||||
+ if (data->previous_valid)
|
||||
+ add_address_entry (data->objfile, data->addr_obstack,
|
||||
+ data->previous_cu_start, start_addr,
|
||||
+ data->previous_cu_index);
|
||||
+
|
||||
+ data->previous_cu_start = start_addr;
|
||||
+ if (pst != NULL)
|
||||
+ {
|
||||
+ struct psymtab_cu_index_map find_map, *map;
|
||||
+ find_map.psymtab = pst;
|
||||
+ map = htab_find (data->cu_index_htab, &find_map);
|
||||
+ gdb_assert (map != NULL);
|
||||
+ data->previous_cu_index = map->cu_index;
|
||||
+ data->previous_valid = 1;
|
||||
+ }
|
||||
+ else
|
||||
+ data->previous_valid = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* Write OBJFILE's address map to OBSTACK.
|
||||
+ CU_INDEX_HTAB is used to map addrmap entries to their CU indices
|
||||
+ in the index file. */
|
||||
+
|
||||
+static void
|
||||
+write_address_map (struct objfile *objfile, struct obstack *obstack,
|
||||
+ htab_t cu_index_htab)
|
||||
+{
|
||||
+ struct addrmap_index_data addrmap_index_data;
|
||||
+
|
||||
+ /* When writing the address table, we have to cope with the fact that
|
||||
+ the addrmap iterator only provides the start of a region; we have to
|
||||
+ wait until the next invocation to get the start of the next region. */
|
||||
+
|
||||
+ addrmap_index_data.objfile = objfile;
|
||||
+ addrmap_index_data.addr_obstack = obstack;
|
||||
+ addrmap_index_data.cu_index_htab = cu_index_htab;
|
||||
+ addrmap_index_data.previous_valid = 0;
|
||||
+
|
||||
+ addrmap_foreach (objfile->psymtabs_addrmap, add_address_entry_worker,
|
||||
+ &addrmap_index_data);
|
||||
+
|
||||
+ /* It's highly unlikely the last entry (end address = 0xff...ff)
|
||||
+ is valid, but we should still handle it.
|
||||
+ The end address is recorded as the start of the next region, but that
|
||||
+ doesn't work here. To cope we pass 0xff...ff, this is a rare situation
|
||||
+ anyway. */
|
||||
+ if (addrmap_index_data.previous_valid)
|
||||
+ add_address_entry (objfile, obstack,
|
||||
+ addrmap_index_data.previous_cu_start, (CORE_ADDR) -1,
|
||||
+ addrmap_index_data.previous_cu_index);
|
||||
}
|
||||
|
||||
/* Add a list of partial symbols to SYMTAB. */
|
||||
@@ -14813,6 +14912,8 @@ write_psymtabs_to_index (struct objfile
|
||||
struct stat st;
|
||||
char buf[8];
|
||||
htab_t psyms_seen;
|
||||
+ htab_t cu_index_htab;
|
||||
+ struct psymtab_cu_index_map *psymtab_cu_index_map;
|
||||
|
||||
if (!objfile->psymtabs)
|
||||
return;
|
||||
@@ -14849,7 +14950,21 @@ write_psymtabs_to_index (struct objfile
|
||||
NULL, xcalloc, xfree);
|
||||
make_cleanup (cleanup_htab, psyms_seen);
|
||||
|
||||
- /* The list is already sorted, so we don't need to do additional
|
||||
+ /* While we're scanning CU's create a table that maps a psymtab pointer
|
||||
+ (which is what addrmap records) to its index (which is what is recorded
|
||||
+ in the index file). This will later be needed to write the address
|
||||
+ table. */
|
||||
+ cu_index_htab = htab_create_alloc (100,
|
||||
+ hash_psymtab_cu_index,
|
||||
+ eq_psymtab_cu_index,
|
||||
+ NULL, xcalloc, xfree);
|
||||
+ make_cleanup (cleanup_htab, cu_index_htab);
|
||||
+ psymtab_cu_index_map = (struct psymtab_cu_index_map *)
|
||||
+ xmalloc (sizeof (struct psymtab_cu_index_map)
|
||||
+ * dwarf2_per_objfile->n_comp_units);
|
||||
+ make_cleanup (xfree, psymtab_cu_index_map);
|
||||
+
|
||||
+ /* The CU list is already sorted, so we don't need to do additional
|
||||
work here. Also, the debug_types entries do not appear in
|
||||
all_comp_units, but only in their own hash table. */
|
||||
for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
|
||||
@@ -14857,6 +14972,8 @@ write_psymtabs_to_index (struct objfile
|
||||
struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i];
|
||||
struct partial_symtab *psymtab = cu->v.psymtab;
|
||||
gdb_byte val[8];
|
||||
+ struct psymtab_cu_index_map *map;
|
||||
+ void **slot;
|
||||
|
||||
write_psymbols (symtab,
|
||||
psyms_seen,
|
||||
@@ -14869,7 +14986,13 @@ write_psymtabs_to_index (struct objfile
|
||||
psymtab->n_static_syms, i,
|
||||
1);
|
||||
|
||||
- add_address_entry (objfile, &addr_obstack, psymtab, i);
|
||||
+ map = &psymtab_cu_index_map[i];
|
||||
+ map->psymtab = psymtab;
|
||||
+ map->cu_index = i;
|
||||
+ slot = htab_find_slot (cu_index_htab, map, INSERT);
|
||||
+ gdb_assert (slot != NULL);
|
||||
+ gdb_assert (*slot == NULL);
|
||||
+ *slot = map;
|
||||
|
||||
store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, cu->offset);
|
||||
obstack_grow (&cu_list, val, 8);
|
||||
@@ -14877,6 +15000,9 @@ write_psymtabs_to_index (struct objfile
|
||||
obstack_grow (&cu_list, val, 8);
|
||||
}
|
||||
|
||||
+ /* Dump the address map. */
|
||||
+ write_address_map (objfile, &addr_obstack, cu_index_htab);
|
||||
+
|
||||
/* Write out the .debug_type entries, if any. */
|
||||
if (dwarf2_per_objfile->signatured_types)
|
||||
{
|
|
@ -0,0 +1,53 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2011-01/msg00169.html
|
||||
|
||||
### src/gdb/ChangeLog 2011/01/25 17:00:23 1.12503
|
||||
### src/gdb/ChangeLog 2011/01/25 17:25:10 1.12504
|
||||
## -1,3 +1,8 @@
|
||||
+2011-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * dwarf2read.c (dwarf2_read_index, write_psymtabs_to_index)
|
||||
+ (save_gdb_index_command): Switch to .gdb_index version 4.
|
||||
+
|
||||
2011-01-25 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* mi/mi-main.c (get_register): Use get_frame_register_value rather
|
||||
Index: gdb-7.2/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/dwarf2read.c 2011-01-25 18:56:43.000000000 +0100
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2011-01-25 18:57:45.000000000 +0100
|
||||
@@ -1905,9 +1905,14 @@ dwarf2_read_index (struct objfile *objfi
|
||||
/* Version check. */
|
||||
version = MAYBE_SWAP (*(offset_type *) addr);
|
||||
/* Versions earlier than 3 emitted every copy of a psymbol. This
|
||||
- causes the index to behave very poorly for certain requests. So,
|
||||
- it seems better to just ignore such indices. */
|
||||
- if (version < 3)
|
||||
+ causes the index to behave very poorly for certain requests. Version 4
|
||||
+ contained incomplete addrmap. So, it seems better to just ignore such
|
||||
+ indices. */
|
||||
+ if (version < 4)
|
||||
+ return 0;
|
||||
+ /* Indexes with higher version than the one supported by GDB may be no
|
||||
+ longer backward compatible. */
|
||||
+ if (version > 4)
|
||||
return 0;
|
||||
|
||||
map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
|
||||
@@ -15029,7 +15034,7 @@ write_psymtabs_to_index (struct objfile
|
||||
total_len = size_of_contents;
|
||||
|
||||
/* The version number. */
|
||||
- val = MAYBE_SWAP (3);
|
||||
+ val = MAYBE_SWAP (4);
|
||||
obstack_grow (&contents, &val, sizeof (val));
|
||||
|
||||
/* The offset of the CU list from the start of the file. */
|
||||
@@ -15087,7 +15092,7 @@ write_psymtabs_to_index (struct objfile
|
||||
1. The file header. This is a sequence of values, of offset_type
|
||||
unless otherwise noted:
|
||||
|
||||
- [0] The version number, currently 3. Versions 1 and 2 are
|
||||
+ [0] The version number, currently 4. Versions 1, 2 and 3 are
|
||||
obsolete.
|
||||
[1] The offset, from the start of the file, of the CU list.
|
||||
[2] The offset, from the start of the file, of the types CU list.
|
|
@ -0,0 +1,145 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-10/msg00048.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/10/07 08:32:36 1.12241
|
||||
### src/gdb/ChangeLog 2010/10/07 17:02:06 1.12242
|
||||
## -1,3 +1,16 @@
|
||||
+2010-10-07 Doug Evans <dje@google.com>
|
||||
+
|
||||
+ * addrmap.h (addrmap_foreach_fn): New typedef.
|
||||
+ (addrmap_foreach): Declare.
|
||||
+ * addrmap.c (struct addrmap_funcs): New member foreach.
|
||||
+ (addrmap_foreach): New function.
|
||||
+ (addrmap_fixed_foreach): New function.
|
||||
+ (addrmap_fixed_funcs): Update.
|
||||
+ (struct mutable_foreach_data): New struct.
|
||||
+ (addrmap_mutable_foreach_worker): New function.
|
||||
+ (addrmap_mutable_foreach): New function.
|
||||
+ (addrmap_mutable_funcs): Update.
|
||||
+
|
||||
2010-10-07 Paul Hilfinger <hilfinger@adacore.com>
|
||||
|
||||
* dictionary.c (dict_hash): Revert to msymbol_hash_iw in
|
||||
--- src/gdb/addrmap.c 2010/05/18 19:23:37 1.8
|
||||
+++ src/gdb/addrmap.c 2010/10/07 17:02:14 1.9
|
||||
@@ -41,6 +41,7 @@
|
||||
struct addrmap *(*create_fixed) (struct addrmap *this,
|
||||
struct obstack *obstack);
|
||||
void (*relocate) (struct addrmap *this, CORE_ADDR offset);
|
||||
+ int (*foreach) (struct addrmap *this, addrmap_foreach_fn fn, void *data);
|
||||
};
|
||||
|
||||
|
||||
@@ -82,6 +83,11 @@
|
||||
}
|
||||
|
||||
|
||||
+int
|
||||
+addrmap_foreach (struct addrmap *map, addrmap_foreach_fn fn, void *data)
|
||||
+{
|
||||
+ return map->funcs->foreach (map, fn, data);
|
||||
+}
|
||||
|
||||
/* Fixed address maps. */
|
||||
|
||||
@@ -175,12 +181,32 @@
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+addrmap_fixed_foreach (struct addrmap *this, addrmap_foreach_fn fn,
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct addrmap_fixed *map = (struct addrmap_fixed *) this;
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; i < map->num_transitions; i++)
|
||||
+ {
|
||||
+ int res = fn (data, map->transitions[i].addr, map->transitions[i].value);
|
||||
+
|
||||
+ if (res != 0)
|
||||
+ return res;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static const struct addrmap_funcs addrmap_fixed_funcs =
|
||||
{
|
||||
addrmap_fixed_set_empty,
|
||||
addrmap_fixed_find,
|
||||
addrmap_fixed_create_fixed,
|
||||
- addrmap_fixed_relocate
|
||||
+ addrmap_fixed_relocate,
|
||||
+ addrmap_fixed_foreach
|
||||
};
|
||||
|
||||
|
||||
@@ -444,12 +470,48 @@
|
||||
}
|
||||
|
||||
|
||||
+/* Struct to map addrmap's foreach function to splay_tree's version. */
|
||||
+struct mutable_foreach_data
|
||||
+{
|
||||
+ addrmap_foreach_fn fn;
|
||||
+ void *data;
|
||||
+};
|
||||
+
|
||||
+
|
||||
+/* This is a splay_tree_foreach_fn. */
|
||||
+
|
||||
+static int
|
||||
+addrmap_mutable_foreach_worker (splay_tree_node node, void *data)
|
||||
+{
|
||||
+ struct mutable_foreach_data *foreach_data = data;
|
||||
+
|
||||
+ return foreach_data->fn (foreach_data->data,
|
||||
+ addrmap_node_key (node),
|
||||
+ addrmap_node_value (node));
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+addrmap_mutable_foreach (struct addrmap *this, addrmap_foreach_fn fn,
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct addrmap_mutable *mutable = (struct addrmap_mutable *) this;
|
||||
+ struct mutable_foreach_data foreach_data;
|
||||
+
|
||||
+ foreach_data.fn = fn;
|
||||
+ foreach_data.data = data;
|
||||
+ return splay_tree_foreach (mutable->tree, addrmap_mutable_foreach_worker,
|
||||
+ &foreach_data);
|
||||
+}
|
||||
+
|
||||
+
|
||||
static const struct addrmap_funcs addrmap_mutable_funcs =
|
||||
{
|
||||
addrmap_mutable_set_empty,
|
||||
addrmap_mutable_find,
|
||||
addrmap_mutable_create_fixed,
|
||||
- addrmap_mutable_relocate
|
||||
+ addrmap_mutable_relocate,
|
||||
+ addrmap_mutable_foreach
|
||||
};
|
||||
|
||||
|
||||
--- src/gdb/addrmap.h 2010/01/01 07:31:29 1.5
|
||||
+++ src/gdb/addrmap.h 2010/10/07 17:02:14 1.6
|
||||
@@ -91,4 +91,15 @@
|
||||
to either mutable or immutable maps.) */
|
||||
void addrmap_relocate (struct addrmap *map, CORE_ADDR offset);
|
||||
|
||||
+/* The type of a function used to iterate over the map.
|
||||
+ OBJ is NULL for unmapped regions. */
|
||||
+typedef int (*addrmap_foreach_fn) (void *data, CORE_ADDR start_addr,
|
||||
+ void *obj);
|
||||
+
|
||||
+/* Call FN, passing it DATA, for every address in MAP, following an
|
||||
+ in-order traversal. If FN ever returns a non-zero value, the
|
||||
+ iteration ceases immediately, and the value is returned.
|
||||
+ Otherwise, this function returns 0. */
|
||||
+int addrmap_foreach (struct addrmap *map, addrmap_foreach_fn fn, void *data);
|
||||
+
|
||||
#endif /* ADDRMAP_H */
|
|
@ -0,0 +1,100 @@
|
|||
--- ./gdb/elfread.c 2011-03-22 19:49:38.000000000 +0100
|
||||
+++ ./gdb/elfread.c 2011-03-22 19:46:01.000000000 +0100
|
||||
@@ -718,6 +718,9 @@ gnu_ifunc_record_cache_unchecked (const
|
||||
return msym_new;
|
||||
}
|
||||
|
||||
+static struct minimal_symbol *
|
||||
+ resolve_gnu_ifunc_by_cache (const char *function_name);
|
||||
+
|
||||
/* Check first the cache if it - unlikely - has not been populated since
|
||||
bp_gnu_ifunc_resolver has been created. gnu_ifunc_record_cache_unchecked
|
||||
could create a duplicate symbol otherwise. */
|
||||
@@ -731,7 +734,10 @@ gnu_ifunc_record_cache (struct gdbarch *
|
||||
msym = resolve_gnu_ifunc_by_cache (function_name);
|
||||
if (msym == NULL)
|
||||
gnu_ifunc_record_cache_unchecked (function_name, function_address);
|
||||
- else if (SYMBOL_VALUE_ADDRESS (msym) != function_address)
|
||||
+ else
|
||||
+ {
|
||||
+ CORE_ADDR msym_address = gdbarch_convert_from_func_ptr_addr (gdbarch, SYMBOL_VALUE_ADDRESS (msym), ¤t_target);
|
||||
+if (msym_address != function_address)
|
||||
{
|
||||
/* This case indicates buggy inferior program. GDB would need to update
|
||||
its MSYM cache symbol for function_address. Anyway FUNCTION_NAME is
|
||||
@@ -740,9 +746,10 @@ gnu_ifunc_record_cache (struct gdbarch *
|
||||
|
||||
warning (_("gnu-indirect-function \"%s\" has changed its resolved "
|
||||
"function_address from %s to %s; GDB is using the former one"),
|
||||
- function_name, paddress (gdbarch, SYMBOL_VALUE_ADDRESS (msym)),
|
||||
+ function_name, paddress (gdbarch, msym_address),
|
||||
paddress (gdbarch, function_address));
|
||||
}
|
||||
+ }
|
||||
}
|
||||
|
||||
static struct minimal_symbol *
|
||||
@@ -782,6 +789,7 @@ resolve_gnu_ifunc_by_got (const char *fu
|
||||
if (target_read_memory (pointer_address, buf, ptr_size) != 0)
|
||||
continue;
|
||||
function_address = extract_typed_address (buf, ptr_type);
|
||||
+ function_address = gdbarch_convert_from_func_ptr_addr (gdbarch, function_address, ¤t_target);
|
||||
|
||||
msym = gnu_ifunc_record_cache_unchecked (function_name, function_address);
|
||||
if (msym == NULL)
|
||||
@@ -792,7 +800,7 @@ resolve_gnu_ifunc_by_got (const char *fu
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-struct minimal_symbol *
|
||||
+static struct minimal_symbol *
|
||||
resolve_gnu_ifunc_by_cache (const char *function_name)
|
||||
{
|
||||
char *function_name_gnu_ifunc_tgt;
|
||||
--- ./gdb/infcall.c 2011-03-22 19:49:38.000000000 +0100
|
||||
+++ ./gdb/infcall.c 2011-03-22 19:42:52.000000000 +0100
|
||||
@@ -256,11 +256,12 @@ gnu_ifunc_resolve (struct gdbarch *gdbar
|
||||
while ADDRESS is a possible function descriptor.. */
|
||||
address_val = call_function_by_hand (function, 0, NULL);
|
||||
address = value_as_address (address_val);
|
||||
+ address = gdbarch_convert_from_func_ptr_addr (gdbarch, address, ¤t_target);
|
||||
|
||||
if (name_at_pc)
|
||||
gnu_ifunc_record_cache (gdbarch, name_at_pc, address);
|
||||
|
||||
- return gdbarch_convert_from_func_ptr_addr (gdbarch, address, ¤t_target);
|
||||
+ return address;
|
||||
}
|
||||
|
||||
static struct type *
|
||||
--- ./gdb/symtab.h 2011-03-22 19:49:38.000000000 +0100
|
||||
+++ ./gdb/symtab.h 2011-03-22 19:41:27.000000000 +0100
|
||||
@@ -960,9 +960,6 @@ extern void clear_pc_function_cache (voi
|
||||
extern int resolve_gnu_ifunc (const char *function_name,
|
||||
CORE_ADDR *function_addressp);
|
||||
|
||||
-extern struct minimal_symbol *resolve_gnu_ifunc_by_cache
|
||||
- (const char *function_name);
|
||||
-
|
||||
extern void gnu_ifunc_record_cache (struct gdbarch *gdbarch,
|
||||
const char *function_name,
|
||||
CORE_ADDR function_address);
|
||||
--- ./gdb/testsuite/gdb.base/gnu-ifunc.exp 2011-03-22 19:49:38.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.base/gnu-ifunc.exp 2011-03-22 20:04:17.000000000 +0100
|
||||
@@ -105,7 +105,15 @@ gdb_test "frame" "#0 +(0x\[0-9a-f\]+ in
|
||||
# Check any commands not doing an inferior call still compute with address of
|
||||
# the gnu-ifunc resolver.
|
||||
|
||||
-gdb_test "p gnu_ifunc" " = {<text gnu-indirect-function variable, no debug info>} 0x\[0-9a-f\]+ <gnu_ifunc>" "p gnu_ifunc executing"
|
||||
+if {[istarget powerpc64-*] && [is_lp64_target]} {
|
||||
+ # With only minimal symbols GDB provides the function descriptors. With
|
||||
+ # full debug info the function code would be displayed.
|
||||
+ set func_prefix {\.}
|
||||
+} else {
|
||||
+ set func_prefix {}
|
||||
+}
|
||||
+
|
||||
+gdb_test "p gnu_ifunc" " = {<text gnu-indirect-function variable, no debug info>} 0x\[0-9a-f\]+ <${func_prefix}gnu_ifunc>" "p gnu_ifunc executing"
|
||||
gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc executing"
|
||||
|
||||
set test "info addr gnu_ifunc"
|
|
@ -0,0 +1,39 @@
|
|||
commit 8800e981e44d9fb518feab23219447bf5fe7cc92
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Fri Jan 28 14:25:41 2011 +0100
|
||||
|
||||
Fix breakpoints unchaining.
|
||||
Possibly: https://bugzilla.redhat.com/show_bug.cgi?id=673483
|
||||
|
||||
[ Backported. ]
|
||||
|
||||
--- gdb-7.2/gdb/breakpoint.c.orig 2011-01-28 14:31:54.000000000 +0100
|
||||
+++ gdb-7.2/gdb/breakpoint.c 2011-01-28 14:33:14.000000000 +0100
|
||||
@@ -9777,20 +9777,18 @@ delete_breakpoint (struct breakpoint *bp
|
||||
breakpoints gets resolved. */
|
||||
if (bpt->related_breakpoint != bpt)
|
||||
{
|
||||
+ struct breakpoint *related;
|
||||
+
|
||||
if (bpt->type == bp_watchpoint_scope)
|
||||
watchpoint_del_at_next_stop (bpt->related_breakpoint);
|
||||
else if (bpt->related_breakpoint->type == bp_watchpoint_scope)
|
||||
watchpoint_del_at_next_stop (bpt);
|
||||
- else
|
||||
- {
|
||||
- struct breakpoint *related;
|
||||
|
||||
- /* Unlink bpt from the bpt->related_breakpoint ring. */
|
||||
- for (related = bpt; related->related_breakpoint != bpt;
|
||||
- related = related->related_breakpoint);
|
||||
- related->related_breakpoint = bpt->related_breakpoint;
|
||||
- bpt->related_breakpoint = bpt;
|
||||
- }
|
||||
+ /* Unlink bpt from the bpt->related_breakpoint ring. */
|
||||
+ for (related = bpt; related->related_breakpoint != bpt;
|
||||
+ related = related->related_breakpoint);
|
||||
+ related->related_breakpoint = bpt->related_breakpoint;
|
||||
+ bpt->related_breakpoint = bpt;
|
||||
}
|
||||
|
||||
observer_notify_breakpoint_deleted (bpt->number);
|
|
@ -0,0 +1,618 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html
|
||||
|
||||
Index: gdb-7.2/gdb/cp-support.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/cp-support.c 2010-06-25 18:16:44.000000000 +0200
|
||||
+++ gdb-7.2/gdb/cp-support.c 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "exceptions.h"
|
||||
#include "expression.h"
|
||||
#include "value.h"
|
||||
+#include "language.h"
|
||||
|
||||
#include "safe-ctype.h"
|
||||
|
||||
@@ -917,7 +918,8 @@ make_symbol_overload_list_qualified (con
|
||||
ALL_OBJFILES (objfile)
|
||||
{
|
||||
if (objfile->sf)
|
||||
- objfile->sf->qf->expand_symtabs_for_function (objfile, func_name);
|
||||
+ objfile->sf->qf->expand_symtabs_for_function (objfile, func_name,
|
||||
+ language_cplus);
|
||||
}
|
||||
|
||||
/* Search upwards from currently selected frame (so that we can
|
||||
Index: gdb-7.2/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/dwarf2read.c 2011-02-03 22:27:54.000000000 +0100
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2011-02-03 22:28:21.000000000 +0100
|
||||
@@ -2185,7 +2185,8 @@ dw2_lookup_symtab (struct objfile *objfi
|
||||
|
||||
static struct symtab *
|
||||
dw2_lookup_symbol (struct objfile *objfile, int block_index,
|
||||
- const char *name, domain_enum domain)
|
||||
+ const char *name, domain_enum domain,
|
||||
+ enum language language)
|
||||
{
|
||||
/* We do all the work in the pre_expand_symtabs_matching hook
|
||||
instead. */
|
||||
@@ -2259,7 +2260,8 @@ dw2_relocate (struct objfile *objfile, s
|
||||
|
||||
static void
|
||||
dw2_expand_symtabs_for_function (struct objfile *objfile,
|
||||
- const char *func_name)
|
||||
+ const char *func_name,
|
||||
+ enum language language)
|
||||
{
|
||||
dw2_do_expand_symtabs_matching (objfile, func_name);
|
||||
}
|
||||
@@ -2313,7 +2315,8 @@ dw2_expand_symtabs_with_filename (struct
|
||||
}
|
||||
|
||||
static const char *
|
||||
-dw2_find_symbol_file (struct objfile *objfile, const char *name)
|
||||
+dw2_find_symbol_file (struct objfile *objfile, const char *name,
|
||||
+ enum language language)
|
||||
{
|
||||
struct dwarf2_per_cu_data *cu;
|
||||
offset_type *vec;
|
||||
Index: gdb-7.2/gdb/linespec.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linespec.c 2010-05-15 01:41:04.000000000 +0200
|
||||
+++ gdb-7.2/gdb/linespec.c 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -1205,7 +1205,7 @@ decode_objc (char **argptr, int funfirst
|
||||
|
||||
static struct symtabs_and_lines
|
||||
decode_compound (char **argptr, int funfirstline, char ***canonical,
|
||||
- char *saved_arg, char *p, int *not_found_ptr)
|
||||
+ char *the_real_saved_arg, char *p, int *not_found_ptr)
|
||||
{
|
||||
struct symtabs_and_lines values;
|
||||
char *p2;
|
||||
@@ -1216,7 +1216,23 @@ decode_compound (char **argptr, int funf
|
||||
struct symbol *sym_class;
|
||||
struct type *t;
|
||||
char *saved_java_argptr = NULL;
|
||||
+ char *saved_arg;
|
||||
|
||||
+ /* THE_REAL_SAVED_ARG cannot be altered, so make a copy that can be. */
|
||||
+ saved_arg = alloca (strlen (the_real_saved_arg) + 1);
|
||||
+ strcpy (saved_arg, the_real_saved_arg);
|
||||
+
|
||||
+ /* If the user specified "'foo::bar(baz)'" (note the quotes -- often
|
||||
+ added to workaround completer issues) -- saved_arg will be
|
||||
+ encapsulated in single-quotes. They are superfluous, so just strip
|
||||
+ them off. */
|
||||
+ if (*saved_arg == '\'')
|
||||
+ {
|
||||
+ char *end = skip_quoted (saved_arg);
|
||||
+ memmove (saved_arg, saved_arg + 1, end - saved_arg);
|
||||
+ memmove (end - 2, end, strlen (saved_arg) + 1);
|
||||
+ }
|
||||
+
|
||||
/* First check for "global" namespace specification, of the form
|
||||
"::foo". If found, skip over the colons and jump to normal
|
||||
symbol processing. I.e. the whole line specification starts with
|
||||
@@ -1467,7 +1483,7 @@ decode_compound (char **argptr, int funf
|
||||
up. The quotes are important if copy is empty. */
|
||||
if (not_found_ptr)
|
||||
*not_found_ptr = 1;
|
||||
- cplusplus_error (saved_arg,
|
||||
+ cplusplus_error (the_real_saved_arg,
|
||||
"Can't find member of namespace, class, struct, or union named \"%s\"\n",
|
||||
copy);
|
||||
}
|
||||
Index: gdb-7.2/gdb/psymtab.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/psymtab.c 2011-02-03 22:27:50.000000000 +0100
|
||||
+++ gdb-7.2/gdb/psymtab.c 2011-02-03 22:30:43.000000000 +0100
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "command.h"
|
||||
#include "readline/readline.h"
|
||||
#include "gdb_regex.h"
|
||||
+#include "language.h"
|
||||
+#include "cp-support.h"
|
||||
|
||||
#ifndef DEV_TTY
|
||||
#define DEV_TTY "/dev/tty"
|
||||
@@ -44,7 +46,8 @@
|
||||
/* Lookup a partial symbol. */
|
||||
static struct partial_symbol *lookup_partial_symbol (struct partial_symtab *,
|
||||
const char *, int,
|
||||
- domain_enum);
|
||||
+ domain_enum,
|
||||
+ enum language);
|
||||
|
||||
static char *psymtab_to_fullname (struct partial_symtab *ps);
|
||||
|
||||
@@ -407,15 +410,35 @@ fixup_psymbol_section (struct partial_sy
|
||||
static struct symtab *
|
||||
lookup_symbol_aux_psymtabs (struct objfile *objfile,
|
||||
int block_index, const char *name,
|
||||
- const domain_enum domain)
|
||||
+ const domain_enum domain, enum language language)
|
||||
{
|
||||
struct partial_symtab *ps;
|
||||
const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0);
|
||||
|
||||
ALL_OBJFILE_PSYMTABS (objfile, ps)
|
||||
{
|
||||
- if (!ps->readin && lookup_partial_symbol (ps, name, psymtab_index, domain))
|
||||
- return PSYMTAB_TO_SYMTAB (ps);
|
||||
+ if (!ps->readin
|
||||
+ && lookup_partial_symbol (ps, name, psymtab_index, domain, language))
|
||||
+ {
|
||||
+ struct symbol *sym;
|
||||
+ struct symtab *stab = PSYMTAB_TO_SYMTAB (ps);
|
||||
+ sym = NULL;
|
||||
+
|
||||
+ /* Some caution must be observed with overloaded functions
|
||||
+ and methods, since the psymtab will not contain any overload
|
||||
+ information (but NAME might contain it). */
|
||||
+ if (stab->primary)
|
||||
+ {
|
||||
+ struct blockvector *bv = BLOCKVECTOR (stab);
|
||||
+ struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
|
||||
+ sym = lookup_block_symbol (block, name, domain);
|
||||
+ }
|
||||
+
|
||||
+ if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
|
||||
+ return stab;
|
||||
+
|
||||
+ /* Keep looking through other psymtabs. */
|
||||
+ }
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -429,22 +452,59 @@ pre_expand_symtabs_matching_psymtabs (st
|
||||
/* Nothing. */
|
||||
}
|
||||
|
||||
+/* Returns the name used to search psymtabs. Unlike symtabs, psymtabs do
|
||||
+ not contain any method/function instance information (since this would
|
||||
+ force reading type information while reading psymtabs). Therefore,
|
||||
+ if NAME contains overload information, it must be stripped before searching
|
||||
+ psymtabs.
|
||||
+
|
||||
+ The caller is responsible for freeing the return result. */
|
||||
+
|
||||
+static const char *
|
||||
+psymtab_search_name (const char *name, enum language language)
|
||||
+{
|
||||
+ switch (language)
|
||||
+ {
|
||||
+ case language_cplus:
|
||||
+ case language_java:
|
||||
+ {
|
||||
+ if (strchr (name, '('))
|
||||
+ {
|
||||
+ char *ret = cp_remove_params (name);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return xstrdup (name);
|
||||
+}
|
||||
+
|
||||
/* Look, in partial_symtab PST, for symbol whose natural name is NAME.
|
||||
Check the global symbols if GLOBAL, the static symbols if not. */
|
||||
|
||||
static struct partial_symbol *
|
||||
lookup_partial_symbol (struct partial_symtab *pst, const char *name,
|
||||
- int global, domain_enum domain)
|
||||
+ int global, domain_enum domain, enum language language)
|
||||
{
|
||||
struct partial_symbol **start, **psym;
|
||||
struct partial_symbol **top, **real_top, **bottom, **center;
|
||||
int length = (global ? pst->n_global_syms : pst->n_static_syms);
|
||||
int do_linear_search = 1;
|
||||
+ const char *search_name;
|
||||
+ struct cleanup *cleanup;
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
+
|
||||
+ search_name = psymtab_search_name (name, language);
|
||||
+ cleanup = make_cleanup (xfree, (void *) search_name);
|
||||
+
|
||||
start = (global ?
|
||||
pst->objfile->global_psymbols.list + pst->globals_offset :
|
||||
pst->objfile->static_psymbols.list + pst->statics_offset);
|
||||
@@ -472,7 +532,8 @@ lookup_partial_symbol (struct partial_sy
|
||||
{
|
||||
do_linear_search = 1;
|
||||
}
|
||||
- if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center), name) >= 0)
|
||||
+ if (strcmp_iw_ordered (SYMBOL_SEARCH_NAME (*center),
|
||||
+ search_name) >= 0)
|
||||
{
|
||||
top = center;
|
||||
}
|
||||
@@ -485,11 +546,14 @@ lookup_partial_symbol (struct partial_sy
|
||||
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
|
||||
|
||||
while (top <= real_top
|
||||
- && SYMBOL_MATCHES_SEARCH_NAME (*top, name))
|
||||
+ && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name))
|
||||
{
|
||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
|
||||
SYMBOL_DOMAIN (*top), domain))
|
||||
- return (*top);
|
||||
+ {
|
||||
+ do_cleanups (cleanup);
|
||||
+ return (*top);
|
||||
+ }
|
||||
top++;
|
||||
}
|
||||
}
|
||||
@@ -504,10 +568,14 @@ lookup_partial_symbol (struct partial_sy
|
||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym),
|
||||
SYMBOL_DOMAIN (*psym), domain)
|
||||
&& SYMBOL_MATCHES_SEARCH_NAME (*psym, name))
|
||||
- return (*psym);
|
||||
+ {
|
||||
+ do_cleanups (cleanup);
|
||||
+ return (*psym);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
+ do_cleanups (cleanup);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -819,7 +887,8 @@ dump_psymtabs_for_objfile (struct objfil
|
||||
by matching FUNC_NAME. Make sure we read that symbol table in. */
|
||||
|
||||
static void
|
||||
-read_symtabs_for_function (struct objfile *objfile, const char *func_name)
|
||||
+read_symtabs_for_function (struct objfile *objfile, const char *func_name,
|
||||
+ enum language language)
|
||||
{
|
||||
struct partial_symtab *ps;
|
||||
|
||||
@@ -828,9 +897,9 @@ read_symtabs_for_function (struct objfil
|
||||
if (ps->readin)
|
||||
continue;
|
||||
|
||||
- if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN)
|
||||
+ if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN, language)
|
||||
!= NULL)
|
||||
- || (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN)
|
||||
+ || (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN, language)
|
||||
!= NULL))
|
||||
psymtab_to_symtab (ps);
|
||||
}
|
||||
@@ -950,13 +1019,14 @@ psymtab_to_fullname (struct partial_symt
|
||||
}
|
||||
|
||||
static const char *
|
||||
-find_symbol_file_from_partial (struct objfile *objfile, const char *name)
|
||||
+find_symbol_file_from_partial (struct objfile *objfile, const char *name,
|
||||
+ enum language language)
|
||||
{
|
||||
struct partial_symtab *pst;
|
||||
|
||||
ALL_OBJFILE_PSYMTABS (objfile, pst)
|
||||
{
|
||||
- if (lookup_partial_symbol (pst, name, 1, VAR_DOMAIN))
|
||||
+ if (lookup_partial_symbol (pst, name, 1, VAR_DOMAIN, language))
|
||||
return pst->filename;
|
||||
}
|
||||
return NULL;
|
||||
Index: gdb-7.2/gdb/symfile.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/symfile.h 2011-02-03 22:27:52.000000000 +0100
|
||||
+++ gdb-7.2/gdb/symfile.h 2011-02-03 22:29:05.000000000 +0100
|
||||
@@ -162,14 +162,15 @@ struct quick_symbol_functions
|
||||
/* Check to see if the symbol is defined in a "partial" symbol table
|
||||
of OBJFILE. KIND should be either GLOBAL_BLOCK or STATIC_BLOCK,
|
||||
depending on whether we want to search global symbols or static
|
||||
- symbols. NAME is the name of the symbol to look for. DOMAIN
|
||||
- indicates what sort of symbol to search for.
|
||||
+ symbols. NAME (valid in LANGUAGE) is the name of the symbol to look for.
|
||||
+ DOMAIN indicates what sort of symbol to search for.
|
||||
|
||||
Returns the newly-expanded symbol table in which the symbol is
|
||||
defined, or NULL if no such symbol table exists. */
|
||||
struct symtab *(*lookup_symbol) (struct objfile *objfile,
|
||||
int kind, const char *name,
|
||||
- domain_enum domain);
|
||||
+ domain_enum domain,
|
||||
+ enum language language);
|
||||
|
||||
/* This is called to expand symbol tables before looking up a
|
||||
symbol. A backend can choose to implement this and then have its
|
||||
@@ -195,10 +196,11 @@ struct quick_symbol_functions
|
||||
struct section_offsets *new_offsets,
|
||||
struct section_offsets *delta);
|
||||
|
||||
- /* Find all the symbols in OBJFILE named FUNC_NAME, and ensure that
|
||||
- the corresponding symbol tables are loaded. */
|
||||
+ /* Find all the symbols in OBJFILE named FUNC_NAME (valid in LANGUAGE),
|
||||
+ and ensure that the corresponding symbol tables are loaded. */
|
||||
void (*expand_symtabs_for_function) (struct objfile *objfile,
|
||||
- const char *func_name);
|
||||
+ const char *func_name,
|
||||
+ enum language language);
|
||||
|
||||
/* Read all symbol tables associated with OBJFILE. */
|
||||
void (*expand_all_symtabs) (struct objfile *objfile);
|
||||
@@ -209,8 +211,10 @@ struct quick_symbol_functions
|
||||
const char *filename);
|
||||
|
||||
/* Return the file name of the file holding the symbol in OBJFILE
|
||||
- named NAME. If no such symbol exists in OBJFILE, return NULL. */
|
||||
- const char *(*find_symbol_file) (struct objfile *objfile, const char *name);
|
||||
+ named NAME (valid in LANGUAGE). If no such symbol exists in OBJFILE,
|
||||
+ return NULL. */
|
||||
+ const char *(*find_symbol_file) (struct objfile *objfile, const char *name,
|
||||
+ enum language language);
|
||||
|
||||
/* This method is specific to Ada. It walks the partial symbol
|
||||
tables of OBJFILE looking for a name match. WILD_MATCH and
|
||||
Index: gdb-7.2/gdb/symtab.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/symtab.c 2011-02-03 22:27:54.000000000 +0100
|
||||
+++ gdb-7.2/gdb/symtab.c 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -1329,7 +1329,8 @@ lookup_symbol_aux_quick (struct objfile
|
||||
|
||||
if (!objfile->sf)
|
||||
return NULL;
|
||||
- symtab = objfile->sf->qf->lookup_symbol (objfile, kind, name, domain);
|
||||
+ symtab = objfile->sf->qf->lookup_symbol (objfile, kind, name, domain,
|
||||
+ current_language->la_language);
|
||||
if (!symtab)
|
||||
return NULL;
|
||||
|
||||
@@ -1500,7 +1501,8 @@ basic_lookup_transparent_type_quick (str
|
||||
|
||||
if (!objfile->sf)
|
||||
return NULL;
|
||||
- symtab = objfile->sf->qf->lookup_symbol (objfile, kind, name, STRUCT_DOMAIN);
|
||||
+ symtab = objfile->sf->qf->lookup_symbol (objfile, kind, name, STRUCT_DOMAIN,
|
||||
+ current_language->la_language);
|
||||
if (!symtab)
|
||||
return NULL;
|
||||
|
||||
@@ -1625,7 +1627,8 @@ find_main_filename (void)
|
||||
|
||||
if (!objfile->sf)
|
||||
continue;
|
||||
- result = objfile->sf->qf->find_symbol_file (objfile, name);
|
||||
+ result = objfile->sf->qf->find_symbol_file (objfile, name,
|
||||
+ current_language->la_language);
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr11734-1.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr11734-1.cc 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ pr11734 *p = new pr11734;
|
||||
+ p->foo ();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr11734-2.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr11734-2.cc 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+void
|
||||
+pr11734::foo(void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr11734-3.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr11734-3.cc 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+void
|
||||
+pr11734::foo (int a)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr11734-4.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr11734-4.cc 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+#include "pr11734.h"
|
||||
+
|
||||
+void
|
||||
+pr11734::foo (char *a)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr11734.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr11734.exp 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -0,0 +1,55 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# Contributed by Red Hat, originally written by Keith Seitz.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+if { [skip_cplus_tests] } { continue }
|
||||
+
|
||||
+set testfile "pr11734"
|
||||
+set class $testfile
|
||||
+
|
||||
+set srcfiles {}
|
||||
+for {set i 1} {$i < 5} {incr i} {
|
||||
+ lappend srcfiles $testfile-$i.cc
|
||||
+}
|
||||
+
|
||||
+prepare_for_testing pr11734 $testfile $srcfiles {c++ debug}
|
||||
+
|
||||
+if {![runto_main]} {
|
||||
+ perror "couldn't run to breakpoint"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# An array holding the overload types for the method pr11734::foo. The
|
||||
+# first element is the overloaded method parameter. The second element
|
||||
+# is the expected source file number, e.g. "pr11734-?.cc".
|
||||
+array set tests {
|
||||
+ "char*" 4
|
||||
+ "int" 3
|
||||
+ "" 2
|
||||
+}
|
||||
+
|
||||
+# Test each overload instance twice: once quoted, once unquoted
|
||||
+foreach ovld [array names tests] {
|
||||
+ set method "${class}::foo\($ovld\)"
|
||||
+ set result "Breakpoint (\[0-9\]).*file .*/$class-$tests($ovld).*"
|
||||
+ gdb_test "break $method" $result
|
||||
+ gdb_test "break '$method'" $result
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+return 0
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr11734.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr11734.h 2011-02-03 22:28:01.000000000 +0100
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+class pr11734
|
||||
+{
|
||||
+ public:
|
||||
+ void foo ();
|
||||
+ void foo (int);
|
||||
+ void foo (char *);
|
||||
+};
|
||||
+
|
|
@ -0,0 +1,18 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-01/msg00460.html
|
||||
|
||||
Index: gdb-7.2/gdb/linespec.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linespec.c 2011-02-03 22:59:46.000000000 +0100
|
||||
+++ gdb-7.2/gdb/linespec.c 2011-02-03 23:03:28.000000000 +0100
|
||||
@@ -1230,7 +1230,10 @@ decode_compound (char **argptr, int funf
|
||||
{
|
||||
char *end = skip_quoted (saved_arg);
|
||||
memmove (saved_arg, saved_arg + 1, end - saved_arg);
|
||||
- memmove (end - 2, end, strlen (saved_arg) + 1);
|
||||
+ if (&end[-2] >= saved_arg && end[-2] == '\'')
|
||||
+ memmove (end - 2, end, strlen (end) + 1);
|
||||
+ else
|
||||
+ memmove (end - 1, end, strlen (end) + 1);
|
||||
}
|
||||
|
||||
/* First check for "global" namespace specification, of the form
|
|
@ -0,0 +1,209 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html
|
||||
|
||||
Index: gdb-7.2/gdb/linespec.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/linespec.c 2011-02-03 22:28:01.000000000 +0100
|
||||
+++ gdb-7.2/gdb/linespec.c 2011-02-03 22:31:29.000000000 +0100
|
||||
@@ -1042,6 +1042,10 @@ locate_first_half (char **argptr, int *i
|
||||
error (_("malformed template specification in command"));
|
||||
p = temp_end;
|
||||
}
|
||||
+
|
||||
+ if (p[0] == '(')
|
||||
+ p = find_method_overload_end (p);
|
||||
+
|
||||
/* Check for a colon and a plus or minus and a [ (which
|
||||
indicates an Objective-C method) */
|
||||
if (is_objc_method_format (p))
|
||||
@@ -1248,8 +1252,10 @@ decode_compound (char **argptr, int funf
|
||||
find_method.
|
||||
|
||||
2) AAA::inA isn't the name of a class. In that case, either the
|
||||
- user made a typo or AAA::inA is the name of a namespace.
|
||||
- Either way, we just look up AAA::inA::fun with lookup_symbol.
|
||||
+ user made a typo, AAA::inA is the name of a namespace, or it is
|
||||
+ the name of a minimal symbol.
|
||||
+ We just look up AAA::inA::fun with lookup_symbol. If that fails,
|
||||
+ try lookup_minimal_symbol.
|
||||
|
||||
Thus, our first task is to find everything before the last set of
|
||||
double-colons and figure out if it's the name of a class. So we
|
||||
@@ -1270,6 +1276,8 @@ decode_compound (char **argptr, int funf
|
||||
|
||||
while (1)
|
||||
{
|
||||
+ static char *break_characters = " \t\'(";
|
||||
+
|
||||
/* Move pointer up to next possible class/namespace token. */
|
||||
|
||||
p = p2 + 1; /* Restart with old value +1. */
|
||||
@@ -1280,8 +1288,7 @@ decode_compound (char **argptr, int funf
|
||||
/* PASS2: p2->"::fun", p->":fun" */
|
||||
|
||||
/* Move pointer ahead to next double-colon. */
|
||||
- while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'')
|
||||
- && (*p != '('))
|
||||
+ while (*p && strchr (break_characters, *p) == NULL)
|
||||
{
|
||||
if (current_language->la_language == language_cplus)
|
||||
p += cp_validate_operator (p);
|
||||
@@ -1305,9 +1312,12 @@ decode_compound (char **argptr, int funf
|
||||
else if ((p[0] == ':') && (p[1] == ':'))
|
||||
break; /* Found double-colon. */
|
||||
else
|
||||
- /* PASS2: We'll keep getting here, until p->"", at which point
|
||||
- we exit this loop. */
|
||||
- p++;
|
||||
+ {
|
||||
+ /* PASS2: We'll keep getting here, until P points to one of the
|
||||
+ break characters, at which point we exit this loop. */
|
||||
+ if (strchr (break_characters, *p) == NULL)
|
||||
+ p++;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (*p != ':')
|
||||
@@ -1316,8 +1326,8 @@ decode_compound (char **argptr, int funf
|
||||
unsuccessfully all the components of the
|
||||
string, and p->""(PASS2) */
|
||||
|
||||
- /* We get here if p points to ' ', '\t', '\'', "::" or ""(i.e
|
||||
- string ended). */
|
||||
+ /* We get here if p points to one of the break characters or ""(i.e
|
||||
+ string ended). */
|
||||
/* Save restart for next time around. */
|
||||
p2 = p;
|
||||
/* Restore argptr as it was on entry to this function. */
|
||||
@@ -1466,6 +1476,18 @@ decode_compound (char **argptr, int funf
|
||||
/* We couldn't find a class, so we're in case 2 above. We check the
|
||||
entire name as a symbol instead. */
|
||||
|
||||
+ if (current_language->la_language == language_cplus
|
||||
+ || current_language->la_language == language_java)
|
||||
+ {
|
||||
+ char *paren = strchr (p, '(');
|
||||
+ if (paren != NULL)
|
||||
+ p = find_method_overload_end (paren);
|
||||
+
|
||||
+ /* Make sure we keep important kewords like "const" */
|
||||
+ if (strncmp (p, " const", 6) == 0)
|
||||
+ p += 6;
|
||||
+ }
|
||||
+
|
||||
copy = (char *) alloca (p - saved_arg2 + 1);
|
||||
memcpy (copy, saved_arg2, p - saved_arg2);
|
||||
/* Note: if is_quoted should be true, we snuff out quote here
|
||||
@@ -1478,9 +1500,18 @@ decode_compound (char **argptr, int funf
|
||||
sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
|
||||
if (sym)
|
||||
return symbol_found (funfirstline, canonical, copy, sym, NULL);
|
||||
+ else
|
||||
+ {
|
||||
+ struct minimal_symbol *msym;
|
||||
+
|
||||
+ /* Couldn't find any interpretation as classes/namespaces. As a last
|
||||
+ resort, try the minimal symbol tables. */
|
||||
+ msym = lookup_minimal_symbol (copy, NULL, NULL);
|
||||
+ if (msym != NULL)
|
||||
+ return minsym_found (funfirstline, msym);
|
||||
+ }
|
||||
|
||||
- /* Couldn't find any interpretation as classes/namespaces, so give
|
||||
- up. The quotes are important if copy is empty. */
|
||||
+ /* Couldn't find a minimal symbol, either, so give up. */
|
||||
if (not_found_ptr)
|
||||
*not_found_ptr = 1;
|
||||
cplusplus_error (the_real_saved_arg,
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr12273.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr12273.cc 2011-02-03 22:31:01.000000000 +0100
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* This test case is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+template <typename T>
|
||||
+class GDB
|
||||
+{
|
||||
+ public:
|
||||
+ static int simple (void) { return 0; }
|
||||
+ static int harder (T a) { return 1; }
|
||||
+ template <typename X>
|
||||
+ static X even_harder (T a) { return static_cast<X> (a); }
|
||||
+ int operator == (GDB const& other)
|
||||
+ { return 1; }
|
||||
+};
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ GDB<int> a, b;
|
||||
+ if (a == b)
|
||||
+ return GDB<char>::harder('a') + GDB<int>::harder(3)
|
||||
+ + GDB<char>::even_harder<int> ('a');
|
||||
+ return GDB<int>::simple ();
|
||||
+}
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/pr12273.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/pr12273.exp 2011-02-03 22:31:01.000000000 +0100
|
||||
@@ -0,0 +1,46 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# Contributed by Red Hat, originally written by Keith Seitz.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+if {[skip_cplus_tests]} { continue }
|
||||
+
|
||||
+set testfile "pr12273"
|
||||
+# Do NOT compile with debug flag.
|
||||
+prepare_for_testing pr12273 $testfile $testfile.cc {c++}
|
||||
+
|
||||
+gdb_test_no_output "set language c++"
|
||||
+
|
||||
+# A list of minimal symbol names to check.
|
||||
+# Note that GDB<char>::even_harder<int>(char) is quoted and includes
|
||||
+# the return type. This is necessary because this is the demangled name
|
||||
+# of the minimal symbol.
|
||||
+set min_syms [list \
|
||||
+ "GDB<int>::operator ==" \
|
||||
+ "GDB<int>::operator==(GDB<int> const&)" \
|
||||
+ "GDB<char>::harder(char)" \
|
||||
+ "GDB<int>::harder(int)" \
|
||||
+ {"int GDB<char>::even_harder<int>(char)"} \
|
||||
+ "GDB<int>::simple()"]
|
||||
+
|
||||
+foreach sym $min_syms {
|
||||
+ if {[gdb_breakpoint $sym]} {
|
||||
+ pass "setting breakpoint at $sym"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
|
@ -0,0 +1,126 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-07/msg00070.html
|
||||
|
||||
[ Left only lib/gdb.exp. ]
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/07/07 18:49:50 1.2377
|
||||
### src/gdb/testsuite/ChangeLog 2010/07/12 17:33:14 1.2378
|
||||
## -1,3 +1,33 @@
|
||||
+2010-07-12 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
+ H.J. Lu <hongjiu.lu@intel.com>
|
||||
+
|
||||
+ * lib/gdb.exp (is_ilp32_target): New.
|
||||
+ (is_lp64_target): Likewise.
|
||||
+
|
||||
+ * gdb.arch/amd64-byte.exp: Use is_lp64_target to check 64bit
|
||||
+ target.
|
||||
+ * gdb.arch/amd64-disp-step.exp: Likewise.
|
||||
+ * gdb.arch/amd64-dword.exp: Likewise.
|
||||
+ * gdb.arch/amd64-i386-address.exp: Likewise.
|
||||
+ * gdb.arch/amd64-word.exp: Likewise.
|
||||
+
|
||||
+ * gdb.arch/i386-avx.exp: Use is_ilp32_target to check for 32bit
|
||||
+ target.
|
||||
+ * gdb.arch/i386-bp_permanent.exp: Likewise.
|
||||
+ * gdb.arch/i386-byte.exp: Likewise.
|
||||
+ * gdb.arch/i386-disp-step.exp: Likewise.
|
||||
+ * gdb.arch/i386-gnu-cfi.exp: Likewise.
|
||||
+ * gdb.arch/i386-prologue.exp: Likewise.
|
||||
+ * gdb.arch/i386-size-overlap.exp: Likewise.
|
||||
+ * gdb.arch/i386-size.exp: Likewise.
|
||||
+ * gdb.arch/i386-sse.exp: Likewise.
|
||||
+ * gdb.arch/i386-unwind.exp: Likewise.
|
||||
+ * gdb.arch/i386-word.exp: Likewise.
|
||||
+
|
||||
+ * gdb.arch/ppc64-atomic-inst.exp: Use is_lp64_target to execute
|
||||
+ test only when building 64-bit executables. Do not hard-code
|
||||
+ -m64 option.
|
||||
+
|
||||
2010-07-07 Doug Evans <dje@google.com>
|
||||
|
||||
* lib/gdb.exp (gdb_test_list_exact): New function.
|
||||
--- src/gdb/testsuite/lib/gdb.exp 2010/07/07 18:49:51 1.153
|
||||
+++ src/gdb/testsuite/lib/gdb.exp 2010/07/12 17:33:15 1.154
|
||||
@@ -1454,6 +1454,83 @@
|
||||
return 1
|
||||
}
|
||||
|
||||
+# Return 1 if target is ILP32.
|
||||
+# This cannot be decided simply from looking at the target string,
|
||||
+# as it might depend on externally passed compiler options like -m64.
|
||||
+proc is_ilp32_target {} {
|
||||
+ global is_ilp32_target_saved
|
||||
+
|
||||
+ # Use the cached value, if it exists. Cache value per "board" to handle
|
||||
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
|
||||
+ set me "is_ilp32_target"
|
||||
+ set board [target_info name]
|
||||
+ if [info exists is_ilp32_target_saved($board)] {
|
||||
+ verbose "$me: returning saved $is_ilp32_target_saved($board)" 2
|
||||
+ return $is_ilp32_target_saved($board)
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ set src ilp32[pid].c
|
||||
+ set obj ilp32[pid].o
|
||||
+
|
||||
+ set f [open $src "w"]
|
||||
+ puts $f "int dummy\[sizeof (int) == 4"
|
||||
+ puts $f " && sizeof (void *) == 4"
|
||||
+ puts $f " && sizeof (long) == 4 ? 1 : -1\];"
|
||||
+ close $f
|
||||
+
|
||||
+ verbose "$me: compiling testfile $src" 2
|
||||
+ set lines [gdb_compile $src $obj object {quiet}]
|
||||
+ file delete $src
|
||||
+ file delete $obj
|
||||
+
|
||||
+ if ![string match "" $lines] then {
|
||||
+ verbose "$me: testfile compilation failed, returning 0" 2
|
||||
+ return [set is_ilp32_target_saved($board) 0]
|
||||
+ }
|
||||
+
|
||||
+ verbose "$me: returning 1" 2
|
||||
+ return [set is_ilp32_target_saved($board) 1]
|
||||
+}
|
||||
+
|
||||
+# Return 1 if target is LP64.
|
||||
+# This cannot be decided simply from looking at the target string,
|
||||
+# as it might depend on externally passed compiler options like -m64.
|
||||
+proc is_lp64_target {} {
|
||||
+ global is_lp64_target_saved
|
||||
+
|
||||
+ # Use the cached value, if it exists. Cache value per "board" to handle
|
||||
+ # runs with multiple options (e.g. unix/{-m32,-64}) correctly.
|
||||
+ set me "is_lp64_target"
|
||||
+ set board [target_info name]
|
||||
+ if [info exists is_lp64_target_saved($board)] {
|
||||
+ verbose "$me: returning saved $is_lp64_target_saved($board)" 2
|
||||
+ return $is_lp64_target_saved($board)
|
||||
+ }
|
||||
+
|
||||
+ set src lp64[pid].c
|
||||
+ set obj lp64[pid].o
|
||||
+
|
||||
+ set f [open $src "w"]
|
||||
+ puts $f "int dummy\[sizeof (int) == 4"
|
||||
+ puts $f " && sizeof (void *) == 8"
|
||||
+ puts $f " && sizeof (long) == 8 ? 1 : -1\];"
|
||||
+ close $f
|
||||
+
|
||||
+ verbose "$me: compiling testfile $src" 2
|
||||
+ set lines [gdb_compile $src $obj object {quiet}]
|
||||
+ file delete $src
|
||||
+ file delete $obj
|
||||
+
|
||||
+ if ![string match "" $lines] then {
|
||||
+ verbose "$me: testfile compilation failed, returning 0" 2
|
||||
+ return [set is_lp64_target_saved($board) 0]
|
||||
+ }
|
||||
+
|
||||
+ verbose "$me: returning 1" 2
|
||||
+ return [set is_lp64_target_saved($board) 1]
|
||||
+}
|
||||
+
|
||||
# Run a test on the target to see if it supports vmx hardware. Return 0 if so,
|
||||
# 1 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00070.html
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/08 23:41:39 1.2442
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/09 20:00:48 1.2443
|
||||
## -1,3 +1,8 @@
|
||||
+2010-09-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.base/break-interp.exp (reach): Permit leading . for ppc64.
|
||||
+ (test_ld) <powerpc64-*>: New.
|
||||
+
|
||||
2010-09-08 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb.cp/templates.exp (test_template_args): Allow "struct".
|
||||
--- src/gdb/testsuite/gdb.base/break-interp.exp 2010/07/05 18:04:33 1.18
|
||||
+++ src/gdb/testsuite/gdb.base/break-interp.exp 2010/09/09 20:00:49 1.19
|
||||
@@ -136,10 +136,10 @@
|
||||
}
|
||||
exp_continue
|
||||
}
|
||||
- -re "Breakpoint \[0-9\]+, $func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
|
||||
+ -re "Breakpoint \[0-9\]+, \\.?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
|
||||
pass $test
|
||||
}
|
||||
- -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\).*\r\n$gdb_prompt $" {
|
||||
+ -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?$func \\(\\).*\r\n$gdb_prompt $" {
|
||||
pass $test
|
||||
}
|
||||
}
|
||||
@@ -399,6 +399,17 @@
|
||||
pass $test
|
||||
}
|
||||
}
|
||||
+ # `info sym' cannot be tested for .opd as the binary may not have
|
||||
+ # symbols.
|
||||
+ if [istarget powerpc64-*] {
|
||||
+ set test "convert entry point"
|
||||
+ gdb_test_multiple "p *(void(*)(void) *) 0x$entrynohex" $test {
|
||||
+ -re " =( \\(\[^0-9\]*\\))? 0x(\[0-9a-f\]+)( < \[^\r\n\]*)?\r\n$gdb_prompt $" {
|
||||
+ set entrynohex $expect_out(2,string)
|
||||
+ pass $test
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
if {$entrynohex != ""} {
|
||||
gdb_test "break *0x$entrynohex" "" "break at entry point"
|
||||
gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
|
|
@ -0,0 +1,24 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00077.html
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/09 20:00:48 1.2443
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/10 20:29:25 1.2444
|
||||
## -1,3 +1,8 @@
|
||||
+2010-09-10 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
|
||||
+
|
||||
+ * gdb.base/break-interp.exp (test_ld) <istarget powerpc64-*>: Add
|
||||
+ is_lp64_target to check 64bit target.
|
||||
+
|
||||
2010-09-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/break-interp.exp (reach): Permit leading . for ppc64.
|
||||
--- src/gdb/testsuite/gdb.base/break-interp.exp 2010/09/09 20:00:49 1.19
|
||||
+++ src/gdb/testsuite/gdb.base/break-interp.exp 2010/09/10 20:29:25 1.20
|
||||
@@ -401,7 +401,7 @@
|
||||
}
|
||||
# `info sym' cannot be tested for .opd as the binary may not have
|
||||
# symbols.
|
||||
- if [istarget powerpc64-*] {
|
||||
+ if {[istarget powerpc64-*] && [is_lp64_target]} {
|
||||
set test "convert entry point"
|
||||
gdb_test_multiple "p *(void(*)(void) *) 0x$entrynohex" $test {
|
||||
-re " =( \\(\[^0-9\]*\\))? 0x(\[0-9a-f\]+)( < \[^\r\n\]*)?\r\n$gdb_prompt $" {
|
|
@ -0,0 +1,89 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-10/msg00065.html
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/10/08 18:28:46 1.2471
|
||||
### src/gdb/testsuite/ChangeLog 2010/10/11 08:45:11 1.2472
|
||||
## -1,3 +1,10 @@
|
||||
+2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix results of prelinked PIEs on ppc*.
|
||||
+ * gdb.base/break-interp.exp (reach, test_core, test_attach_gdb):
|
||||
+ Accept also DISPLACEMENT "PRESENT".
|
||||
+ (main): Replace "ZERO" displacements by "PRESENT".
|
||||
+
|
||||
2010-10-08 Sami Wagiaalla <swagiaal@redhat.com>
|
||||
|
||||
* gdb.cp/oranking.exp: New test.
|
||||
--- src/gdb/testsuite/gdb.base/break-interp.exp 2010/09/10 20:29:25 1.20
|
||||
+++ src/gdb/testsuite/gdb.base/break-interp.exp 2010/10/11 08:45:12 1.21
|
||||
@@ -109,7 +109,9 @@
|
||||
}
|
||||
|
||||
# `runto' does not check we stopped really at the function we specified.
|
||||
-# DISPLACEMENT can be "NONE", "ZERO" or "NONZERO"
|
||||
+# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
|
||||
+# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
|
||||
+# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
|
||||
proc reach {func command displacement} {
|
||||
global gdb_prompt expect_out
|
||||
|
||||
@@ -128,7 +130,7 @@
|
||||
} else {
|
||||
set case "NONZERO"
|
||||
}
|
||||
- if {$displacement == $case} {
|
||||
+ if {$displacement == $case || $displacement == "PRESENT"} {
|
||||
pass $test_displacement
|
||||
set displacement "FOUND-$displacement"
|
||||
} else {
|
||||
@@ -184,7 +186,7 @@
|
||||
} else {
|
||||
set case "NONZERO"
|
||||
}
|
||||
- if {$displacement == $case} {
|
||||
+ if {$displacement == $case || $displacement == "PRESENT"} {
|
||||
pass $test_displacement
|
||||
set displacement "FOUND-$displacement"
|
||||
} else {
|
||||
@@ -241,7 +243,7 @@
|
||||
} else {
|
||||
set case "NONZERO"
|
||||
}
|
||||
- if {$displacement == $case} {
|
||||
+ if {$displacement == $case || $displacement == "PRESENT"} {
|
||||
pass $test_displacement
|
||||
set displacement "FOUND-$displacement"
|
||||
} else {
|
||||
@@ -428,7 +430,7 @@
|
||||
} else {
|
||||
set case "NONZERO"
|
||||
}
|
||||
- if {$displacement == $case} {
|
||||
+ if {$displacement == $case || $displacement == "PRESENT"} {
|
||||
pass $test_displacement
|
||||
set displacement "FOUND-$displacement"
|
||||
} else {
|
||||
@@ -533,7 +535,10 @@
|
||||
if {$ldprelink == "NO"} {
|
||||
set displacement "NONZERO"
|
||||
} else {
|
||||
- set displacement "ZERO"
|
||||
+ # x86* kernel loads prelinked PIE binary at its prelinked address
|
||||
+ # but ppc* kernel loads it at a random address. prelink normally
|
||||
+ # skips PIE binaries during the system scan.
|
||||
+ set displacement "PRESENT"
|
||||
}
|
||||
test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
|
||||
|
||||
@@ -582,7 +587,11 @@
|
||||
} elseif {$binprelink == "NO"} {
|
||||
set displacement "NONZERO"
|
||||
} else {
|
||||
- set displacement "ZERO"
|
||||
+ # x86* kernel loads prelinked PIE binary at its
|
||||
+ # prelinked address but ppc* kernel loads it at
|
||||
+ # a random address. prelink normally skips PIE
|
||||
+ # binaries during the system scan.
|
||||
+ set displacement "PRESENT"
|
||||
}
|
||||
|
||||
if {[prelink$binprelink $relink_args [file tail $exec]]
|
|
@ -0,0 +1,177 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-10/msg00066.html
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/10/11 08:45:11 1.2472
|
||||
### src/gdb/testsuite/ChangeLog 2010/10/11 08:47:47 1.2473
|
||||
## -1,5 +1,13 @@
|
||||
2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
+ Fix missing _start PIE relocation on ppc64 due to stop on dl_main.
|
||||
+ * break-interp.exp (reach): Move the core body ...
|
||||
+ (reach_1): ... here. Use stop-on-solib-events for _dl_debug_state.
|
||||
+ (test_ld): Provide always real argument, even to the linker. Replace
|
||||
+ dl_main by _dl_debug_state.
|
||||
+
|
||||
+2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
Fix results of prelinked PIEs on ppc*.
|
||||
* gdb.base/break-interp.exp (reach, test_core, test_attach_gdb):
|
||||
Accept also DISPLACEMENT "PRESENT".
|
||||
--- src/gdb/testsuite/gdb.base/break-interp.exp 2010/10/11 08:45:12 1.21
|
||||
+++ src/gdb/testsuite/gdb.base/break-interp.exp 2010/10/11 08:47:47 1.22
|
||||
@@ -108,47 +108,87 @@
|
||||
}
|
||||
}
|
||||
|
||||
-# `runto' does not check we stopped really at the function we specified.
|
||||
-# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
|
||||
-# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
|
||||
-# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
|
||||
-proc reach {func command displacement} {
|
||||
+# Implementation of reach.
|
||||
+
|
||||
+proc reach_1 {func command displacement} {
|
||||
global gdb_prompt expect_out
|
||||
|
||||
- global pf_prefix
|
||||
- set old_ldprefix $pf_prefix
|
||||
- lappend pf_prefix "reach-$func:"
|
||||
+ if {$func == "_dl_debug_state"} {
|
||||
+ # Breakpoint on _dl_debug_state can have problems due to its overlap
|
||||
+ # with the existing internal breakpoint from GDB.
|
||||
+ gdb_test_no_output "set stop-on-solib-events 1"
|
||||
+ } elseif {! [gdb_breakpoint $func allow-pending]} {
|
||||
+ return
|
||||
+ }
|
||||
|
||||
- if [gdb_breakpoint $func allow-pending] {
|
||||
- set test "reach"
|
||||
- set test_displacement "seen displacement message as $displacement"
|
||||
- gdb_test_multiple $command $test {
|
||||
- -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
|
||||
- # Missing "$gdb_prompt $" is intentional.
|
||||
- if {$expect_out(1,string) == "0x0"} {
|
||||
- set case "ZERO"
|
||||
- } else {
|
||||
- set case "NONZERO"
|
||||
- }
|
||||
- if {$displacement == $case || $displacement == "PRESENT"} {
|
||||
- pass $test_displacement
|
||||
- set displacement "FOUND-$displacement"
|
||||
- } else {
|
||||
- fail $test_displacement
|
||||
- }
|
||||
- exp_continue
|
||||
+ set test "reach"
|
||||
+ set test_displacement "seen displacement message as $displacement"
|
||||
+ set debug_state_count 0
|
||||
+ gdb_test_multiple $command $test {
|
||||
+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
|
||||
+ # Missing "$gdb_prompt $" is intentional.
|
||||
+ if {$expect_out(1,string) == "0x0"} {
|
||||
+ set case "ZERO"
|
||||
+ } else {
|
||||
+ set case "NONZERO"
|
||||
}
|
||||
- -re "Breakpoint \[0-9\]+, \\.?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
|
||||
+ if {$displacement == $case || $displacement == "PRESENT"} {
|
||||
+ pass $test_displacement
|
||||
+ set displacement "FOUND-$displacement"
|
||||
+ } else {
|
||||
+ fail $test_displacement
|
||||
+ }
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ -re "Breakpoint \[0-9\]+, \\.?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
|
||||
+ if {$func == "_dl_debug_state"} {
|
||||
+ fail $test
|
||||
+ } else {
|
||||
pass $test
|
||||
}
|
||||
- -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?$func \\(\\).*\r\n$gdb_prompt $" {
|
||||
+ }
|
||||
+ -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?$func \\(\\).*\r\n$gdb_prompt $" {
|
||||
+ if {$func == "_dl_debug_state"} {
|
||||
+ fail $test
|
||||
+ } else {
|
||||
pass $test
|
||||
}
|
||||
}
|
||||
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
|
||||
- fail $test_displacement
|
||||
+ -re "Stopped due to shared library event\r\n$gdb_prompt $" {
|
||||
+ if {$func == "_dl_debug_state"} {
|
||||
+ if {$debug_state_count == 0} {
|
||||
+ # First stop does not yet relocate the _start function
|
||||
+ # descriptor on ppc64.
|
||||
+ set debug_state_count 1
|
||||
+ send_gdb "continue\n"
|
||||
+ exp_continue
|
||||
+ } else {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ } else {
|
||||
+ fail $test
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
|
||||
+ fail $test_displacement
|
||||
+ }
|
||||
+
|
||||
+ if {$func == "_dl_debug_state"} {
|
||||
+ gdb_test_no_output "set stop-on-solib-events 0"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# `runto' does not check we stopped really at the function we specified.
|
||||
+# DISPLACEMENT can be "NONE" for no message to be present, "ZERO" for
|
||||
+# displacement of 0 bytes to be present, "NONZERO" for displacement of non-0
|
||||
+# bytes to be present and "PRESENT" if both "ZERO" and "NONZERO" are valid.
|
||||
+proc reach {func command displacement} {
|
||||
+ global pf_prefix
|
||||
+ set old_ldprefix $pf_prefix
|
||||
+ lappend pf_prefix "reach-$func:"
|
||||
+
|
||||
+ reach_1 $func $command $displacement
|
||||
|
||||
set pf_prefix $old_ldprefix
|
||||
}
|
||||
@@ -344,9 +384,18 @@
|
||||
# prevents that from happening. So turn it off.
|
||||
gdb_test "set disable-randomization off"
|
||||
|
||||
- reach "dl_main" "run segv" $displacement
|
||||
+ if $ifmain {
|
||||
+ gdb_test_no_output "set args segv"
|
||||
+ } else {
|
||||
+ global objdir binfile_test
|
||||
+
|
||||
+ # ld.so needs some executable to run to reach _dl_debug_state.
|
||||
+ gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test"
|
||||
+ }
|
||||
+
|
||||
+ reach "_dl_debug_state" "run" $displacement
|
||||
|
||||
- gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
|
||||
+ gdb_test "bt" "#0 +\[^\r\n\]*\\m_dl_debug_state\\M.*" "dl bt"
|
||||
|
||||
if $ifmain {
|
||||
reach "main" continue "NONE"
|
||||
@@ -358,7 +407,7 @@
|
||||
|
||||
# Try re-run if the new PIE displacement takes effect.
|
||||
gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
|
||||
- reach "dl_main" "run segv" $displacement
|
||||
+ reach "_dl_debug_state" "run" $displacement
|
||||
|
||||
if $ifmain {
|
||||
test_core $file $displacement
|
||||
@@ -391,7 +440,7 @@
|
||||
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
|
||||
|
||||
if $ifmain {
|
||||
- reach "dl_main" run $displacement
|
||||
+ reach "_dl_debug_state" run $displacement
|
||||
|
||||
set test "info files"
|
||||
set entrynohex ""
|
|
@ -0,0 +1,102 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-10/msg00067.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/10/08 20:45:20 1.12248
|
||||
### src/gdb/ChangeLog 2010/10/11 08:50:28 1.12249
|
||||
## -1,3 +1,9 @@
|
||||
+2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix attaching to re-prelinked executables on ppc64.
|
||||
+ * solib-svr4.c (svr4_exec_displacement): New variable plt2_asect,
|
||||
+ initialize it, try to adjust FILESZ field by it.
|
||||
+
|
||||
2010-10-08 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* tracepoint.c (merge_uploaded_trace_state_variables): Only print
|
||||
--- src/gdb/solib-svr4.c 2010/08/03 22:35:41 1.138
|
||||
+++ src/gdb/solib-svr4.c 2010/10/11 08:50:33 1.139
|
||||
@@ -1844,6 +1844,7 @@
|
||||
Elf32_External_Phdr *phdr2p;
|
||||
gdb_byte *buf_vaddr_p, *buf_paddr_p;
|
||||
CORE_ADDR vaddr, paddr;
|
||||
+ asection *plt2_asect;
|
||||
|
||||
phdrp = &((Elf32_External_Phdr *) buf)[i];
|
||||
buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
|
||||
@@ -1869,6 +1870,34 @@
|
||||
if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
continue;
|
||||
|
||||
+ /* prelink can convert .plt SHT_NOBITS to SHT_PROGBITS. */
|
||||
+ plt2_asect = bfd_get_section_by_name (exec_bfd, ".plt");
|
||||
+ if (plt2_asect)
|
||||
+ {
|
||||
+ int content2;
|
||||
+ gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz;
|
||||
+ CORE_ADDR filesz;
|
||||
+
|
||||
+ content2 = (bfd_get_section_flags (exec_bfd, plt2_asect)
|
||||
+ & SEC_HAS_CONTENTS) != 0;
|
||||
+
|
||||
+ filesz = extract_unsigned_integer (buf_filesz_p, 4,
|
||||
+ byte_order);
|
||||
+
|
||||
+ /* PLT2_ASECT is from on-disk file (exec_bfd) while
|
||||
+ FILESZ is from the in-memory image. */
|
||||
+ if (content2)
|
||||
+ filesz += bfd_get_section_size (plt2_asect);
|
||||
+ else
|
||||
+ filesz -= bfd_get_section_size (plt2_asect);
|
||||
+
|
||||
+ store_unsigned_integer (buf_filesz_p, 4, byte_order,
|
||||
+ filesz);
|
||||
+
|
||||
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
||||
@@ -1921,6 +1950,7 @@
|
||||
Elf64_External_Phdr *phdr2p;
|
||||
gdb_byte *buf_vaddr_p, *buf_paddr_p;
|
||||
CORE_ADDR vaddr, paddr;
|
||||
+ asection *plt2_asect;
|
||||
|
||||
phdrp = &((Elf64_External_Phdr *) buf)[i];
|
||||
buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
|
||||
@@ -1946,6 +1976,34 @@
|
||||
if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
continue;
|
||||
|
||||
+ /* prelink can convert .plt SHT_NOBITS to SHT_PROGBITS. */
|
||||
+ plt2_asect = bfd_get_section_by_name (exec_bfd, ".plt");
|
||||
+ if (plt2_asect)
|
||||
+ {
|
||||
+ int content2;
|
||||
+ gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz;
|
||||
+ CORE_ADDR filesz;
|
||||
+
|
||||
+ content2 = (bfd_get_section_flags (exec_bfd, plt2_asect)
|
||||
+ & SEC_HAS_CONTENTS) != 0;
|
||||
+
|
||||
+ filesz = extract_unsigned_integer (buf_filesz_p, 8,
|
||||
+ byte_order);
|
||||
+
|
||||
+ /* PLT2_ASECT is from on-disk file (exec_bfd) while
|
||||
+ FILESZ is from the in-memory image. */
|
||||
+ if (content2)
|
||||
+ filesz += bfd_get_section_size (plt2_asect);
|
||||
+ else
|
||||
+ filesz -= bfd_get_section_size (plt2_asect);
|
||||
+
|
||||
+ store_unsigned_integer (buf_filesz_p, 8, byte_order,
|
||||
+ filesz);
|
||||
+
|
||||
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
ok = 0;
|
||||
break;
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-09/msg00321.html
|
||||
Subject: [patch] PR 12028 "GDB crashes on a double free during overload resolution"
|
||||
|
||||
old_cleanups was being set twice making the later call to
|
||||
discard_cleanups ignore the first 'make_cleanup' request.
|
||||
|
||||
The patch is proposed for both head and the 7.2 branch.
|
||||
|
||||
This has been regression tested on x8664 with gcc-4.4.4-10.fc13
|
||||
|
||||
|
||||
Fix PR 12028: "GDB crashes on a double free during overload resolution "
|
||||
|
||||
2010-09-16 Sami Wagiaalla <swagiaal@redhat.com>
|
||||
|
||||
PR C++/12028
|
||||
* valops.c (find_oload_champ_namespace_loop): removed incorrect
|
||||
'old_cleanups' reassignment.
|
||||
|
||||
2010-09-16 Sami Wagiaalla <swagiaal@redhat.com>
|
||||
|
||||
* gdb.cp/pr12028.cc: New.
|
||||
* gdb.cp/pr12028.exp: New.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr12028.cc b/gdb/testsuite/gdb.cp/pr12028.cc
|
||||
new file mode 100644
|
||||
index 0000000..0fcab6b
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr12028.cc
|
||||
@@ -0,0 +1,21 @@
|
||||
+class A{};
|
||||
+class B{};
|
||||
+class C: public B {};
|
||||
+
|
||||
+namespace D{
|
||||
+ int foo (A) { return 11; }
|
||||
+ int foo (C) { return 12; }
|
||||
+}
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ A a;
|
||||
+ B b;
|
||||
+ C c;
|
||||
+
|
||||
+ D::foo (a);
|
||||
+ // D::foo (b);
|
||||
+ D::foo (c);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp
|
||||
new file mode 100644
|
||||
index 0000000..746c6b5
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/pr12028.exp
|
||||
@@ -0,0 +1,29 @@
|
||||
+# Copyright 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile pr12028
|
||||
+set srcfile ${testfile}.cc
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+############################################
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ perror "couldn't run to breakpoint main"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_test "p D::foo(b)" "Cannot resolve function foo to any overloaded instance"
|
||||
diff --git a/gdb/valops.c b/gdb/valops.c
|
||||
index 7fbad10..4e83a04 100644
|
||||
--- a/gdb/valops.c
|
||||
+++ b/gdb/valops.c
|
||||
@@ -2715,7 +2715,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
|
||||
function symbol to start off with.) */
|
||||
|
||||
old_cleanups = make_cleanup (xfree, *oload_syms);
|
||||
- old_cleanups = make_cleanup (xfree, *oload_champ_bv);
|
||||
+ make_cleanup (xfree, *oload_champ_bv);
|
||||
new_namespace = alloca (namespace_len + 1);
|
||||
strncpy (new_namespace, qualified_name, namespace_len);
|
||||
new_namespace[namespace_len] = '\0';
|
|
@ -0,0 +1,141 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-02/msg00630.html
|
||||
Subject: [patch] [i386] Fix {,un}prelinked libraries for attach/core-load
|
||||
|
||||
Hi,
|
||||
|
||||
please see comments in the patch. The adjusted testcase FAILs on i386.
|
||||
|
||||
"Prelink", March 4, 2004 - by Jakub Jelinek:
|
||||
http://people.redhat.com/jakub/prelink.pdf
|
||||
primarily section 7 - REL to RELA conversion
|
||||
|
||||
An example of unprelinked -> prelinked library change:
|
||||
Program Headers:
|
||||
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
- LOAD 0x000000 0x00000000 0x00000000 0x00538 0x00538 R E 0x1000
|
||||
- LOAD 0x000538 0x00001538 0x00001538 0x00100 0x00110 RW 0x1000
|
||||
- DYNAMIC 0x000550 0x00001550 0x00001550 0x000c8 0x000c8 RW 0x4
|
||||
- NOTE 0x0000f4 0x000000f4 0x000000f4 0x00024 0x00024 R 0x4
|
||||
- GNU_EH_FRAME 0x0004e8 0x000004e8 0x000004e8 0x00014 0x00014 R 0x4
|
||||
+ LOAD 0x000000 0x411b3000 0x411b3000 0x00558 0x00558 R E 0x1000
|
||||
+ LOAD 0x000558 0x411b4558 0x411b4558 0x00100 0x00110 RW 0x1000
|
||||
+ DYNAMIC 0x000570 0x411b4570 0x411b4570 0x000c8 0x000c8 RW 0x4
|
||||
+ NOTE 0x0000f4 0x411b30f4 0x411b30f4 0x00024 0x00024 R 0x4
|
||||
+ GNU_EH_FRAME 0x000508 0x411b3508 0x411b3508 0x00014 0x00014 R 0x4
|
||||
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
|
||||
|
||||
So far GDB expected all such displacements will be always PAGE_SIZE aligned.
|
||||
This applies for example for re-prelinking of an already prelinked file.
|
||||
But it does not apply for prelinking of an unprelinked file or unprelinking of
|
||||
a prelinked file, there can be arbitrary displacement.
|
||||
|
||||
It affects i386 (=i686, prelink doc reports also ARM and MIPS) which uses REL.
|
||||
x86_64 always uses RELA, therefore I have not noticed it so far. i386 still
|
||||
has to be supported.
|
||||
|
||||
This affects both attachment to a PID and core file loads.
|
||||
|
||||
This applies in real world if you transfer a core file between hosts and try to
|
||||
backtrace them, libraries of both hosts may differ whether they are / are not
|
||||
prelinked.
|
||||
|
||||
I could implement some (displacement-forgiving and prelink-modifications
|
||||
forgiving) comparison of both DYNAMIC segments found. But I do not think it is
|
||||
useful, if the DYNAMIC address from linkmap vs. bfd do not match it is still a
|
||||
better chance to try a displacement to make them match. Keeping the file
|
||||
relocation cannot work anyway when the DYNAMIC address is verified as wrong.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
|
||||
|
||||
Mostly do you agree the DYNAMIC content does not have to be verifed?
|
||||
Do you have any comments on the in-code long comments?
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2011-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Fix libraries displacement if they change whether they were prelinked.
|
||||
* solib-svr4.c (LM_ADDR_CHECK): Set L_ADDR even if the DYNAMIC pointer
|
||||
does not match. Comment why.
|
||||
|
||||
gdb/testsuite/
|
||||
2011-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/break-interp-lib.c (v, vptr): New variables.
|
||||
* gdb.base/break-interp.exp (test_attach): New comment.
|
||||
|
||||
--- a/gdb/solib-svr4.c
|
||||
+++ b/gdb/solib-svr4.c
|
||||
@@ -237,11 +237,11 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
|
||||
|
||||
Even on PPC it must be zero-aligned at least for MINPAGESIZE. */
|
||||
|
||||
+ l_addr = l_dynaddr - dynaddr;
|
||||
+
|
||||
if ((l_addr & (minpagesize - 1)) == 0
|
||||
&& (l_addr & align) == ((l_dynaddr - dynaddr) & align))
|
||||
{
|
||||
- l_addr = l_dynaddr - dynaddr;
|
||||
-
|
||||
if (info_verbose)
|
||||
printf_unfiltered (_("Using PIC (Position Independent Code) "
|
||||
"prelink displacement %s for \"%s\".\n"),
|
||||
@@ -249,9 +249,20 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
|
||||
so->so_name);
|
||||
}
|
||||
else
|
||||
- warning (_(".dynamic section for \"%s\" "
|
||||
- "is not at the expected address "
|
||||
- "(wrong library or version mismatch?)"), so->so_name);
|
||||
+ {
|
||||
+ /* There is no way to verify the library file matches. prelink
|
||||
+ can during prelinking of an unprelinked file (or unprelinking
|
||||
+ of a prelinked file) shift the DYNAMIC segment by arbitrary
|
||||
+ offset without any page size alignment. There is no way to
|
||||
+ find out the ELF header and/or Program Headers for a limited
|
||||
+ verification if it they match. One could do a verification
|
||||
+ of the DYNAMIC segment. Still the found address is the best
|
||||
+ one GDB could find. */
|
||||
+
|
||||
+ warning (_(".dynamic section for \"%s\" "
|
||||
+ "is not at the expected address "
|
||||
+ "(wrong library or version mismatch?)"), so->so_name);
|
||||
+ }
|
||||
}
|
||||
|
||||
set_addr:
|
||||
--- a/gdb/testsuite/gdb.base/break-interp-lib.c
|
||||
+++ b/gdb/testsuite/gdb.base/break-interp-lib.c
|
||||
@@ -20,6 +20,10 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+/* Force REL->RELA conversion on i386, see "Prelink", March 4, 2004. */
|
||||
+volatile int v[2];
|
||||
+volatile int *vptr = &v[1];
|
||||
+
|
||||
void
|
||||
libfunc (const char *action)
|
||||
{
|
||||
--- a/gdb/testsuite/gdb.base/break-interp.exp
|
||||
+++ b/gdb/testsuite/gdb.base/break-interp.exp
|
||||
@@ -352,6 +352,14 @@ proc test_attach {file displacement {relink_args ""}} {
|
||||
# test simplicity, we merged this test and the test above by not
|
||||
# restoring $INTERP after $EXEC prelink. $INTERP gets restored
|
||||
# later below.
|
||||
+ #
|
||||
+ # `(wrong library or version mismatch?)' messages are printed for
|
||||
+ # $binfile_lib on platforms converting REL->RELA relocations by
|
||||
+ # prelink (such as on i386). There is no reliable way to verify
|
||||
+ # the library file matches the running library in such case but
|
||||
+ # GDB at least attempts to set the right displacement. We test
|
||||
+ # `libfunc' is present in the backtrace and therefore the
|
||||
+ # displacement has been guessed right.
|
||||
|
||||
if [prelink$relink $relink_args [file tail $exec]] {
|
||||
# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
|
||||
|
|
@ -0,0 +1,592 @@
|
|||
http://sourceware.org/ml/gdb-patches/2010-10/msg00175.html
|
||||
Subject: Re: [patch] python: save/restore/fix error state
|
||||
|
||||
On Fri, 08 Oct 2010 22:08:27 +0200, Doug Evans wrote:
|
||||
> The comment above this code says:
|
||||
>
|
||||
> /* Note: If an exception occurs python will print the traceback and
|
||||
> clear the error indicator. */
|
||||
>
|
||||
> ISTM that either this comment is wrong or the above patch is wrong, or
|
||||
> some combination thereof.
|
||||
|
||||
This comment is right, Python has no bug there, other gdb/python/ code has
|
||||
bugs. That is some gdb/python/ code returned success value while still
|
||||
leaving the python exception set. Such case is undefined and unchecked by
|
||||
Python. Python error state does not follow the errno POSIX semantics
|
||||
The setting of errno after a successful call to a function is
|
||||
unspecified [...].
|
||||
as Python requires instead:
|
||||
The Python error state after a successful call to a function must be
|
||||
cleared.
|
||||
|
||||
I have checked callers of these functions, as a closure on the callers of the
|
||||
top py-utils.c functions. That does not mean this Python error state handling
|
||||
verification is complete:
|
||||
python_string_to_unicode unicode_to_encoded_string
|
||||
unicode_to_encoded_python_string unicode_to_target_string
|
||||
unicode_to_target_python_string python_string_to_target_string
|
||||
python_string_to_target_python_string python_string_to_host_string
|
||||
target_string_to_unicode gdbpy_obj_to_string gdbpy_exception_to_string
|
||||
get_addr_from_python convert_value_from_python frapy_read_var
|
||||
gdbpy_get_display_hint valpy_getitem FIXME set_parameter_value
|
||||
compute_enum_values infpy_read_memory infpy_write_memory
|
||||
infpy_search_memory valpy_new valpy_call valpy_binop valpy_richcompare
|
||||
pretty_print_one_value set_attr parmpy_init
|
||||
|
||||
Therefore I have removed the check after PyRun_SimpleFile.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2010-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* python/py-breakpoint.c (bppy_set_condition): New comment.
|
||||
* python/py-cmd.c (cmdpy_function): Call also gdbpy_print_stack for
|
||||
failed PyUnicode_Decode.
|
||||
(cmdpy_completer): Skip element for failed
|
||||
python_string_to_host_string.
|
||||
(cmdpy_init): Return -1 on failed python_string_to_host_string.
|
||||
* python/py-frame.c (frapy_read_var): Extend the function comment.
|
||||
* python/py-function.c (fnpy_init): Return -1 on failed
|
||||
python_string_to_host_string.
|
||||
* python/py-inferior.c (infpy_read_memory, infpy_write_memory): Extend
|
||||
the function comment.
|
||||
(infpy_search_memory): Extend the function comment. Remove the
|
||||
PyErr_SetString call on already set error state.
|
||||
* python/py-param.c (set_parameter_value): Extend the function
|
||||
comment. Return -1 on failed python_string_to_host_string, twice.
|
||||
(set_attr): Extend the function comment.
|
||||
(compute_enum_values): Extend the function comment. New variable
|
||||
back_to. Protect self->enumeration by BACK_TO cleanups. Return 0 on
|
||||
failed python_string_to_host_string.
|
||||
(get_doc_string): Call gdbpy_print_stack on failed
|
||||
python_string_to_host_string.
|
||||
(parmpy_init): Extend the function comment.
|
||||
* python/py-prettyprint.c (pretty_print_one_value): Likewise.
|
||||
(gdbpy_get_display_hint, print_children): Call gdbpy_print_stack on
|
||||
failed python_string_to_host_string.
|
||||
* python/py-value.c (valpy_new, valpy_getitem, valpy_call)
|
||||
(valpy_binop, valpy_richcompare): Extend the function comment.
|
||||
* python/python.c
|
||||
(struct python_env) <error_type, error_value, error_traceback>: New
|
||||
fields.
|
||||
(restore_python_env): Handle PyErr_Occurred. Call PyErr_Restore.
|
||||
(ensure_python_env): Call PyErr_Fetch.
|
||||
* varobj.c (update_dynamic_varobj_children): Call gdbpy_print_stack on
|
||||
failed convert_value_from_python.
|
||||
(value_get_print_value): Call gdbpy_print_stack on failed
|
||||
python_string_to_target_python_string.
|
||||
|
||||
gdb/testsuite/
|
||||
2010-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.python/py-error.exp: New file.
|
||||
* gdb.python/py-error.py: New file.
|
||||
|
||||
Index: gdb-7.2/gdb/python/py-breakpoint.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-breakpoint.c 2010-10-12 18:27:54.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-breakpoint.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -420,6 +420,9 @@ bppy_get_condition (PyObject *self, void
|
||||
return PyString_Decode (str, strlen (str), host_charset (), NULL);
|
||||
}
|
||||
|
||||
+/* Returns 0 on success. Returns -1 on error, with a python exception set.
|
||||
+ */
|
||||
+
|
||||
static int
|
||||
bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
|
||||
{
|
||||
Index: gdb-7.2/gdb/python/py-cmd.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-cmd.c 2010-10-12 18:27:54.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-cmd.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -138,7 +138,10 @@ cmdpy_function (struct cmd_list_element
|
||||
args = "";
|
||||
argobj = PyUnicode_Decode (args, strlen (args), host_charset (), NULL);
|
||||
if (! argobj)
|
||||
- error (_("Could not convert arguments to Python string."));
|
||||
+ {
|
||||
+ gdbpy_print_stack ();
|
||||
+ error (_("Could not convert arguments to Python string."));
|
||||
+ }
|
||||
|
||||
ttyobj = from_tty ? Py_True : Py_False;
|
||||
Py_INCREF (ttyobj);
|
||||
@@ -255,6 +258,12 @@ cmdpy_completer (struct cmd_list_element
|
||||
continue;
|
||||
}
|
||||
result[out] = python_string_to_host_string (elt);
|
||||
+ if (result[out] == NULL)
|
||||
+ {
|
||||
+ /* Skip problem elements. */
|
||||
+ PyErr_Clear ();
|
||||
+ continue;
|
||||
+ }
|
||||
++out;
|
||||
}
|
||||
result[out] = NULL;
|
||||
@@ -465,7 +474,15 @@ cmdpy_init (PyObject *self, PyObject *ar
|
||||
PyObject *ds_obj = PyObject_GetAttr (self, gdbpy_doc_cst);
|
||||
|
||||
if (ds_obj && gdbpy_is_string (ds_obj))
|
||||
- docstring = python_string_to_host_string (ds_obj);
|
||||
+ {
|
||||
+ docstring = python_string_to_host_string (ds_obj);
|
||||
+ if (docstring == NULL)
|
||||
+ {
|
||||
+ xfree (cmd_name);
|
||||
+ xfree (pfx_name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
if (! docstring)
|
||||
docstring = xstrdup (_("This command is not documented."));
|
||||
Index: gdb-7.2/gdb/python/py-frame.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-frame.c 2010-06-28 23:16:03.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-frame.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -385,7 +385,8 @@ frapy_find_sal (PyObject *self, PyObject
|
||||
start the search from that block, otherwise search from the frame's
|
||||
current block (determined by examining the resume address of the
|
||||
frame). The variable argument must be a string or an instance of a
|
||||
- gdb.Symbol. The block argument must be an instance of gdb.Block. */
|
||||
+ gdb.Symbol. The block argument must be an instance of gdb.Block. Returns
|
||||
+ NULL on error, with a python exception set. */
|
||||
static PyObject *
|
||||
frapy_read_var (PyObject *self, PyObject *args)
|
||||
{
|
||||
Index: gdb-7.2/gdb/python/py-function.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-function.c 2010-05-17 23:23:25.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-function.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -113,7 +113,14 @@ fnpy_init (PyObject *self, PyObject *arg
|
||||
{
|
||||
PyObject *ds_obj = PyObject_GetAttrString (self, "__doc__");
|
||||
if (ds_obj && gdbpy_is_string (ds_obj))
|
||||
- docstring = python_string_to_host_string (ds_obj);
|
||||
+ {
|
||||
+ docstring = python_string_to_host_string (ds_obj);
|
||||
+ if (docstring == NULL)
|
||||
+ {
|
||||
+ Py_DECREF (self);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
if (! docstring)
|
||||
docstring = xstrdup (_("This function is not documented."));
|
||||
Index: gdb-7.2/gdb/python/py-inferior.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-inferior.c 2010-06-28 23:16:03.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-inferior.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -293,7 +293,8 @@ gdbpy_inferiors (PyObject *unused, PyObj
|
||||
|
||||
/* Implementation of gdb.read_memory (address, length).
|
||||
Returns a Python buffer object with LENGTH bytes of the inferior's
|
||||
- memory at ADDRESS. Both arguments are integers. */
|
||||
+ memory at ADDRESS. Both arguments are integers. Returns NULL on error,
|
||||
+ with a python exception set. */
|
||||
static PyObject *
|
||||
infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
@@ -361,7 +362,8 @@ infpy_read_memory (PyObject *self, PyObj
|
||||
Writes the contents of BUFFER (a Python object supporting the read
|
||||
buffer protocol) at ADDRESS in the inferior's memory. Write LENGTH
|
||||
bytes from BUFFER, or its entire contents if the argument is not
|
||||
- provided. The function returns nothing. */
|
||||
+ provided. The function returns nothing. Returns NULL on error, with
|
||||
+ a python exception set. */
|
||||
static PyObject *
|
||||
infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
@@ -473,7 +475,8 @@ get_char_buffer (PyObject *self, Py_ssiz
|
||||
search from ADDRESS. PATTERN is the pattern to search for (and
|
||||
must be a Python object supporting the buffer protocol).
|
||||
Returns a Python Long object holding the address where the pattern
|
||||
- was located, or if the pattern was not found, returns None. */
|
||||
+ was located, or if the pattern was not found, returns None. Returns NULL
|
||||
+ on error, with a python exception set. */
|
||||
static PyObject *
|
||||
infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
@@ -511,12 +514,7 @@ infpy_search_memory (PyObject *self, PyO
|
||||
}
|
||||
}
|
||||
else
|
||||
- {
|
||||
- PyErr_SetString (PyExc_RuntimeError,
|
||||
- _("Cannot get search address/range from Python."));
|
||||
-
|
||||
- return NULL;
|
||||
- }
|
||||
+ return NULL;
|
||||
|
||||
if (!PyObject_CheckReadBuffer (pattern))
|
||||
{
|
||||
Index: gdb-7.2/gdb/python/py-param.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-param.c 2010-05-17 23:23:25.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-param.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -110,8 +110,8 @@ get_attr (PyObject *obj, PyObject *attr_
|
||||
return PyObject_GenericGetAttr (obj, attr_name);
|
||||
}
|
||||
|
||||
-/* Set a parameter value from a Python value. Return 0 on success, -1
|
||||
- on failure. */
|
||||
+/* Set a parameter value from a Python value. Return 0 on success. Returns
|
||||
+ -1 on error, with a python exception set. */
|
||||
static int
|
||||
set_parameter_value (parmpy_object *self, PyObject *value)
|
||||
{
|
||||
@@ -142,7 +142,11 @@ set_parameter_value (parmpy_object *self
|
||||
self->value.stringval = NULL;
|
||||
}
|
||||
else
|
||||
- self->value.stringval = python_string_to_host_string (value);
|
||||
+ {
|
||||
+ self->value.stringval = python_string_to_host_string (value);
|
||||
+ if (self->value.stringval == NULL)
|
||||
+ return -1;
|
||||
+ }
|
||||
break;
|
||||
|
||||
case var_enum:
|
||||
@@ -158,6 +162,8 @@ set_parameter_value (parmpy_object *self
|
||||
}
|
||||
|
||||
str = python_string_to_host_string (value);
|
||||
+ if (str == NULL)
|
||||
+ return -1;
|
||||
for (i = 0; self->enumeration[i]; ++i)
|
||||
if (! strcmp (self->enumeration[i], str))
|
||||
break;
|
||||
@@ -258,7 +264,7 @@ set_parameter_value (parmpy_object *self
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/* Set an attribute. */
|
||||
+/* Set an attribute. Returns -1 on error, with a python exception set. */
|
||||
static int
|
||||
set_attr (PyObject *obj, PyObject *attr_name, PyObject *val)
|
||||
{
|
||||
@@ -358,12 +364,13 @@ add_setshow_generic (int parmclass, enum
|
||||
}
|
||||
}
|
||||
|
||||
-/* A helper which computes enum values. Returns 1 on success, 0 on
|
||||
- error. */
|
||||
+/* A helper which computes enum values. Returns 1 on success. Returns 0 on
|
||||
+ error, with a python exception set. */
|
||||
static int
|
||||
compute_enum_values (parmpy_object *self, PyObject *enum_values)
|
||||
{
|
||||
Py_ssize_t size, i;
|
||||
+ struct cleanup *back_to;
|
||||
|
||||
if (! enum_values)
|
||||
{
|
||||
@@ -390,6 +397,7 @@ compute_enum_values (parmpy_object *self
|
||||
}
|
||||
|
||||
self->enumeration = xmalloc ((size + 1) * sizeof (char *));
|
||||
+ back_to = make_cleanup (free_current_contents, &self->enumeration);
|
||||
memset (self->enumeration, 0, (size + 1) * sizeof (char *));
|
||||
|
||||
for (i = 0; i < size; ++i)
|
||||
@@ -397,16 +405,27 @@ compute_enum_values (parmpy_object *self
|
||||
PyObject *item = PySequence_GetItem (enum_values, i);
|
||||
|
||||
if (! item)
|
||||
- return 0;
|
||||
+ {
|
||||
+ do_cleanups (back_to);
|
||||
+ return 0;
|
||||
+ }
|
||||
if (! gdbpy_is_string (item))
|
||||
{
|
||||
+ do_cleanups (back_to);
|
||||
PyErr_SetString (PyExc_RuntimeError,
|
||||
_("The enumeration item not a string."));
|
||||
return 0;
|
||||
}
|
||||
self->enumeration[i] = python_string_to_host_string (item);
|
||||
+ if (self->enumeration[i] == NULL)
|
||||
+ {
|
||||
+ do_cleanups (back_to);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ make_cleanup (xfree, (char *) self->enumeration[i]);
|
||||
}
|
||||
|
||||
+ discard_cleanups (back_to);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -422,7 +441,11 @@ get_doc_string (PyObject *object, PyObje
|
||||
PyObject *ds_obj = PyObject_GetAttr (object, attr);
|
||||
|
||||
if (ds_obj && gdbpy_is_string (ds_obj))
|
||||
- result = python_string_to_host_string (ds_obj);
|
||||
+ {
|
||||
+ result = python_string_to_host_string (ds_obj);
|
||||
+ if (result == NULL)
|
||||
+ gdbpy_print_stack ();
|
||||
+ }
|
||||
}
|
||||
if (! result)
|
||||
result = xstrdup (_("This command is not documented."));
|
||||
@@ -449,8 +472,9 @@ get_doc_string (PyObject *object, PyObje
|
||||
|
||||
The documentation for the parameter is taken from the doc string
|
||||
for the python class.
|
||||
-
|
||||
-*/
|
||||
+
|
||||
+ Returns -1 on error, with a python exception set. */
|
||||
+
|
||||
static int
|
||||
parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
Index: gdb-7.2/gdb/python/py-prettyprint.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-prettyprint.c 2010-10-12 18:27:57.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-prettyprint.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -185,8 +185,8 @@ find_pretty_printer (PyObject *value)
|
||||
is returned. If the function returns Py_NONE that means the pretty
|
||||
printer returned the Python None as a value. Otherwise, if the
|
||||
function returns a value, *OUT_VALUE is set to the value, and NULL
|
||||
- is returned. On error, *OUT_VALUE is set to NULL, and NULL is
|
||||
- returned. */
|
||||
+ is returned. On error, *OUT_VALUE is set to NULL, NULL is
|
||||
+ returned, with a python exception set. */
|
||||
|
||||
static PyObject *
|
||||
pretty_print_one_value (PyObject *printer, struct value **out_value)
|
||||
@@ -232,7 +232,11 @@ gdbpy_get_display_hint (PyObject *printe
|
||||
if (hint)
|
||||
{
|
||||
if (gdbpy_is_string (hint))
|
||||
- result = python_string_to_host_string (hint);
|
||||
+ {
|
||||
+ result = python_string_to_host_string (hint);
|
||||
+ if (result == NULL)
|
||||
+ gdbpy_print_stack ();
|
||||
+ }
|
||||
Py_DECREF (hint);
|
||||
}
|
||||
else
|
||||
@@ -574,7 +578,10 @@ print_children (PyObject *printer, const
|
||||
else
|
||||
{
|
||||
output = python_string_to_host_string (py_v);
|
||||
- fputs_filtered (output, stream);
|
||||
+ if (!output)
|
||||
+ gdbpy_print_stack ();
|
||||
+ else
|
||||
+ fputs_filtered (output, stream);
|
||||
xfree (output);
|
||||
}
|
||||
}
|
||||
Index: gdb-7.2/gdb/python/py-value.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/py-value.c 2010-10-12 18:27:54.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/py-value.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -114,7 +114,8 @@ note_value (value_object *value_obj)
|
||||
values_in_python = value_obj;
|
||||
}
|
||||
|
||||
-/* Called when a new gdb.Value object needs to be allocated. */
|
||||
+/* Called when a new gdb.Value object needs to be allocated. Returns NULL on
|
||||
+ error, with a python exception set. */
|
||||
static PyObject *
|
||||
valpy_new (PyTypeObject *subtype, PyObject *args, PyObject *keywords)
|
||||
{
|
||||
@@ -334,7 +335,7 @@ valpy_length (PyObject *self)
|
||||
}
|
||||
|
||||
/* Given string name of an element inside structure, return its value
|
||||
- object. */
|
||||
+ object. Returns NULL on error, with a python exception set. */
|
||||
static PyObject *
|
||||
valpy_getitem (PyObject *self, PyObject *key)
|
||||
{
|
||||
@@ -468,7 +469,8 @@ enum valpy_opcode
|
||||
((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
|
||||
|
||||
/* Returns a value object which is the result of applying the operation
|
||||
- specified by OPCODE to the given arguments. */
|
||||
+ specified by OPCODE to the given arguments. Returns NULL on error, with
|
||||
+ a python exception set. */
|
||||
static PyObject *
|
||||
valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
|
||||
{
|
||||
@@ -723,7 +725,8 @@ valpy_xor (PyObject *self, PyObject *oth
|
||||
return valpy_binop (VALPY_BITXOR, self, other);
|
||||
}
|
||||
|
||||
-/* Implements comparison operations for value objects. */
|
||||
+/* Implements comparison operations for value objects. Returns NULL on error,
|
||||
+ with a python exception set. */
|
||||
static PyObject *
|
||||
valpy_richcompare (PyObject *self, PyObject *other, int op)
|
||||
{
|
||||
Index: gdb-7.2/gdb/python/python.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/python/python.c 2010-10-12 18:27:54.000000000 +0200
|
||||
+++ gdb-7.2/gdb/python/python.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -82,6 +82,7 @@ struct python_env
|
||||
PyGILState_STATE state;
|
||||
struct gdbarch *gdbarch;
|
||||
const struct language_defn *language;
|
||||
+ PyObject *error_type, *error_value, *error_traceback;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -89,6 +90,16 @@ restore_python_env (void *p)
|
||||
{
|
||||
struct python_env *env = (struct python_env *)p;
|
||||
|
||||
+ /* Leftover Python error is forbidden by Python Exception Handling. */
|
||||
+ if (PyErr_Occurred ())
|
||||
+ {
|
||||
+ /* This order is similar to the one calling error afterwards. */
|
||||
+ gdbpy_print_stack ();
|
||||
+ warning (_("internal error: Unhandled Python exception"));
|
||||
+ }
|
||||
+
|
||||
+ PyErr_Restore (env->error_type, env->error_value, env->error_traceback);
|
||||
+
|
||||
PyGILState_Release (env->state);
|
||||
python_gdbarch = env->gdbarch;
|
||||
python_language = env->language;
|
||||
@@ -111,6 +122,9 @@ ensure_python_env (struct gdbarch *gdbar
|
||||
python_gdbarch = gdbarch;
|
||||
python_language = language;
|
||||
|
||||
+ /* Save it and ensure ! PyErr_Occurred () afterwards. */
|
||||
+ PyErr_Fetch (&env->error_type, &env->error_value, &env->error_traceback);
|
||||
+
|
||||
return make_cleanup (restore_python_env, env);
|
||||
}
|
||||
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.python/py-error.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.python/py-error.exp 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -0,0 +1,56 @@
|
||||
+# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Test error while loading *-gdb.py. IBM1047 is chosen as possibly supported
|
||||
+# by glibc but unsupported by Python
|
||||
+
|
||||
+set testfile "py-error"
|
||||
+
|
||||
+load_lib gdb-python.exp
|
||||
+
|
||||
+# Start with a fresh gdb.
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+
|
||||
+# Skip all tests if Python scripting is not enabled.
|
||||
+if { [skip_python_tests] } { continue }
|
||||
+
|
||||
+set charset "IBM1047"
|
||||
+
|
||||
+set test2 "main reached"
|
||||
+
|
||||
+set test "set host-charset $charset"
|
||||
+set test_regex [string_to_regexp $test]
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "^$test_regex\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "^$test_regex\r\nUndefined item: \"$charset\"\\.\r\n$gdb_prompt $" {
|
||||
+ xfail $test
|
||||
+ untested $test2
|
||||
+ set test2 ""
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if {$test2 == ""} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
|
||||
+
|
||||
+# argc=LookupError: unknown encoding: IBM1047
|
||||
+gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2
|
||||
+
|
||||
+gdb_test "p 1" " = 1" "no delayed error"
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.python/py-error.py
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.python/py-error.py 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -0,0 +1,25 @@
|
||||
+# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+import gdb
|
||||
+
|
||||
+class ClassName(gdb.Command):
|
||||
+ 'a'
|
||||
+ def __init__(self):
|
||||
+ gdb.Command.__init__ (self, "ClassName", gdb.COMMAND_DATA, prefix=True)
|
||||
+ def invoke(self, args, from_tty):
|
||||
+ print
|
||||
+
|
||||
+ClassName()
|
||||
Index: gdb-7.2/gdb/varobj.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/varobj.c 2010-10-12 18:27:54.000000000 +0200
|
||||
+++ gdb-7.2/gdb/varobj.c 2010-10-12 18:28:58.000000000 +0200
|
||||
@@ -1054,6 +1054,8 @@ update_dynamic_varobj_children (struct v
|
||||
error (_("Invalid item from the child list"));
|
||||
|
||||
v = convert_value_from_python (py_v);
|
||||
+ if (v == NULL)
|
||||
+ gdbpy_print_stack ();
|
||||
install_dynamic_child (var, can_mention ? changed : NULL,
|
||||
can_mention ? new : NULL,
|
||||
can_mention ? unchanged : NULL,
|
||||
@@ -2542,6 +2544,8 @@ value_get_print_value (struct value *val
|
||||
type = builtin_type (gdbarch)->builtin_char;
|
||||
Py_DECREF (py_str);
|
||||
}
|
||||
+ else
|
||||
+ gdbpy_print_stack ();
|
||||
}
|
||||
Py_DECREF (output);
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
commit 6e962026419305ae6c540eb01a735cf7c2685c20
|
||||
Author: pmuldoon <pmuldoon>
|
||||
Date: Tue Aug 9 12:45:39 2011 +0000
|
||||
|
||||
2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
* 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-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
|
||||
* gdb.texinfo (Python): Document command and function
|
||||
auto-loading.
|
||||
|
||||
[ Backport for F-14.
|
||||
Drop python/python.c changes.
|
||||
Make explicit `import os'.
|
||||
Ignore: register_pretty_printer_commands()
|
||||
- Required for
|
||||
[RFA, doc RFA]: New printing module and info/disable/enable commands
|
||||
http://sourceware.org/ml/gdb-patches/2010-11/msg00001.html
|
||||
87c4cdd048cfaef8db45587bc58f06df97e992b9
|
||||
which is not present in F-14.
|
||||
]
|
||||
|
||||
### a/gdb/ChangeLog
|
||||
### b/gdb/ChangeLog
|
||||
## -1,3 +1,13 @@
|
||||
+2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
+
|
||||
+ * 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 <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full) <DWARF_VALUE_STACK>
|
||||
### a/gdb/doc/ChangeLog
|
||||
### b/gdb/doc/ChangeLog
|
||||
## -1,3 +1,8 @@
|
||||
+2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||
+
|
||||
+ * gdb.texinfo (Python): Document command and function
|
||||
+ auto-loading.
|
||||
+
|
||||
2011-07-26 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
--- ./gdb/NEWS 2011-11-10 01:05:53.963411574 +0100
|
||||
+++ ./gdb/NEWS 2011-11-10 01:09:26.457874127 +0100
|
||||
@@ -1,6 +1,13 @@
|
||||
What has changed in GDB?
|
||||
(Organized release by release)
|
||||
|
||||
+*** Changes after GDB 7.2
|
||||
+
|
||||
+** 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.
|
||||
+
|
||||
*** Changes since GDB 7.2
|
||||
|
||||
* GDB now supports thread debugging of core dumps on GNU/Linux.
|
||||
--- ./gdb/doc/gdb.texinfo 2011-11-10 01:05:53.811411957 +0100
|
||||
+++ ./gdb/doc/gdb.texinfo 2011-11-10 01:06:47.029277357 +0100
|
||||
@@ -20389,6 +20389,12 @@ the data directory as determined at @val
|
||||
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.
|
||||
--- ./gdb/python/lib/gdb/__init__.py 2011-11-10 01:05:53.528412675 +0100
|
||||
+++ ./gdb/python/lib/gdb/__init__.py 2011-11-10 01:08:24.443030975 +0100
|
||||
@@ -15,5 +15,30 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-# Load the require command by default.
|
||||
-import gdb.command.require
|
||||
+import traceback
|
||||
+import os
|
||||
+
|
||||
+# 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()
|
|
@ -0,0 +1,266 @@
|
|||
http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
|
||||
Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
|
||||
|
||||
Hi Chet,
|
||||
|
||||
FSF GDB currently ships bundled with readline-5.2 which works fine.
|
||||
But using --with-system-readline and readline-6.0-patchlevel4 has
|
||||
a regression:
|
||||
|
||||
readline-5.2: Run `gdb -nx -q' and type CTRL-C:
|
||||
(gdb) Quit
|
||||
(gdb) _
|
||||
|
||||
readline-6.0: Run `gdb -nx -q' and type CTRL-C:
|
||||
(gdb) _
|
||||
= nothing happens (it gets buffered and executed later)
|
||||
(It does also FAIL on gdb.gdb/selftest.exp.)
|
||||
|
||||
It is because GDB waits in its own poll() mainloop and readline uses via
|
||||
rl_callback_handler_install and rl_callback_handler_remove. This way the
|
||||
readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
|
||||
only stored to _rl_caught_signal but not executed.
|
||||
|
||||
Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
|
||||
_rl_handle_signal is called then the signal is still stored to
|
||||
_rl_caught_signal. In the _rl_interrupt_immediately case it should not be
|
||||
stored when it was already processed.
|
||||
|
||||
rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
|
||||
of its meaning it breaks the nest-counting of other routines which do
|
||||
`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
|
||||
creating problematic `_rl_interrupt_immediately == -1'.
|
||||
|
||||
`_rl_interrupt_immediately' is an internal variable, how it could be accessed
|
||||
by a readline application? (OK, maybe it should not be used.)
|
||||
|
||||
Attaching a current GDB-side patch but it must access readline internal
|
||||
variable _rl_caught_signal and it is generally just a workaround. Could you
|
||||
please include support for signals in this asynchronous mode in readline-6.1?
|
||||
I find it would be enough to make RL_CHECK_SIGNALS public?
|
||||
|
||||
|
||||
GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
|
||||
But this is not a patch intended to be accepted.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* config.in, configure: Regenerate.
|
||||
* configure.ac (for readline_echoing_p): Move inside $LIBS change.
|
||||
(for _rl_caught_signal): New.
|
||||
* event-loop.c: Include readline/readline.h.
|
||||
(gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
|
||||
|
||||
gdb/testsuite/
|
||||
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.gdb/selftest.exp (backtrace through signal handler): Move before
|
||||
SIGINT pass, drop the timeout case.
|
||||
(send SIGINT signal to child process): Use gdb_test.
|
||||
(backtrace through readline handler): New.
|
||||
|
||||
Index: gdb-7.2/gdb/config.in
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/config.in 2011-01-16 19:04:55.000000000 +0100
|
||||
+++ gdb-7.2/gdb/config.in 2011-01-16 19:05:01.000000000 +0100
|
||||
@@ -463,6 +463,9 @@
|
||||
/* Define to 1 if wcwidth is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_WCWIDTH
|
||||
|
||||
+/* readline-6.0 workaround of blocked signals. */
|
||||
+#undef HAVE_READLINE_CAUGHT_SIGNAL
|
||||
+
|
||||
/* Define to 1 if you have the `realpath' function. */
|
||||
#undef HAVE_REALPATH
|
||||
|
||||
Index: gdb-7.2/gdb/configure.ac
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/configure.ac 2011-01-16 19:04:57.000000000 +0100
|
||||
+++ gdb-7.2/gdb/configure.ac 2011-01-16 19:05:01.000000000 +0100
|
||||
@@ -779,17 +779,25 @@ if test "$with_system_readline" = yes; t
|
||||
# readline-6.0 started to use the name `_rl_echoing_p'.
|
||||
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
|
||||
|
||||
- AC_MSG_CHECKING([for readline_echoing_p])
|
||||
save_LIBS=$LIBS
|
||||
LIBS="$LIBS $READLINE"
|
||||
+ AC_MSG_CHECKING([for readline_echoing_p])
|
||||
AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
|
||||
return readline_echoing_p;]]),
|
||||
[READLINE_ECHOING_P=yes],
|
||||
[READLINE_ECHOING_P=no
|
||||
AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
|
||||
[readline-6.0 started to use different name.])])
|
||||
- LIBS="$save_LIBS"
|
||||
AC_MSG_RESULT([$READLINE_ECHOING_P])
|
||||
+ AC_MSG_CHECKING([for _rl_caught_signal])
|
||||
+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
|
||||
+ return _rl_caught_signal;]]),
|
||||
+ [READLINE_CAUGHT_SIGNAL=yes
|
||||
+ AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
|
||||
+ [readline-6.0 workaround of blocked signals.])],
|
||||
+ [READLINE_CAUGHT_SIGNAL=no])
|
||||
+ AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
|
||||
+ LIBS="$save_LIBS"
|
||||
else
|
||||
READLINE='$(READLINE_DIR)/libreadline.a'
|
||||
READLINE_DEPS='$(READLINE)'
|
||||
Index: gdb-7.2/gdb/event-loop.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/event-loop.c 2010-05-25 17:48:43.000000000 +0200
|
||||
+++ gdb-7.2/gdb/event-loop.c 2011-01-16 19:13:31.000000000 +0100
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "exceptions.h"
|
||||
#include "gdb_assert.h"
|
||||
#include "gdb_select.h"
|
||||
+#include "readline/readline.h"
|
||||
|
||||
/* Tell create_file_handler what events we are interested in.
|
||||
This is used by the select version of the event loop. */
|
||||
@@ -416,6 +417,9 @@ gdb_do_one_event (void *data)
|
||||
static int event_source_head = 0;
|
||||
const int number_of_sources = 3;
|
||||
int current = 0;
|
||||
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
|
||||
+ extern int volatile _rl_caught_signal;
|
||||
+#endif
|
||||
|
||||
/* Any events already waiting in the queue? */
|
||||
if (process_event ())
|
||||
@@ -460,6 +464,29 @@ gdb_do_one_event (void *data)
|
||||
if (gdb_wait_for_event (1) < 0)
|
||||
return -1;
|
||||
|
||||
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
|
||||
+ if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
|
||||
+ && _rl_caught_signal)
|
||||
+ {
|
||||
+ char *prompt;
|
||||
+
|
||||
+ if (rl_prompt == NULL)
|
||||
+ {
|
||||
+ /* Should not happen, defensive only. */
|
||||
+ prompt = "";
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ prompt = alloca (strlen (rl_prompt) + 1);
|
||||
+ strcpy (prompt, rl_prompt);
|
||||
+ }
|
||||
+
|
||||
+ /* Call RL_CHECK_SIGNALS this way. */
|
||||
+ rl_callback_handler_remove ();
|
||||
+ rl_callback_handler_install (prompt, input_handler);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/* Handle any new events occurred while waiting. */
|
||||
if (process_event ())
|
||||
return 1;
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/testsuite/gdb.gdb/selftest.exp 2011-01-16 19:04:55.000000000 +0100
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.gdb/selftest.exp 2011-01-16 19:05:01.000000000 +0100
|
||||
@@ -433,6 +433,28 @@ proc test_with_self { executable } {
|
||||
}
|
||||
}
|
||||
|
||||
+ # get a stack trace with the poll function
|
||||
+ #
|
||||
+ # This fails on some linux systems for unknown reasons. On the
|
||||
+ # systems where it fails, sometimes it works fine when run manually.
|
||||
+ # The testsuite failures may not be limited to just aout systems.
|
||||
+ setup_xfail "i*86-pc-linuxaout-gnu"
|
||||
+ set description "backtrace through signal handler"
|
||||
+ gdb_test_multiple "backtrace" "$description" {
|
||||
+ -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
|
||||
+ pass "$description"
|
||||
+ }
|
||||
+ -re ".*$gdb_prompt $" {
|
||||
+ # On the alpha, we hit the infamous problem about gdb
|
||||
+ # being unable to get the frame pointer (mentioned in
|
||||
+ # gdb/README). As it is intermittent, there is no way to
|
||||
+ # XFAIL it which will give us an XPASS if the problem goes
|
||||
+ # away.
|
||||
+ setup_xfail "alpha*-*-osf*"
|
||||
+ fail "$description"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
set description "send SIGINT signal to child process"
|
||||
gdb_test "signal SIGINT" \
|
||||
"Continuing with signal SIGINT.*" \
|
||||
@@ -443,10 +465,11 @@ proc test_with_self { executable } {
|
||||
# This fails on some linux systems for unknown reasons. On the
|
||||
# systems where it fails, sometimes it works fine when run manually.
|
||||
# The testsuite failures may not be limited to just aout systems.
|
||||
+ # Optional system readline may not have symbols to be shown.
|
||||
setup_xfail "i*86-pc-linuxaout-gnu"
|
||||
- set description "backtrace through signal handler"
|
||||
+ set description "backtrace through readline handler"
|
||||
gdb_test_multiple "backtrace" "$description" {
|
||||
- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
|
||||
+ -re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
|
||||
pass "$description"
|
||||
}
|
||||
-re ".*$gdb_prompt $" {
|
||||
Index: gdb-7.2/gdb/configure
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/configure 2011-01-16 19:04:57.000000000 +0100
|
||||
+++ gdb-7.2/gdb/configure 2011-01-16 19:05:01.000000000 +0100
|
||||
@@ -10305,10 +10305,10 @@ if test "$with_system_readline" = yes; t
|
||||
# readline-6.0 started to use the name `_rl_echoing_p'.
|
||||
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
|
||||
|
||||
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
|
||||
-$as_echo_n "checking for readline_echoing_p... " >&6; }
|
||||
save_LIBS=$LIBS
|
||||
LIBS="$LIBS $READLINE"
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
|
||||
+$as_echo_n "checking for readline_echoing_p... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
@@ -10331,9 +10331,35 @@ $as_echo "#define readline_echoing_p _rl
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
- LIBS="$save_LIBS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
|
||||
$as_echo "$READLINE_ECHOING_P" >&6; }
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
|
||||
+$as_echo_n "checking for _rl_caught_signal... " >&6; }
|
||||
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
+/* end confdefs.h. */
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+extern int volatile _rl_caught_signal;
|
||||
+ return _rl_caught_signal;
|
||||
+ ;
|
||||
+ return 0;
|
||||
+}
|
||||
+_ACEOF
|
||||
+if ac_fn_c_try_link "$LINENO"; then :
|
||||
+ READLINE_CAUGHT_SIGNAL=yes
|
||||
+
|
||||
+$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
|
||||
+
|
||||
+else
|
||||
+ READLINE_CAUGHT_SIGNAL=no
|
||||
+fi
|
||||
+rm -f core conftest.err conftest.$ac_objext \
|
||||
+ conftest$ac_exeext conftest.$ac_ext
|
||||
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
|
||||
+$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
|
||||
+ LIBS="$save_LIBS"
|
||||
else
|
||||
READLINE='$(READLINE_DIR)/libreadline.a'
|
||||
READLINE_DEPS='$(READLINE)'
|
|
@ -38,32 +38,3 @@ Index: gdb-7.0.50.20100115/gdb/corelow.c
|
|||
|
||||
static void
|
||||
build_id_locate_exec (int from_tty)
|
||||
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 22:19:27.000000000 +0100
|
||||
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 22:19:55.000000000 +0100
|
||||
@@ -1768,8 +1768,22 @@ 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);
|
||||
+ /* 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;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,757 @@
|
|||
--- ./gdb/breakpoint.c 2011-01-13 17:41:49.000000000 +0100
|
||||
+++ ./gdb/breakpoint.c 2011-01-13 21:01:03.000000000 +0100
|
||||
@@ -142,7 +142,7 @@ static void watchpoints_info (char *, in
|
||||
|
||||
static int breakpoint_1 (int, int, int (*) (const struct breakpoint *));
|
||||
|
||||
-static bpstat bpstat_alloc (const struct bp_location *, bpstat);
|
||||
+static bpstat bpstat_alloc (struct bp_location *, bpstat);
|
||||
|
||||
static int breakpoint_cond_eval (void *);
|
||||
|
||||
@@ -209,6 +209,8 @@ static int single_step_breakpoint_insert
|
||||
CORE_ADDR pc);
|
||||
|
||||
static void free_bp_location (struct bp_location *loc);
|
||||
+static void incref_bp_location (struct bp_location *loc);
|
||||
+static void decref_bp_location (struct bp_location **loc);
|
||||
|
||||
static struct bp_location *allocate_bp_location (struct breakpoint *bpt);
|
||||
|
||||
@@ -216,9 +218,6 @@ static void update_global_location_list
|
||||
|
||||
static void update_global_location_list_nothrow (int);
|
||||
|
||||
-static int bpstat_remove_bp_location_callback (struct thread_info *th,
|
||||
- void *data);
|
||||
-
|
||||
static int is_hardware_watchpoint (const struct breakpoint *bpt);
|
||||
|
||||
static int is_watchpoint (const struct breakpoint *bpt);
|
||||
@@ -2663,7 +2662,7 @@ breakpoint_init_inferior (enum inf_conte
|
||||
|
||||
/* Get rid of the moribund locations. */
|
||||
for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, bpt); ++ix)
|
||||
- free_bp_location (bpt);
|
||||
+ decref_bp_location (&bpt);
|
||||
VEC_free (bp_location_p, moribund_locations);
|
||||
}
|
||||
|
||||
@@ -2911,12 +2910,16 @@ ep_is_catchpoint (struct breakpoint *ep)
|
||||
return (ep->type == bp_catchpoint);
|
||||
}
|
||||
|
||||
-void
|
||||
+/* Frees any storage that is part of a bpstat. Does not walk the
|
||||
+ 'next' chain. */
|
||||
+
|
||||
+static void
|
||||
bpstat_free (bpstat bs)
|
||||
{
|
||||
if (bs->old_val != NULL)
|
||||
value_free (bs->old_val);
|
||||
decref_counted_command_line (&bs->commands);
|
||||
+ decref_bp_location (&bs->bp_location_at);
|
||||
xfree (bs);
|
||||
}
|
||||
|
||||
@@ -2959,6 +2962,7 @@ bpstat_copy (bpstat bs)
|
||||
tmp = (bpstat) xmalloc (sizeof (*tmp));
|
||||
memcpy (tmp, bs, sizeof (*tmp));
|
||||
incref_counted_command_line (tmp->commands);
|
||||
+ incref_bp_location (tmp->bp_location_at);
|
||||
if (bs->old_val != NULL)
|
||||
{
|
||||
tmp->old_val = value_copy (bs->old_val);
|
||||
@@ -2986,7 +2990,7 @@ bpstat_find_breakpoint (bpstat bsp, stru
|
||||
|
||||
for (; bsp != NULL; bsp = bsp->next)
|
||||
{
|
||||
- if (bsp->breakpoint_at && bsp->breakpoint_at->owner == breakpoint)
|
||||
+ if (bsp->breakpoint_at == breakpoint)
|
||||
return bsp;
|
||||
}
|
||||
return NULL;
|
||||
@@ -3013,7 +3017,7 @@ bpstat_num (bpstat *bsp, int *num)
|
||||
correspond to a single breakpoint -- otherwise,
|
||||
this function might return the same number more
|
||||
than once and this will look ugly. */
|
||||
- b = (*bsp)->breakpoint_at ? (*bsp)->breakpoint_at->owner : NULL;
|
||||
+ b = (*bsp)->breakpoint_at;
|
||||
*bsp = (*bsp)->next;
|
||||
if (b == NULL)
|
||||
return -1; /* breakpoint that's been deleted since */
|
||||
@@ -3225,13 +3229,11 @@ print_it_typical (bpstat bs)
|
||||
which has since been deleted. */
|
||||
if (bs->breakpoint_at == NULL)
|
||||
return PRINT_UNKNOWN;
|
||||
- bl = bs->breakpoint_at;
|
||||
|
||||
- /* bl->owner can be NULL if it was a momentary breakpoint
|
||||
- which has since been placed into moribund_locations. */
|
||||
- if (bl->owner == NULL)
|
||||
- return PRINT_UNKNOWN;
|
||||
- b = bl->owner;
|
||||
+ gdb_assert (bs->bp_location_at != NULL);
|
||||
+
|
||||
+ bl = bs->bp_location_at;
|
||||
+ b = bs->breakpoint_at;
|
||||
|
||||
stb = ui_out_stream_new (uiout);
|
||||
old_chain = make_cleanup_ui_out_stream_delete (stb);
|
||||
@@ -3240,7 +3242,7 @@ print_it_typical (bpstat bs)
|
||||
{
|
||||
case bp_breakpoint:
|
||||
case bp_hardware_breakpoint:
|
||||
- bp_temp = bs->breakpoint_at->owner->disposition == disp_del;
|
||||
+ bp_temp = b->disposition == disp_del;
|
||||
if (bl->address != bl->requested_address)
|
||||
breakpoint_adjustment_warning (bl->requested_address,
|
||||
bl->address,
|
||||
@@ -3431,9 +3433,8 @@ print_bp_stop_message (bpstat bs)
|
||||
|
||||
case print_it_normal:
|
||||
{
|
||||
- const struct bp_location *bl = bs->breakpoint_at;
|
||||
- struct breakpoint *b = bl ? bl->owner : NULL;
|
||||
-
|
||||
+ struct breakpoint *b = bs->breakpoint_at;
|
||||
+
|
||||
/* Normal case. Call the breakpoint's print_it method, or
|
||||
print_it_typical. */
|
||||
/* FIXME: how breakpoint can ever be NULL here? */
|
||||
@@ -3512,13 +3513,15 @@ breakpoint_cond_eval (void *exp)
|
||||
/* Allocate a new bpstat and chain it to the current one. */
|
||||
|
||||
static bpstat
|
||||
-bpstat_alloc (const struct bp_location *bl, bpstat cbs /* Current "bs" value */ )
|
||||
+bpstat_alloc (struct bp_location *bl, bpstat cbs /* Current "bs" value */ )
|
||||
{
|
||||
bpstat bs;
|
||||
|
||||
bs = (bpstat) xmalloc (sizeof (*bs));
|
||||
cbs->next = bs;
|
||||
- bs->breakpoint_at = bl;
|
||||
+ bs->breakpoint_at = bl->owner;
|
||||
+ bs->bp_location_at = bl;
|
||||
+ incref_bp_location (bl);
|
||||
/* If the condition is false, etc., don't do the commands. */
|
||||
bs->commands = NULL;
|
||||
bs->commands_left = NULL;
|
||||
@@ -3611,10 +3614,9 @@ watchpoint_check (void *p)
|
||||
struct frame_info *fr;
|
||||
int within_current_scope;
|
||||
|
||||
- /* BS is built for existing struct breakpoint. */
|
||||
+ /* BS is built from an existing struct breakpoint. */
|
||||
gdb_assert (bs->breakpoint_at != NULL);
|
||||
- gdb_assert (bs->breakpoint_at->owner != NULL);
|
||||
- b = bs->breakpoint_at->owner;
|
||||
+ b = bs->breakpoint_at;
|
||||
|
||||
gdb_assert (is_watchpoint (b));
|
||||
|
||||
@@ -3805,9 +3807,9 @@ bpstat_check_watchpoint (bpstat bs)
|
||||
struct breakpoint *b;
|
||||
|
||||
/* BS is built for existing struct breakpoint. */
|
||||
- bl = bs->breakpoint_at;
|
||||
+ bl = bs->bp_location_at;
|
||||
gdb_assert (bl != NULL);
|
||||
- b = bl->owner;
|
||||
+ b = bs->breakpoint_at;
|
||||
gdb_assert (b != NULL);
|
||||
|
||||
if (is_watchpoint (b))
|
||||
@@ -3956,6 +3958,7 @@ bpstat_check_watchpoint (bpstat bs)
|
||||
/* Check conditions (condition proper, frame, thread and ignore count)
|
||||
of breakpoint referred to by BS. If we should not stop for this
|
||||
breakpoint, set BS->stop to 0. */
|
||||
+
|
||||
static void
|
||||
bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
|
||||
{
|
||||
@@ -3964,9 +3967,9 @@ bpstat_check_breakpoint_conditions (bpst
|
||||
struct breakpoint *b;
|
||||
|
||||
/* BS is built for existing struct breakpoint. */
|
||||
- bl = bs->breakpoint_at;
|
||||
+ bl = bs->bp_location_at;
|
||||
gdb_assert (bl != NULL);
|
||||
- b = bl->owner;
|
||||
+ b = bs->breakpoint_at;
|
||||
gdb_assert (b != NULL);
|
||||
|
||||
if (frame_id_p (b->frame_id)
|
||||
@@ -3977,19 +3980,12 @@ bpstat_check_breakpoint_conditions (bpst
|
||||
int value_is_zero = 0;
|
||||
struct expression *cond;
|
||||
|
||||
- /* If this is a scope breakpoint, mark the associated
|
||||
- watchpoint as triggered so that we will handle the
|
||||
- out-of-scope event. We'll get to the watchpoint next
|
||||
- iteration. */
|
||||
- if (b->type == bp_watchpoint_scope && b->related_breakpoint != b)
|
||||
- b->related_breakpoint->watchpoint_triggered = watch_triggered_yes;
|
||||
-
|
||||
if (is_watchpoint (b))
|
||||
cond = b->cond_exp;
|
||||
else
|
||||
cond = bl->cond;
|
||||
|
||||
- if (cond && bl->owner->disposition != disp_del_at_next_stop)
|
||||
+ if (cond && b->disposition != disp_del_at_next_stop)
|
||||
{
|
||||
int within_current_scope = 1;
|
||||
|
||||
@@ -4100,10 +4096,15 @@ bpstat_stop_status (struct address_space
|
||||
bpstat bs = root_bs;
|
||||
int ix;
|
||||
int need_remove_insert;
|
||||
+ int removed_any;
|
||||
+ bpstat bs_prev;
|
||||
|
||||
- /* ALL_BP_LOCATIONS iteration would break across
|
||||
- update_global_location_list possibly executed by
|
||||
- bpstat_check_breakpoint_conditions's inferior call. */
|
||||
+ /* First, build the bpstat chain with locations that explain a
|
||||
+ target stop, while being careful to not set the target running,
|
||||
+ as that may invalidate locations (in particular watchpoint
|
||||
+ locations are recreated). Resuming will happen here with
|
||||
+ breakpoint conditions or watchpoint expressions that include
|
||||
+ inferior function calls. */
|
||||
|
||||
ALL_BREAKPOINTS (b)
|
||||
{
|
||||
@@ -4112,8 +4113,6 @@ bpstat_stop_status (struct address_space
|
||||
|
||||
for (bl = b->loc; bl != NULL; bl = bl->next)
|
||||
{
|
||||
- bpstat bs_prev = bs;
|
||||
-
|
||||
/* For hardware watchpoints, we look only at the first location.
|
||||
The watchpoint_check function will work on the entire expression,
|
||||
not the individual locations. For read watchpoints, the
|
||||
@@ -4131,27 +4130,66 @@ bpstat_stop_status (struct address_space
|
||||
/* Come here if it's a watchpoint, or if the break address matches */
|
||||
|
||||
bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
|
||||
- gdb_assert (bs_prev->next == bs);
|
||||
|
||||
- /* Assume we stop. Should we find watchpoint that is not actually
|
||||
- triggered, or if condition of breakpoint is false, we'll reset
|
||||
- 'stop' to 0. */
|
||||
+ /* Assume we stop. Should we find a watchpoint that is not
|
||||
+ actually triggered, or if the condition of the breakpoint
|
||||
+ evaluates as false, we'll reset 'stop' to 0. */
|
||||
bs->stop = 1;
|
||||
bs->print = 1;
|
||||
|
||||
- if (!bpstat_check_watchpoint (bs))
|
||||
+ /* If this is a scope breakpoint, mark the associated
|
||||
+ watchpoint as triggered so that we will handle the
|
||||
+ out-of-scope event. We'll get to the watchpoint next
|
||||
+ iteration. */
|
||||
+ if (b->type == bp_watchpoint_scope)
|
||||
+ b->related_breakpoint->watchpoint_triggered = watch_triggered_yes;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
|
||||
+ {
|
||||
+ if (breakpoint_address_match (loc->pspace->aspace, loc->address,
|
||||
+ aspace, bp_addr))
|
||||
+ {
|
||||
+ bs = bpstat_alloc (loc, bs);
|
||||
+ /* For hits of moribund locations, we should just proceed. */
|
||||
+ bs->stop = 0;
|
||||
+ bs->print = 0;
|
||||
+ bs->print_it = print_it_noop;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* Terminate the chain. */
|
||||
+ bs->next = NULL;
|
||||
+
|
||||
+ /* Now go through the locations that caused the target to stop, and
|
||||
+ check whether we're interested in reporting this stop to higher
|
||||
+ layers, or whether we should resume the target transparently. */
|
||||
+
|
||||
+ removed_any = 0;
|
||||
+
|
||||
+ bs_prev = root_bs;
|
||||
+ for (bs = root_bs->next; bs != NULL; bs_prev = bs, bs = bs->next)
|
||||
+ {
|
||||
+ if (!bs->stop)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!bpstat_check_watchpoint (bs) && bs->print_it == print_it_noop
|
||||
+ && !bs->stop)
|
||||
{
|
||||
/* Ensure bpstat_explains_signal stays false if this BL could not be
|
||||
the cause of this trap. */
|
||||
|
||||
- gdb_assert (bs->print_it == print_it_noop);
|
||||
- gdb_assert (!bs->stop);
|
||||
+// gdb_assert (bs->print_it == print_it_noop);
|
||||
+// gdb_assert (!bs->stop);
|
||||
+ bs_prev->next = bs->next;
|
||||
xfree (bs);
|
||||
bs = bs_prev;
|
||||
- bs->next = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
+ b = bs->breakpoint_at;
|
||||
+
|
||||
if (b->type == bp_thread_event || b->type == bp_overlay_event
|
||||
|| b->type == bp_longjmp_master
|
||||
|| b->type == bp_std_terminate_master
|
||||
@@ -4160,7 +4198,7 @@ bpstat_stop_status (struct address_space
|
||||
bs->stop = 0;
|
||||
else
|
||||
bpstat_check_breakpoint_conditions (bs, ptid);
|
||||
-
|
||||
+
|
||||
if (bs->stop)
|
||||
{
|
||||
++(b->hit_count);
|
||||
@@ -4170,7 +4208,7 @@ bpstat_stop_status (struct address_space
|
||||
{
|
||||
if (b->enable_state != bp_permanent)
|
||||
b->enable_state = bp_disabled;
|
||||
- update_global_location_list (0);
|
||||
+ removed_any = 1;
|
||||
}
|
||||
if (b->silent)
|
||||
bs->print = 0;
|
||||
@@ -4191,24 +4229,8 @@ bpstat_stop_status (struct address_space
|
||||
/* Print nothing for this entry if we dont stop or dont print. */
|
||||
if (bs->stop == 0 || bs->print == 0)
|
||||
bs->print_it = print_it_noop;
|
||||
- }
|
||||
}
|
||||
|
||||
- for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
|
||||
- {
|
||||
- if (breakpoint_address_match (loc->pspace->aspace, loc->address,
|
||||
- aspace, bp_addr))
|
||||
- {
|
||||
- bs = bpstat_alloc (loc, bs);
|
||||
- /* For hits of moribund locations, we should just proceed. */
|
||||
- bs->stop = 0;
|
||||
- bs->print = 0;
|
||||
- bs->print_it = print_it_noop;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- bs->next = NULL; /* Terminate the chain */
|
||||
-
|
||||
/* If we aren't stopping, the value of some hardware watchpoint may
|
||||
not have changed, but the intermediate memory locations we are
|
||||
watching may have. Don't bother if we're stopping; this will get
|
||||
@@ -4217,18 +4239,17 @@ bpstat_stop_status (struct address_space
|
||||
if (! bpstat_causes_stop (root_bs->next))
|
||||
for (bs = root_bs->next; bs != NULL; bs = bs->next)
|
||||
if (!bs->stop
|
||||
- && bs->breakpoint_at->owner
|
||||
- && is_hardware_watchpoint (bs->breakpoint_at->owner))
|
||||
+ && bs->breakpoint_at
|
||||
+ && is_hardware_watchpoint (bs->breakpoint_at))
|
||||
{
|
||||
- update_watchpoint (bs->breakpoint_at->owner, 0 /* don't reparse. */);
|
||||
- /* Updating watchpoints invalidates bs->breakpoint_at.
|
||||
- Prevent further code from trying to use it. */
|
||||
- bs->breakpoint_at = NULL;
|
||||
+ update_watchpoint (bs->breakpoint_at, 0 /* don't reparse. */);
|
||||
need_remove_insert = 1;
|
||||
}
|
||||
|
||||
if (need_remove_insert)
|
||||
update_global_location_list (1);
|
||||
+ else if (removed_any)
|
||||
+ update_global_location_list (0);
|
||||
|
||||
return root_bs->next;
|
||||
}
|
||||
@@ -4283,10 +4304,10 @@ bpstat_what (bpstat bs_head)
|
||||
breakpoint which has since been deleted. */
|
||||
bptype = bp_none;
|
||||
}
|
||||
- else if (bs->breakpoint_at->owner == NULL)
|
||||
+ else if (bs->breakpoint_at == NULL)
|
||||
bptype = bp_none;
|
||||
else
|
||||
- bptype = bs->breakpoint_at->owner->type;
|
||||
+ bptype = bs->breakpoint_at->type;
|
||||
|
||||
switch (bptype)
|
||||
{
|
||||
@@ -4326,13 +4347,13 @@ bpstat_what (bpstat bs_head)
|
||||
case bp_longjmp:
|
||||
case bp_exception:
|
||||
this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME;
|
||||
- retval.is_longjmp = bs->breakpoint_at->owner->type == bp_longjmp;
|
||||
+ retval.is_longjmp = bs->breakpoint_at->type == bp_longjmp;
|
||||
break;
|
||||
case bp_longjmp_resume:
|
||||
case bp_exception_resume:
|
||||
this_action = BPSTAT_WHAT_CLEAR_LONGJMP_RESUME;
|
||||
retval.is_longjmp
|
||||
- = bs->breakpoint_at->owner->type == bp_longjmp_resume;
|
||||
+ = bs->breakpoint_at->type == bp_longjmp_resume;
|
||||
break;
|
||||
case bp_step_resume:
|
||||
if (bs->stop)
|
||||
@@ -4456,15 +4477,13 @@ bpstat_what (bpstat bs_head)
|
||||
{
|
||||
if (bs->breakpoint_at == NULL)
|
||||
continue;
|
||||
- if (bs->breakpoint_at->owner == NULL)
|
||||
- continue;
|
||||
- switch (bs->breakpoint_at->owner->type)
|
||||
+ switch (bs->breakpoint_at->type)
|
||||
{
|
||||
case bp_gnu_ifunc_resolver:
|
||||
- gnu_ifunc_resolver_stop (bs->breakpoint_at->owner);
|
||||
+ gnu_ifunc_resolver_stop (bs->breakpoint_at);
|
||||
break;
|
||||
case bp_gnu_ifunc_resolver_return:
|
||||
- gnu_ifunc_resolver_return_stop (bs->breakpoint_at->owner);
|
||||
+ gnu_ifunc_resolver_return_stop (bs->breakpoint_at);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5500,32 +5519,41 @@ allocate_bp_location (struct breakpoint
|
||||
internal_error (__FILE__, __LINE__, _("unknown breakpoint type"));
|
||||
}
|
||||
|
||||
+ loc->refc = 1;
|
||||
return loc;
|
||||
}
|
||||
|
||||
-static void free_bp_location (struct bp_location *loc)
|
||||
+static void
|
||||
+free_bp_location (struct bp_location *loc)
|
||||
{
|
||||
- /* Be sure no bpstat's are pointing at it after it's been freed. */
|
||||
- /* FIXME, how can we find all bpstat's?
|
||||
- We just check stop_bpstat for now. Note that we cannot just
|
||||
- remove bpstats pointing at bpt from the stop_bpstat list
|
||||
- entirely, as breakpoint commands are associated with the bpstat;
|
||||
- if we remove it here, then the later call to
|
||||
- bpstat_do_actions (&stop_bpstat);
|
||||
- in event-top.c won't do anything, and temporary breakpoints
|
||||
- with commands won't work. */
|
||||
-
|
||||
- iterate_over_threads (bpstat_remove_bp_location_callback, loc);
|
||||
-
|
||||
if (loc->cond)
|
||||
xfree (loc->cond);
|
||||
|
||||
if (loc->function_name)
|
||||
xfree (loc->function_name);
|
||||
-
|
||||
+
|
||||
xfree (loc);
|
||||
}
|
||||
|
||||
+/* Increment reference count. */
|
||||
+
|
||||
+static void
|
||||
+incref_bp_location (struct bp_location *bl)
|
||||
+{
|
||||
+ ++bl->refc;
|
||||
+}
|
||||
+
|
||||
+/* Decrement reference count. If the reference count reaches 0,
|
||||
+ destroy the bp_location. Sets *BLP to NULL. */
|
||||
+
|
||||
+static void
|
||||
+decref_bp_location (struct bp_location **blp)
|
||||
+{
|
||||
+ if (--(*blp)->refc == 0)
|
||||
+ free_bp_location (*blp);
|
||||
+ *blp = NULL;
|
||||
+}
|
||||
+
|
||||
/* Helper to set_raw_breakpoint below. Creates a breakpoint
|
||||
that has type BPTYPE and has no locations as yet. */
|
||||
/* This function is used in gdbtk sources and thus can not be made static. */
|
||||
@@ -9276,11 +9304,10 @@ breakpoint_auto_delete (bpstat bs)
|
||||
struct breakpoint *b, *temp;
|
||||
|
||||
for (; bs; bs = bs->next)
|
||||
- if (bs->breakpoint_at
|
||||
- && bs->breakpoint_at->owner
|
||||
- && bs->breakpoint_at->owner->disposition == disp_del
|
||||
+ if (bs->breakpoint_at
|
||||
+ && bs->breakpoint_at->disposition == disp_del
|
||||
&& bs->stop)
|
||||
- delete_breakpoint (bs->breakpoint_at->owner);
|
||||
+ delete_breakpoint (bs->breakpoint_at);
|
||||
|
||||
ALL_BREAKPOINTS_SAFE (b, temp)
|
||||
{
|
||||
@@ -9593,7 +9620,10 @@ update_global_location_list (int should_
|
||||
VEC_safe_push (bp_location_p, moribund_locations, old_loc);
|
||||
}
|
||||
else
|
||||
- free_bp_location (old_loc);
|
||||
+ {
|
||||
+ old_loc->owner = NULL;
|
||||
+ decref_bp_location (&old_loc);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9676,7 +9706,7 @@ breakpoint_retire_moribund (void)
|
||||
for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
|
||||
if (--(loc->events_till_retirement) == 0)
|
||||
{
|
||||
- free_bp_location (loc);
|
||||
+ decref_bp_location (&loc);
|
||||
VEC_unordered_remove (bp_location_p, moribund_locations, ix);
|
||||
--ix;
|
||||
}
|
||||
@@ -9691,14 +9721,15 @@ update_global_location_list_nothrow (int
|
||||
update_global_location_list (inserting);
|
||||
}
|
||||
|
||||
-/* Clear LOC from a BPS. */
|
||||
+/* Clear BKP from a BPS. */
|
||||
+
|
||||
static void
|
||||
-bpstat_remove_bp_location (bpstat bps, struct bp_location *loc)
|
||||
+bpstat_remove_bp_location (bpstat bps, struct breakpoint *bpt)
|
||||
{
|
||||
bpstat bs;
|
||||
|
||||
for (bs = bps; bs; bs = bs->next)
|
||||
- if (bs->breakpoint_at == loc)
|
||||
+ if (bs->breakpoint_at == bpt)
|
||||
{
|
||||
bs->breakpoint_at = NULL;
|
||||
bs->old_val = NULL;
|
||||
@@ -9708,16 +9739,16 @@ bpstat_remove_bp_location (bpstat bps, s
|
||||
|
||||
/* Callback for iterate_over_threads. */
|
||||
static int
|
||||
-bpstat_remove_bp_location_callback (struct thread_info *th, void *data)
|
||||
+bpstat_remove_breakpoint_callback (struct thread_info *th, void *data)
|
||||
{
|
||||
- struct bp_location *loc = data;
|
||||
+ struct breakpoint *bpt = data;
|
||||
|
||||
- bpstat_remove_bp_location (th->stop_bpstat, loc);
|
||||
+ bpstat_remove_bp_location (th->stop_bpstat, bpt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Delete a breakpoint and clean up all traces of it in the data
|
||||
- structures. */
|
||||
+ structures. */
|
||||
|
||||
void
|
||||
delete_breakpoint (struct breakpoint *bpt)
|
||||
@@ -9785,6 +9816,19 @@ delete_breakpoint (struct breakpoint *bp
|
||||
xfree (bpt->exec_pathname);
|
||||
clean_up_filters (&bpt->syscalls_to_be_caught);
|
||||
|
||||
+
|
||||
+ /* Be sure no bpstat's are pointing at the breakpoint after it's
|
||||
+ been freed. */
|
||||
+ /* FIXME, how can we find all bpstat's? We just check stop_bpstat
|
||||
+ in all threeds for now. Note that we cannot just remove bpstats
|
||||
+ pointing at bpt from the stop_bpstat list entirely, as breakpoint
|
||||
+ commands are associated with the bpstat; if we remove it here,
|
||||
+ then the later call to bpstat_do_actions (&stop_bpstat); in
|
||||
+ event-top.c won't do anything, and temporary breakpoints with
|
||||
+ commands won't work. */
|
||||
+
|
||||
+ iterate_over_threads (bpstat_remove_breakpoint_callback, bpt);
|
||||
+
|
||||
/* Now that breakpoint is removed from breakpoint
|
||||
list, update the global location list. This
|
||||
will remove locations that used to belong to
|
||||
--- ./gdb/breakpoint.h 2011-01-13 17:41:49.000000000 +0100
|
||||
+++ ./gdb/breakpoint.h 2011-01-13 18:13:40.000000000 +0100
|
||||
@@ -253,13 +253,18 @@ struct bp_location
|
||||
the same parent breakpoint. */
|
||||
struct bp_location *next;
|
||||
|
||||
+ /* The reference count. */
|
||||
+ int refc;
|
||||
+
|
||||
/* Type of this breakpoint location. */
|
||||
enum bp_loc_type loc_type;
|
||||
|
||||
/* Each breakpoint location must belong to exactly one higher-level
|
||||
- breakpoint. This and the DUPLICATE flag are more straightforward
|
||||
- than reference counting. This pointer is NULL iff this bp_location is in
|
||||
- (and therefore only in) moribund_locations. */
|
||||
+ breakpoint. This pointer is NULL iff this bp_location is no
|
||||
+ longer attached to a breakpoint. For example, when a breakpoint
|
||||
+ is deleted, its locations may still be found in the
|
||||
+ moribund_locations list, or if we had stopped for it, in
|
||||
+ bpstats. */
|
||||
struct breakpoint *owner;
|
||||
|
||||
/* Conditional. Break only if this expression's value is nonzero.
|
||||
@@ -573,10 +578,6 @@ DEF_VEC_P(breakpoint_p);
|
||||
|
||||
typedef struct bpstats *bpstat;
|
||||
|
||||
-/* Frees any storage that is part of a bpstat.
|
||||
- Does not walk the 'next' chain. */
|
||||
-extern void bpstat_free (bpstat);
|
||||
-
|
||||
/* Clears a chain of bpstat, freeing storage
|
||||
of each. */
|
||||
extern void bpstat_clear (bpstat *);
|
||||
@@ -745,16 +746,41 @@ enum bp_print_how
|
||||
|
||||
struct bpstats
|
||||
{
|
||||
- /* Linked list because there can be two breakpoints at the same
|
||||
- place, and a bpstat reflects the fact that both have been hit. */
|
||||
+ /* Linked list because there can be more than one breakpoint at
|
||||
+ the same place, and a bpstat reflects the fact that all have
|
||||
+ been hit. */
|
||||
bpstat next;
|
||||
- /* Breakpoint that we are at. */
|
||||
- const struct bp_location *breakpoint_at;
|
||||
+
|
||||
+ /* Location that caused the stop. Locations are refcounted, so
|
||||
+ this will never be NULL. Note that this location may end up
|
||||
+ detached from a breakpoint, but that does not necessary mean
|
||||
+ that the struct breakpoint is gone. E.g., consider a
|
||||
+ watchpoint with a condition that involves an inferior function
|
||||
+ call. Watchpoint locations are recreated often (on resumes,
|
||||
+ hence on infcalls too). Between creating the bpstat and after
|
||||
+ evaluating the watchpoint condition, this location may hence
|
||||
+ end up detached from its original owner watchpoint, even though
|
||||
+ the watchpoint is still listed. If it's condition evaluates as
|
||||
+ true, we still want this location to cause a stop, and we will
|
||||
+ still need to know which watchpoint it was originally attached.
|
||||
+ What this means is that we should not (in most cases) follow
|
||||
+ the `bpstat->bp_location->owner' link, but instead use the
|
||||
+ `breakpoint_at' field below. */
|
||||
+ struct bp_location *bp_location_at;
|
||||
+
|
||||
+ /* Breakpoint that caused the stop. This is nullified if the
|
||||
+ breakpoint ends up being deleted. See comments on
|
||||
+ `bp_location_at' above for why do we need this field instead of
|
||||
+ following the location's owner. */
|
||||
+ struct breakpoint *breakpoint_at;
|
||||
+
|
||||
/* The associated command list. */
|
||||
struct counted_command_line *commands;
|
||||
+
|
||||
/* Commands left to be done. This points somewhere in
|
||||
base_command. */
|
||||
struct command_line *commands_left;
|
||||
+
|
||||
/* Old value associated with a watchpoint. */
|
||||
struct value *old_val;
|
||||
|
||||
--- ./gdb/testsuite/gdb.base/watch-cond-infcall.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.base/watch-cond-infcall.c 2011-01-13 18:13:40.000000000 +0100
|
||||
@@ -0,0 +1,33 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+volatile int var;
|
||||
+
|
||||
+int
|
||||
+return_1 (void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main(void)
|
||||
+{
|
||||
+ var++;
|
||||
+ var++; /* watchpoint-stop */
|
||||
+
|
||||
+ return 0; /* break-at-exit */
|
||||
+}
|
||||
--- ./gdb/testsuite/gdb.base/watch-cond-infcall.exp 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.base/watch-cond-infcall.exp 2011-01-13 18:13:40.000000000 +0100
|
||||
@@ -0,0 +1,61 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Test for watchpoints with conditions that involve inferior function
|
||||
+# calls.
|
||||
+
|
||||
+set testfile "watch-cond-infcall"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+
|
||||
+if { [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+proc test_watchpoint { hw teststr } {
|
||||
+ global testfile
|
||||
+ global pf_prefix
|
||||
+
|
||||
+ set old_pf_prefix $pf_prefix
|
||||
+ lappend pf_prefix "$teststr:"
|
||||
+
|
||||
+ clean_restart ${testfile}
|
||||
+
|
||||
+ if { ![runto main] } then {
|
||||
+ fail "run to main"
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
+ if { ! $hw } {
|
||||
+ gdb_test_no_output "set can-use-hw-watchpoints 0" ""
|
||||
+ }
|
||||
+
|
||||
+ gdb_test "watch var if return_1 ()" "atchpoint .*: var"
|
||||
+
|
||||
+ gdb_breakpoint [gdb_get_line_number "break-at-exit"]
|
||||
+
|
||||
+ gdb_test "continue" \
|
||||
+ "atchpoint \[0-9\]+: var\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*watchpoint-stop.*" \
|
||||
+ "continue"
|
||||
+
|
||||
+ set pf_prefix $old_pf_prefix
|
||||
+}
|
||||
+
|
||||
+if { ![target_info exists gdb,no_hardware_watchpoints] } {
|
||||
+ test_watchpoint 1 "hw"
|
||||
+}
|
||||
+
|
||||
+test_watchpoint 0 "sw"
|
|
@ -0,0 +1,11 @@
|
|||
--- ./gdb/testsuite/gdb.cp/infcall-dlopen.exp.orig 2011-01-13 21:16:47.000000000 +0100
|
||||
+++ ./gdb/testsuite/gdb.cp/infcall-dlopen.exp 2011-01-13 21:17:19.000000000 +0100
|
||||
@@ -40,6 +40,8 @@ if { ![runto_main] } {
|
||||
|
||||
for {set i 0} {$i < 10} {incr i} {
|
||||
gdb_test "p openlib (\"${libfile}\")" " = 1" "test $i"
|
||||
+ # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=660197
|
||||
+ gdb_test "info program" "\r\nProgram stopped at .*\r\nIt stopped at breakpoint 1\\." "test $i info program"
|
||||
# Try to exploit the GDB trashed memory.
|
||||
gdb_test "b openlib" {Breakpoint [0-9]+ at .*} "test $i stub 1"
|
||||
gdb_test_no_output {delete $bpnum} "test $i stub 2"
|
|
@ -0,0 +1,887 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-07/msg00184.html
|
||||
240d54e9507a9f69b59fe6dc8579a6459dded8b6
|
||||
|
||||
### src/gdb/ChangeLog 2010/07/28 12:08:19 1.12035
|
||||
### src/gdb/ChangeLog 2010/07/28 16:23:54 1.12036
|
||||
## -1,3 +1,36 @@
|
||||
+2010-07-28 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ PR c++/9946:
|
||||
+ * symfile.c (reread_symbols): Clear template_symbols.
|
||||
+ * symtab.h (struct symbol) <is_cplus_template_function>: New
|
||||
+ field.
|
||||
+ (SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION): New macro.
|
||||
+ (struct template_symbol): New.
|
||||
+ * symtab.c (lookup_symbol_aux_local): Use
|
||||
+ cp_lookup_symbol_imports_or_template.
|
||||
+ * objfiles.h (struct objfile) <template_symbols>: New field.
|
||||
+ * objfiles.c (relocate_one_symbol): New function.
|
||||
+ (objfile_relocate1): Use it. Relocate isolated symbols.
|
||||
+ * gdbtypes.h (struct cplus_struct_type) <n_template_arguments,
|
||||
+ template_arguments>: New fields.
|
||||
+ (TYPE_N_TEMPLATE_ARGUMENTS): New macro.
|
||||
+ (TYPE_TEMPLATE_ARGUMENTS): Likewise.
|
||||
+ (TYPE_TEMPLATE_ARGUMENT): Likewise.
|
||||
+ (lookup_typename): Update.
|
||||
+ * gdbtypes.c (lookup_typename): Constify "block" argument.
|
||||
+ * dwarf2read.c: Include vec.h.
|
||||
+ (symbolp): New typedef.
|
||||
+ (read_func_scope): Read template arguments. Allocate a
|
||||
+ template_symbol when needed.
|
||||
+ (read_structure_type): Read template arguments.
|
||||
+ (new_symbol_full): New function, from new_symbol. Handle
|
||||
+ DW_TAG_template_type_param and DW_TAG_template_value_param.
|
||||
+ (new_symbol): Rewrite as wrapper.
|
||||
+ * cp-support.h (cp_lookup_symbol_imports_or_template): Declare.
|
||||
+ * cp-namespace.c: Include language.h.
|
||||
+ (search_symbol_list): New function.
|
||||
+ (cp_lookup_symbol_imports_or_template): Likewise.
|
||||
+
|
||||
2010-07-28 Balazs Kezes <rlblaster@gmail.com>
|
||||
|
||||
* tui/tui-win.c (make_visible_with_new_height): Resize and move
|
||||
Index: gdb-7.2/gdb/cp-namespace.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/cp-namespace.c 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/cp-namespace.c 2011-01-01 17:52:44.000000000 +0100
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "command.h"
|
||||
#include "frame.h"
|
||||
#include "buildsym.h"
|
||||
+#include "language.h"
|
||||
|
||||
static struct symbol *lookup_namespace_scope (const char *name,
|
||||
const struct block *block,
|
||||
@@ -412,6 +413,93 @@ cp_lookup_symbol_imports (const char *sc
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+/* Helper function that searches an array of symbols for one named
|
||||
+ NAME. */
|
||||
+
|
||||
+static struct symbol *
|
||||
+search_symbol_list (const char *name, int num, struct symbol **syms)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ /* Maybe we should store a dictionary in here instead. */
|
||||
+ for (i = 0; i < num; ++i)
|
||||
+ {
|
||||
+ if (strcmp (name, SYMBOL_NATURAL_NAME (syms[i])) == 0)
|
||||
+ return syms[i];
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Like cp_lookup_symbol_imports, but if BLOCK is a function, it
|
||||
+ searches through the template parameters of the function and the
|
||||
+ function's type. */
|
||||
+
|
||||
+struct symbol *
|
||||
+cp_lookup_symbol_imports_or_template (const char *scope,
|
||||
+ const char *name,
|
||||
+ const struct block *block,
|
||||
+ const domain_enum domain)
|
||||
+{
|
||||
+ struct symbol *function = BLOCK_FUNCTION (block);
|
||||
+
|
||||
+ if (function != NULL && SYMBOL_LANGUAGE (function) == language_cplus)
|
||||
+ {
|
||||
+ int i;
|
||||
+
|
||||
+ /* Search the function's template parameters. */
|
||||
+ if (SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION (function))
|
||||
+ {
|
||||
+ struct template_symbol *templ = (struct template_symbol *) function;
|
||||
+ struct symbol *result;
|
||||
+
|
||||
+ result = search_symbol_list (name,
|
||||
+ templ->n_template_arguments,
|
||||
+ templ->template_arguments);
|
||||
+ if (result != NULL)
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ /* Search the template parameters of the function's defining
|
||||
+ context. */
|
||||
+ if (SYMBOL_NATURAL_NAME (function))
|
||||
+ {
|
||||
+ struct type *context;
|
||||
+ char *name_copy = xstrdup (SYMBOL_NATURAL_NAME (function));
|
||||
+ struct cleanup *cleanups = make_cleanup (xfree, name_copy);
|
||||
+ const struct language_defn *lang = language_def (language_cplus);
|
||||
+ struct gdbarch *arch = SYMBOL_SYMTAB (function)->objfile->gdbarch;
|
||||
+ const struct block *parent = BLOCK_SUPERBLOCK (block);
|
||||
+
|
||||
+ while (1)
|
||||
+ {
|
||||
+ struct symbol *result;
|
||||
+ unsigned int prefix_len = cp_entire_prefix_len (name_copy);
|
||||
+
|
||||
+ if (prefix_len == 0)
|
||||
+ context = NULL;
|
||||
+ else
|
||||
+ {
|
||||
+ name_copy[prefix_len] = '\0';
|
||||
+ context = lookup_typename (lang, arch, name_copy, parent, 1);
|
||||
+ }
|
||||
+
|
||||
+ if (context == NULL)
|
||||
+ break;
|
||||
+
|
||||
+ result = search_symbol_list (name,
|
||||
+ TYPE_N_TEMPLATE_ARGUMENTS (context),
|
||||
+ TYPE_TEMPLATE_ARGUMENTS (context));
|
||||
+ if (result != NULL)
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ do_cleanups (cleanups);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return cp_lookup_symbol_imports (scope, name, block, domain, 1, 1);
|
||||
+}
|
||||
+
|
||||
/* Searches for NAME in the current namespace, and by applying relevant import
|
||||
statements belonging to BLOCK and its parents. SCOPE is the namespace scope
|
||||
of the context in which the search is being evaluated. */
|
||||
Index: gdb-7.2/gdb/cp-support.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/cp-support.h 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/cp-support.h 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -158,6 +158,12 @@ extern struct symbol *cp_lookup_symbol_i
|
||||
const int declaration_only,
|
||||
const int search_parents);
|
||||
|
||||
+extern struct symbol *cp_lookup_symbol_imports_or_template
|
||||
+ (const char *scope,
|
||||
+ const char *name,
|
||||
+ const struct block *block,
|
||||
+ const domain_enum domain);
|
||||
+
|
||||
extern struct type *cp_lookup_nested_type (struct type *parent_type,
|
||||
const char *nested_name,
|
||||
const struct block *block);
|
||||
Index: gdb-7.2/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/dwarf2read.c 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2011-01-01 17:52:36.000000000 +0100
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "gdb_stat.h"
|
||||
#include "completer.h"
|
||||
#include "top.h"
|
||||
+#include "vec.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include "gdb_string.h"
|
||||
@@ -70,6 +71,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+typedef struct symbol *symbolp;
|
||||
+DEF_VEC_P (symbolp);
|
||||
+
|
||||
#if 0
|
||||
/* .debug_info header for a compilation unit
|
||||
Because of alignment constraints, this structure has padding and cannot
|
||||
@@ -999,6 +1003,9 @@ static void dwarf2_start_subfile (char *
|
||||
static struct symbol *new_symbol (struct die_info *, struct type *,
|
||||
struct dwarf2_cu *);
|
||||
|
||||
+static struct symbol *new_symbol_full (struct die_info *, struct type *,
|
||||
+ struct dwarf2_cu *, struct symbol *);
|
||||
+
|
||||
static void dwarf2_const_value (struct attribute *, struct symbol *,
|
||||
struct dwarf2_cu *);
|
||||
|
||||
@@ -5144,6 +5151,8 @@ read_func_scope (struct die_info *die, s
|
||||
CORE_ADDR baseaddr;
|
||||
struct block *block;
|
||||
int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
|
||||
+ VEC (symbolp) *template_args = NULL;
|
||||
+ struct template_symbol *templ_func = NULL;
|
||||
|
||||
if (inlined_func)
|
||||
{
|
||||
@@ -5189,8 +5198,23 @@ read_func_scope (struct die_info *die, s
|
||||
/* Record the function range for dwarf_decode_lines. */
|
||||
add_to_cu_func_list (name, lowpc, highpc, cu);
|
||||
|
||||
+ /* If we have any template arguments, then we must allocate a
|
||||
+ different sort of symbol. */
|
||||
+ for (child_die = die->child; child_die; child_die = sibling_die (child_die))
|
||||
+ {
|
||||
+ if (child_die->tag == DW_TAG_template_type_param
|
||||
+ || child_die->tag == DW_TAG_template_value_param)
|
||||
+ {
|
||||
+ templ_func = OBSTACK_ZALLOC (&objfile->objfile_obstack,
|
||||
+ struct template_symbol);
|
||||
+ templ_func->base.is_cplus_template_function = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
new = push_context (0, lowpc);
|
||||
- new->name = new_symbol (die, read_type_die (die, cu), cu);
|
||||
+ new->name = new_symbol_full (die, read_type_die (die, cu), cu,
|
||||
+ (struct symbol *) templ_func);
|
||||
|
||||
/* If there is a location expression for DW_AT_frame_base, record
|
||||
it. */
|
||||
@@ -5214,7 +5238,15 @@ read_func_scope (struct die_info *die, s
|
||||
child_die = die->child;
|
||||
while (child_die && child_die->tag)
|
||||
{
|
||||
- process_die (child_die, cu);
|
||||
+ if (child_die->tag == DW_TAG_template_type_param
|
||||
+ || child_die->tag == DW_TAG_template_value_param)
|
||||
+ {
|
||||
+ struct symbol *arg = new_symbol (child_die, NULL, cu);
|
||||
+
|
||||
+ VEC_safe_push (symbolp, template_args, arg);
|
||||
+ }
|
||||
+ else
|
||||
+ process_die (child_die, cu);
|
||||
child_die = sibling_die (child_die);
|
||||
}
|
||||
}
|
||||
@@ -5260,6 +5292,22 @@ read_func_scope (struct die_info *die, s
|
||||
/* If we have address ranges, record them. */
|
||||
dwarf2_record_block_ranges (die, block, baseaddr, cu);
|
||||
|
||||
+ /* Attach template arguments to function. */
|
||||
+ if (! VEC_empty (symbolp, template_args))
|
||||
+ {
|
||||
+ gdb_assert (templ_func != NULL);
|
||||
+
|
||||
+ templ_func->n_template_arguments = VEC_length (symbolp, template_args);
|
||||
+ templ_func->template_arguments
|
||||
+ = obstack_alloc (&objfile->objfile_obstack,
|
||||
+ (templ_func->n_template_arguments
|
||||
+ * sizeof (struct symbol *)));
|
||||
+ memcpy (templ_func->template_arguments,
|
||||
+ VEC_address (symbolp, template_args),
|
||||
+ (templ_func->n_template_arguments * sizeof (struct symbol *)));
|
||||
+ VEC_free (symbolp, template_args);
|
||||
+ }
|
||||
+
|
||||
/* In C++, we can have functions nested inside functions (e.g., when
|
||||
a function declares a class that has methods). This means that
|
||||
when we finish processing a function scope, we may need to go
|
||||
@@ -6474,6 +6522,7 @@ read_structure_type (struct die_info *di
|
||||
{
|
||||
struct field_info fi;
|
||||
struct die_info *child_die;
|
||||
+ VEC (symbolp) *template_args = NULL;
|
||||
|
||||
memset (&fi, 0, sizeof (struct field_info));
|
||||
|
||||
@@ -6504,9 +6553,34 @@ read_structure_type (struct die_info *di
|
||||
}
|
||||
else if (child_die->tag == DW_TAG_typedef)
|
||||
dwarf2_add_typedef (&fi, child_die, cu);
|
||||
+ else if (child_die->tag == DW_TAG_template_type_param
|
||||
+ || child_die->tag == DW_TAG_template_value_param)
|
||||
+ {
|
||||
+ struct symbol *arg = new_symbol (child_die, NULL, cu);
|
||||
+
|
||||
+ VEC_safe_push (symbolp, template_args, arg);
|
||||
+ }
|
||||
+
|
||||
child_die = sibling_die (child_die);
|
||||
}
|
||||
|
||||
+ /* Attach template arguments to type. */
|
||||
+ if (! VEC_empty (symbolp, template_args))
|
||||
+ {
|
||||
+ ALLOCATE_CPLUS_STRUCT_TYPE (type);
|
||||
+ TYPE_N_TEMPLATE_ARGUMENTS (type)
|
||||
+ = VEC_length (symbolp, template_args);
|
||||
+ TYPE_TEMPLATE_ARGUMENTS (type)
|
||||
+ = obstack_alloc (&objfile->objfile_obstack,
|
||||
+ (TYPE_N_TEMPLATE_ARGUMENTS (type)
|
||||
+ * sizeof (struct symbol *)));
|
||||
+ memcpy (TYPE_TEMPLATE_ARGUMENTS (type),
|
||||
+ VEC_address (symbolp, template_args),
|
||||
+ (TYPE_N_TEMPLATE_ARGUMENTS (type)
|
||||
+ * sizeof (struct symbol *)));
|
||||
+ VEC_free (symbolp, template_args);
|
||||
+ }
|
||||
+
|
||||
/* Attach fields and member functions to the type. */
|
||||
if (fi.nfields)
|
||||
dwarf2_attach_fields_to_type (&fi, type, cu);
|
||||
@@ -6630,7 +6704,9 @@ process_structure_scope (struct die_info
|
||||
if (child_die->tag == DW_TAG_member
|
||||
|| child_die->tag == DW_TAG_variable
|
||||
|| child_die->tag == DW_TAG_constant
|
||||
- || child_die->tag == DW_TAG_inheritance)
|
||||
+ || child_die->tag == DW_TAG_inheritance
|
||||
+ || child_die->tag == DW_TAG_template_value_param
|
||||
+ || child_die->tag == DW_TAG_template_type_param)
|
||||
{
|
||||
/* Do nothing. */
|
||||
}
|
||||
@@ -10241,10 +10317,13 @@ var_decode_location (struct attribute *a
|
||||
to make a symbol table entry for it, and if so, create a new entry
|
||||
and return a pointer to it.
|
||||
If TYPE is NULL, determine symbol type from the die, otherwise
|
||||
- used the passed type. */
|
||||
+ used the passed type.
|
||||
+ If SPACE is not NULL, use it to hold the new symbol. If it is
|
||||
+ NULL, allocate a new symbol on the objfile's obstack. */
|
||||
|
||||
static struct symbol *
|
||||
-new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||
+new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
||||
+ struct symbol *space)
|
||||
{
|
||||
struct objfile *objfile = cu->objfile;
|
||||
struct symbol *sym = NULL;
|
||||
@@ -10260,11 +10339,13 @@ new_symbol (struct die_info *die, struct
|
||||
if (name)
|
||||
{
|
||||
const char *linkagename;
|
||||
+ int suppress_add = 0;
|
||||
|
||||
- sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
|
||||
- sizeof (struct symbol));
|
||||
+ if (space)
|
||||
+ sym = space;
|
||||
+ else
|
||||
+ sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol);
|
||||
OBJSTAT (objfile, n_syms++);
|
||||
- memset (sym, 0, sizeof (struct symbol));
|
||||
/* Some methods are called w/o checking SYMBOL_COMPUTED_OPS validity. */
|
||||
SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs;
|
||||
|
||||
@@ -10355,11 +10436,15 @@ new_symbol (struct die_info *die, struct
|
||||
/* Do not add the symbol to any lists. It will be found via
|
||||
BLOCK_FUNCTION from the blockvector. */
|
||||
break;
|
||||
+ case DW_TAG_template_value_param:
|
||||
+ suppress_add = 1;
|
||||
+ goto variable_or_member;
|
||||
case DW_TAG_constant:
|
||||
SYMBOL_TYPE (sym) = make_cv_type (1,
|
||||
TYPE_VOLATILE (SYMBOL_TYPE (sym)),
|
||||
SYMBOL_TYPE (sym), NULL);
|
||||
/* PASSTHRU */
|
||||
+variable_or_member:
|
||||
case DW_TAG_variable:
|
||||
case DW_TAG_member:
|
||||
/* Compilation with minimal debug info may result in variables
|
||||
@@ -10383,10 +10468,18 @@ new_symbol (struct die_info *die, struct
|
||||
{
|
||||
dwarf2_const_value (attr, sym, cu);
|
||||
attr2 = dwarf2_attr (die, DW_AT_external, cu);
|
||||
- if (attr2 && (DW_UNSND (attr2) != 0))
|
||||
- add_symbol_to_list (sym, &global_symbols);
|
||||
+ if (suppress_add)
|
||||
+ {
|
||||
+ sym->hash_next = objfile->template_symbols;
|
||||
+ objfile->template_symbols = sym;
|
||||
+ }
|
||||
else
|
||||
- add_symbol_to_list (sym, cu->list_in_scope);
|
||||
+ {
|
||||
+ if (attr2 && (DW_UNSND (attr2) != 0))
|
||||
+ add_symbol_to_list (sym, &global_symbols);
|
||||
+ else
|
||||
+ add_symbol_to_list (sym, cu->list_in_scope);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
attr = dwarf2_attr (die, DW_AT_location, cu);
|
||||
@@ -10448,13 +10541,25 @@ new_symbol (struct die_info *die, struct
|
||||
? &global_symbols : cu->list_in_scope);
|
||||
|
||||
SYMBOL_CLASS (sym) = LOC_UNRESOLVED;
|
||||
- add_symbol_to_list (sym, list_to_add);
|
||||
+ if (suppress_add)
|
||||
+ {
|
||||
+ sym->hash_next = objfile->template_symbols;
|
||||
+ objfile->template_symbols = sym;
|
||||
+ }
|
||||
+ else
|
||||
+ add_symbol_to_list (sym, list_to_add);
|
||||
}
|
||||
else if (!die_is_declaration (die, cu))
|
||||
{
|
||||
/* Use the default LOC_OPTIMIZED_OUT class. */
|
||||
gdb_assert (SYMBOL_CLASS (sym) == LOC_OPTIMIZED_OUT);
|
||||
- add_symbol_to_list (sym, cu->list_in_scope);
|
||||
+ if (suppress_add)
|
||||
+ {
|
||||
+ sym->hash_next = objfile->template_symbols;
|
||||
+ objfile->template_symbols = sym;
|
||||
+ }
|
||||
+ else
|
||||
+ add_symbol_to_list (sym, cu->list_in_scope);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -10493,6 +10598,9 @@ new_symbol (struct die_info *die, struct
|
||||
interest in this information, so just ignore it for now.
|
||||
(FIXME?) */
|
||||
break;
|
||||
+ case DW_TAG_template_type_param:
|
||||
+ suppress_add = 1;
|
||||
+ /* Fall through. */
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_interface_type:
|
||||
case DW_TAG_structure_type:
|
||||
@@ -10511,14 +10619,22 @@ new_symbol (struct die_info *die, struct
|
||||
saves you. See the OtherFileClass tests in
|
||||
gdb.c++/namespace.exp. */
|
||||
|
||||
- struct pending **list_to_add;
|
||||
+ if (suppress_add)
|
||||
+ {
|
||||
+ sym->hash_next = objfile->template_symbols;
|
||||
+ objfile->template_symbols = sym;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ struct pending **list_to_add;
|
||||
|
||||
- list_to_add = (cu->list_in_scope == &file_symbols
|
||||
- && (cu->language == language_cplus
|
||||
- || cu->language == language_java)
|
||||
- ? &global_symbols : cu->list_in_scope);
|
||||
+ list_to_add = (cu->list_in_scope == &file_symbols
|
||||
+ && (cu->language == language_cplus
|
||||
+ || cu->language == language_java)
|
||||
+ ? &global_symbols : cu->list_in_scope);
|
||||
|
||||
- add_symbol_to_list (sym, list_to_add);
|
||||
+ add_symbol_to_list (sym, list_to_add);
|
||||
+ }
|
||||
|
||||
/* The semantics of C++ state that "struct foo { ... }" also
|
||||
defines a typedef for "foo". A Java class declaration also
|
||||
@@ -10594,6 +10710,14 @@ new_symbol (struct die_info *die, struct
|
||||
return (sym);
|
||||
}
|
||||
|
||||
+/* A wrapper for new_symbol_full that always allocates a new symbol. */
|
||||
+
|
||||
+static struct symbol *
|
||||
+new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||
+{
|
||||
+ return new_symbol_full (die, type, cu, NULL);
|
||||
+}
|
||||
+
|
||||
/* Copy constant value from an attribute to a symbol. */
|
||||
|
||||
static void
|
||||
Index: gdb-7.2/gdb/gdbtypes.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/gdbtypes.c 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/gdbtypes.c 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -1107,7 +1107,7 @@ type_name_no_tag (const struct type *typ
|
||||
struct type *
|
||||
lookup_typename (const struct language_defn *language,
|
||||
struct gdbarch *gdbarch, char *name,
|
||||
- struct block *block, int noerr)
|
||||
+ const struct block *block, int noerr)
|
||||
{
|
||||
struct symbol *sym;
|
||||
struct type *tmp;
|
||||
Index: gdb-7.2/gdb/gdbtypes.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/gdbtypes.h 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/gdbtypes.h 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -780,6 +780,9 @@ struct cplus_struct_type
|
||||
|
||||
short nfn_fields_total;
|
||||
|
||||
+ /* Number of template arguments. */
|
||||
+ unsigned short n_template_arguments;
|
||||
+
|
||||
/* One if this struct is a dynamic class, as defined by the
|
||||
Itanium C++ ABI: if it requires a virtual table pointer,
|
||||
because it or any of its base classes have one or more virtual
|
||||
@@ -925,6 +928,11 @@ struct cplus_struct_type
|
||||
}
|
||||
*typedef_field;
|
||||
unsigned typedef_field_count;
|
||||
+
|
||||
+ /* The template arguments. This is an array with
|
||||
+ N_TEMPLATE_ARGUMENTS elements. This is NULL for non-template
|
||||
+ classes. */
|
||||
+ struct symbol **template_arguments;
|
||||
};
|
||||
|
||||
/* Struct used in computing virtual base list */
|
||||
@@ -1137,6 +1145,13 @@ extern void allocate_gnat_aux_type (stru
|
||||
#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
|
||||
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
|
||||
|
||||
+#define TYPE_N_TEMPLATE_ARGUMENTS(thistype) \
|
||||
+ TYPE_CPLUS_SPECIFIC (thistype)->n_template_arguments
|
||||
+#define TYPE_TEMPLATE_ARGUMENTS(thistype) \
|
||||
+ TYPE_CPLUS_SPECIFIC (thistype)->template_arguments
|
||||
+#define TYPE_TEMPLATE_ARGUMENT(thistype, n) \
|
||||
+ TYPE_CPLUS_SPECIFIC (thistype)->template_arguments[n]
|
||||
+
|
||||
#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
|
||||
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
|
||||
#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
|
||||
@@ -1487,7 +1502,7 @@ extern char *gdb_mangle_name (struct typ
|
||||
|
||||
extern struct type *lookup_typename (const struct language_defn *,
|
||||
struct gdbarch *, char *,
|
||||
- struct block *, int);
|
||||
+ const struct block *, int);
|
||||
|
||||
extern struct type *lookup_template_type (char *, struct type *,
|
||||
struct block *);
|
||||
Index: gdb-7.2/gdb/objfiles.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/objfiles.c 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/objfiles.c 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -702,6 +702,27 @@ free_all_objfiles (void)
|
||||
clear_symtab_users (0);
|
||||
}
|
||||
|
||||
+/* A helper function for objfile_relocate1 that relocates a single
|
||||
+ symbol. */
|
||||
+
|
||||
+static void
|
||||
+relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
|
||||
+ struct section_offsets *delta)
|
||||
+{
|
||||
+ fixup_symbol_section (sym, objfile);
|
||||
+
|
||||
+ /* The RS6000 code from which this was taken skipped
|
||||
+ any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.
|
||||
+ But I'm leaving out that test, on the theory that
|
||||
+ they can't possibly pass the tests below. */
|
||||
+ if ((SYMBOL_CLASS (sym) == LOC_LABEL
|
||||
+ || SYMBOL_CLASS (sym) == LOC_STATIC)
|
||||
+ && SYMBOL_SECTION (sym) >= 0)
|
||||
+ {
|
||||
+ SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (delta, SYMBOL_SECTION (sym));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
|
||||
entries in new_offsets. SEPARATE_DEBUG_OBJFILE is not touched here.
|
||||
Return non-zero iff any change happened. */
|
||||
@@ -767,24 +788,20 @@ objfile_relocate1 (struct objfile *objfi
|
||||
|
||||
ALL_BLOCK_SYMBOLS (b, iter, sym)
|
||||
{
|
||||
- fixup_symbol_section (sym, objfile);
|
||||
-
|
||||
- /* The RS6000 code from which this was taken skipped
|
||||
- any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.
|
||||
- But I'm leaving out that test, on the theory that
|
||||
- they can't possibly pass the tests below. */
|
||||
- if ((SYMBOL_CLASS (sym) == LOC_LABEL
|
||||
- || SYMBOL_CLASS (sym) == LOC_STATIC)
|
||||
- && SYMBOL_SECTION (sym) >= 0)
|
||||
- {
|
||||
- SYMBOL_VALUE_ADDRESS (sym) +=
|
||||
- ANOFFSET (delta, SYMBOL_SECTION (sym));
|
||||
- }
|
||||
+ relocate_one_symbol (sym, objfile, delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ /* Relocate isolated symbols. */
|
||||
+ {
|
||||
+ struct symbol *iter;
|
||||
+
|
||||
+ for (iter = objfile->template_symbols; iter; iter = iter->hash_next)
|
||||
+ relocate_one_symbol (iter, objfile, delta);
|
||||
+ }
|
||||
+
|
||||
if (objfile->psymtabs_addrmap)
|
||||
addrmap_relocate (objfile->psymtabs_addrmap,
|
||||
ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
|
||||
Index: gdb-7.2/gdb/objfiles.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/objfiles.h 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/objfiles.h 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -391,6 +391,12 @@ struct objfile
|
||||
/* FIXME/carlton-2003-06-27: Delete this in a few years once
|
||||
"possible namespace symbols" go away. */
|
||||
struct symtab *cp_namespace_symtab;
|
||||
+
|
||||
+ /* A linked list of symbols created when reading template types or
|
||||
+ function templates. These symbols are not stored in any symbol
|
||||
+ table, so we have to keep them here to relocate them
|
||||
+ properly. */
|
||||
+ struct symbol *template_symbols;
|
||||
};
|
||||
|
||||
/* Defines for the objfile flag word. */
|
||||
Index: gdb-7.2/gdb/symfile.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/symfile.c 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/symfile.c 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -2450,6 +2450,7 @@ reread_symbols (void)
|
||||
objfile->psymtabs_addrmap = NULL;
|
||||
objfile->free_psymtabs = NULL;
|
||||
objfile->cp_namespace_symtab = NULL;
|
||||
+ objfile->template_symbols = NULL;
|
||||
objfile->msymbols = NULL;
|
||||
objfile->deprecated_sym_private = NULL;
|
||||
objfile->minimal_symbol_count = 0;
|
||||
Index: gdb-7.2/gdb/symtab.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/symtab.c 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/symtab.c 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -1176,12 +1176,8 @@ lookup_symbol_aux_local (const char *nam
|
||||
|
||||
if (language == language_cplus || language == language_fortran)
|
||||
{
|
||||
- sym = cp_lookup_symbol_imports (scope,
|
||||
- name,
|
||||
- block,
|
||||
- domain,
|
||||
- 1,
|
||||
- 1);
|
||||
+ sym = cp_lookup_symbol_imports_or_template (scope, name, block,
|
||||
+ domain);
|
||||
if (sym != NULL)
|
||||
return sym;
|
||||
}
|
||||
Index: gdb-7.2/gdb/symtab.h
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/symtab.h 2011-01-01 17:48:56.000000000 +0100
|
||||
+++ gdb-7.2/gdb/symtab.h 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -583,6 +583,10 @@ struct symbol
|
||||
/* Whether this is an inlined function (class LOC_BLOCK only). */
|
||||
unsigned is_inlined : 1;
|
||||
|
||||
+ /* True if this is a C++ function symbol with template arguments.
|
||||
+ In this case the symbol is really a "struct template_symbol". */
|
||||
+ unsigned is_cplus_template_function : 1;
|
||||
+
|
||||
/* Line number of this symbol's definition, except for inlined
|
||||
functions. For an inlined function (class LOC_BLOCK and
|
||||
SYMBOL_INLINED set) this is the line number of the function's call
|
||||
@@ -630,12 +634,34 @@ struct symbol
|
||||
#define SYMBOL_CLASS(symbol) (symbol)->aclass
|
||||
#define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument
|
||||
#define SYMBOL_INLINED(symbol) (symbol)->is_inlined
|
||||
+#define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \
|
||||
+ (symbol)->is_cplus_template_function
|
||||
#define SYMBOL_TYPE(symbol) (symbol)->type
|
||||
#define SYMBOL_LINE(symbol) (symbol)->line
|
||||
#define SYMBOL_SYMTAB(symbol) (symbol)->symtab
|
||||
#define SYMBOL_COMPUTED_OPS(symbol) (symbol)->ops.ops_computed
|
||||
#define SYMBOL_REGISTER_OPS(symbol) (symbol)->ops.ops_register
|
||||
#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
|
||||
+
|
||||
+/* An instance of this type is used to represent a C++ template
|
||||
+ function. It includes a "struct symbol" as a kind of base class;
|
||||
+ users downcast to "struct template_symbol *" when needed. A symbol
|
||||
+ is really of this type iff SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION is
|
||||
+ true. */
|
||||
+
|
||||
+struct template_symbol
|
||||
+{
|
||||
+ /* The base class. */
|
||||
+ struct symbol base;
|
||||
+
|
||||
+ /* The number of template arguments. */
|
||||
+ int n_template_arguments;
|
||||
+
|
||||
+ /* The template arguments. This is an array with
|
||||
+ N_TEMPLATE_ARGUMENTS elements. */
|
||||
+ struct symbol **template_arguments;
|
||||
+};
|
||||
+
|
||||
|
||||
/* Each item represents a line-->pc (or the reverse) mapping. This is
|
||||
somewhat more wasteful of space than one might wish, but since only
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/temargs.cc
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/temargs.cc 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -0,0 +1,71 @@
|
||||
+/* Template argument tests.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@gnu.org */
|
||||
+
|
||||
+int a_global;
|
||||
+
|
||||
+struct S
|
||||
+{
|
||||
+ int f;
|
||||
+};
|
||||
+
|
||||
+template<typename T, int I, int *P, int S::*MP>
|
||||
+struct Base
|
||||
+{
|
||||
+ template<typename Z>
|
||||
+ struct Inner
|
||||
+ {
|
||||
+ void inner_m ()
|
||||
+ {
|
||||
+ // Breakpoint 2.
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ void base_m ()
|
||||
+ {
|
||||
+ // Breakpoint 1.
|
||||
+ }
|
||||
+
|
||||
+ template<typename Q>
|
||||
+ void templ_m ()
|
||||
+ {
|
||||
+ // Breakpoint 4.
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+template<typename T, int I, int *P, int S::*MP>
|
||||
+void func ()
|
||||
+{
|
||||
+ // Breakpoint 3.
|
||||
+}
|
||||
+
|
||||
+int main ()
|
||||
+{
|
||||
+ Base<double, 23, &a_global, &S::f> base;
|
||||
+ // Note that instantiating with P==0 does not work with g++.
|
||||
+ // That would be worth testing, once g++ is fixed.
|
||||
+ Base<long, 47, &a_global, &S::f>::Inner<float> inner;
|
||||
+
|
||||
+ base.base_m ();
|
||||
+ inner.inner_m ();
|
||||
+ func<unsigned char, 91, &a_global, &S::f> ();
|
||||
+ base.templ_m<short> ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.cp/temargs.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.cp/temargs.exp 2011-01-01 17:48:57.000000000 +0100
|
||||
@@ -0,0 +1,102 @@
|
||||
+# temargs.exp - Template argument tests
|
||||
+#
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+if {$tracelevel} {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+if {[skip_cplus_tests]} {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "temargs"
|
||||
+set srcfile "${testfile}.cc"
|
||||
+
|
||||
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if {![runto_main]} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set line [gdb_get_line_number "Breakpoint 1" $srcfile]
|
||||
+gdb_test "break $srcfile:$line" "Breakpoint 2.*" \
|
||||
+ "set first breakpoint for temargs"
|
||||
+set line [gdb_get_line_number "Breakpoint 2" $srcfile]
|
||||
+gdb_test "break $srcfile:$line" "Breakpoint 3.*" \
|
||||
+ "set second breakpoint for temargs"
|
||||
+set line [gdb_get_line_number "Breakpoint 3" $srcfile]
|
||||
+gdb_test "break $srcfile:$line" "Breakpoint 4.*" \
|
||||
+ "set third breakpoint for temargs"
|
||||
+set line [gdb_get_line_number "Breakpoint 4" $srcfile]
|
||||
+gdb_test "break $srcfile:$line" "Breakpoint 5.*" \
|
||||
+ "set fourth breakpoint for temargs"
|
||||
+
|
||||
+#
|
||||
+# Tests in Base::base_m.
|
||||
+#
|
||||
+
|
||||
+gdb_continue_to_breakpoint "continue to first breakpoint for temargs"
|
||||
+
|
||||
+gdb_test "ptype T" "double" "test type of T in base_m"
|
||||
+gdb_test "print I" " = 23" "test value of I in base_m"
|
||||
+gdb_test "print P == &a_global" " = true" "test value of P in base_m"
|
||||
+setup_kfail "gcc/41736" *-*-*
|
||||
+gdb_test "print MP" "&S::f" "test value of MP in base_m"
|
||||
+
|
||||
+#
|
||||
+# Tests in Inner::inner_m.
|
||||
+#
|
||||
+
|
||||
+gdb_continue_to_breakpoint "continue to second breakpoint for temargs"
|
||||
+
|
||||
+setup_kfail "gcc/45024" *-*-*
|
||||
+gdb_test "ptype T" "long" "test type of T in inner_m"
|
||||
+setup_kfail "gcc/45024" *-*-*
|
||||
+gdb_test "print I" " = 47" "test value of I in inner_m"
|
||||
+gdb_test "print P == &a_global" " = true" "test value of P in inner_m"
|
||||
+setup_kfail "gcc/41736" *-*-*
|
||||
+gdb_test "print MP" "&S::f" "test value of MP in inner_m"
|
||||
+gdb_test "whatis Z" "float" "test type of Z in inner_m"
|
||||
+
|
||||
+#
|
||||
+# Tests in func.
|
||||
+#
|
||||
+
|
||||
+gdb_continue_to_breakpoint "continue to third breakpoint for temargs"
|
||||
+
|
||||
+gdb_test "ptype T" "unsigned char" "test type of T in func"
|
||||
+gdb_test "print I" " = 91" "test value of I in func"
|
||||
+gdb_test "print P == &a_global" " = true" "test value of P in func"
|
||||
+setup_kfail "gcc/41736" *-*-*
|
||||
+gdb_test "print MP" "&S::f" "test value of MP in func"
|
||||
+
|
||||
+#
|
||||
+# Tests in Base::templ_m.
|
||||
+#
|
||||
+
|
||||
+gdb_continue_to_breakpoint "continue to fourth breakpoint for temargs"
|
||||
+
|
||||
+gdb_test "ptype T" "double" "test type of T in templ_m"
|
||||
+gdb_test "print I" " = 23" "test value of I in templ_m"
|
||||
+gdb_test "print P == &a_global" " = true" "test value of P in templ_m"
|
||||
+setup_kfail "gcc/41736" *-*-*
|
||||
+gdb_test "print MP" "&S::f" "test value of MP in templ_m"
|
||||
+gdb_test "whatis Q" "short" "test type of Q in templ_m"
|
|
@ -0,0 +1,46 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00063.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/08 19:49:28 1.12163
|
||||
### src/gdb/ChangeLog 2010/09/08 23:14:52 1.12164
|
||||
## -1,3 +1,8 @@
|
||||
+2010-09-08 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
+
|
||||
+ * dwarf2read.c (read_func_scope, read_structure_type)
|
||||
+ (read_common_block): Check for a NULL return from new_symbol.
|
||||
+
|
||||
2010-09-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2read.c (dwarf2_read_index): Return on no SEC_HAS_CONTENTS.
|
||||
Index: gdb-7.2/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/dwarf2read.c 2011-01-01 17:47:52.000000000 +0100
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2011-01-01 17:48:35.000000000 +0100
|
||||
@@ -5243,7 +5243,8 @@ read_func_scope (struct die_info *die, s
|
||||
{
|
||||
struct symbol *arg = new_symbol (child_die, NULL, cu);
|
||||
|
||||
- VEC_safe_push (symbolp, template_args, arg);
|
||||
+ if (arg != NULL)
|
||||
+ VEC_safe_push (symbolp, template_args, arg);
|
||||
}
|
||||
else
|
||||
process_die (child_die, cu);
|
||||
@@ -6558,7 +6559,8 @@ read_structure_type (struct die_info *di
|
||||
{
|
||||
struct symbol *arg = new_symbol (child_die, NULL, cu);
|
||||
|
||||
- VEC_safe_push (symbolp, template_args, arg);
|
||||
+ if (arg != NULL)
|
||||
+ VEC_safe_push (symbolp, template_args, arg);
|
||||
}
|
||||
|
||||
child_die = sibling_die (child_die);
|
||||
@@ -7104,7 +7106,7 @@ read_common_block (struct die_info *die,
|
||||
|
||||
/* Undocumented in DWARF3, when it can be present? */
|
||||
attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
|
||||
- if (attr)
|
||||
+ if (sym != NULL && attr != NULL)
|
||||
{
|
||||
CORE_ADDR byte_offset = 0;
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00203.html
|
||||
|
||||
[ Backported. ]
|
||||
|
||||
### src/gdb/ChangeLog 2010/08/31 19:31:00 1.12131
|
||||
### src/gdb/ChangeLog 2010/08/31 20:03:20 1.12132
|
||||
## -1,3 +1,9 @@
|
||||
+2010-08-31 Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ PR c++/11961:
|
||||
+ * dwarf2read.c (new_symbol_full) <DW_TAG_template_type_param>:
|
||||
+ Don't set TYPE_NAME on the type.
|
||||
+
|
||||
2010-08-31 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
|
||||
|
||||
* infrun.c (set_exec_direction_func): Error out if target does not
|
||||
--- gdb-7.2/gdb/dwarf2read.c.orig 2011-01-03 08:01:35.000000000 +0100
|
||||
+++ gdb-7.2/gdb/dwarf2read.c 2011-01-03 08:14:01.000000000 +0100
|
||||
@@ -10636,20 +10636,21 @@ variable_or_member:
|
||||
? &global_symbols : cu->list_in_scope);
|
||||
|
||||
add_symbol_to_list (sym, list_to_add);
|
||||
- }
|
||||
|
||||
- /* The semantics of C++ state that "struct foo { ... }" also
|
||||
- defines a typedef for "foo". A Java class declaration also
|
||||
- defines a typedef for the class. */
|
||||
- if (cu->language == language_cplus
|
||||
- || cu->language == language_java
|
||||
- || cu->language == language_ada)
|
||||
- {
|
||||
- /* The symbol's name is already allocated along with
|
||||
- this objfile, so we don't need to duplicate it for
|
||||
- the type. */
|
||||
- if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
|
||||
- TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_SEARCH_NAME (sym);
|
||||
+ /* The semantics of C++ state that "struct foo {
|
||||
+ ... }" also defines a typedef for "foo". A Java
|
||||
+ class declaration also defines a typedef for the
|
||||
+ class. */
|
||||
+ if (cu->language == language_cplus
|
||||
+ || cu->language == language_java
|
||||
+ || cu->language == language_ada)
|
||||
+ {
|
||||
+ /* The symbol's name is already allocated along
|
||||
+ with this objfile, so we don't need to
|
||||
+ duplicate it for the type. */
|
||||
+ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
|
||||
+ TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_SEARCH_NAME (sym);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
break;
|
|
@ -0,0 +1,220 @@
|
|||
http://sourceware.org/ml/archer/2010-q3/msg00028.html
|
||||
Subject: [delayed-symfile] [commit] Fix a regression on CFI without DIE [Re:
|
||||
|
||||
On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote:
|
||||
> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5
|
||||
>
|
||||
> There was a regression on gdb.base/savedregs.exp.
|
||||
>
|
||||
> quick_addrmap/require_partial_symbols should be used even for the unwind debug
|
||||
> info checking as its load has been also delayed by this branch.
|
||||
[...]
|
||||
> --- a/gdb/dwarf2-frame.c
|
||||
> +++ b/gdb/dwarf2-frame.c
|
||||
[...]
|
||||
> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
|
||||
> struct dwarf2_fde *fde;
|
||||
> CORE_ADDR offset;
|
||||
>
|
||||
> + if (objfile->quick_addrmap)
|
||||
> + {
|
||||
> + if (!addrmap_find (objfile->quick_addrmap, *pc))
|
||||
> + continue;
|
||||
> + }
|
||||
> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */
|
||||
> + require_partial_symbols (objfile);
|
||||
> +
|
||||
|
||||
but this has caused a different regression (as discussed in the confcall).
|
||||
|
||||
QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing
|
||||
built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have
|
||||
DWARF at all while they can feature CFIs (.eh_frame or .debug_frame).
|
||||
It has been described by Daniel Jacobowitz at:
|
||||
Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs
|
||||
http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html
|
||||
|
||||
Sorry for this regression by me (in that fix of a different regression).
|
||||
|
||||
Fixed it the "slow way" as this branch is now obsoleted by .gdb-index.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
||||
|
||||
Checked-in.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb
|
||||
|
||||
Test CFI is parsed even for range (function) not described by any DIE.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=614028
|
||||
|
||||
gdb/
|
||||
* dwarf2-frame.c (dwarf2_frame_find_fde): Remove the
|
||||
OBJFILE->QUICK_ADDRMAP check. New comment why.
|
||||
|
||||
gdb/testsuite/
|
||||
* gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c,
|
||||
gdb.base/cfi-without-die-caller.c: New files.
|
||||
---
|
||||
gdb/dwarf2-frame.c | 8 +--
|
||||
gdb/testsuite/gdb.base/cfi-without-die-caller.c | 28 ++++++++++
|
||||
gdb/testsuite/gdb.base/cfi-without-die-main.c | 32 +++++++++++
|
||||
gdb/testsuite/gdb.base/cfi-without-die.exp | 67 +++++++++++++++++++++++
|
||||
4 files changed, 130 insertions(+), 5 deletions(-)
|
||||
create mode 100644 gdb/testsuite/gdb.base/cfi-without-die-caller.c
|
||||
create mode 100644 gdb/testsuite/gdb.base/cfi-without-die-main.c
|
||||
create mode 100644 gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
|
||||
new file mode 100644
|
||||
index 0000000..afdfd53
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+typedef int (*callback_t) (void);
|
||||
+
|
||||
+int
|
||||
+caller (callback_t callback)
|
||||
+{
|
||||
+ /* Ensure some frame content to push away the return address. */
|
||||
+ volatile const long one = 1;
|
||||
+
|
||||
+ /* Modify the return value to prevent any tail-call optimization. */
|
||||
+ return (*callback) () - one;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die-main.c b/gdb/testsuite/gdb.base/cfi-without-die-main.c
|
||||
new file mode 100644
|
||||
index 0000000..8451c4b
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die-main.c
|
||||
@@ -0,0 +1,32 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+typedef int (*callback_t) (void);
|
||||
+
|
||||
+extern int caller (callback_t callback);
|
||||
+
|
||||
+int
|
||||
+callback (void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return caller (callback);
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
new file mode 100644
|
||||
index 0000000..db6d248
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
@@ -0,0 +1,67 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Test CFI is parsed even for range (function) not described by any DIE.
|
||||
+
|
||||
+set testfile cfi-without-die
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set srccallerfile ${testfile}-caller.c
|
||||
+set executable ${testfile}
|
||||
+set objmainfile ${objdir}/${subdir}/${testfile}-main.o
|
||||
+set objcallerfile ${objdir}/${subdir}/${testfile}-caller.o
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
|
||||
+ object [list {additional_flags=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables}]] != ""
|
||||
+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
|
||||
+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+if ![runto callback] then {
|
||||
+ fail "verify unwinding: Can't run to callback"
|
||||
+ return 0
|
||||
+}
|
||||
+set test "verify unwinding breaks without CFI"
|
||||
+gdb_test_multiple "bt" $test {
|
||||
+ -re " in main .*\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
|
||||
+ object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != ""
|
||||
+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
|
||||
+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+if ![runto callback] then {
|
||||
+ fail "test CFI without DIEs: Can't run to callback"
|
||||
+ return 0
|
||||
+}
|
||||
+# #0 callback () at ...
|
||||
+# #1 0x00000000004004e9 in caller ()
|
||||
+# #2 0x00000000004004cd in main () at ...
|
||||
+gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs"
|
||||
--
|
||||
1.7.1.1
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
[archer-tromey-delayed-symfile]
|
||||
|
||||
commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d
|
||||
Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
|
||||
Date: Sat Aug 15 15:05:54 2009 +0200
|
||||
|
||||
Test for "handle incorrect aranges".
|
||||
|
||||
readelf:
|
||||
Contents of the .debug_aranges section:
|
||||
|
||||
Length: 8
|
||||
Version: 2
|
||||
Offset into .debug_info: 0x0
|
||||
Pointer Size: 0
|
||||
Segment Size: 0
|
||||
|
||||
Address Length
|
||||
Floating point exception
|
||||
|
||||
* gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
|
||||
new file mode 100644
|
||||
index 0000000..d5b9ca5a
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S
|
||||
@@ -0,0 +1,140 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* Test .debug_aranges containing zero address_size. */
|
||||
+
|
||||
+/* Dummy function to provide debug information for. */
|
||||
+
|
||||
+ .text
|
||||
+.Lbegin_text1:
|
||||
+ .globl main
|
||||
+ .type main, %function
|
||||
+main:
|
||||
+.Lbegin_main:
|
||||
+ .int 0
|
||||
+.Lend_main:
|
||||
+ .size main, .-main
|
||||
+.Lend_text1:
|
||||
+
|
||||
+/* Debug information */
|
||||
+
|
||||
+ .section .debug_info
|
||||
+.Lcu1_begin:
|
||||
+ /* CU header */
|
||||
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
|
||||
+.Lcu1_start:
|
||||
+ .2byte 2 /* DWARF Version */
|
||||
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
|
||||
+ .byte 4 /* Pointer size */
|
||||
+
|
||||
+ /* CU die */
|
||||
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
|
||||
+ .4byte .Lend_text1 /* DW_AT_high_pc */
|
||||
+ .4byte .Lbegin_text1 /* DW_AT_low_pc */
|
||||
+ .ascii "file1.txt\0" /* DW_AT_name */
|
||||
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
|
||||
+ .byte 1 /* DW_AT_language (C) */
|
||||
+
|
||||
+ /* main */
|
||||
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
|
||||
+ .byte 1 /* DW_AT_external */
|
||||
+ .byte 1 /* DW_AT_decl_file */
|
||||
+ .byte 2 /* DW_AT_decl_line */
|
||||
+ .ascii "main\0" /* DW_AT_name */
|
||||
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
|
||||
+ .4byte .Lbegin_main /* DW_AT_low_pc */
|
||||
+ .4byte .Lend_main /* DW_AT_high_pc */
|
||||
+ .byte 1 /* DW_AT_frame_base: length */
|
||||
+ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
|
||||
+
|
||||
+.Ltype_int:
|
||||
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
|
||||
+ .ascii "int\0" /* DW_AT_name */
|
||||
+ .byte 4 /* DW_AT_byte_size */
|
||||
+ .byte 5 /* DW_AT_encoding */
|
||||
+
|
||||
+ .byte 0 /* End of children of CU */
|
||||
+
|
||||
+.Lcu1_end:
|
||||
+
|
||||
+/* Abbrev table */
|
||||
+ .section .debug_abbrev
|
||||
+.Labbrev1_begin:
|
||||
+ .uleb128 1 /* Abbrev code */
|
||||
+ .uleb128 0x11 /* DW_TAG_compile_unit */
|
||||
+ .byte 1 /* has_children */
|
||||
+ .uleb128 0x12 /* DW_AT_high_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x11 /* DW_AT_low_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x25 /* DW_AT_producer */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x13 /* DW_AT_language */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 2 /* Abbrev code */
|
||||
+ .uleb128 0x2e /* DW_TAG_subprogram */
|
||||
+ .byte 0 /* has_children */
|
||||
+ .uleb128 0x3f /* DW_AT_external */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .uleb128 0x3a /* DW_AT_decl_file */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x3b /* DW_AT_decl_line */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .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 0xa /* DW_FORM_block1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 3 /* Abbrev code */
|
||||
+ .uleb128 0x24 /* DW_TAG_base_type */
|
||||
+ .byte 0 /* has_children */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0xb /* DW_AT_byte_size */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x3e /* DW_AT_encoding */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+/* aranges table */
|
||||
+ .section .debug_aranges
|
||||
+ .long .Laranges_end - 1f
|
||||
+1:
|
||||
+ .2byte 2 /* aranges Version */
|
||||
+ .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */
|
||||
+ /* The GDB crasher is this zero value. */
|
||||
+ .byte 0 /* aranges address_size */
|
||||
+ .byte 0 /* aranges segment_size */
|
||||
+
|
||||
+.Laranges_end:
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
|
||||
new file mode 100644
|
||||
index 0000000..39632d5
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp
|
||||
@@ -0,0 +1,40 @@
|
||||
+# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Test .debug_aranges containing zero address_size.
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*]
|
||||
+ && ![istarget arm-*-eabi*]
|
||||
+ && ![istarget powerpc-*-eabi*]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-aranges"
|
||||
+set srcfile ${testfile}.S
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $testfile
|
||||
+
|
||||
+# Failed gdb_load would abort the testcase execution earlier.
|
||||
+pass "file loaded"
|
|
@ -0,0 +1,207 @@
|
|||
archer archer-keiths-expr-cumulative
|
||||
b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc
|
||||
|
||||
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
||||
+++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.cc 2009-09-25 06:50:38.000000000 +0200
|
||||
@@ -0,0 +1,36 @@
|
||||
+namespace A
|
||||
+{
|
||||
+ namespace B
|
||||
+ {
|
||||
+ int ab = 11;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+namespace C
|
||||
+{
|
||||
+ namespace D
|
||||
+ {
|
||||
+ using namespace A::B;
|
||||
+
|
||||
+ int
|
||||
+ second()
|
||||
+ {
|
||||
+ ab;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ int
|
||||
+ first()
|
||||
+ {
|
||||
+ //ab;
|
||||
+ return D::second();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ //ab;
|
||||
+ return C::first();
|
||||
+}
|
||||
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
||||
+++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.exp 2009-09-25 06:50:38.000000000 +0200
|
||||
@@ -0,0 +1,50 @@
|
||||
+# Copyright 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile namespace-nested-imports
|
||||
+set srcfile ${testfile}.cc
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+############################################
|
||||
+if ![runto_main] then {
|
||||
+ perror "couldn't run to breakpoint main"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_test "print ab" "No symbol .* in current context."
|
||||
+
|
||||
+############################################
|
||||
+gdb_breakpoint C::first
|
||||
+gdb_continue_to_breakpoint "C::first"
|
||||
+
|
||||
+gdb_test "print ab" "No symbol .* in current context."
|
||||
+gdb_test "print C::D::ab" "= 11"
|
||||
+
|
||||
+############################################
|
||||
+gdb_breakpoint C::D::second
|
||||
+gdb_continue_to_breakpoint "C::D::second"
|
||||
+
|
||||
+gdb_test "print ab" "= 11"
|
||||
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
||||
+++ ./gdb/testsuite/gdb.cp/namespace-no-imports.cc 2009-09-25 06:50:38.000000000 +0200
|
||||
@@ -0,0 +1,37 @@
|
||||
+
|
||||
+namespace A
|
||||
+{
|
||||
+ int _a = 11;
|
||||
+
|
||||
+ namespace B{
|
||||
+
|
||||
+ int ab = 22;
|
||||
+
|
||||
+ namespace C{
|
||||
+
|
||||
+ int abc = 33;
|
||||
+
|
||||
+ int second(){
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ int first(){
|
||||
+ _a;
|
||||
+ ab;
|
||||
+ C::abc;
|
||||
+ return C::second();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ A::_a;
|
||||
+ A::B::ab;
|
||||
+ A::B::C::abc;
|
||||
+ return A::B::first();
|
||||
+}
|
||||
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
||||
+++ ./gdb/testsuite/gdb.cp/namespace-no-imports.exp 2009-09-25 06:50:38.000000000 +0200
|
||||
@@ -0,0 +1,69 @@
|
||||
+# Copyright 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile namespace-no-imports
|
||||
+set srcfile ${testfile}.cc
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+############################################
|
||||
+if ![runto_main] then {
|
||||
+ perror "couldn't run to breakpoint main"
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+gdb_test "print A::_a" "= 11"
|
||||
+gdb_test "print A::B::ab" "= 22"
|
||||
+gdb_test "print A::B::C::abc" "= 33"
|
||||
+
|
||||
+gdb_test "print _a" "No symbol .* in current context."
|
||||
+gdb_test "print ab" "No symbol .* in current context."
|
||||
+gdb_test "print abc" "No symbol .* in current context."
|
||||
+
|
||||
+############################################
|
||||
+gdb_breakpoint A::B::first
|
||||
+gdb_continue_to_breakpoint "A::B::first"
|
||||
+
|
||||
+gdb_test "print A::_a" "= 11"
|
||||
+gdb_test "print A::B::ab" "= 22"
|
||||
+gdb_test "print A::B::C::abc" "= 33"
|
||||
+
|
||||
+gdb_test "print _a" "= 11"
|
||||
+gdb_test "print ab" "= 22"
|
||||
+gdb_test "print C::abc" "= 33"
|
||||
+
|
||||
+gdb_test "print abc" "No symbol .* in current context."
|
||||
+
|
||||
+############################################
|
||||
+gdb_breakpoint A::B::C::second
|
||||
+gdb_continue_to_breakpoint "A::B::C::second"
|
||||
+
|
||||
+gdb_test "print A::_a" "= 11"
|
||||
+gdb_test "print A::B::ab" "= 22"
|
||||
+gdb_test "print A::B::C::abc" "= 33"
|
||||
+
|
||||
+gdb_test "print _a" "= 11"
|
||||
+gdb_test "print ab" "= 22"
|
||||
+gdb_test "print abc" "= 33"
|
|
@ -0,0 +1,64 @@
|
|||
https://bugzilla.redhat.com/show_bug.cgi?id=632259
|
||||
|
||||
commit 90b1513f9291220ad2d0314fc8c327219873bc25
|
||||
commit 86dd523433b348f0740848dec5842e63037ae6b3
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
|
||||
index 8ecf558..a14d8d0 100644
|
||||
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
|
||||
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp
|
||||
@@ -18,12 +18,17 @@ if {[skip_shlib_tests]} {
|
||||
}
|
||||
|
||||
set testfile "gnu-ifunc"
|
||||
+set executable ${testfile}
|
||||
set srcfile ${testfile}.c
|
||||
-set binfile ${objdir}/${subdir}/${testfile}
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+set staticexecutable ${executable}-static
|
||||
+set staticbinfile ${objdir}/${subdir}/${staticexecutable}
|
||||
|
||||
set libfile "${testfile}-lib"
|
||||
set libsrc ${libfile}.c
|
||||
set lib_so ${objdir}/${subdir}/${libfile}.so
|
||||
+# $lib_o must not have {debug}, it would override the gnu-ifunc ELF markers.
|
||||
+set lib_o ${objdir}/${subdir}/${libfile}.o
|
||||
|
||||
# We need DWARF for the "final" function as we "step" into the function and GDB
|
||||
# would step-over the "final" function if there would be no line number debug
|
||||
@@ -47,14 +52,16 @@ if [get_compiler_info ${binfile}] {
|
||||
}
|
||||
|
||||
if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_so $lib_opts] != ""
|
||||
- || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""} {
|
||||
+ || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""
|
||||
+ || [gdb_compile ${srcdir}/${subdir}/$libsrc $lib_o object {}] != ""
|
||||
+ || [gdb_compile "${srcdir}/${subdir}/$srcfile $lib_o" $staticbinfile executable {debug}] != ""} {
|
||||
untested "Could not compile either $libsrc or $srcfile."
|
||||
return -1
|
||||
}
|
||||
|
||||
# Start with a fresh gdb.
|
||||
|
||||
-clean_restart $testfile
|
||||
+clean_restart $executable
|
||||
gdb_load_shlibs ${lib_so}
|
||||
|
||||
if ![runto_main] then {
|
||||
@@ -108,3 +115,16 @@ gdb_test_multiple $test $test {
|
||||
}
|
||||
}
|
||||
gdb_test "info sym $expect_out(1,string)" "gnu_ifunc in section .*" "info sym <gnu_ifunc-address>"
|
||||
+
|
||||
+
|
||||
+# Test statically linked ifunc resolving during inferior start.
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=624967
|
||||
+
|
||||
+if ![target_info exists gdb_stub] {
|
||||
+ clean_restart $staticexecutable
|
||||
+
|
||||
+ gdb_breakpoint "gnu_ifunc"
|
||||
+ gdb_breakpoint "main"
|
||||
+ gdb_run_cmd
|
||||
+ gdb_test "" "Breakpoint \[0-9\]*, main .*" "static gnu_ifunc"
|
||||
+}
|
|
@ -0,0 +1,123 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00090.html
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/08/17 20:59:03 1.2412
|
||||
### src/gdb/testsuite/ChangeLog 2010/08/17 21:31:12 1.2413
|
||||
## -1,4 +1,10 @@
|
||||
2010-08-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.cp/infcall-dlopen.exp: New file.
|
||||
+ * gdb.cp/infcall-dlopen.cc: New file.
|
||||
+ * gdb.cp/infcall-dlopen-lib.cc: New file.
|
||||
+
|
||||
+2010-08-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
PR breakpoints/11371
|
||||
--- src/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc
|
||||
+++ src/gdb/testsuite/gdb.cp/infcall-dlopen-lib.cc 2011-01-01 12:52:07.599598000 +0000
|
||||
@@ -0,0 +1,16 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
--- src/gdb/testsuite/gdb.cp/infcall-dlopen.cc
|
||||
+++ src/gdb/testsuite/gdb.cp/infcall-dlopen.cc 2011-01-01 12:52:07.883051000 +0000
|
||||
@@ -0,0 +1,37 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <dlfcn.h>
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+static int
|
||||
+openlib (const char *filename)
|
||||
+{
|
||||
+ void *h = dlopen (filename, RTLD_LAZY);
|
||||
+
|
||||
+ if (h == NULL)
|
||||
+ return 0;
|
||||
+ if (dlclose (h) != 0)
|
||||
+ return 0;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
--- src/gdb/testsuite/gdb.cp/infcall-dlopen.exp
|
||||
+++ src/gdb/testsuite/gdb.cp/infcall-dlopen.exp 2011-01-01 12:52:08.166496000 +0000
|
||||
@@ -0,0 +1,46 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if {[skip_shlib_tests]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if [get_compiler_info not-used] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set testfile "infcall-dlopen"
|
||||
+set srcmainfile ${testfile}.cc
|
||||
+set srclibfile ${testfile}-lib.cc
|
||||
+set executable ${testfile}
|
||||
+set libfile ${objdir}/${subdir}/${executable}.so
|
||||
+set binfile ${objdir}/${subdir}/${executable}
|
||||
+
|
||||
+# Use completely arbitrary file for $libfile source.
|
||||
+if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} {debug c++}] != ""
|
||||
+ || [prepare_for_testing ${testfile}.exp ${executable} ${srcmainfile} {debug c++ shlib_load}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+for {set i 0} {$i < 10} {incr i} {
|
||||
+ gdb_test "p openlib (\"${libfile}\")" " = 1" "test $i"
|
||||
+ # Try to exploit the GDB trashed memory.
|
||||
+ gdb_test "b openlib" {Breakpoint [0-9]+ at .*} "test $i stub 1"
|
||||
+ gdb_test_no_output {delete $bpnum} "test $i stub 2"
|
||||
+}
|
|
@ -0,0 +1,36 @@
|
|||
http://sourceware.org/ml/gdb-cvs/2010-10/msg00070.html
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/10/11 08:47:47 1.2473
|
||||
### src/gdb/testsuite/ChangeLog 2010/10/11 21:36:25 1.2474
|
||||
## -1,5 +1,10 @@
|
||||
2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
+ * gdb.cp/infcall-dlopen.cc (openlib): Support NULL FILENAME.
|
||||
+ (main): Make openlib dummy call.
|
||||
+
|
||||
+2010-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
Fix missing _start PIE relocation on ppc64 due to stop on dl_main.
|
||||
* break-interp.exp (reach): Move the core body ...
|
||||
(reach_1): ... here. Use stop-on-solib-events for _dl_debug_state.
|
||||
--- src/gdb/testsuite/gdb.cp/infcall-dlopen.cc 2010/08/17 21:31:13 1.1
|
||||
+++ src/gdb/testsuite/gdb.cp/infcall-dlopen.cc 2010/10/11 21:36:26 1.2
|
||||
@@ -23,6 +23,9 @@
|
||||
{
|
||||
void *h = dlopen (filename, RTLD_LAZY);
|
||||
|
||||
+ if (filename == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
if (h == NULL)
|
||||
return 0;
|
||||
if (dlclose (h) != 0)
|
||||
@@ -33,5 +36,8 @@
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
+ /* Dummy call to get the function always compiled in. */
|
||||
+ openlib (NULL);
|
||||
+
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
https://bugzilla.redhat.com/show_bug.cgi?id=611435
|
||||
|
||||
Fix:
|
||||
Re: [RFA]corelow.c: Add tid to add_to_thread_list
|
||||
http://sourceware.org/ml/gdb-patches/2010-08/msg00085.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00026.html
|
||||
2e5bcfdef1ec3883d48c3f87a4be5c0dff25e17e
|
||||
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu
|
||||
@@ -0,0 +1,20 @@
|
||||
+begin 600 x86_64-pid0-core.core.bz2
|
||||
+M0EIH.3%!629362,CA>P!$/'_____^*#EZ-A!SP36P&_:G0#=14``04A&8,'U
|
||||
+M2*9`>$$)P`*RN"#*;#4R()IJ8C$TT&FC3$&@`T`#:C1H8C0T,@,FC,D"4T2!
|
||||
+M"/2CU'B90]31ZAD#U`&AZF@/4:``!HT&F@!H<`#0-`-#0``#3$-&F@```#0R
|
||||
+M``#")2FD]2>4]0TTT-!HTT--,0,"#$`R!I@AD`#1H,3&GZT.4TO$#H40/`0C
|
||||
+M2$IRXS,<55!8T,&&,R.Z441"?J9I%G6GUA2!.[]Z"C5S[&19,%VS7E6[3"60
|
||||
+M@`-*2G)QEQ(;?0Y<=MK]/U?Q)LB%+F37TJ9BI*46)H'*Z@V"`"$"P7]&<Q<?
|
||||
+M>XZ:JE0E<*:#1M$P3G]>VCI)(A!O$64`5$4`E$$-.``7&(09`8HO`B6K!Q^&
|
||||
+M562%N)2+0@*HB@%D@5$%!*0!L1&0D4D6\:-$A`)`+<6D82PP*H(J(H!?F;0$
|
||||
+M%PXB7N!2D4!44`W7"ADEQM6<B]J<B(%1GF'5*0;_00KO55=43LPR0,Q?N72`
|
||||
+M8"W*_;DV<AN#,XRU]Q-J2FDAFKAQ(9A+ZK$MCY#EI8:W-(15>O9TBO5,_]1)
|
||||
+M($Q2))#),UE,QQK)E$,3D\W.>!4)QO8A_@^Z_SXS<OEHM*+"M8I1)-C(=DIJ
|
||||
+MW+@WN)O)YO;3:I9YW-A$)N'2<A`F3),R3"3-'"S3E1;6VE*_95KD<!0050(G
|
||||
+M,JV"N(Z:@0E#)50BSF)$T6_IN)#"Z8PLQ4UQ9]@Z'+;T]990-:Y:2`P26#!D
|
||||
+MV+0L6"X@C9`GHAGSY7)%LWOY+E[2/>4;Q8=HV6[:&$@2$@$R29IBW)K%3"O`
|
||||
+M9^Y0YJ&BXY1U2HTZ5)2H-V\_(.DZHWE+C#WS($(!I"3CUH2#(+(OWUV"*<<9
|
||||
+MJ%A!J[%O.P&V%GI.`L7<1@0>,^1F\MY=V5UT,&NOG%7TTZ[03!@BHB@&)<A^
|
||||
+4B.Z!/,0-IZ^W_Q=R13A0D",CA>P`
|
||||
+`
|
||||
+end
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp
|
||||
@@ -0,0 +1,46 @@
|
||||
+# This testcase is part of GDB, the GNU debugger.
|
||||
+#
|
||||
+# Copyright 2010 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.
|
||||
+
|
||||
+# Some kernel core files have PID 0 - for the idle task.
|
||||
+
|
||||
+if ![istarget "x86_64-*-*"] {
|
||||
+ verbose "Skipping x86_64-pid0-core test."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "x86_64-pid0-core"
|
||||
+set corebz2uufile ${srcdir}/${subdir}/${testfile}.core.bz2.uu
|
||||
+set corefile ${objdir}/${subdir}/${testfile}.core
|
||||
+
|
||||
+if {[catch "system \"uudecode -o - ${corebz2uufile} | bzip2 -dc >${corefile}\""] != 0} {
|
||||
+ untested "failed uudecode or bzip2"
|
||||
+ return -1
|
||||
+}
|
||||
+file stat ${corefile} corestat
|
||||
+if {$corestat(size) != 8798208} {
|
||||
+ untested "uudecode or bzip2 produce invalid result"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+# Former crash was:
|
||||
+# thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed.
|
||||
+gdb_test "core-file ${corefile}" "Program terminated with signal 11, Segmentation fault\\.\r\n.*"
|
|
@ -0,0 +1,99 @@
|
|||
http://sourceware.org/ml/gdb-patches/2011-01/msg00016.html
|
||||
Subject: [patch] New testcase: py-prettyprint.exp: print hint_error
|
||||
|
||||
Hi,
|
||||
|
||||
PASS: gdb.python/py-prettyprint.exp: print hint_error
|
||||
for
|
||||
FYI: fix buglet in gdbpy_get_display_hint
|
||||
http://sourceware.org/ml/gdb-patches/2010-07/msg00190.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-07/msg00061.html
|
||||
|
||||
I would check it in as obvious but the 2011 ChangeLog move process has to be
|
||||
done first. So to be checked in later.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/testsuite/
|
||||
2011-01-01 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.python/py-prettyprint.c (struct hint_error): New.
|
||||
(main): New variable hint_error.
|
||||
* gdb.python/py-prettyprint.exp (run_lang_tests): New testcase
|
||||
"print hint_error".
|
||||
* gdb.python/py-prettyprint.py (class pp_hint_error): New.
|
||||
(register_pretty_printers): Register it.
|
||||
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.python/py-prettyprint.c
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/testsuite/gdb.python/py-prettyprint.c 2010-07-14 16:18:04.000000000 +0200
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.python/py-prettyprint.c 2011-01-01 17:41:24.000000000 +0100
|
||||
@@ -44,6 +44,10 @@ struct lazystring {
|
||||
const char *lazy_str;
|
||||
};
|
||||
|
||||
+struct hint_error {
|
||||
+ int x;
|
||||
+};
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
struct S : public s {
|
||||
int zs;
|
||||
@@ -232,6 +236,8 @@ main ()
|
||||
struct lazystring estring;
|
||||
estring.lazy_str = "embedded x\201\202\203\204" ;
|
||||
|
||||
+ struct hint_error hint_error;
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
S cps;
|
||||
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.python/py-prettyprint.exp
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-01-01 17:40:07.000000000 +0100
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-01-01 17:40:52.000000000 +0100
|
||||
@@ -102,6 +102,8 @@ proc run_lang_tests {lang} {
|
||||
gdb_test "print estring" "\"embedded x\\\\201\\\\202\\\\203\\\\204\""
|
||||
gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
|
||||
|
||||
+ gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"
|
||||
+
|
||||
gdb_test "print nullstr" "RuntimeError: Error reading string from inferior.*"
|
||||
|
||||
gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
|
||||
Index: gdb-7.2/gdb/testsuite/gdb.python/py-prettyprint.py
|
||||
===================================================================
|
||||
--- gdb-7.2.orig/gdb/testsuite/gdb.python/py-prettyprint.py 2010-06-04 20:18:28.000000000 +0200
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.python/py-prettyprint.py 2011-01-01 17:40:23.000000000 +0100
|
||||
@@ -151,6 +151,18 @@ class pp_ls:
|
||||
def display_hint (self):
|
||||
return 'string'
|
||||
|
||||
+class pp_hint_error:
|
||||
+ "Throw error from display_hint"
|
||||
+
|
||||
+ def __init__(self, val):
|
||||
+ self.val = val
|
||||
+
|
||||
+ def to_string(self):
|
||||
+ return 'hint_error_val'
|
||||
+
|
||||
+ def display_hint (self):
|
||||
+ raise Exception("hint failed")
|
||||
+
|
||||
class pp_outer:
|
||||
"Print struct outer"
|
||||
|
||||
@@ -236,6 +248,9 @@ def register_pretty_printers ():
|
||||
pretty_printers_dict[re.compile ('^struct outerstruct$')] = pp_outer
|
||||
pretty_printers_dict[re.compile ('^outerstruct$')] = pp_outer
|
||||
|
||||
+ pretty_printers_dict[re.compile ('^struct hint_error$')] = pp_hint_error
|
||||
+ pretty_printers_dict[re.compile ('^hint_error$')] = pp_hint_error
|
||||
+
|
||||
pretty_printers_dict = {}
|
||||
|
||||
register_pretty_printers ()
|
|
@ -0,0 +1,75 @@
|
|||
ad20e5eb15d037a31e3b484e9f57542dc927c0a9
|
||||
http://sourceware.org/ml/gdb-cvs/2010-10/msg00005.html
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/30 18:58:07 1.2462
|
||||
### src/gdb/testsuite/ChangeLog 2010/10/01 17:03:49 1.2463
|
||||
## -1,3 +1,19 @@
|
||||
+2010-10-01 Doug Evans <dje@google.com>
|
||||
+
|
||||
+ * lib/gdb-python.exp: New file.
|
||||
+ * gdb.python/py-block.exp: Use it.
|
||||
+ * gdb.python/py-breakpoint.exp: Ditto.
|
||||
+ * gdb.python/py-frame.exp: Ditto.
|
||||
+ * gdb.python/py-inferior.exp: Ditto.
|
||||
+ * gdb.python/py-param.exp: Ditto.
|
||||
+ * gdb.python/py-prettyprint.exp: Ditto.
|
||||
+ * gdb.python/py-shared.exp: Ditto.
|
||||
+ * gdb.python/py-symbol.exp: Ditto.
|
||||
+ * gdb.python/py-symtab.exp: Ditto.
|
||||
+ * gdb.python/py-type.exp: Ditto.
|
||||
+ * gdb.python/py-value.exp: Ditto.
|
||||
+ * gdb.python/python.exp: Ditto.
|
||||
+
|
||||
2010-09-30 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* gdb.base/anon.exp: New file.
|
||||
--- src/gdb/testsuite/lib/gdb-python.exp
|
||||
+++ src/gdb/testsuite/lib/gdb-python.exp 2010-10-12 17:58:35.904468000 +0000
|
||||
@@ -0,0 +1,47 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Utilities for python-scripting related tests.
|
||||
+
|
||||
+# Run a command in GDB, and report a failure if a Python exception is thrown.
|
||||
+# If report_pass is true, report a pass if no exception is thrown.
|
||||
+
|
||||
+proc gdb_py_test_silent_cmd { cmd name report_pass } {
|
||||
+ global gdb_prompt
|
||||
+
|
||||
+ gdb_test_multiple $cmd $name {
|
||||
+ -re "Traceback.*$gdb_prompt $" { fail $name }
|
||||
+ -re "$gdb_prompt $" { if $report_pass { pass $name } }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}...
|
||||
+# Run a test named NAME, consisting of multiple lines of input.
|
||||
+# After each input line INPUT, search for result line RESULT.
|
||||
+# Succeed if all results are seen; fail otherwise.
|
||||
+
|
||||
+proc gdb_py_test_multiple { name args } {
|
||||
+ global gdb_prompt
|
||||
+ foreach {input result} $args {
|
||||
+ if {[gdb_test_multiple $input "$name - $input" {
|
||||
+ -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" {
|
||||
+ pass "$name - $input"
|
||||
+ }
|
||||
+ }]} {
|
||||
+ return 1
|
||||
+ }
|
||||
+ }
|
||||
+ return 0
|
||||
+}
|
|
@ -0,0 +1,813 @@
|
|||
https://bugzilla.redhat.com/show_bug.cgi?id=610986
|
||||
http://sourceware.org/ml/gdb-cvs/2010-08/msg00112.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/08/18 22:57:45 1.12097
|
||||
### src/gdb/ChangeLog 2010/08/19 07:34:26 1.12098
|
||||
## -1,3 +1,9 @@
|
||||
+2010-08-19 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * varobj.c (varobj_create): Replace variable old_fi with old_id,
|
||||
+ initialize it by null_frame_id, wrap its usage by get_frame_id,
|
||||
+ frame_id_p and frame_find_by_id.
|
||||
+
|
||||
2010-08-18 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
PR python/11900:
|
||||
--- src/gdb/varobj.c 2010/08/06 14:17:56 1.159
|
||||
+++ src/gdb/varobj.c 2010/08/19 07:34:27 1.160
|
||||
@@ -524,7 +524,7 @@ varobj_create (char *objname,
|
||||
{
|
||||
struct varobj *var;
|
||||
struct frame_info *fi;
|
||||
- struct frame_info *old_fi = NULL;
|
||||
+ struct frame_id old_id = null_frame_id;
|
||||
struct block *block;
|
||||
struct cleanup *old_chain;
|
||||
|
||||
@@ -611,7 +611,7 @@
|
||||
|
||||
var->root->frame = get_frame_id (fi);
|
||||
var->root->thread_id = pid_to_thread_id (inferior_ptid);
|
||||
- old_fi = get_selected_frame (NULL);
|
||||
+ old_id = get_frame_id (get_selected_frame (NULL));
|
||||
select_frame (fi);
|
||||
}
|
||||
|
||||
@@ -639,8 +639,8 @@
|
||||
var->root->rootvar = var;
|
||||
|
||||
/* Reset the selected frame */
|
||||
- if (old_fi != NULL)
|
||||
- select_frame (old_fi);
|
||||
+ if (frame_id_p (old_id))
|
||||
+ select_frame (frame_find_by_id (old_id));
|
||||
}
|
||||
|
||||
/* If the variable object name is null, that means this
|
||||
|
||||
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=627506
|
||||
Re: [patch] Fix nesting of ui_out_redirect
|
||||
http://sourceware.org/ml/gdb-patches/2010-09/msg00122.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00031.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/03 01:29:09 1.12149
|
||||
### src/gdb/ChangeLog 2010/09/03 15:41:59 1.12150
|
||||
## -1,3 +1,27 @@
|
||||
+2010-09-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * breakpoint.c (save_breakpoints): Use RETURN_MASK_ALL.
|
||||
+ * cli-out.c: Include vec.h.
|
||||
+ (cli_field_fmt, cli_spaces, cli_text, cli_message, cli_flush): New
|
||||
+ variable stream, initialize it, use it.
|
||||
+ (cli_redirect): New function comment. Replace the stream and
|
||||
+ original_stream fields by the new streams field. Remove the
|
||||
+ original_stream != NULL conditional, assert error on NULL instead.
|
||||
+ (out_field_fmt, field_separator): New variable stream, initialize it, use it.
|
||||
+ (cli_out_data_ctor): Assert non-NULL stream. Replace the stream and
|
||||
+ original_stream fields by the new streams field.
|
||||
+ (cli_out_set_stream): Replace the stream field by the new streams
|
||||
+ field.
|
||||
+ * cli-out.h: Include vec.h.
|
||||
+ (ui_filep): New typedef, call DEF_VEC_P for it.
|
||||
+ (struct cli_ui_out_data): Replace the stream and original_stream
|
||||
+ fields by the new streams field.
|
||||
+ * cli/cli-logging.c (set_logging_redirect): Call ui_out_redirect with
|
||||
+ NULL first. Extend the comment.
|
||||
+ (handle_redirections): Call ui_out_redirect with output.
|
||||
+ * python/py-breakpoint.c (bppy_get_commands): Move ui_out_redirect
|
||||
+ calls outside of the TRY_CATCH block.
|
||||
+
|
||||
|
||||
[ cli/cli-logging.c removed. ]
|
||||
|
||||
--- src/gdb/breakpoint.c 2010/08/30 09:49:12 1.511
|
||||
+++ src/gdb/breakpoint.c 2010/09/03 15:42:02 1.512
|
||||
@@ -11487,7 +11487,7 @@
|
||||
fprintf_unfiltered (fp, " commands\n");
|
||||
|
||||
ui_out_redirect (uiout, fp);
|
||||
- TRY_CATCH (ex, RETURN_MASK_ERROR)
|
||||
+ TRY_CATCH (ex, RETURN_MASK_ALL)
|
||||
{
|
||||
print_command_lines (uiout, tp->commands->commands, 2);
|
||||
}
|
||||
--- src/gdb/cli-out.c 2010/05/13 23:53:32 1.30
|
||||
+++ src/gdb/cli-out.c 2010/09/03 15:42:02 1.31
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "cli-out.h"
|
||||
#include "gdb_string.h"
|
||||
#include "gdb_assert.h"
|
||||
+#include "vec.h"
|
||||
|
||||
typedef struct cli_ui_out_data cli_out_data;
|
||||
|
||||
@@ -224,11 +225,13 @@
|
||||
va_list args)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
+ struct ui_file *stream;
|
||||
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
|
||||
- vfprintf_filtered (data->stream, format, args);
|
||||
+ stream = VEC_last (ui_filep, data->streams);
|
||||
+ vfprintf_filtered (stream, format, args);
|
||||
|
||||
if (align != ui_noalign)
|
||||
field_separator ();
|
||||
@@ -238,20 +241,26 @@
|
||||
cli_spaces (struct ui_out *uiout, int numspaces)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
+ struct ui_file *stream;
|
||||
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
- print_spaces_filtered (numspaces, data->stream);
|
||||
+
|
||||
+ stream = VEC_last (ui_filep, data->streams);
|
||||
+ print_spaces_filtered (numspaces, stream);
|
||||
}
|
||||
|
||||
static void
|
||||
cli_text (struct ui_out *uiout, const char *string)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
+ struct ui_file *stream;
|
||||
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
- fputs_filtered (string, data->stream);
|
||||
+
|
||||
+ stream = VEC_last (ui_filep, data->streams);
|
||||
+ fputs_filtered (string, stream);
|
||||
}
|
||||
|
||||
static void ATTRIBUTE_PRINTF (3, 0)
|
||||
@@ -262,8 +271,13 @@
|
||||
|
||||
if (data->suppress_output)
|
||||
return;
|
||||
+
|
||||
if (ui_out_get_verblvl (uiout) >= verbosity)
|
||||
- vfprintf_unfiltered (data->stream, format, args);
|
||||
+ {
|
||||
+ struct ui_file *stream = VEC_last (ui_filep, data->streams);
|
||||
+
|
||||
+ vfprintf_unfiltered (stream, format, args);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -280,25 +294,24 @@
|
||||
cli_flush (struct ui_out *uiout)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
+ struct ui_file *stream = VEC_last (ui_filep, data->streams);
|
||||
|
||||
- gdb_flush (data->stream);
|
||||
+ gdb_flush (stream);
|
||||
}
|
||||
|
||||
+/* OUTSTREAM as non-NULL will push OUTSTREAM on the stack of output streams
|
||||
+ and make it therefore active. OUTSTREAM as NULL will pop the last pushed
|
||||
+ output stream; it is an internal error if it does not exist. */
|
||||
+
|
||||
static int
|
||||
cli_redirect (struct ui_out *uiout, struct ui_file *outstream)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
|
||||
if (outstream != NULL)
|
||||
- {
|
||||
- data->original_stream = data->stream;
|
||||
- data->stream = outstream;
|
||||
- }
|
||||
- else if (data->original_stream != NULL)
|
||||
- {
|
||||
- data->stream = data->original_stream;
|
||||
- data->original_stream = NULL;
|
||||
- }
|
||||
+ VEC_safe_push (ui_filep, data->streams, outstream);
|
||||
+ else
|
||||
+ VEC_pop (ui_filep, data->streams);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -315,10 +328,11 @@
|
||||
const char *format,...)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
+ struct ui_file *stream = VEC_last (ui_filep, data->streams);
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
- vfprintf_filtered (data->stream, format, args);
|
||||
+ vfprintf_filtered (stream, format, args);
|
||||
|
||||
va_end (args);
|
||||
}
|
||||
@@ -329,8 +343,9 @@
|
||||
field_separator (void)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
+ struct ui_file *stream = VEC_last (ui_filep, data->streams);
|
||||
|
||||
- fputc_filtered (' ', data->stream);
|
||||
+ fputc_filtered (' ', stream);
|
||||
}
|
||||
|
||||
/* This is the CLI ui-out implementation functions vector */
|
||||
@@ -364,8 +379,11 @@
|
||||
void
|
||||
cli_out_data_ctor (cli_out_data *self, struct ui_file *stream)
|
||||
{
|
||||
- self->stream = stream;
|
||||
- self->original_stream = NULL;
|
||||
+ gdb_assert (stream != NULL);
|
||||
+
|
||||
+ self->streams = NULL;
|
||||
+ VEC_safe_push (ui_filep, self->streams, stream);
|
||||
+
|
||||
self->suppress_output = 0;
|
||||
}
|
||||
|
||||
@@ -385,8 +403,10 @@
|
||||
cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
|
||||
{
|
||||
cli_out_data *data = ui_out_data (uiout);
|
||||
- struct ui_file *old = data->stream;
|
||||
+ struct ui_file *old;
|
||||
+
|
||||
+ old = VEC_pop (ui_filep, data->streams);
|
||||
+ VEC_quick_push (ui_filep, data->streams, stream);
|
||||
|
||||
- data->stream = stream;
|
||||
return old;
|
||||
}
|
||||
--- src/gdb/cli-out.h 2010/04/18 00:11:55 1.11
|
||||
+++ src/gdb/cli-out.h 2010/09/03 15:42:02 1.12
|
||||
@@ -22,14 +22,19 @@
|
||||
#define CLI_OUT_H
|
||||
|
||||
#include "ui-out.h"
|
||||
+#include "vec.h"
|
||||
+
|
||||
+/* Used for cli_ui_out_data->streams. */
|
||||
+
|
||||
+typedef struct ui_file *ui_filep;
|
||||
+DEF_VEC_P (ui_filep);
|
||||
|
||||
/* These are exported so that they can be extended by other `ui_out'
|
||||
implementations, like TUI's. */
|
||||
|
||||
struct cli_ui_out_data
|
||||
{
|
||||
- struct ui_file *stream;
|
||||
- struct ui_file *original_stream;
|
||||
+ VEC (ui_filep) *streams;
|
||||
int suppress_output;
|
||||
};
|
||||
|
||||
--- src/gdb/python/py-breakpoint.c 2010/07/01 10:36:12 1.4
|
||||
+++ src/gdb/python/py-breakpoint.c 2010/09/03 15:42:03 1.5
|
||||
@@ -474,12 +474,12 @@
|
||||
string_file = mem_fileopen ();
|
||||
chain = make_cleanup_ui_file_delete (string_file);
|
||||
|
||||
+ ui_out_redirect (uiout, string_file);
|
||||
TRY_CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
- ui_out_redirect (uiout, string_file);
|
||||
print_command_lines (uiout, breakpoint_commands (bp), 0);
|
||||
- ui_out_redirect (uiout, NULL);
|
||||
}
|
||||
+ ui_out_redirect (uiout, NULL);
|
||||
cmdstr = ui_file_xstrdup (string_file, &length);
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/02 15:19:56 1.2435
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/03 15:42:04 1.2436
|
||||
## -1,3 +1,7 @@
|
||||
+2010-09-03 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.base/ui-redirect.exp: New file.
|
||||
+
|
||||
2010-09-02 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Joel Brobecker <brobecker@adacore.com>
|
||||
|
||||
--- src/gdb/testsuite/gdb.base/ui-redirect.exp
|
||||
+++ src/gdb/testsuite/gdb.base/ui-redirect.exp 2010-09-11 18:42:40.040910000 +0000
|
||||
@@ -0,0 +1,41 @@
|
||||
+# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [prepare_for_testing ui-redirect.exp ui-redirect start.c] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_breakpoint main
|
||||
+
|
||||
+set test "commands"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "End with a line saying just \"end\"\\.\r\n>$" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "print 1"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "\r\n>$" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+gdb_test_no_output "end"
|
||||
+
|
||||
+gdb_test_no_output "set logging file /dev/null"
|
||||
+gdb_test "set logging on" "Copying output to /dev/null\\."
|
||||
+gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\."
|
||||
+gdb_test "set logging off" "Done logging to /dev/null\\."
|
||||
+gdb_test "help" "List of classes of commands:.*"
|
||||
|
||||
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=627506
|
||||
Re: [patch] Fix uiout for execute_command_to_string
|
||||
http://sourceware.org/ml/gdb-patches/2010-09/msg00235.html
|
||||
http://sourceware.org/ml/gdb-cvs/2010-09/msg00080.html
|
||||
|
||||
### src/gdb/ChangeLog 2010/09/10 16:17:11 1.12170
|
||||
### src/gdb/ChangeLog 2010/09/11 16:00:20 1.12171
|
||||
## -1,3 +1,21 @@
|
||||
+2010-09-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+ Paul Bolle <pebolle@tiscali.nl>
|
||||
+
|
||||
+ Redirect also uiout and stdtarg{,err} in execute_command_to_string.
|
||||
+ * cli-logging.c (struct saved_output_files) <targerr>: New.
|
||||
+ (set_logging_redirect, pop_output_files, handle_redirections):
|
||||
+ Redirect also gdb_stdtargerr.
|
||||
+ * defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New
|
||||
+ declarations.
|
||||
+ * event-top.c (gdb_setup_readline, gdb_disable_readline): Redirect
|
||||
+ also gdb_stdtargerr.
|
||||
+ * top.c (execute_command_to_string): Move make_cleanup_ui_file_delete
|
||||
+ to the top. Redirect also gdb_stdlog, gdb_stdtarg and gdb_stdtargerr.
|
||||
+ Use ui_out_redirect, register make_cleanup_ui_out_redirect_pop.
|
||||
+ * tui/tui-io.c (tui_setup_io): Redirect also gdb_stdtargerr.
|
||||
+ * utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop):
|
||||
+ New functions.
|
||||
+
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/10 20:29:25 1.2444
|
||||
### src/gdb/testsuite/ChangeLog 2010/09/11 16:00:26 1.2445
|
||||
## -1,3 +1,8 @@
|
||||
+2010-09-11 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.python/python.exp (set height 0, collect help from uiout)
|
||||
+ (verify help to uiout): New tests.
|
||||
+
|
||||
|
||||
[ gdb_stdtargerr handling dropped. ]
|
||||
|
||||
--- src/gdb/defs.h 2010/08/31 18:08:43 1.278
|
||||
+++ src/gdb/defs.h 2010/09/11 16:00:25 1.279
|
||||
@@ -337,6 +337,10 @@
|
||||
struct ui_file;
|
||||
extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *);
|
||||
|
||||
+struct ui_out;
|
||||
+extern struct cleanup *
|
||||
+ make_cleanup_ui_out_redirect_pop (struct ui_out *uiout);
|
||||
+
|
||||
struct section_addr_info;
|
||||
extern struct cleanup *(make_cleanup_free_section_addr_info
|
||||
(struct section_addr_info *));
|
||||
--- src/gdb/top.c 2010/08/07 15:00:37 1.183
|
||||
+++ src/gdb/top.c 2010/09/11 16:00:25 1.184
|
||||
@@ -475,12 +475,23 @@
|
||||
|
||||
str_file = mem_fileopen ();
|
||||
|
||||
+ make_cleanup_ui_file_delete (str_file);
|
||||
make_cleanup_restore_ui_file (&gdb_stdout);
|
||||
make_cleanup_restore_ui_file (&gdb_stderr);
|
||||
- make_cleanup_ui_file_delete (str_file);
|
||||
+ make_cleanup_restore_ui_file (&gdb_stdlog);
|
||||
+ make_cleanup_restore_ui_file (&gdb_stdtarg);
|
||||
+ make_cleanup_restore_ui_file (&gdb_stdtargerr);
|
||||
+
|
||||
+ if (ui_out_redirect (uiout, str_file) < 0)
|
||||
+ warning (_("Current output protocol does not support redirection"));
|
||||
+ else
|
||||
+ make_cleanup_ui_out_redirect_pop (uiout);
|
||||
|
||||
gdb_stdout = str_file;
|
||||
gdb_stderr = str_file;
|
||||
+ gdb_stdlog = str_file;
|
||||
+ gdb_stdtarg = str_file;
|
||||
+ gdb_stdtargerr = str_file;
|
||||
|
||||
execute_command (p, from_tty);
|
||||
|
||||
--- src/gdb/utils.c 2010/08/07 15:00:37 1.239
|
||||
+++ src/gdb/utils.c 2010/09/11 16:00:25 1.240
|
||||
@@ -311,6 +311,26 @@
|
||||
return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg);
|
||||
}
|
||||
|
||||
+/* Helper function for make_cleanup_ui_out_redirect_pop. */
|
||||
+
|
||||
+static void
|
||||
+do_ui_out_redirect_pop (void *arg)
|
||||
+{
|
||||
+ struct ui_out *uiout = arg;
|
||||
+
|
||||
+ if (ui_out_redirect (uiout, NULL) < 0)
|
||||
+ warning (_("Cannot restore redirection of the current output protocol"));
|
||||
+}
|
||||
+
|
||||
+/* Return a new cleanup that pops the last redirection by ui_out_redirect
|
||||
+ with NULL parameter. */
|
||||
+
|
||||
+struct cleanup *
|
||||
+make_cleanup_ui_out_redirect_pop (struct ui_out *uiout)
|
||||
+{
|
||||
+ return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout);
|
||||
+}
|
||||
+
|
||||
static void
|
||||
do_free_section_addr_info (void *arg)
|
||||
{
|
||||
--- gdb-7.2/gdb/testsuite/gdb.python/python.exp-orig 2010-08-09 21:23:00.000000000 +0200
|
||||
+++ gdb-7.2/gdb/testsuite/gdb.python/python.exp 2010-09-11 20:49:22.000000000 +0200
|
||||
@@ -110,3 +110,9 @@ gdb_test_multiple "python print \"\\n\"
|
||||
}
|
||||
}
|
||||
gdb_test "q" "Quit" "verify pagination afterwards: q"
|
||||
+
|
||||
+gdb_test_no_output "set height 0"
|
||||
+
|
||||
+gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect help from uiout"
|
||||
+
|
||||
+gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout"
|
||||
|
||||
|
||||
|
||||
http://sourceware.org/ml/gdb-cvs/2011-02/msg00063.html
|
||||
|
||||
### src/gdb/ChangeLog 2011/02/12 13:07:38 1.12557
|
||||
### src/gdb/ChangeLog 2011/02/13 09:09:33 1.12558
|
||||
## -1,3 +1,9 @@
|
||||
+2011-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * symtab.c (find_pc_sect_line): New variable objfile, initialize it
|
||||
+ from S. Iterate S using ALL_OBJFILE_SYMTABS. Verify BV for each S.
|
||||
+ * symtab.h (struct symtab) <next>: Comment extension.
|
||||
+
|
||||
2011-02-12 Yao Qi <yao@codesourcery.com>
|
||||
|
||||
* Makefile.in (CLEANDIRS): Remove duplicated common dir.
|
||||
--- src/gdb/symtab.c 2011/01/11 21:53:24 1.257
|
||||
+++ src/gdb/symtab.c 2011/02/13 09:09:36 1.258
|
||||
@@ -1904,6 +1904,7 @@
|
||||
struct blockvector *bv;
|
||||
struct minimal_symbol *msymbol;
|
||||
struct minimal_symbol *mfunsym;
|
||||
+ struct objfile *objfile;
|
||||
|
||||
/* Info on best line seen so far, and where it starts, and its file. */
|
||||
|
||||
@@ -2031,13 +2032,17 @@
|
||||
}
|
||||
|
||||
bv = BLOCKVECTOR (s);
|
||||
+ objfile = s->objfile;
|
||||
|
||||
/* Look at all the symtabs that share this blockvector.
|
||||
They all have the same apriori range, that we found was right;
|
||||
but they have different line tables. */
|
||||
|
||||
- for (; s && BLOCKVECTOR (s) == bv; s = s->next)
|
||||
+ ALL_OBJFILE_SYMTABS (objfile, s)
|
||||
{
|
||||
+ if (BLOCKVECTOR (s) != bv)
|
||||
+ continue;
|
||||
+
|
||||
/* Find the best line in this symtab. */
|
||||
l = LINETABLE (s);
|
||||
if (!l)
|
||||
--- src/gdb/symtab.h 2011/01/11 21:53:25 1.168
|
||||
+++ src/gdb/symtab.h 2011/02/13 09:09:36 1.169
|
||||
@@ -738,8 +738,7 @@
|
||||
|
||||
struct symtab
|
||||
{
|
||||
-
|
||||
- /* Chain of all existing symtabs. */
|
||||
+ /* Unordered chain of all existing symtabs of this objfile. */
|
||||
|
||||
struct symtab *next;
|
||||
|
||||
|
||||
|
||||
|
||||
http://sourceware.org/ml/gdb-cvs/2011-02/msg00064.html
|
||||
|
||||
### src/gdb/ChangeLog 2011/02/13 09:09:33 1.12558
|
||||
### src/gdb/ChangeLog 2011/02/13 09:15:50 1.12559
|
||||
## -1,5 +1,12 @@
|
||||
2011-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
+ Fix const/volatile qualifiers of C++ types, PR c++/12328.
|
||||
+ * c-typeprint.c (c_type_print_args): Update the function comment. New
|
||||
+ variable param_type, initialize it. Remove const/volatile qualifiers
|
||||
+ for language_cplus and !show_artificial. Use param_type.
|
||||
+
|
||||
+2011-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
* symtab.c (find_pc_sect_line): New variable objfile, initialize it
|
||||
from S. Iterate S using ALL_OBJFILE_SYMTABS. Verify BV for each S.
|
||||
* symtab.h (struct symtab) <next>: Comment extension.
|
||||
--- src/gdb/c-typeprint.c 2011/01/07 19:36:15 1.68
|
||||
+++ src/gdb/c-typeprint.c 2011/02/13 09:15:53 1.69
|
||||
@@ -371,9 +371,12 @@ c_type_print_modifier (struct type *type
|
||||
/* Print out the arguments of TYPE, which should have TYPE_CODE_METHOD
|
||||
or TYPE_CODE_FUNC, to STREAM. Artificial arguments, such as "this"
|
||||
in non-static methods, are displayed if SHOW_ARTIFICIAL is
|
||||
- non-zero. LANGUAGE is the language in which TYPE was defined. This is
|
||||
- a necessary evil since this code is used by the C, C++, and Java
|
||||
- backends. */
|
||||
+ non-zero. If SHOW_ARTIFICIAL is zero and LANGUAGE is language_cplus
|
||||
+ the topmost parameter types get removed their possible const and volatile
|
||||
+ qualifiers to match demangled linkage name parameters part of such function
|
||||
+ type. LANGUAGE is the language in which TYPE was defined. This is
|
||||
+ a necessary evil since this code is used by the C, C++, and Java backends.
|
||||
+ */
|
||||
|
||||
void
|
||||
c_type_print_args (struct type *type, struct ui_file *stream,
|
||||
@@ -406,6 +409,8 @@
|
||||
|
||||
for (i = 0; i < TYPE_NFIELDS (type); i++)
|
||||
{
|
||||
+ struct type *param_type;
|
||||
+
|
||||
if (TYPE_FIELD_ARTIFICIAL (type, i) && !show_artificial)
|
||||
continue;
|
||||
|
||||
@@ -398,10 +403,24 @@ c_type_print_args (struct type *type, st
|
||||
wrap_here (" ");
|
||||
}
|
||||
|
||||
+ param_type = TYPE_FIELD_TYPE (type, i);
|
||||
+
|
||||
+ if (language == language_cplus && !show_artificial)
|
||||
+ {
|
||||
+ /* C++ standard, 13.1 Overloadable declarations, point 3, item:
|
||||
+ - Parameter declarations that differ only in the presence or
|
||||
+ absence of const and/or volatile are equivalent.
|
||||
+
|
||||
+ And the const/volatile qualifiers are not present in the mangled
|
||||
+ names as produced by GCC. */
|
||||
+
|
||||
+ param_type = make_cv_type (0, 0, param_type, NULL);
|
||||
+ }
|
||||
+
|
||||
if (language == language_java)
|
||||
- java_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
|
||||
+ java_print_type (param_type, "", stream, -1, 0);
|
||||
else
|
||||
- c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
|
||||
+ c_print_type (param_type, "", stream, -1, 0);
|
||||
printed_any = 1;
|
||||
}
|
||||
|
||||
### src/gdb/testsuite/ChangeLog 2011/02/08 13:30:08 1.2576
|
||||
### src/gdb/testsuite/ChangeLog 2011/02/13 09:15:53 1.2577
|
||||
## -1,3 +1,9 @@
|
||||
+2011-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Fix const/volatile qualifiers of C++ types, PR c++/12328.
|
||||
+ * gdb.cp/overload-const.exp: New file.
|
||||
+ * gdb.cp/overload-const.cc: New file.
|
||||
+
|
||||
2011-02-08 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* gdb.opencl/callfuncs.cl: New file.
|
||||
--- src/gdb/testsuite/gdb.cp/overload-const.cc
|
||||
+++ src/gdb/testsuite/gdb.cp/overload-const.cc 2011-02-13 09:24:14.258748000 +0000
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This test case 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 <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+class myclass
|
||||
+{
|
||||
+public:
|
||||
+ static void func(const int aa) {}
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ myclass::func (42);
|
||||
+}
|
||||
--- src/gdb/testsuite/gdb.cp/overload-const.exp
|
||||
+++ src/gdb/testsuite/gdb.cp/overload-const.exp 2011-02-13 09:24:14.561175000 +0000
|
||||
@@ -0,0 +1,29 @@
|
||||
+# 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+if {[skip_cplus_tests]} { continue }
|
||||
+
|
||||
+set testfile "overload-const"
|
||||
+if [prepare_for_testing $testfile $testfile $testfile.cc {c++ debug}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test_no_output "set language c++"
|
||||
+
|
||||
+if [gdb_breakpoint "myclass::func"] {
|
||||
+ pass "setting breakpoint at myclass::func"
|
||||
+}
|
||||
|
||||
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=678454
|
||||
http://sourceware.org/ml/gdb-cvs/2011-02/msg00133.html
|
||||
|
||||
### src/gdb/ChangeLog 2011/02/18 16:43:50 1.12607
|
||||
### src/gdb/ChangeLog 2011/02/18 19:10:44 1.12608
|
||||
## -1,3 +1,10 @@
|
||||
+2011-02-18 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+ Tom Tromey <tromey@redhat.com>
|
||||
+
|
||||
+ * cp-support.c (make_symbol_overload_list_namespace): Do not call
|
||||
+ make_symbol_overload_list_block with NULL BLOCK.
|
||||
+ * valarith.c (unop_user_defined_p): Resolve also TYPE_CODE_TYPEDEF.
|
||||
+
|
||||
2011-02-18 Pedro Alves <pedro@codesourcery.com>
|
||||
|
||||
* breakpoint.c (get_number_trailer): No longer accept a NULL PP.
|
||||
--- src/gdb/cp-support.c 2011/01/05 22:22:47 1.47
|
||||
+++ src/gdb/cp-support.c 2011/02/18 19:10:46 1.48
|
||||
@@ -778,11 +778,13 @@
|
||||
|
||||
/* Look in the static block. */
|
||||
block = block_static_block (get_selected_block (0));
|
||||
- make_symbol_overload_list_block (name, block);
|
||||
+ if (block)
|
||||
+ make_symbol_overload_list_block (name, block);
|
||||
|
||||
/* Look in the global block. */
|
||||
block = block_global_block (block);
|
||||
- make_symbol_overload_list_block (name, block);
|
||||
+ if (block)
|
||||
+ make_symbol_overload_list_block (name, block);
|
||||
|
||||
}
|
||||
|
||||
--- src/gdb/valarith.c 2011/02/14 11:30:37 1.98
|
||||
+++ src/gdb/valarith.c 2011/02/18 19:10:46 1.99
|
||||
@@ -315,15 +315,9 @@
|
||||
if (op == UNOP_ADDR)
|
||||
return 0;
|
||||
type1 = check_typedef (value_type (arg1));
|
||||
- for (;;)
|
||||
- {
|
||||
- if (TYPE_CODE (type1) == TYPE_CODE_STRUCT)
|
||||
- return 1;
|
||||
- else if (TYPE_CODE (type1) == TYPE_CODE_REF)
|
||||
- type1 = TYPE_TARGET_TYPE (type1);
|
||||
- else
|
||||
- return 0;
|
||||
- }
|
||||
+ if (TYPE_CODE (type1) == TYPE_CODE_REF)
|
||||
+ type1 = check_typedef (TYPE_TARGET_TYPE (type1));
|
||||
+ return TYPE_CODE (type1) == TYPE_CODE_STRUCT;
|
||||
}
|
||||
|
||||
/* Try to find an operator named OPERATOR which takes NARGS arguments
|
||||
### src/gdb/testsuite/ChangeLog 2011/02/17 22:08:12 1.2594
|
||||
### src/gdb/testsuite/ChangeLog 2011/02/18 19:10:46 1.2595
|
||||
## -1,3 +1,8 @@
|
||||
+2011-02-18 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ * gdb.cp/typedef-operator.exp: New file.
|
||||
+ * gdb.cp/typedef-operator.cc: New file.
|
||||
+
|
||||
2011-02-17 Michael Snyder <msnyder@vmware.com>
|
||||
|
||||
* gdb.threads/thread-find.exp: Fix regular expressions.
|
||||
--- src/gdb/testsuite/gdb.cp/typedef-operator.cc
|
||||
+++ src/gdb/testsuite/gdb.cp/typedef-operator.cc 2011-02-21 17:18:30.419734000 +0000
|
||||
@@ -0,0 +1,31 @@
|
||||
+/* This test case 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 <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+class C
|
||||
+{
|
||||
+public:
|
||||
+ int operator* () { return 42; }
|
||||
+};
|
||||
+typedef C D;
|
||||
+
|
||||
+D u;
|
||||
+D &v = u;
|
||||
+
|
||||
+int main ()
|
||||
+{
|
||||
+ return *v;
|
||||
+}
|
||||
--- src/gdb/testsuite/gdb.cp/typedef-operator.exp
|
||||
+++ src/gdb/testsuite/gdb.cp/typedef-operator.exp 2011-02-21 17:18:30.916753000 +0000
|
||||
@@ -0,0 +1,33 @@
|
||||
+# 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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# This file is part of the gdb testsuite.
|
||||
+
|
||||
+if {[skip_cplus_tests]} { continue }
|
||||
+
|
||||
+set testfile "typedef-operator"
|
||||
+if [prepare_for_testing $testfile $testfile $testfile.cc {c++ debug}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test_no_output "set language c++"
|
||||
+
|
||||
+gdb_test "p *u" {You can't do that without a process to debug.} "test crash"
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "p *v" " = 42" "test typedef"
|
|
@ -0,0 +1,474 @@
|
|||
--- ./gdb/breakpoint.c 2011-03-05 07:11:41.000000000 +0100
|
||||
+++ ./gdb/breakpoint.c 2011-03-05 07:08:59.000000000 +0100
|
||||
@@ -11730,6 +11730,7 @@ all_tracepoints ()
|
||||
return tp_vec;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
/* Call type_mark_used for any TYPEs referenced from this GDB source file. */
|
||||
|
||||
static void
|
||||
@@ -11745,6 +11746,7 @@ breakpoint_types_mark_used (void)
|
||||
type_mark_used (value_type (b->val));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
|
||||
/* This help string is used for the break, hbreak, tbreak and thbreak commands.
|
||||
@@ -12441,5 +12443,7 @@ inferior in all-stop mode, gdb behaves a
|
||||
automatic_hardware_breakpoints = 1;
|
||||
|
||||
observer_attach_about_to_proceed (breakpoint_about_to_proceed);
|
||||
+#if 0
|
||||
observer_attach_mark_used (breakpoint_types_mark_used);
|
||||
+#endif
|
||||
}
|
||||
--- ./gdb/doc/observer.texi 2011-03-05 07:11:40.000000000 +0100
|
||||
+++ ./gdb/doc/observer.texi 2011-03-05 07:08:59.000000000 +0100
|
||||
@@ -223,10 +223,10 @@ Bytes from @var{data} to @var{data} + @v
|
||||
to the current inferior at @var{addr}.
|
||||
@end deftypefun
|
||||
|
||||
-@deftypefun void mark_used (void)
|
||||
-Mark any possibly reclaimable objects as used during a mark-and-sweep garbage
|
||||
-collector pass. Currently only @code{type_mark_used} marker is supported.
|
||||
-@end deftypefun
|
||||
+@c @deftypefun void mark_used (void)
|
||||
+@c Mark any possibly reclaimable objects as used during a mark-and-sweep garbage
|
||||
+@c collector pass. Currently only @code{type_mark_used} marker is supported.
|
||||
+@c @end deftypefun
|
||||
|
||||
@deftypefun void test_notification (int @var{somearg})
|
||||
This observer is used for internal testing. Do not use.
|
||||
--- ./gdb/gdbtypes.c 2011-03-05 07:11:41.000000000 +0100
|
||||
+++ ./gdb/gdbtypes.c 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -126,11 +126,13 @@ static void print_arg_types (struct fiel
|
||||
static void dump_fn_fieldlists (struct type *, int);
|
||||
static void print_cplus_stuff (struct type *, int);
|
||||
|
||||
+#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
|
||||
@@ -161,6 +163,7 @@ 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. */
|
||||
@@ -179,6 +182,7 @@ set_type_as_discardable (struct type *ty
|
||||
gdb_assert (!*slot);
|
||||
*slot = type;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Allocate a new type like alloc_type but preserve for it the discardability
|
||||
state of PARENT_TYPE. */
|
||||
@@ -188,8 +192,10 @@ alloc_type_as_parent (struct type *paren
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -3219,11 +3225,13 @@ copy_type_recursive_1 (struct objfile *o
|
||||
TYPE_OBJFILE_OWNED (new_type) = 0;
|
||||
TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
|
||||
|
||||
+#if 0
|
||||
/* TYPE_MAIN_TYPE memory copy above rewrote the TYPE_DISCARDABLE flag so we
|
||||
need to initialize it again. And even if TYPE was already discardable
|
||||
NEW_TYPE so far is not registered in TYPE_DISCARDABLE_TABLE. */
|
||||
TYPE_DISCARDABLE (new_type) = 0;
|
||||
set_type_as_discardable (new_type);
|
||||
+#endif
|
||||
|
||||
/* Pre-clear the fields processed by delete_main_type. If DWARF block
|
||||
evaluations below call error we would leave an unfreeable TYPE. */
|
||||
@@ -3537,6 +3545,7 @@ copy_type (const struct type *type)
|
||||
return new_type;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
/* Callback type for main_type_crawl. */
|
||||
typedef int (*main_type_crawl_iter) (struct type *type, void *data);
|
||||
|
||||
@@ -3730,6 +3739,7 @@ free_all_types (void)
|
||||
|
||||
htab_traverse (type_discardable_table, type_discardable_remove, NULL);
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Helper functions to initialize architecture-specific types. */
|
||||
|
||||
@@ -4261,9 +4271,11 @@ _initialize_gdbtypes (void)
|
||||
{
|
||||
gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init);
|
||||
|
||||
+#if 0
|
||||
type_discardable_table = htab_create_alloc (20, type_discardable_hash,
|
||||
type_discardable_equal, NULL,
|
||||
xcalloc, xfree);
|
||||
+#endif
|
||||
|
||||
objfile_type_data = register_objfile_data ();
|
||||
|
||||
--- ./gdb/gdbtypes.h 2011-03-05 07:11:41.000000000 +0100
|
||||
+++ ./gdb/gdbtypes.h 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -297,6 +297,7 @@ enum type_instance_flag_value
|
||||
|
||||
#define TYPE_DECLARED_CLASS(t) (TYPE_MAIN_TYPE (t)->flag_declared_class)
|
||||
|
||||
+#if 0
|
||||
/* Define this type as being reclaimable during free_all_types. Type is
|
||||
required to be have TYPE_OBJFILE set to NULL. Setting this flag requires
|
||||
initializing TYPE_DISCARDABLE_AGE, see alloc_type_discardable. */
|
||||
@@ -308,6 +309,7 @@ enum type_instance_flag_value
|
||||
by TYPE_DISCARDABLE_AGE_CURRENT. */
|
||||
|
||||
#define TYPE_DISCARDABLE_AGE(t) (TYPE_MAIN_TYPE (t)->flag_discardable_age)
|
||||
+#endif
|
||||
|
||||
/* Is HIGH_BOUND a low-bound relative count (1) or the high bound itself (0)? */
|
||||
|
||||
@@ -450,8 +452,10 @@ struct main_type
|
||||
/* True if this type was declared with "class" rather than
|
||||
"struct". */
|
||||
unsigned int flag_declared_class : 1;
|
||||
+#if 0
|
||||
unsigned int flag_discardable : 1;
|
||||
unsigned int flag_discardable_age : 1;
|
||||
+#endif
|
||||
unsigned int flag_dynamic : 1;
|
||||
unsigned int flag_range_high_bound_is_count : 1;
|
||||
unsigned int flag_not_allocated : 1;
|
||||
@@ -1519,7 +1523,9 @@ extern int is_public_ancestor (struct ty
|
||||
|
||||
extern int is_unique_ancestor (struct type *, struct value *);
|
||||
|
||||
+#if 0
|
||||
extern void type_mark_used (struct type *type);
|
||||
+#endif
|
||||
|
||||
/* Overload resolution */
|
||||
|
||||
@@ -1588,6 +1594,8 @@ extern struct type *copy_type_recursive
|
||||
|
||||
extern struct type *copy_type (const struct type *type);
|
||||
|
||||
+#if 0
|
||||
extern void free_all_types (void);
|
||||
+#endif
|
||||
|
||||
#endif /* GDBTYPES_H */
|
||||
--- ./gdb/parse.c 2011-03-05 07:11:41.000000000 +0100
|
||||
+++ ./gdb/parse.c 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -1584,6 +1584,7 @@ exp_uses_objfile (struct expression *exp
|
||||
|
||||
/* Helper for exp_types_mark_used. */
|
||||
|
||||
+#if 0
|
||||
static int
|
||||
exp_types_mark_used_iter (struct type *type, void *unused)
|
||||
{
|
||||
@@ -1600,6 +1601,7 @@ exp_types_mark_used (struct expression *
|
||||
{
|
||||
exp_iterate (exp, exp_types_mark_used_iter, NULL, NULL);
|
||||
}
|
||||
+#endif
|
||||
|
||||
void
|
||||
_initialize_parse (void)
|
||||
--- ./gdb/parser-defs.h 2011-03-05 07:11:40.000000000 +0100
|
||||
+++ ./gdb/parser-defs.h 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -328,6 +328,8 @@ extern int exp_uses_objfile (struct expr
|
||||
|
||||
extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile);
|
||||
|
||||
+#if 0
|
||||
extern void exp_types_mark_used (struct expression *exp);
|
||||
+#endif
|
||||
|
||||
#endif /* PARSER_DEFS_H */
|
||||
--- ./gdb/printcmd.c 2011-03-05 07:11:40.000000000 +0100
|
||||
+++ ./gdb/printcmd.c 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -1485,6 +1485,7 @@ x_command (char *exp, int from_tty)
|
||||
}
|
||||
}
|
||||
|
||||
+#if 0
|
||||
/* Call type_mark_used for any TYPEs referenced from this GDB source file. */
|
||||
|
||||
static void
|
||||
@@ -1499,6 +1500,7 @@ print_types_mark_used (void)
|
||||
if (d->exp)
|
||||
exp_types_mark_used (d->exp);
|
||||
}
|
||||
+#endif
|
||||
|
||||
|
||||
|
||||
@@ -2899,5 +2901,7 @@ Show printing of source filename and lin
|
||||
Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\
|
||||
a command line, and call it."));
|
||||
|
||||
+#if 0
|
||||
observer_attach_mark_used (print_types_mark_used);
|
||||
+#endif
|
||||
}
|
||||
--- ./gdb/python/py-type.c 2011-03-05 07:11:40.000000000 +0100
|
||||
+++ ./gdb/python/py-type.c 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -45,8 +45,10 @@ typedef struct pyty_type_object
|
||||
struct pyty_type_object *next;
|
||||
} type_object;
|
||||
|
||||
+#if 0
|
||||
/* First element of a doubly-linked list of TYPE_DISCARDABLE Types. */
|
||||
static type_object *pyty_objects_discardable;
|
||||
+#endif
|
||||
|
||||
static PyTypeObject type_object_type;
|
||||
|
||||
@@ -647,6 +649,7 @@ typy_link (type_object *type_obj)
|
||||
type_obj->next->prev = type_obj;
|
||||
set_objfile_data (objfile, typy_objfile_data_key, type_obj);
|
||||
}
|
||||
+#if 0
|
||||
else if (type_obj->type && TYPE_DISCARDABLE (type_obj->type))
|
||||
{
|
||||
type_obj->next = pyty_objects_discardable;
|
||||
@@ -654,6 +657,7 @@ typy_link (type_object *type_obj)
|
||||
type_obj->next->prev = type_obj;
|
||||
pyty_objects_discardable = type_obj;
|
||||
}
|
||||
+#endif
|
||||
else
|
||||
type_obj->next = NULL;
|
||||
}
|
||||
@@ -672,8 +676,10 @@ typy_unlink (type_object *type_obj)
|
||||
|
||||
set_objfile_data (objfile, typy_objfile_data_key, type_obj->next);
|
||||
}
|
||||
+#if 0
|
||||
else if (pyty_objects_discardable == type_obj)
|
||||
pyty_objects_discardable = type_obj->next;
|
||||
+#endif
|
||||
|
||||
if (type_obj->next)
|
||||
type_obj->next->prev = type_obj->prev;
|
||||
@@ -722,6 +728,7 @@ typy_dealloc (PyObject *obj)
|
||||
type_obj->ob_type->tp_free (obj);
|
||||
}
|
||||
|
||||
+#if 0
|
||||
/* Call type_mark_used for any TYPEs referenced from this GDB source file. */
|
||||
static void
|
||||
typy_types_mark_used (void)
|
||||
@@ -733,6 +740,7 @@ typy_types_mark_used (void)
|
||||
type_obj = type_obj->next)
|
||||
type_mark_used (type_obj->type);
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* Create a new Type referring to TYPE. */
|
||||
PyObject *
|
||||
@@ -820,7 +828,9 @@ gdbpy_initialize_types (void)
|
||||
Py_INCREF (&field_object_type);
|
||||
PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type);
|
||||
|
||||
+#if 0
|
||||
observer_attach_mark_used (typy_types_mark_used);
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
--- ./gdb/python/py-value.c 2011-03-05 07:11:41.000000000 +0100
|
||||
+++ ./gdb/python/py-value.c 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -1071,6 +1071,7 @@ gdbpy_is_value_object (PyObject *obj)
|
||||
return PyObject_TypeCheck (obj, &value_object_type);
|
||||
}
|
||||
|
||||
+#if 0
|
||||
/* Call type_mark_used for any TYPEs referenced from this GDB source file. */
|
||||
|
||||
static void
|
||||
@@ -1081,6 +1082,7 @@ python_types_mark_used (void)
|
||||
for (iter = values_in_python; iter; iter = iter->next)
|
||||
type_mark_used (value_type (iter->value));
|
||||
}
|
||||
+#endif
|
||||
|
||||
void
|
||||
gdbpy_initialize_values (void)
|
||||
@@ -1093,7 +1095,9 @@ gdbpy_initialize_values (void)
|
||||
|
||||
values_in_python = NULL;
|
||||
|
||||
+#if 0
|
||||
observer_attach_mark_used (python_types_mark_used);
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
--- ./gdb/top.c 2011-03-05 07:11:41.000000000 +0100
|
||||
+++ ./gdb/top.c 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -337,7 +337,9 @@ void
|
||||
prepare_execute_command (void)
|
||||
{
|
||||
free_all_values ();
|
||||
+#if 0
|
||||
free_all_types ();
|
||||
+#endif
|
||||
|
||||
/* With multiple threads running while the one we're examining is stopped,
|
||||
the dcache can get stale without us being able to detect it.
|
||||
--- ./gdb/value.c 2011-03-05 07:11:41.000000000 +0100
|
||||
+++ ./gdb/value.c 2011-03-05 07:09:00.000000000 +0100
|
||||
@@ -1004,7 +1004,9 @@ value_history_cleanup (void *unused)
|
||||
|
||||
/* Free the unreferenced types above. */
|
||||
free_all_values ();
|
||||
+#if 0
|
||||
free_all_types ();
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Internal variables. These are variables within the debugger
|
||||
@@ -1484,6 +1486,7 @@ call_internal_function (struct gdbarch *
|
||||
return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv);
|
||||
}
|
||||
|
||||
+#if 0
|
||||
/* Call type_mark_used for any TYPEs referenced from this GDB source file. */
|
||||
|
||||
static void
|
||||
@@ -1517,6 +1520,7 @@ value_types_mark_used (void)
|
||||
type_mark_used (value_type (chunk->values[i]));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
/* The 'function' command. This does nothing -- it is just a
|
||||
placeholder to let "help function NAME" work. This is also used as
|
||||
@@ -2573,5 +2577,7 @@ Placeholder command for showing help on
|
||||
|
||||
make_final_cleanup (value_history_cleanup, NULL);
|
||||
|
||||
+#if 0
|
||||
observer_attach_mark_used (value_types_mark_used);
|
||||
+#endif
|
||||
}
|
||||
commit b20c7d74a7e132186e7d80525eae8ed08ca4d5b8
|
||||
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Date: Tue Mar 8 08:50:33 2011 +0100
|
||||
|
||||
New testcase for the garbage collector MI incompleteness.
|
||||
|
||||
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.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ char vla[argc];
|
||||
+
|
||||
+ vla[0] = 0; /* break-here */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
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.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+load_lib mi-support.exp
|
||||
+set MIFLAGS "-i=mi2"
|
||||
+
|
||||
+gdb_exit
|
||||
+if [mi_gdb_start] {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "mi2-var-stale-type"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile ${objdir}/${subdir}/${testfile}
|
||||
+if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+mi_delete_breakpoints
|
||||
+mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||
+mi_gdb_load ${binfile}
|
||||
+
|
||||
+mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
|
||||
+ {\^done} \
|
||||
+ "maintenance set internal-error quit yes"
|
||||
+
|
||||
+mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
|
||||
+ {\^done} \
|
||||
+ "maintenance set internal-error corefile yes"
|
||||
+
|
||||
+set line [gdb_get_line_number "break-here"]
|
||||
+set func "main"
|
||||
+
|
||||
+mi_gdb_test "-break-insert -t $srcfile:$line" \
|
||||
+ "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",line=\"$line\",times=\"0\",original-location=\".*\"\}" \
|
||||
+ "breakpoint at $func"
|
||||
+
|
||||
+if { [mi_run_cmd] < 0 } {
|
||||
+ return -1
|
||||
+}
|
||||
+mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
|
||||
+
|
||||
+mi_create_varobj "vla" "vla" "create local variable vla"
|
||||
+
|
||||
+mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
|
57
gdb2fail.sh
57
gdb2fail.sh
|
@ -1,57 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
if test "$#" -eq 0
|
||||
then
|
||||
echo >&2 "Usage: $0 [ /mnt/brew/packages/gdb/VERSION/DIST/data/logs/ARCH/build.log ]"
|
||||
echo >&2 " [ /mnt/brew/scratch/USERNAME/task_TASKID/logs/ARCH/build.log ]"
|
||||
echo >&2 " [ /mnt/brew/work/tasks/TASKID/build.log ] ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d tests ];then
|
||||
if [ ! -f tests/.v2 ];then
|
||||
echo >&2 "Directory will be deleted!: tests"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf tests
|
||||
fi
|
||||
mkdir tests
|
||||
touch tests/.v2 # Marker for this temporary directory type
|
||||
|
||||
find "$@" -path '*/build.log' -print | while read f
|
||||
do
|
||||
echo "$f" >&2
|
||||
ver=`echo "$f" | sed -n -e 's,^.*gdb/\([-0-9\.]*\)/\([^/]*\)/data/logs/\([^/]*\)/.*$,-\1,p'`
|
||||
rel=`echo "$f" | sed -n -e 's,^.*gdb/\([-0-9\.]*\)/\([^/]*\)/data/logs/\([^/]*\)/.*$,-\2,p'`
|
||||
isa=`echo "$f" | sed -n -e 's,^.*gdb/\([-0-9\.]*\)/\([^/]*\)/data/logs/\([^/]*\)/.*$,.\3,p'`
|
||||
if test -z "$ver" ; then
|
||||
ver=`echo "$f" | sed -n -e 's,^.*/scratch/.*/task_\([0-9]*\)/logs/\([^/]*\)/.*$,-\1,p'`
|
||||
fi
|
||||
if test -z "$ver" ; then
|
||||
ver=`echo "$f" | sed -n -e 's,^.*/build-\([0-9]*\)/.*$,-\1,p'`
|
||||
fi
|
||||
if test -z "$isa" ; then
|
||||
isa=`echo "$f" | sed -n -e 's,^.*/scratch/.*/task_\([0-9]*\)/logs/\([^/]*\)/.*$,-\2,p'`
|
||||
fi
|
||||
if test -z "$ver" ; then
|
||||
ver=`echo "$f" | sed -n -e 's,^.*/work/tasks/\([0-9]*\)/.*$,-\1,p'`
|
||||
fi
|
||||
# begin 644 gdb-i386-redhat-linux-gnu.tar.bz2
|
||||
for t in sum log ; do
|
||||
if test -z "$isa" ; then
|
||||
isa=`uudecode < "$f" -o /dev/stdout | bunzip2 \
|
||||
| tar -t -f - "gdb-*-redhat-linux-gnu.$t" 2>&1 \
|
||||
| sed -n 's/^gdb-\(.*\)-redhat-linux-gnu[.].*$/-\1/p' \
|
||||
`
|
||||
fi
|
||||
line="gdb${ver}${rel}${isa}"
|
||||
uudecode < "$f" -o /dev/stdout | bunzip2 \
|
||||
| tar -xpvvO -f - "gdb-*-redhat-linux-gnu.$t" \
|
||||
> "tests/$line.$t"
|
||||
done
|
||||
done
|
||||
|
||||
( cd tests && /home/cygnus/cagney/bin/do-analize-tests *.sum )
|
||||
|
||||
echo "$PWD/tests/*.html"
|
||||
ls -1 tests/*.html 1>&2
|
40
gdb2patch.sh
40
gdb2patch.sh
|
@ -1,40 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Generate a patch that brings the most recent snapshot up-to-date
|
||||
|
||||
#branch=HEAD
|
||||
date='-D 2004-06-07-gmt'
|
||||
dir=`echo "cvs${branch}${date}" | tr ' ' '-'`
|
||||
patch=gdb-`sed -n -e 's/^Version:[ ]*\(.*\)$/\1/p' gdb.spec`
|
||||
|
||||
if test ! -d ${dir}/src
|
||||
then
|
||||
( mkdir -p ${dir} && cd ${dir} && cvs \
|
||||
-d :pserver:anoncvs@sources.redhat.com:/cvs/src \
|
||||
checkout ${branch} ${date} gdb )
|
||||
fi
|
||||
|
||||
( cd ${dir}/src && cvs diff -Nu -r BASE -D `date -u +"%Y-%m-%d-gmt"` ./gdb ) | sed -e '
|
||||
/^Index: .*\/version\.in$/,/^Index/ d
|
||||
/^Index:/d
|
||||
/^====/d
|
||||
/^RCS/d
|
||||
/^retrieving/d
|
||||
/^diff/d
|
||||
/^--- /N
|
||||
/^---.* \/dev\/null/ {
|
||||
p
|
||||
d
|
||||
}
|
||||
/^--- \.\// {
|
||||
s/^--- \([-a-zA-Z\/\.0-9\+]*\)/--- \1.1/
|
||||
p
|
||||
d
|
||||
}
|
||||
' | tee $patch-sync-`date -u +%Y%m%d`
|
||||
|
||||
exit
|
||||
|
||||
# s/^--- \([-a-zA-Z\/\.0-9\+]*\)/--- \1.1/
|
||||
# s/^[\+][\+][\+] \([-a-zA-Z\/\.0-9\+]*\)/+++ \1/
|
||||
|
71
gdbcompare
71
gdbcompare
|
@ -1,71 +0,0 @@
|
|||
#! /usr/bin/perl
|
||||
# $Id: gdbcompare,v 1.5 2008/03/01 08:01:57 jkratoch Exp $
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::Dumper;
|
||||
|
||||
my $reverse=shift @ARGV if ($ARGV[0]||"") eq "-r";
|
||||
my $suffix=shift @ARGV if ($ARGV[0]||"")=~/^(?:sum|log)$/;
|
||||
$suffix||="sum";
|
||||
|
||||
local *DIR;
|
||||
opendir DIR,"tests" or die "opendir: $!";
|
||||
my %arch;
|
||||
for my $name (sort readdir(DIR)) {
|
||||
# next if $name!~/^gdb-.*[-.]([^-.]+)[.]$suffix$/o;
|
||||
next if $name!~/^\d+-(.*)[.]$suffix$/o;
|
||||
push @{$arch{$1}},$name;
|
||||
}
|
||||
closedir DIR or die "closedir: $!";
|
||||
|
||||
for (values(%arch)) {
|
||||
next if 2==@$_;
|
||||
warn "Single element: ".${$_}[0]."\n" if 1==@$_;
|
||||
die "Not 2 elements:\n".Dumper($_) if 1!=@$_;
|
||||
}
|
||||
|
||||
system("rm -f tests/gdbcompare-*.diff") and die;
|
||||
|
||||
for my $arch (sort keys(%arch)) {
|
||||
next if 2!=@{$arch{$arch}};
|
||||
# sub trans { return {"."=>0,"-"=>1}->{($_[0]=~/([-.])[^-.]+[.]\w+$/)[0]}.$_[0]; };
|
||||
sub trans { return $_[0]; };
|
||||
my @sorted=sort { my $a1=trans $a; my $b1=trans $b; ($b1 cmp $a1) * ($reverse ? -1 : +1); } @{$arch{$arch}};
|
||||
do { system $_ and die $_; } for "diff -u tests/'".$sorted[1]."' tests/'".$sorted[0]."' >tests/gdbcompare-'$arch'.'$suffix'.diff;true";
|
||||
}
|
||||
|
||||
system("vim tests/gdbcompare-*.'$suffix'.diff");
|
||||
|
||||
__END__;
|
||||
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2820599 Dec 11 16:23 gdb-450894-i386.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 661657 Dec 11 16:23 gdb-450894-i386.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 3238088 Dec 11 16:23 gdb-450894-ia64.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 662796 Dec 11 16:23 gdb-450894-ia64.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2959339 Dec 11 16:23 gdb-450894-ppc.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 678114 Dec 11 16:23 gdb-450894-ppc.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2932760 Dec 11 16:23 gdb-450894-ppc64.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 674048 Dec 11 16:23 gdb-450894-ppc64.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2855270 Dec 11 16:23 gdb-450894-s390.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 666079 Dec 11 16:23 gdb-450894-s390.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2883027 Dec 11 16:23 gdb-450894-s390x.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 668279 Dec 11 16:23 gdb-450894-s390x.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2911138 Dec 11 16:23 gdb-450894-x86_64.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 666999 Dec 11 16:23 gdb-450894-x86_64.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2882257 Dec 11 16:23 gdb-6.5-13.fc6.i386.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 667929 Dec 11 16:23 gdb-6.5-13.fc6.i386.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 3311427 Dec 11 16:23 gdb-6.5-13.fc6.ia64.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 669221 Dec 11 16:23 gdb-6.5-13.fc6.ia64.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 3025126 Dec 11 16:23 gdb-6.5-13.fc6.ppc.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 684577 Dec 11 16:23 gdb-6.5-13.fc6.ppc.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 3267611 Dec 11 16:23 gdb-6.5-13.fc6.ppc64.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 682348 Dec 11 16:23 gdb-6.5-13.fc6.ppc64.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2912963 Dec 11 16:23 gdb-6.5-13.fc6.s390.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 672505 Dec 11 16:23 gdb-6.5-13.fc6.s390.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2942297 Dec 11 16:23 gdb-6.5-13.fc6.s390x.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 674676 Dec 11 16:23 gdb-6.5-13.fc6.s390x.sum
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 2974880 Dec 11 16:23 gdb-6.5-13.fc6.x86_64.log
|
||||
-rw-rw-r-- 1 jkratoch jkratoch 673396 Dec 11 16:23 gdb-6.5-13.fc6.x86_64.sum
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#! /bin/sh
|
||||
# $Id: gdbpatchno,v 1.1 2006/12/29 20:35:43 jkratoch Exp $
|
||||
# Print the first unused patch number across all the current package's branches.
|
||||
|
||||
echo $[1+$(cat ../*/*.spec|sed -n 's/^[# %]*patch\([0-9]*\).*$/\1/p'|sort -rnu|head -n1)]
|
Loading…
Reference in New Issue