Accepting request 125095 from devel:gcc

- Merge from gdb-7.4.50.20120603-3.fc18.src.rpm.
  * Wed Jun  6 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120603-3.fc18
  - Disable -lmcheck in the development builds.
  - Fix assertion on some files as glibc-2.15.90-8.fc18 (Doug Evans).
  
  * Sun Jun  3 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120603-2.fc18
  - Fix Release.
  - Make yum --enablerepo compatible with at least mock-1.1.21-1.fc16 Rawhide cfg.
  
  * Sun Jun  3 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120602-1.fc18
  - Rebase to FSF GDB 7.4.50.20120602.
  - [testsuite] BuildRequire gcc-go.
  - Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763).
  - Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651).
  - Use librpm.so.3 for rpm-4.10.0 in Fedora 18.
  - Revert recent breakage of UNIX objfiles order for symbols lookup.
  
  * Sat Jun  2 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-48.fc17
  - [ppc] Fix hardware watchpoints on PowerPC (BZ 827600, Edjunior Machado).
  
  * Mon May 28 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-47.fc17
  - Workaround PR libc/14166 for inferior calls of strstr.
  
  * Mon May 14 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-46.fc17
  - [RHEL5] Workaround doc build race.
  
  * Mon May 14 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-45.fc17
  - Rename "set auto-load" patchset variable $ddir to $datadir.
  
  * Wed May  9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-44.fc17

OBS-URL: https://build.opensuse.org/request/show/125095
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=88
This commit is contained in:
Stephan Kulow 2012-06-16 04:55:29 +00:00 committed by Git OBS Bridge
parent c0ed4ee70c
commit cfb8ad09aa
86 changed files with 9093 additions and 34330 deletions

View File

@ -1,11 +1,11 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231832
Index: gdb-7.2.50.20101116/gdb/symmisc.c
Index: gdb-7.4.50.20111218/gdb/symmisc.c
===================================================================
--- gdb-7.2.50.20101116.orig/gdb/symmisc.c 2010-11-16 07:53:59.000000000 +0100
+++ gdb-7.2.50.20101116/gdb/symmisc.c 2010-11-16 08:03:08.000000000 +0100
@@ -186,8 +186,8 @@ print_objfile_statistics (void)
--- gdb-7.4.50.20111218.orig/gdb/symmisc.c 2011-04-04 17:19:59.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/symmisc.c 2011-12-19 00:28:18.189232014 +0100
@@ -147,8 +147,8 @@ print_objfile_statistics (void)
if (OBJSTAT (objfile, sz_strtab) > 0)
printf_filtered (_(" Space used by a.out string tables: %d\n"),
OBJSTAT (objfile, sz_strtab));
@ -16,10 +16,10 @@ Index: gdb-7.2.50.20101116/gdb/symmisc.c
printf_filtered (_(" Total memory used for psymbol cache: %d\n"),
bcache_memory_used (psymbol_bcache_get_bcache
(objfile->psymbol_cache)));
Index: gdb-7.2.50.20101116/include/obstack.h
Index: gdb-7.4.50.20111218/include/obstack.h
===================================================================
--- gdb-7.2.50.20101116.orig/include/obstack.h 2008-10-21 01:03:31.000000000 +0200
+++ gdb-7.2.50.20101116/include/obstack.h 2010-11-16 08:02:37.000000000 +0100
--- gdb-7.4.50.20111218.orig/include/obstack.h 2011-10-22 03:35:29.000000000 +0200
+++ gdb-7.4.50.20111218/include/obstack.h 2011-12-19 00:28:18.189232014 +0100
@@ -188,31 +188,31 @@ struct obstack /* control current objec
/* Declare the external functions we use; they are in obstack.c. */
@ -125,19 +125,10 @@ Index: gdb-7.2.50.20101116/include/obstack.h
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
obstack_blank_fast (__o, __len); \
@@ -532,7 +532,7 @@ __extension__ \
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
- ? (int) ((h)->next_free = (h)->object_base \
+ ? (PTR_INT_TYPE) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
Index: gdb-7.2.50.20101116/libiberty/obstack.c
Index: gdb-7.4.50.20111218/libiberty/obstack.c
===================================================================
--- gdb-7.2.50.20101116.orig/libiberty/obstack.c 2005-05-10 17:33:33.000000000 +0200
+++ gdb-7.2.50.20101116/libiberty/obstack.c 2010-11-16 08:02:37.000000000 +0100
--- gdb-7.4.50.20111218.orig/libiberty/obstack.c 2005-05-10 17:33:33.000000000 +0200
+++ gdb-7.4.50.20111218/libiberty/obstack.c 2011-12-19 00:28:18.191232006 +0100
@@ -44,9 +44,11 @@
#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
#include <gnu-versions.h>

View File

@ -4,11 +4,11 @@
to install and uninstall.
* gstack.sh, gstack.1: New files.
Index: gdb-7.2.50.20101116/gdb/Makefile.in
Index: gdb-7.4.50.20120103/gdb/Makefile.in
===================================================================
--- gdb-7.2.50.20101116.orig/gdb/Makefile.in 2010-11-05 15:31:25.000000000 +0100
+++ gdb-7.2.50.20101116/gdb/Makefile.in 2010-11-16 07:56:10.000000000 +0100
@@ -972,7 +972,7 @@ gdb.z:gdb.1
--- gdb-7.4.50.20120103.orig/gdb/Makefile.in 2012-01-03 05:52:15.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/Makefile.in 2012-01-03 05:53:25.974210230 +0100
@@ -1017,7 +1017,7 @@ gdb.z:gdb.1
install: all
@$(MAKE) $(FLAGS_TO_PASS) install-only
@ -17,7 +17,7 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e "$$t"` ; \
if test "x$$transformed_name" = x; then \
@@ -1008,7 +1008,25 @@ install-tui:
@@ -1039,7 +1039,25 @@ install-only: $(CONFIG_INSTALL)
install-python:
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb
@ -44,10 +44,10 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in
transformed_name=`t='$(program_transform_name)'; \
echo gdb | sed -e $$t` ; \
if test "x$$transformed_name" = x; then \
@@ -1030,6 +1048,17 @@ uninstall-tui:
fi ; \
rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
@@ -1051,6 +1069,18 @@ uninstall: force $(CONFIG_UNINSTALL)
$(DESTDIR)$(man1dir)/$$transformed_name.1
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
+.PHONY: uninstall-gstack
+uninstall-gstack:
+ transformed_name=`t='$(program_transform_name)'; \
@ -59,14 +59,15 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in
+ fi ; \
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
+
# The C++ name parser can be built standalone for testing.
test-cp-name-parser.o: cp-name-parser.c
Index: gdb-7.2.50.20101116/gdb/gstack.sh
$(COMPILE) -DTEST_CPNAMES cp-name-parser.c
Index: gdb-7.4.50.20120103/gdb/gstack.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101116/gdb/gstack.sh 2010-11-16 07:55:47.000000000 +0100
@@ -0,0 +1,48 @@
+++ gdb-7.4.50.20120103/gdb/gstack.sh 2012-01-03 05:52:37.278385632 +0100
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+if test $# -ne 1; then
@ -98,14 +99,9 @@ Index: gdb-7.2.50.20101116/gdb/gstack.sh
+
+GDB=${GDB:-/usr/bin/gdb}
+
+if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
+ readnever=--readnever
+else
+ readnever=
+fi
+
+# Run GDB, strip out unwanted noise.
+$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 |
+# --readnever is no longer used since .gdb_index is now in use.
+$GDB --quiet -nx /proc/$1/exe $1 <<EOF 2>&1 |
+set width 0
+set height 0
+set pagination no
@ -115,12 +111,12 @@ Index: gdb-7.2.50.20101116/gdb/gstack.sh
+ -e 's/^\((gdb) \)*//' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp
Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp 2010-11-16 07:55:47.000000000 +0100
@@ -0,0 +1,71 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.exp 2012-01-03 05:52:37.279385629 +0100
@@ -0,0 +1,66 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
@ -150,6 +146,7 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp
+ fail $test
+ return
+}
+set use_gdb_stub 1
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re "looping\r\n" {
@ -177,24 +174,18 @@ Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp
+ fail $test
+}
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re {^#0 +0x[0-9a-f]+ in \.?func \(\)\r\n#1 +0x[0-9a-f]+ in \.?main \(\)\r\nGSTACK-END\r\n$} {
+gdb_test_multiple "" $test {
+ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+}
+gdb_exit
+
+remote_exec host "kill -9 $pid"
Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.c
Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.c 2010-11-16 07:55:47.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/gstack.c 2012-01-03 05:52:37.279385629 +0100
@@ -0,0 +1,43 @@
+/* This testcase is part of GDB, the GNU debugger.
+

View File

@ -12,10 +12,10 @@ gdb/testsuite:
* gdb.arch/ia64-sigill.c: New test.
* gdb.arch/ia64-sigill.exp: Ditto.
Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.arch/ia64-sigill.exp
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.arch/ia64-sigill.exp 2011-01-01 00:55:04.000000000 +0100
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.exp 2011-07-22 19:16:13.000000000 +0200
@@ -0,0 +1,49 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
@ -66,10 +66,10 @@ Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.arch/ia64-sigill.exp
+gdb_test "handle SIGILL nostop noprint" "SIGILL.*No.*No.*Yes.*" "handle sigill"
+gdb_test "run" "Starting program.*ia64-sigill.*\[New thread.*\].*hello world.*Program exited normally." "run to exit"
+
Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.arch/ia64-sigill.c
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.arch/ia64-sigill.c 2011-01-01 00:55:04.000000000 +0100
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.arch/ia64-sigill.c 2011-07-22 19:16:13.000000000 +0200
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
@ -79,11 +79,11 @@ Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.arch/ia64-sigill.c
+ return 0;
+}
+
Index: gdb-7.2.50.20101231/gdb/linux-nat.c
Index: gdb-7.3.50.20110722/gdb/linux-nat.c
===================================================================
--- gdb-7.2.50.20101231.orig/gdb/linux-nat.c 2011-01-01 00:54:04.000000000 +0100
+++ gdb-7.2.50.20101231/gdb/linux-nat.c 2011-01-01 00:55:58.000000000 +0100
@@ -3652,7 +3652,8 @@ retry:
--- gdb-7.3.50.20110722.orig/gdb/linux-nat.c 2011-07-22 19:15:05.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/linux-nat.c 2011-07-22 19:16:13.000000000 +0200
@@ -3733,7 +3733,8 @@ retry:
threads can be a bit time-consuming so if we want decent
performance with heavily multi-threaded programs, especially when
they're using a high frequency timer, we'd better avoid it if we
@ -93,14 +93,3 @@ Index: gdb-7.2.50.20101231/gdb/linux-nat.c
if (WIFSTOPPED (status))
{
@@ -3670,7 +3671,9 @@ retry:
&& inf->control.stop_soon == NO_STOP_QUIETLY
&& signal_stop_state (signo) == 0
&& signal_print_state (signo) == 0
- && signal_pass_state (signo) == 1)
+ && signal_pass_state (signo) == 1
+ && signo != TARGET_SIGNAL_ILL
+ && signo != TARGET_SIGNAL_TRAP)
{
/* FIMXE: kettenis/2001-06-06: Should we resume all threads
here? It is not clear we should. GDB may not expect

View File

@ -1,31 +0,0 @@
2004-10-22 Andrew Cagney <cagney@gnu.org>
* solib-svr4.c (enable_break): Convert a symbol descriptor into
the corresponding function entry point.
(solib_break_names): Delete "._dl_debug_state", no longer needed.
2007-10-12 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.8.50.20090802/gdb/solib-svr4.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/solib-svr4.c 2009-08-03 10:03:36.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/solib-svr4.c 2009-08-03 10:51:15.000000000 +0200
@@ -1431,7 +1431,15 @@ enable_break (struct svr4_info *info)
{
sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
if (sym_addr != 0)
- break;
+ {
+ /* The symbol might be a descriptor, convert to into the
+ corresponding code address. */
+ sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+ sym_addr,
+ tmp_bfd_target);
+ if (sym_addr != 0)
+ break;
+ }
}
if (sym_addr != 0)

View File

@ -11,11 +11,11 @@
* gdb.texinfo (File Options): Document --readnever.
Index: gdb-7.2.90.20110411/gdb/doc/gdb.texinfo
Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/doc/gdb.texinfo 2011-04-11 19:11:55.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/doc/gdb.texinfo 2011-04-11 19:15:51.000000000 +0200
@@ -1007,6 +1007,12 @@ Read each symbol file's entire symbol ta
--- gdb-7.4.50.20120602.orig/gdb/doc/gdb.texinfo 2012-06-02 18:16:36.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/doc/gdb.texinfo 2012-06-02 18:25:20.300254019 +0200
@@ -1020,6 +1020,12 @@ Read each symbol file's entire symbol ta
the default, which is to read it incrementally as it is needed.
This makes startup slower, but makes future operations faster.
@ -28,11 +28,11 @@ Index: gdb-7.2.90.20110411/gdb/doc/gdb.texinfo
@end table
@node Mode Options
Index: gdb-7.2.90.20110411/gdb/main.c
Index: gdb-7.4.50.20120602/gdb/main.c
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/main.c 2011-04-11 19:11:56.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/main.c 2011-04-11 19:15:51.000000000 +0200
@@ -398,6 +398,7 @@ captured_main (void *data)
--- gdb-7.4.50.20120602.orig/gdb/main.c 2012-06-02 18:16:36.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/main.c 2012-06-02 18:25:20.302254019 +0200
@@ -414,6 +414,7 @@ captured_main (void *data)
{"xdb", no_argument, &xdb_commands, 1},
{"dbx", no_argument, &dbx_commands, 1},
{"readnow", no_argument, &readnow_symbol_files, 1},
@ -40,7 +40,7 @@ Index: gdb-7.2.90.20110411/gdb/main.c
{"r", no_argument, &readnow_symbol_files, 1},
{"quiet", no_argument, &quiet, 1},
{"q", no_argument, &quiet, 1},
@@ -1064,6 +1065,7 @@ Options:\n\n\
@@ -1131,6 +1132,7 @@ Options:\n\n\
fputs_unfiltered (_("\
--quiet Do not print version number on startup.\n\
--readnow Fully read symbol files on first access.\n\
@ -48,11 +48,11 @@ Index: gdb-7.2.90.20110411/gdb/main.c
"), stream);
fputs_unfiltered (_("\
--se=FILE Use FILE as symbol file and executable file.\n\
Index: gdb-7.2.90.20110411/gdb/symfile.c
Index: gdb-7.4.50.20120602/gdb/symfile.c
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/symfile.c 2011-03-23 19:23:55.000000000 +0100
+++ gdb-7.2.90.20110411/gdb/symfile.c 2011-04-11 19:15:51.000000000 +0200
@@ -81,6 +81,7 @@ static void clear_symtab_users_cleanup (
--- gdb-7.4.50.20120602.orig/gdb/symfile.c 2012-05-31 20:44:49.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.c 2012-06-02 18:25:20.334254013 +0200
@@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup (
/* Global variables owned by this file. */
int readnow_symbol_files; /* Read full symbols immediately. */
@ -60,20 +60,20 @@ Index: gdb-7.2.90.20110411/gdb/symfile.c
/* External variables and functions referenced. */
Index: gdb-7.2.90.20110411/gdb/dwarf2read.c
Index: gdb-7.4.50.20120602/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/dwarf2read.c 2011-04-11 19:11:55.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/dwarf2read.c 2011-04-11 19:16:01.000000000 +0200
@@ -58,6 +58,7 @@
#include "c-lang.h"
--- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 18:16:36.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 18:25:32.837250535 +0200
@@ -63,6 +63,7 @@
#include "valprint.h"
#include "gdbcore.h" /* for gnutarget */
#include <ctype.h>
+#include "top.h"
#include <fcntl.h>
#include "gdb_string.h"
@@ -1351,8 +1352,9 @@ dwarf2_has_info (struct objfile *objfile
bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
@@ -1514,8 +1515,9 @@ dwarf2_has_info (struct objfile *objfile
(void *) names);
dwarf2_per_objfile->objfile = objfile;
}
- return (dwarf2_per_objfile->info.asection != NULL
@ -83,12 +83,12 @@ Index: gdb-7.2.90.20110411/gdb/dwarf2read.c
+ && dwarf2_per_objfile->abbrev.asection != NULL));
}
/* When loading sections, we can either look for ".<name>", or for
Index: gdb-7.2.90.20110411/gdb/top.h
/* When loading sections, we look either for uncompressed section or for
Index: gdb-7.4.50.20120602/gdb/top.h
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/top.h 2011-01-01 16:33:18.000000000 +0100
+++ gdb-7.2.90.20110411/gdb/top.h 2011-04-11 19:15:51.000000000 +0200
@@ -61,6 +61,7 @@ extern void set_prompt (char *);
--- gdb-7.4.50.20120602.orig/gdb/top.h 2012-01-23 18:12:30.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/top.h 2012-06-02 18:25:20.367254001 +0200
@@ -60,6 +60,7 @@ extern void set_prompt (const char *s);
/* From random places. */
extern int readnow_symbol_files;

View File

@ -1,243 +0,0 @@
http://sourceware.org/ml/gdb-patches/2005-05/threads.html#00637
Proposed upstream but never committed upstream.
2005-06-09 Jeff Johnston <jjohnstn@redhat.com>
* gdb.base/gdbinit.exp: New testcase.
* gdb.base/gdbinit.sample: Sample .gdbinit for gdbinit.exp.
2005-06-08 Daniel Jacobowitz <dan@codesourcery.com>
Jeff Johnston <jjohnstn@redhat.com>
* Makefile.in (cli-cmds.o): Update.
* configure.in: Add check for getuid.
* configure: Regenerated.
* config.in: Ditto.
* main.c (captured_main): Pass -1 to source_command when loading
gdbinit files.
* cli/cli-cmds.c: Include "gdb_stat.h" and <fcntl.h>.
(source_command): Update documentation. Check permissions if
FROM_TTY is -1.
Index: gdb-7.2.50.20101231/gdb/cli/cli-cmds.c
===================================================================
--- gdb-7.2.50.20101231.orig/gdb/cli/cli-cmds.c 2010-12-29 03:11:04.000000000 +0100
+++ gdb-7.2.50.20101231/gdb/cli/cli-cmds.c 2011-01-01 00:53:51.000000000 +0100
@@ -39,6 +39,7 @@
#include "source.h"
#include "disasm.h"
#include "tracepoint.h"
+#include "gdb_stat.h"
#include "ui-out.h"
@@ -488,7 +489,7 @@ Script filename extension recognition is
int
find_and_open_script (const char *script_file, int search_path,
- FILE **streamp, char **full_pathp)
+ FILE **streamp, char **full_pathp, int from_tty)
{
char *file;
int fd;
@@ -514,6 +515,32 @@ find_and_open_script (const char *script
return 0;
}
+#ifdef HAVE_GETUID
+ if (from_tty == -1)
+ {
+ struct stat statbuf;
+
+ if (fstat (fd, &statbuf) < 0)
+ {
+ int save_errno = errno;
+
+ close (fd);
+ do_cleanups (old_cleanups);
+ errno = save_errno;
+ return 0;
+ }
+ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH))
+ {
+ /* FILE gets freed by do_cleanups (old_cleanups). */
+ warning (_("not using untrusted file \"%s\""), file);
+ close (fd);
+ do_cleanups (old_cleanups);
+ errno = EPERM;
+ return 0;
+ }
+ }
+#endif
+
do_cleanups (old_cleanups);
*streamp = fdopen (fd, FOPEN_RT);
@@ -573,13 +600,14 @@ source_script_with_search (const char *f
if (file == NULL || *file == 0)
error (_("source command requires file name of file to source."));
- if (!find_and_open_script (file, search_path, &stream, &full_path))
+ if (!find_and_open_script (file, search_path, &stream, &full_path,
+ from_tty))
{
/* The script wasn't found, or was otherwise inaccessible.
If the source command was invoked interactively, throw an
error. Otherwise (e.g. if it was invoked by a script),
silently ignore the error. */
- if (from_tty)
+ if (from_tty > 0)
perror_with_name (file);
else
return;
Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.exp 2011-01-01 00:53:09.000000000 +0100
@@ -0,0 +1,91 @@
+# Copyright 2005
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Jeff Johnston <jjohnstn@redhat.com>.
+
+# are we on a target board
+if [is_remote target] {
+ return
+}
+
+
+global verbose
+global GDB
+global GDBFLAGS
+global gdb_prompt
+global timeout
+global gdb_spawn_id;
+
+gdb_stop_suppressing_tests;
+
+verbose "Spawning $GDB -nw"
+
+if [info exists gdb_spawn_id] {
+ return 0;
+}
+
+if ![is_remote host] {
+ if { [which $GDB] == 0 } then {
+ perror "$GDB does not exist."
+ exit 1
+ }
+}
+
+set env(HOME) [pwd]
+remote_exec build "rm .gdbinit"
+remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit"
+remote_exec build "chmod 646 .gdbinit"
+
+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $GDB failed."
+ return 1;
+}
+gdb_expect 360 {
+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
+ pass "untrusted .gdbinit caught."
+ }
+ -re "$gdb_prompt $" {
+ fail "untrusted .gdbinit caught."
+ }
+ timeout {
+ fail "(timeout) untrusted .gdbinit caught."
+ }
+}
+
+remote_exec build "chmod 644 .gdbinit"
+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $GDB failed."
+ return 1;
+}
+gdb_expect 360 {
+ -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
+ fail "trusted .gdbinit allowed."
+ }
+ -re "in gdbinit.*$gdb_prompt $" {
+ pass "trusted .gdbinit allowed."
+ }
+ timeout {
+ fail "(timeout) trusted .gdbinit allowed."
+ }
+}
+
+remote_exec build "rm .gdbinit"
Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.sample
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101231/gdb/testsuite/gdb.base/gdbinit.sample 2011-01-01 00:53:09.000000000 +0100
@@ -0,0 +1 @@
+echo "\nin gdbinit"
Index: gdb-7.2.50.20101231/gdb/main.c
===================================================================
--- gdb-7.2.50.20101231.orig/gdb/main.c 2010-12-29 01:58:14.000000000 +0100
+++ gdb-7.2.50.20101231/gdb/main.c 2011-01-01 00:53:09.000000000 +0100
@@ -805,7 +805,7 @@ Excess command line arguments ignored. (
debugging or what directory you are in. */
if (home_gdbinit && !inhibit_gdbinit)
- catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL);
+ catch_command_errors (source_script, home_gdbinit, -1, RETURN_MASK_ALL);
/* Now perform all the actions indicated by the arguments. */
if (cdarg != NULL)
@@ -880,7 +880,7 @@ Can't attach to process and specify a co
/* Read the .gdbinit file in the current directory, *if* it isn't
the same as the $HOME/.gdbinit file (it should exist, also). */
if (local_gdbinit && !inhibit_gdbinit)
- catch_command_errors (source_script, local_gdbinit, 0, RETURN_MASK_ALL);
+ catch_command_errors (source_script, local_gdbinit, -1, RETURN_MASK_ALL);
/* Now that all .gdbinit's have been read and all -d options have been
processed, we can read any scripts mentioned in SYMARG.
Index: gdb-7.2.50.20101231/gdb/python/py-auto-load.c
===================================================================
--- gdb-7.2.50.20101231.orig/gdb/python/py-auto-load.c 2010-12-15 18:27:59.000000000 +0100
+++ gdb-7.2.50.20101231/gdb/python/py-auto-load.c 2011-01-01 00:53:09.000000000 +0100
@@ -224,7 +224,7 @@ source_section_scripts (struct objfile *
}
opened = find_and_open_script (file, 1 /*search_path*/,
- &stream, &full_path);
+ &stream, &full_path, 1 /* from_tty */);
/* If the file is not found, we still record the file in the hash table,
we only want to print an error message once.
Index: gdb-7.2.50.20101231/gdb/cli/cli-cmds.h
===================================================================
--- gdb-7.2.50.20101231.orig/gdb/cli/cli-cmds.h 2010-12-29 03:11:04.000000000 +0100
+++ gdb-7.2.50.20101231/gdb/cli/cli-cmds.h 2011-01-01 00:53:09.000000000 +0100
@@ -126,7 +126,8 @@ extern void source_script (char *, int);
/* Exported to objfiles.c. */
extern int find_and_open_script (const char *file, int search_path,
- FILE **streamp, char **full_path);
+ FILE **streamp, char **full_path,
+ int from_tty);
/* Command tracing state. */

View File

@ -1,188 +0,0 @@
2005-02-11 Jeff Johnston <jjohnstn@redhat.com>
* testsuite/gdb.threads/step-thread-exit.c: New testcase.
* testsuite/gdb.threads/step-thread-exit.exp: Ditto.
Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.c 2008-12-08 22:21:26.000000000 +0100
@@ -0,0 +1,50 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+void *thread_function (void *ptr)
+{
+ int *x = (int *)ptr;
+ printf("In thread_function, *x is %d\n", *x);
+} /* thread_function_end */
+
+volatile int repeat = 0;
+
+main()
+{
+ int ret;
+ pthread_t th;
+ int i = 3;
+
+ ret = pthread_create (&th, NULL, thread_function, &i);
+ do
+ {
+ repeat = 0;
+ sleep (3); /* sleep */
+ }
+ while (repeat);
+ pthread_join (th, NULL);
+ return 0;
+}
+
+
Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.exp 2008-12-08 22:22:14.000000000 +0100
@@ -0,0 +1,123 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Check that GDB can step over a thread exit.
+
+set testfile "step-thread-exit"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Reset the debug file directory so we can't debug within the C library
+gdb_test "set debug-file-directory ." "" ""
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# FIXME: Currently the main thread will escape/exit before our thread finishes
+# without this setting.
+gdb_test "set scheduler-locking step"
+gdb_test "show scheduler-locking" "Mode for locking scheduler during execution is \"step\"." "check scheduler-locking first"
+
+set sleep_line [expr [gdb_get_line_number "sleep"]]
+set end_line [expr [gdb_get_line_number "thread_function_end"]]
+
+gdb_breakpoint "$end_line"
+gdb_test "continue" "Break.*thread_function.*" "continue to thread_function 1"
+
+# Keep nexting until we cause the thread to exit. We expect the main
+# thread to be stopped and a message printed to tell us we have stepped
+# over the thread exit.
+set test "step over thread exit 1"
+gdb_test_multiple "next" "$test" {
+ -re "\}.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+ -re "\[Thread .* exited\].*Program received signal SIGSTOP.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "start_thread.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+}
+
+# Without this fixup we could end up in:
+# #0 0x00110416 in __kernel_vsyscall ()
+# #1 0x0011de26 in __lll_unlock_wake_private () from /lib/libpthread.so.0
+# #2 0x001179f4 in _L_unlock_3164 () from /lib/libpthread.so.0
+# #3 0x00116f01 in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0
+# #4 0x08048531 in main () at ../.././gdb/testsuite/gdb.threads/step-thread-exit.c:39
+gdb_breakpoint "$sleep_line"
+gdb_test "set repeat=1" "" "Get to the sleep function prepare 1"
+gdb_test "continue" "Break.*$sleep_line.*" "Get to the sleep function 1"
+
+gdb_test "bt" "main.*$sleep_line.*" "backtrace after step 1"
+
+runto_main
+gdb_test "show scheduler-locking" "Mode for locking scheduler during execution is \"step\"." "check scheduler-locking second"
+
+gdb_breakpoint "$sleep_line"
+gdb_breakpoint "$end_line"
+set test "continue to thread_function 2"
+gdb_test_multiple "continue" "$test" {
+ -re "Break.*thread_function.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Break.*$sleep_line.*$gdb_prompt $" {
+ gdb_test "set repeat=1" "" ""
+ send_gdb "continue\n"
+ exp_continue
+ }
+}
+
+# Keep nexting until we cause the thread to exit. In this case, we
+# expect the breakpoint in the main thread to have already triggered
+# and so we should stop there with a message that we stepped over
+# the thread exit.
+set test "step over thread exit 2"
+gdb_test_multiple "next" "$test" {
+ -re "\}.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+ -re "\[Thread .* exited\].*Break.*$sleep_line.*$gdb_prompt $" {
+ pass "$test (breakpoint hit)"
+ }
+ -re "\[Thread .* exited\].*$gdb_prompt $" {
+ pass "$test (breakpoint not hit)"
+ }
+ -re "start_thread.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+}
+

View File

@ -1,32 +1,7 @@
Index: gdb/testsuite/ChangeLog
2005-01-21 Jeff Johnston <jjohnstn@redhat.com>
* gdb.cp/constructortest.exp: New test.
* gdb.cp/constructortest.cc: Ditto.
* gdb.cp/templates.exp: Change break of dtor to be fully quoted.
2007-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp, gdb.cp/constructortest.cc: Test also the
`$delete' destructor variant.
2007-09-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp: Delete the FIXME workaround of restarting
the whole GDB.
2007-10-05 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/constructortest.exp: Test BREAKPOINT_RE_SET for multiple PCs
by PIE.
* gdb.cp/constructortest.exp: Handle the change of settings breakpoints
always at all the ctor/dtor variants.
[ Removed the `gdb.cp/templates.exp' patch. ]
[ Updated the patch for "(X location") of GDB-6.8+. ]
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc.fix Fri Jan 21 17:06:56 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.cc Fri Jan 21 17:05:18 2005
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.cc
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.cc 2011-12-19 22:05:02.825431735 +0100
@@ -0,0 +1,99 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -127,8 +102,10 @@ Index: gdb/testsuite/ChangeLog
+{
+ y = 2; /* First line D */
+}
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.cp/constructortest.exp 2011-12-19 23:07:24.148290893 +0100
@@ -0,0 +1,130 @@
+# This testcase is part of GDB, the GNU debugger.
+
@ -232,7 +209,7 @@ Index: gdb/testsuite/ChangeLog
+set define_line_dtor [gdb_get_line_number "Destructor C"]
+# Break on the various forms of the C::~C destructor
+# " ([23] locations)" is displayed depending on G++ version.
+gdb_test "break C\:\:~C" "Breakpoint .*, line ($define_line_dtor|$define_line_dtor)\\..*" "breaking on C::~C"
+gdb_test "break C\:\:~C" "Breakpoint .*: C::~C\\. \\(2 locations\\)" "breaking on C::~C"
+gdb_continue_to_breakpoint "First line ~C"
+
+# Verify that we can break by line number in a destructor and find

View File

@ -1,29 +1,29 @@
Index: gdb-7.2.50.20110320/gdb/testsuite/configure.ac
Index: gdb-7.4.50.20120602/gdb/testsuite/configure.ac
===================================================================
--- gdb-7.2.50.20110320.orig/gdb/testsuite/configure.ac 2011-03-03 17:57:55.000000000 +0100
+++ gdb-7.2.50.20110320/gdb/testsuite/configure.ac 2011-03-20 20:21:43.000000000 +0100
@@ -97,6 +97,6 @@ AC_OUTPUT([Makefile \
--- gdb-7.4.50.20120602.orig/gdb/testsuite/configure.ac 2012-04-25 16:07:22.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/configure.ac 2012-06-02 18:24:38.456266545 +0200
@@ -96,6 +96,6 @@ AC_OUTPUT([Makefile \
gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \
gdb.hp/gdb.defects/Makefile \
gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \
gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
- gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
+ gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \
gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
Index: gdb-7.2.50.20110320/gdb/testsuite/configure
Index: gdb-7.4.50.20120602/gdb/testsuite/configure
===================================================================
--- gdb-7.2.50.20110320.orig/gdb/testsuite/configure 2011-03-03 17:57:55.000000000 +0100
+++ gdb-7.2.50.20110320/gdb/testsuite/configure 2011-03-20 20:21:43.000000000 +0100
--- gdb-7.4.50.20120602.orig/gdb/testsuite/configure 2012-04-25 16:07:21.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/configure 2012-06-02 18:25:06.200258240 +0200
@@ -3448,7 +3448,7 @@ done
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4173,6 +4173,7 @@ do
@@ -4175,6 +4175,7 @@ do
"gdb.opencl/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opencl/Makefile" ;;
"gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;;
"gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;;
@ -31,10 +31,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/configure
"gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
"gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
"gdb.stabs/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.stabs/Makefile" ;;
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.c 2011-03-20 20:21:43.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c 2012-06-02 18:24:38.497266532 +0200
@@ -0,0 +1,20 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -56,10 +56,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.c
+ }
+ return 0;
+}
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach2.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach2.c 2011-03-20 20:21:43.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c 2012-06-02 18:24:38.504266529 +0200
@@ -0,0 +1,24 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -85,10 +85,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach2.c
+ }
+ return (0);
+}
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.c 2011-03-20 20:21:43.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c 2012-06-02 18:24:38.505266529 +0200
@@ -0,0 +1,146 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -236,10 +236,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.c
+ }
+ return 0;
+}
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break1.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break1.c 2011-03-20 20:21:43.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c 2012-06-02 18:24:38.506266530 +0200
@@ -0,0 +1,44 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -285,10 +285,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break1.c
+void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */
+void marker4 (d) long d; {} /* set breakpoint 13 here */
+#endif
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/coremaker.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/coremaker.c 2011-03-20 20:21:43.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c 2012-06-02 18:24:38.506266530 +0200
@@ -0,0 +1,142 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
+ Free Software Foundation, Inc.
@ -432,10 +432,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/coremaker.c
+ return 0;
+}
+
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.exp 2011-03-20 20:25:53.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp 2012-06-02 18:24:38.508266531 +0200
@@ -0,0 +1,417 @@
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+
@ -854,11 +854,11 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/attach.exp
+do_call_attach_tests
+
+return 0
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp 2011-03-20 20:21:43.000000000 +0100
@@ -0,0 +1,966 @@
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp 2012-06-02 18:24:38.510266529 +0200
@@ -0,0 +1,962 @@
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2002, 2003, 2004
+# Free Software Foundation, Inc.
@ -1246,14 +1246,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp
+# Verify that GDB responds gracefully when asked to set a breakpoint
+# on a nonexistent source line.
+#
+send_gdb "break 999\n"
+gdb_expect {
+ -re "No line 999 in file .*$gdb_prompt $"\
+ {pass "break on non-existent source line"}
+ -re "$gdb_prompt $"\
+ {fail "break on non-existent source line"}
+ timeout {fail "(timeout) break on non-existent source line"}
+}
+gdb_test_no_output "set breakpoint pending off"
+gdb_test "break 999" \
+ "No line 999 in the current file." \
+ "break on non-existent source line"
+
+# Run to the desired default location. If not positioned here, the
+# tests below don't work.
@ -1378,7 +1374,7 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp
+#
+send_gdb "break $bp_location12 foo\n"
+gdb_expect {
+ -re "Junk at end of arguments..*$gdb_prompt $"\
+ -re "malformed linespec error: unexpected string, \"foo\"\r\n$gdb_prompt $"\
+ {pass "breakpoint with trailing garbage disallowed"}
+ -re "$gdb_prompt $"\
+ {fail "breakpoint with trailing garbage disallowed"}
@ -1825,10 +1821,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/break.exp
+ send_gdb "set args main\n"
+ gdb_expect -re ".*$gdb_prompt $" {}
+}
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/corefile.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/corefile.exp 2011-03-20 20:21:43.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp 2012-06-02 18:24:38.511266528 +0200
@@ -0,0 +1,233 @@
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
@ -2063,10 +2059,10 @@ Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/corefile.exp
+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)"
+
+gdb_test "core" "No core file now."
Index: gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/Makefile.in
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110320/gdb/testsuite/gdb.pie/Makefile.in 2011-03-20 20:21:43.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in 2012-06-02 18:24:38.512266527 +0200
@@ -0,0 +1,19 @@
+VPATH = @srcdir@
+srcdir = @srcdir@

View File

@ -32,17 +32,20 @@
(amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto.
(amd64_linux_new_thread): Ditto.
(_initialize_amd64_linux_nat): Register linux new thread observer.
* testsuite/gdb.threads/watchthreads2.c: New test case.
* testsuite/gdb.threads/watchthreads2.exp: Ditto.
* testsuite/gdb.threads/watchthreads-threaded.c: New test case.
* testsuite/gdb.threads/watchthreads-threaded.exp: Ditto.
[ With recent upstream GDB (6.8) reduced only to the testcase. ]
[ It was called watchthreads2.{exp,c} before but it conflicted with FSF GDB new
testcase of the same name. ]
FIXME: The testcase does not expects multiple watchpoints hits per one stop.
Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads-threaded.c 2006-07-12 01:54:29.000000000 -0300
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.c 2011-12-19 22:05:02.867431570 +0100
@@ -0,0 +1,66 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -110,10 +113,10 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.c
+ pthread_exit(NULL);
+}
+
Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads-threaded.exp 2006-07-12 01:54:29.000000000 -0300
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/watchthreads-threaded.exp 2011-12-19 22:28:33.294911982 +0100
@@ -0,0 +1,126 @@
+# This testcase is part of GDB, the GNU debugger.
+
@ -141,7 +144,7 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp
+ return 0;
+}
+
+set testfile "watchthreads2"
+set testfile "watchthreads-threaded"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
@ -198,13 +201,13 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp
+for {set i 0} {$i < 30} {incr i} {
+ set test_flag 0
+ gdb_test_multiple "continue" "threaded watch loop" {
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
+ { set args_2 1; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads2.c:$init_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
+ { set args_3 1; set test_flag 1 }
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*in thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ { set args_2 [expr $args_2+1]; set test_flag 1 }
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads2.c:$inc_line.*$gdb_prompt $"
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*in thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
+ { set args_3 [expr $args_3+1]; set test_flag 1 }
+ }
+ # If we fail above, don't bother continuing loop

View File

@ -1,14 +1,14 @@
Index: gdb-7.0.90.20100306/gdb/symfile.c
Index: gdb-7.4.50.20120602/gdb/symfile.c
===================================================================
--- gdb-7.0.90.20100306.orig/gdb/symfile.c 2010-03-06 23:20:35.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/symfile.c 2010-03-06 23:26:25.000000000 +0100
@@ -3642,6 +3642,12 @@ default_symfile_relocate (struct objfile
{
bfd *abfd = objfile->obfd;
--- gdb-7.4.50.20120602.orig/gdb/symfile.c 2012-06-02 18:25:20.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.c 2012-06-02 18:26:36.145232057 +0200
@@ -3630,6 +3630,12 @@ default_symfile_relocate (struct objfile
DWO file. */
bfd *abfd = sectp->owner;
+ /* Executable files have all the relocations already resolved.
+ * Handle files linked with --emit-relocs.
+ * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
+ Handle files linked with --emit-relocs.
+ http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
+ if ((abfd->flags & EXEC_P) != 0)
+ return NULL;
+

View File

@ -23,8 +23,325 @@ instead.
Port to GDB-6.7.
Index: gdb-7.4.50.20120602/gdb/amd64-linux-tdep.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/amd64-linux-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/amd64-linux-tdep.c 2012-06-02 21:06:25.536265325 +0200
@@ -271,6 +271,80 @@ amd64_linux_register_reggroup_p (struct
/* Set the program counter for process PTID to PC. */
+/* Detect the outermost frame; during unwind of
+ #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6
+ avoid the additional bogus frame
+ #6 0x0000000000000000 in ??
+ We compare if the `linux_clone_code' block is _before_ unwound PC. */
+
+static const unsigned char linux_clone_code[] =
+{
+/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */
+/* #ifdef RESET_PID */
+/* ... */
+/* mov $SYS_ify(getpid), %eax */
+/* 0xb8, 0x27, 0x00, 0x00, 0x00 */
+/* OR */
+/* mov $SYS_ify(getpid), %rax */
+/* 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00 */
+/* so just: */
+ 0x27, 0x00, 0x00, 0x00,
+/* syscall */
+ 0x0f, 0x05,
+/* movl %eax, %fs:PID */
+ 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00,
+/* movl %eax, %fs:TID */
+ 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00,
+/* #endif */
+/* |* Set up arguments for the function call. *| */
+/* popq %rax |* Function to call. *| */
+ 0x58,
+/* popq %rdi |* Argument. *| */
+ 0x5f,
+/* call *%rax$ */
+ 0xff, 0xd0
+};
+
+#define LINUX_CLONE_LEN (sizeof linux_clone_code)
+
+static int
+amd64_linux_clone_running (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ unsigned char buf[LINUX_CLONE_LEN];
+
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_LEN, buf,
+ LINUX_CLONE_LEN))
+ return 0;
+
+ if (memcmp (buf, linux_clone_code, LINUX_CLONE_LEN) != 0)
+ return 0;
+
+ return 1;
+}
+
+static int
+amd64_linux_outermost_frame (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ const char *name;
+
+ find_pc_partial_function (pc, &name, NULL, NULL);
+
+ /* If we have NAME, we can optimize the search.
+ `clone' NAME still needs to have the code checked as its name may be
+ present in the user code.
+ `__clone' NAME should not be present in the user code but in the initial
+ parts of the `__clone' implementation the unwind still makes sense.
+ More detailed unwinding decision would be too much sensitive to possible
+ subtle changes in specific glibc revisions. */
+ if (name == NULL || strcmp (name, "clone") == 0
+ || strcmp ("__clone", name) == 0)
+ return (amd64_linux_clone_running (this_frame) != 0);
+
+ return 0;
+}
+
static void
amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
@@ -1330,6 +1404,8 @@ amd64_linux_init_abi (struct gdbarch_inf
tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
+ tdep->outermost_frame_p = amd64_linux_outermost_frame;
+
/* GNU/Linux uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
Index: gdb-7.4.50.20120602/gdb/amd64-tdep.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/amd64-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/amd64-tdep.c 2012-06-02 21:06:00.437274574 +0200
@@ -2138,6 +2138,7 @@ amd64_frame_unwind_stop_reason (struct f
{
struct amd64_frame_cache *cache =
amd64_frame_cache (this_frame, this_cache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
if (!cache->base_p)
return UNWIND_UNAVAILABLE;
@@ -2146,6 +2147,10 @@ amd64_frame_unwind_stop_reason (struct f
if (cache->base == 0)
return UNWIND_OUTERMOST;
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
+ return UNWIND_OUTERMOST;
+
return UNWIND_NO_REASON;
}
@@ -2155,6 +2160,7 @@ amd64_frame_this_id (struct frame_info *
{
struct amd64_frame_cache *cache =
amd64_frame_cache (this_frame, this_cache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
if (!cache->base_p)
return;
@@ -2163,6 +2169,10 @@ amd64_frame_this_id (struct frame_info *
if (cache->base == 0)
return;
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame))
+ return;
+
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
}
Index: gdb-7.4.50.20120602/gdb/i386-tdep.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/i386-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/i386-tdep.c 2012-06-02 21:06:00.466274562 +0200
@@ -7639,6 +7639,9 @@ i386_gdbarch_init (struct gdbarch_info i
tdep->xsave_xcr0_offset = -1;
+ /* Unwinding stops on i386 automatically. */
+ tdep->outermost_frame_p = NULL;
+
tdep->record_regmap = i386_record_regmap;
set_gdbarch_long_long_align_bit (gdbarch, 32);
Index: gdb-7.4.50.20120602/gdb/i386-tdep.h
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/i386-tdep.h 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/i386-tdep.h 2012-06-02 21:06:00.486274568 +0200
@@ -219,6 +219,9 @@ struct gdbarch_tdep
int (*i386_sysenter_record) (struct regcache *regcache);
/* Parse syscall args. */
int (*i386_syscall_record) (struct regcache *regcache);
+
+ /* Detect OS dependent outermost frames; such as `clone'. */
+ int (*outermost_frame_p) (struct frame_info *this_frame);
};
/* Floating-point registers. */
Index: gdb-7.4.50.20120602/gdb/ia64-tdep.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/ia64-tdep.c 2012-06-02 21:05:45.352280128 +0200
+++ gdb-7.4.50.20120602/gdb/ia64-tdep.c 2012-06-02 21:06:00.490274552 +0200
@@ -2176,6 +2176,138 @@ static const struct frame_unwind ia64_fr
default_frame_sniffer
};
+/* Detect the outermost frame; during unwind of
+ #6 0x2000000000347100 in __clone2 () from /lib/libc.so.6.1
+ avoid the additional bogus frame
+ #7 0x0000000000000000 in ?? () */
+
+static char linux_clone2_code[] =
+{
+/* libc/sysdeps/unix/sysv/linux/ia64/clone2.S */
+ 0x09, 0x00, 0x20, 0x12, 0x90, 0x11, 0x00, 0x40,
+ 0x28, 0x20, 0x23, 0x00, 0x00, 0x00, 0x04, 0x00,
+/* st4 [r9]=r8 */
+/* st4 [r10]=r8 */
+/* ;; */
+/* #endif */
+ 0x02, 0x50, 0x21, 0x40, 0x18, 0x14, 0x90, 0x02,
+ 0x90, 0x00, 0x42, 0x00, 0x00, 0x00, 0x04, 0x00,
+/* 1: ld8 out1=[in0],8 |* Retrieve code pointer. *| */
+/* mov out0=in4 |* Pass proper argument to fn *| */
+/* ;; */
+ 0x11, 0x08, 0x00, 0x40, 0x18, 0x10, 0x60, 0x50,
+ 0x05, 0x80, 0x03, 0x00, 0x68, 0x00, 0x80, 0x12,
+/* ld8 gp=[in0] |* Load function gp. *| */
+/* mov b6=out1 */
+/* br.call.dptk.many rp=b6 |* Call fn(arg) in the child *| */
+/* ;; */
+ 0x10, 0x48, 0x01, 0x10, 0x00, 0x21, 0x10, 0x00,
+ 0xa0, 0x00, 0x42, 0x00, 0x98, 0xdf, 0xf7, 0x5b,
+/* mov out0=r8 |* Argument to _exit *| */
+/* mov gp=loc0 */
+/* .globl HIDDEN_JUMPTARGET(_exit) */
+/* br.call.dpnt.many rp=HIDDEN_JUMPTARGET(_exit) */
+/* |* call _exit with result from fn. *| */
+ 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x84, 0x00
+/* ret |* Not reached. *| */
+};
+
+#define LINUX_CLONE_PRE_SLOTS 3 /* Number of slots before PC. */
+#define LINUX_CLONE_LEN (sizeof linux_clone2_code)
+
+static int
+ia64_linux_clone2_running (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ char buf[LINUX_CLONE_LEN];
+ struct minimal_symbol *minsym;
+ long long instr;
+
+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_PRE_SLOTS * 16,
+ buf, LINUX_CLONE_LEN))
+ return 0;
+
+ if (memcmp (buf, linux_clone2_code, LINUX_CLONE_PRE_SLOTS * 16) != 0)
+ return 0;
+
+ /* Adjust the expected "_exit" address. */
+ minsym = lookup_minimal_symbol_text ("_exit", NULL);
+ if (minsym == NULL)
+ return 0;
+
+ instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
+ instr &= ~(((1L << 20) - 1) << 13);
+ /* Address is relative to the jump instruction slot, not the next one. */
+ instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
+ & ((1L << 20) - 1)) << 13;
+ replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
+ 2);
+
+ if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
+ &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],
+ LINUX_CLONE_LEN - (LINUX_CLONE_PRE_SLOTS * 16)) != 0)
+ return 0;
+
+ return 1;
+}
+
+static int
+ia64_outermost_frame (struct frame_info *this_frame)
+{
+ CORE_ADDR pc = get_frame_pc (this_frame);
+ char *name;
+
+ find_pc_partial_function (pc, &name, NULL, NULL);
+
+ /* If we have NAME, we can optimize the search.
+ `clone' NAME still needs to have the code checked as its name may be
+ present in the user code.
+ `__clone' NAME should not be present in the user code but in the initial
+ parts of the `__clone' implementation the unwind still makes sense.
+ More detailed unwinding decision would be too much sensitive to possible
+ subtle changes in specific glibc revisions. */
+ if (name == NULL || strcmp (name, "clone2") == 0
+ || strcmp ("__clone2", name) == 0)
+ return (ia64_linux_clone2_running (this_frame) != 0);
+
+ return 0;
+}
+
+static void
+ia64_clone2_frame_this_id (struct frame_info *this_frame, void **this_cache,
+ struct frame_id *this_id)
+{
+ /* Leave the default outermost frame at *THIS_ID. */
+}
+
+static struct value *
+ia64_clone2_frame_prev_register (struct frame_info *this_frame,
+ void **this_cache, int regnum)
+{
+ return frame_unwind_got_register (this_frame, regnum, regnum);
+}
+
+static int
+ia64_clone2_frame_sniffer (const struct frame_unwind *self,
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
+{
+ if (ia64_outermost_frame (this_frame))
+ return 1;
+
+ return 0;
+}
+
+static const struct frame_unwind ia64_clone2_frame_unwind =
+{
+ NORMAL_FRAME,
+ &ia64_clone2_frame_this_id,
+ &ia64_clone2_frame_prev_register,
+ NULL,
+ &ia64_clone2_frame_sniffer
+};
+
/* Signal trampolines. */
static void
@@ -4146,6 +4278,7 @@ ia64_gdbarch_init (struct gdbarch_info i
set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
+ frame_unwind_append_unwinder (gdbarch, &ia64_clone2_frame_unwind);
#ifdef HAVE_LIBUNWIND_IA64_H
frame_unwind_append_unwinder (gdbarch,
&ia64_libunwind_sigtramp_frame_unwind);
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.c 2009-08-03 15:50:08.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.c 2012-06-02 21:06:00.514274544 +0200
@@ -0,0 +1,39 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -65,10 +382,10 @@ instead.
+ for (;;)
+ pause();
+}
Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2009-08-03 15:50:08.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2012-06-02 21:06:00.515274547 +0200
@@ -0,0 +1,61 @@
+# Copyright 2006 Free Software Foundation, Inc.
+

119
gdb-6.6-bfd-vdso8k.patch Normal file
View File

@ -0,0 +1,119 @@
2007-09-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New variables
X_SHDR_SHSTRTAB and I_SHDR_SHSTRTAB. Fixed the CONTENTS_SIZE trimming
check for its aligned size between the last segment and still before
the section header end. Added variables check to cover also the
section header string table.
--- gdb-7.4.50.20120120-orig/bfd/elfcode.h 2012-02-29 09:17:08.000000000 +0100
+++ gdb-7.4.50.20120120/bfd/elfcode.h 2012-02-29 10:23:03.000000000 +0100
@@ -1621,6 +1621,8 @@ NAME(_bfd_elf,bfd_from_remote_memory)
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
Elf_External_Phdr *x_phdrs;
Elf_Internal_Phdr *i_phdrs, *last_phdr;
+ Elf_External_Shdr *x_shdrs;
+ Elf_Internal_Shdr *i_shdrs;
bfd *nbfd;
struct bfd_in_memory *bim;
int contents_size;
@@ -1740,24 +1742,46 @@ NAME(_bfd_elf,bfd_from_remote_memory)
/* Trim the last segment so we don't bother with zeros in the last page
that are off the end of the file. However, if the extra bit in that
- page includes the section headers, keep them. */
- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
- && (bfd_vma) contents_size >= (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ page includes the section headers os the section header string table,
+ keep them. */
+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz)
+ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+
+ if ((bfd_vma) contents_size < i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize)
+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+
+ /* Verify also all the sections fit into CONTENTS_SIZE. */
+
+ x_shdrs = bfd_malloc (i_ehdr.e_shnum * (sizeof *x_shdrs + sizeof *i_shdrs));
+ if (x_shdrs == NULL)
{
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+ free (x_phdrs);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
}
+ err = target_read_memory (ehdr_vma + i_ehdr.e_shoff, (bfd_byte *) x_shdrs,
+ i_ehdr.e_shnum * sizeof *x_shdrs);
+ if (err)
+ i_shdrs = NULL;
else
- contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+ {
+ i_shdrs = (Elf_Internal_Shdr *) &x_shdrs[i_ehdr.e_shnum];
+ for (i = 0; i < i_ehdr.e_shnum; ++i)
+ {
+ elf_swap_shdr_in (templ, &x_shdrs[i], &i_shdrs[i]);
+
+ if ((bfd_vma) contents_size < i_shdrs[i].sh_offset + i_shdrs[i].sh_size)
+ contents_size = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
+ }
+ }
/* Now we know the size of the whole image we want read in. */
contents = (bfd_byte *) bfd_zmalloc (contents_size);
if (contents == NULL)
{
free (x_phdrs);
+ free (x_shdrs);
bfd_set_error (bfd_error_no_memory);
return NULL;
}
@@ -1776,6 +1800,7 @@ NAME(_bfd_elf,bfd_from_remote_memory)
if (err)
{
free (x_phdrs);
+ free (x_shdrs);
free (contents);
bfd_set_error (bfd_error_system_call);
errno = err;
@@ -1784,10 +1809,32 @@ NAME(_bfd_elf,bfd_from_remote_memory)
}
free (x_phdrs);
- /* If the segments visible in memory didn't include the section headers,
+ if (i_shdrs)
+ {
+ memcpy (contents + i_ehdr.e_shoff, x_shdrs,
+ i_ehdr.e_shnum * sizeof *x_shdrs);
+
+ for (i = 0; i < i_ehdr.e_shnum; ++i)
+ {
+ bfd_vma start = i_shdrs[i].sh_offset;
+ bfd_vma end = i_shdrs[i].sh_offset + i_shdrs[i].sh_size;
+
+ if (end > (bfd_vma) contents_size)
+ end = contents_size;
+ err = target_read_memory (ehdr_vma + start, contents + start,
+ end - start);
+ if (err)
+ {
+ i_shdrs = NULL;
+ break;
+ }
+ }
+ }
+ free (x_shdrs);
+
+ /* If the segments readable in memory didn't include the section headers,
then clear them from the file header. */
- if ((bfd_vma) contents_size < (i_ehdr.e_shoff
- + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ if (i_shdrs == NULL)
{
memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff);
memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum);

View File

@ -1,6 +1,8 @@
--- ./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
Index: gdb-7.4.50.20120602/gdb/elfread.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:35:09.669510757 +0200
+++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:35:31.106502660 +0200
@@ -1658,6 +1658,19 @@ build_id_to_filename (struct build_id *b
#include <dlfcn.h>
#endif
@ -10,6 +12,7 @@
+ 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. */
+extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
+int
+rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
+{
@ -19,8 +22,10 @@
/* 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
Index: gdb-7.4.50.20120602/gdb/proc-service.list
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/proc-service.list 2012-06-02 21:35:09.669510757 +0200
+++ gdb-7.4.50.20120602/gdb/proc-service.list 2012-06-02 21:35:14.296508989 +0200
@@ -37,4 +37,7 @@
ps_pstop;
ps_ptread;

View File

@ -1,28 +1,105 @@
Index: gdb-7.1/gdb/elfread.c
Index: gdb-7.4.50.20120603/gdb/elfread.c
===================================================================
*** gdb-7.1.orig/gdb/elfread.c 2010-04-15 14:46:14.000000000 +0200
--- gdb-7.1/gdb/elfread.c 2010-04-15 14:50:17.000000000 +0200
*************** debug_print_missing (const char *binary,
*** 1625,1633 ****
fprintf_unfiltered (gdb_stdlog,
_("Missing separate debuginfo for %s\n"), binary);
if (debug != NULL)
! fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
! "yum --disablerepo='*' --enablerepo='*-debuginfo'"
! " install", debug);
}
}
--- 1625,1636 ----
fprintf_unfiltered (gdb_stdlog,
_("Missing separate debuginfo for %s\n"), binary);
if (debug != NULL)
! {
! const char *p = strrchr (debug, '/');
! fprintf_unfiltered (gdb_stdlog, _("Try: %s%.2s%.38s\"\n"),
! "zypper install -C \"debuginfo(build-id)=",
! p - 2, p + 1);
! }
}
}
--- gdb-7.4.50.20120603.orig/gdb/elfread.c 2012-06-12 15:12:05.000000000 +0200
+++ gdb-7.4.50.20120603/gdb/elfread.c 2012-06-12 15:13:39.678712939 +0200
@@ -1809,9 +1809,9 @@ missing_rpm_enlist (const char *filename
if (h == NULL)
break;
- /* Verify the debuginfo file is not already installed. */
-
- debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}",
+ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
+ debuginfo = headerFormat_p (h,
+ "%{name}-debuginfo-%{version}-%{release}.%{arch}",
&err);
if (!debuginfo)
{
@@ -1819,60 +1819,19 @@ missing_rpm_enlist (const char *filename
err);
continue;
}
- /* s = `.src.rpm-debuginfo.%{arch}' */
- s = strrchr (debuginfo, '-') - srcrpmlen;
- s2 = NULL;
- if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0)
- {
- /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */
- s2 = memrchr (debuginfo, '-', s - debuginfo);
- }
- if (s2)
- {
- /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
- s2 = memrchr (debuginfo, '-', s2 - debuginfo);
- }
- if (!s2)
- {
- warning (_("Error querying the rpm file `%s': %s"), filename,
- debuginfo);
- xfree (debuginfo);
- continue;
- }
- /* s = `.src.rpm-debuginfo.%{arch}' */
- /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */
- memmove (s2 + debuginfolen, s2, s - s2);
- memcpy (s2, "-debuginfo", debuginfolen);
- /* s = `XXXX.%{arch}' */
- /* strlen ("XXXX") == srcrpmlen + debuginfolen */
- /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */
- /* strlen ("XX") == srcrpmlen */
- memmove (s + debuginfolen, s + srcrpmlen + debuginfolen,
- strlen (s + srcrpmlen + debuginfolen) + 1);
- /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
+ /* Verify the debuginfo file is not already installed. */
/* RPMDBI_PACKAGES requires keylen == sizeof (int). */
/* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */
mi_debuginfo = rpmtsInitIterator_p (ts, RPMDBI_LABEL, debuginfo, 0);
- xfree (debuginfo);
if (mi_debuginfo)
{
+ xfree (debuginfo);
rpmdbFreeIterator_p (mi_debuginfo);
count = 0;
break;
}
- /* The allocated memory gets utilized below for MISSING_RPM_HASH. */
- debuginfo = headerFormat_p (h,
- "%{name}-%{version}-%{release}.%{arch}",
- &err);
- if (!debuginfo)
- {
- warning (_("Error querying the rpm file `%s': %s"), filename,
- err);
- continue;
- }
-
/* Base package name for `debuginfo-install'. We do not use the
`yum' command directly as the line
yum --disablerepo='*' --enablerepo='*debug*' \
@@ -1958,7 +1917,7 @@ missing_rpm_list_print (void)
(int (*) (const void *, const void *)) missing_rpm_list_compar);
printf_unfiltered (_("Missing separate debuginfos, use: %s"),
- "debuginfo-install");
+ "zypper install");
for (array_iter = array; array_iter < array + missing_rpm_list_entries;
array_iter++)
{
@@ -2171,9 +2130,12 @@ debug_print_missing (const char *binary,
fprintf_unfiltered (gdb_stdlog,
_("Missing separate debuginfo for %s\n"), binary);
if (debug != NULL)
- fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
- "yum --disablerepo='*' --enablerepo='*debug*'"
- " install", debug);
+ {
+ const char *p = strrchr (debug, '/');
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s%.2s%.38s\"\n"),
+ "zypper install -C \"debuginfo(build-id)=",
+ p - 2, p + 1);
+ }
}
}

View File

@ -1,25 +1,25 @@
Index: gdb-7.2.90.20110429/gdb/event-top.c
Index: gdb-7.4.50.20120602/gdb/event-top.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/event-top.c 2011-03-16 16:18:58.000000000 +0100
+++ gdb-7.2.90.20110429/gdb/event-top.c 2011-05-03 05:21:11.000000000 +0200
@@ -33,6 +33,7 @@
#include "cli/cli-script.h" /* for reset_command_nest_depth */
#include "main.h"
#include "gdbthread.h"
--- gdb-7.4.50.20120602.orig/gdb/event-top.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/event-top.c 2012-06-02 21:08:23.479221885 +0200
@@ -36,6 +36,7 @@
#include "observer.h"
#include "continuations.h"
#include "gdbcmd.h" /* for dont_repeat() */
+#include "symfile.h"
#include "gdbcmd.h" /* for dont_repeat() */
@@ -192,6 +193,8 @@ cli_command_loop (void)
char *a_prompt;
char *gdb_prompt = get_prompt ();
+ debug_flush_missing ();
/* readline include files. */
#include "readline/readline.h"
@@ -176,6 +177,8 @@ rl_callback_read_char_wrapper (gdb_clien
void
cli_command_loop (void)
{
+ debug_flush_missing ();
+
/* Tell readline what the prompt to display is and what function
it will need to call after a whole line is read. This also
displays the first prompt. */
@@ -263,6 +266,8 @@ display_gdb_prompt (char *new_prompt)
display_gdb_prompt (0);
/* Now it's time to start the event loop. */
@@ -241,6 +244,8 @@ display_gdb_prompt (char *new_prompt)
/* Reset the nesting depth used when trace-commands is set. */
reset_command_nest_depth ();
@ -28,11 +28,11 @@ Index: gdb-7.2.90.20110429/gdb/event-top.c
/* Each interpreter has its own rules on displaying the command
prompt. */
if (!current_interp_display_prompt_p ())
Index: gdb-7.2.90.20110429/gdb/elfread.c
Index: gdb-7.4.50.20120602/gdb/elfread.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/elfread.c 2011-05-03 05:19:27.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/elfread.c 2011-05-03 05:21:22.000000000 +0200
@@ -53,6 +53,7 @@
--- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:08:23.482221882 +0200
@@ -48,6 +48,7 @@
#include "gdbcore.h"
#include "gdbcmd.h"
#include "observer.h"
@ -40,7 +40,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
#include <sys/stat.h>
extern void _initialize_elfread (void);
@@ -1655,8 +1656,361 @@ build_id_to_filename (struct build_id *b
@@ -1647,8 +1648,361 @@ build_id_to_filename (struct build_id *b
return retval;
}
@ -258,7 +258,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+
+ /* Base package name for `debuginfo-install'. We do not use the
+ `yum' command directly as the line
+ yum --disablerepo='*' --enablerepo='*-debuginfo' \
+ yum --disablerepo='*' --enablerepo='*debug*' \
+ install NAME-debuginfo.ARCH
+ would be more complicated than just:
+ debuginfo-install NAME-VERSION-RELEASE.ARCH
@ -399,11 +399,11 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+
/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
- Try to install the hash file ...
+ yum --disablerepo='*' --enablerepo='*-debuginfo' install ...
+ yum --disablerepo='*' --enablerepo='*debug*' install ...
avoidance. */
struct missing_filepair
@@ -1710,11 +2064,17 @@ missing_filepair_change (void)
@@ -1702,11 +2056,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
@ -421,7 +421,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
missing_filepair_change ();
}
@@ -1781,14 +2141,35 @@ debug_print_missing (const char *binary,
@@ -1773,14 +2133,35 @@ debug_print_missing (const char *binary,
*slot = missing_filepair;
@ -458,17 +458,17 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+ _("Missing separate debuginfo for %s\n"), binary);
+ if (debug != NULL)
+ fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
+ "yum --disablerepo='*' --enablerepo='*-debuginfo'"
+ "yum --disablerepo='*' --enablerepo='*debug*'"
+ " install", debug);
+ }
}
static char *
Index: gdb-7.2.90.20110429/gdb/symfile.h
Index: gdb-7.4.50.20120602/gdb/symfile.h
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/symfile.h 2011-05-03 05:14:57.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/symfile.h 2011-05-03 05:21:11.000000000 +0200
@@ -611,6 +611,8 @@ extern struct build_id *build_id_addr_ge
--- gdb-7.4.50.20120602.orig/gdb/symfile.h 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.h 2012-06-02 21:08:23.499221877 +0200
@@ -621,6 +621,8 @@ extern struct build_id *build_id_addr_ge
extern char *build_id_to_filename (struct build_id *build_id,
char **link_return, int add_debug_suffix);
extern void debug_print_missing (const char *binary, const char *debug);
@ -477,11 +477,11 @@ Index: gdb-7.2.90.20110429/gdb/symfile.h
/* From dwarf2read.c */
Index: gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/testsuite/lib/gdb.exp 2011-05-03 05:14:57.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp 2011-05-03 05:21:11.000000000 +0200
@@ -1381,7 +1381,7 @@ proc default_gdb_start { } {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 21:08:23.510221873 +0200
@@ -1388,7 +1388,7 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -490,24 +490,24 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp
send_gdb "set build-id-verbose 0\n"
gdb_expect 10 {
-re "$gdb_prompt $" {
Index: gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/testsuite/lib/mi-support.exp 2011-05-03 05:14:57.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp 2011-05-03 05:21:11.000000000 +0200
@@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
}
}
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:08:23.523221869 +0200
@@ -213,7 +213,7 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
}
- # Turn off the missing warnings as the testsuite does not expect it.
+ # Turn off the missing RPMs warnings as the testsuite does not expect it.
send_gdb "190-gdb-set build-id-verbose 0\n"
gdb_expect 10 {
-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
Index: gdb-7.2.90.20110429/gdb/tui/tui-interp.c
Index: gdb-7.4.50.20120602/gdb/tui/tui-interp.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/tui/tui-interp.c 2011-01-01 16:33:52.000000000 +0100
+++ gdb-7.2.90.20110429/gdb/tui/tui-interp.c 2011-05-03 05:21:11.000000000 +0200
@@ -31,6 +31,7 @@
--- gdb-7.4.50.20120602.orig/gdb/tui/tui-interp.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/tui/tui-interp.c 2012-06-02 21:08:23.524221869 +0200
@@ -30,6 +30,7 @@
#include "tui/tui.h"
#include "tui/tui-io.h"
#include "exceptions.h"
@ -515,24 +515,16 @@ Index: gdb-7.2.90.20110429/gdb/tui/tui-interp.c
/* Set to 1 when the TUI mode must be activated when we first start
gdb. */
@@ -147,6 +148,8 @@ tui_command_loop (void *data)
char *a_prompt;
char *gdb_prompt = get_prompt ();
+ debug_flush_missing ();
+
/* Tell readline what the prompt to display is and what function
it will need to call after a whole line is read. This also
displays the first prompt. */
Index: gdb-7.2.90.20110429/gdb/aclocal.m4
Index: gdb-7.4.50.20120602/gdb/aclocal.m4
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/aclocal.m4 2011-02-15 22:05:53.000000000 +0100
+++ gdb-7.2.90.20110429/gdb/aclocal.m4 2011-05-03 05:21:11.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'.])])
--- gdb-7.4.50.20120602.orig/gdb/aclocal.m4 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/aclocal.m4 2012-06-02 21:08:23.545221858 +0200
@@ -11,6 +11,164 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
@ -560,7 +552,10 @@ Index: gdb-7.2.90.20110429/gdb/aclocal.m4
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
@ -573,7 +568,6 @@ Index: gdb-7.2.90.20110429/gdb/aclocal.m4
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
@ -582,21 +576,20 @@ Index: gdb-7.2.90.20110429/gdb/aclocal.m4
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_ifval([$2], [$2], [:])
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
@ -649,6 +642,7 @@ Index: gdb-7.2.90.20110429/gdb/aclocal.m4
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
@ -658,7 +652,7 @@ Index: gdb-7.2.90.20110429/gdb/aclocal.m4
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ ifelse([$4], , [AC_MSG_ERROR(dnl
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
@ -666,36 +660,35 @@ Index: gdb-7.2.90.20110429/gdb/aclocal.m4
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+ [AC_MSG_RESULT([no])
+ $4])
+_PKG_TEXT])
+ ])
+elif test $pkg_failed = untried; then
+ ifelse([$4], , [AC_MSG_FAILURE(dnl
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+ [$4])
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ ifelse([$3], , :, [$3])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
Index: gdb-7.2.90.20110429/gdb/config.in
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
Index: gdb-7.4.50.20120602/gdb/config.in
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/config.in 2011-03-17 14:19:09.000000000 +0100
+++ gdb-7.2.90.20110429/gdb/config.in 2011-05-03 05:21:11.000000000 +0200
@@ -46,6 +46,9 @@
--- gdb-7.4.50.20120602.orig/gdb/config.in 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/config.in 2012-06-02 21:08:23.546221859 +0200
@@ -36,6 +36,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
@ -705,70 +698,78 @@ Index: gdb-7.2.90.20110429/gdb/config.in
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -233,6 +236,9 @@
@@ -216,6 +219,9 @@
/* Define if Python 2.7 is being used. */
#undef HAVE_LIBPYTHON2_7
+/* Define if librpm library is being used. */
+#undef HAVE_LIBRPM
+
/* Define if libunwind library is being used. */
#undef HAVE_LIBUNWIND
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
Index: gdb-7.2.90.20110429/gdb/configure
Index: gdb-7.4.50.20120602/gdb/configure
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/configure 2011-04-03 18:32:40.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/configure 2011-05-03 05:21:11.000000000 +0200
@@ -682,6 +682,9 @@ REPORT_BUGS_TO
--- gdb-7.4.50.20120602.orig/gdb/configure 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/configure 2012-06-02 21:20:53.245838121 +0200
@@ -680,6 +680,11 @@ REPORT_BUGS_TO
PKGVERSION
TARGET_OBS
subdirs
+RPM_LIBS
+RPM_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
GDB_DATADIR
DEBUGDIR
am__fastdepCC_FALSE
@@ -948,6 +951,7 @@ enable_dependency_tracking
with_separate_debug_dir
with_gdb_datadir
MAKEINFO_EXTRA_FLAGS
@@ -780,6 +785,7 @@ with_gdb_datadir
with_relocated_sources
with_auto_load_dir
with_auto_load_safe_path
+with_rpm
enable_targets
enable_64_bit_bfd
enable_gdbcli
@@ -989,6 +993,9 @@ LDFLAGS
LIBS
CPPFLAGS
@@ -825,6 +831,11 @@ CPPFLAGS
CPP
MAKEINFO
MAKEINFOFLAGS
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+RPM_CFLAGS
+RPM_LIBS
YACC
YFLAGS
XMKMF'
@@ -1652,6 +1659,8 @@ Optional Packages:
[DATADIR/gdb]
--with-relocated-sources=PATH
automatically relocate this path for source files
@@ -1494,6 +1505,8 @@ Optional Packages:
[--with-auto-load-dir]
--without-auto-load-safe-path
do not restrict auto-loaded files locations
+ --with-rpm query rpm database for missing debuginfos (yes/no,
+ def. auto=librpm.so)
--with-libunwind use libunwind frame unwinding support
--with-libunwind-ia64 use libunwind frame unwinding for ia64 targets
--with-curses use the curses library instead of the termcap
library
@@ -1687,6 +1696,9 @@ Some influential environment variables:
CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
@@ -1535,6 +1548,13 @@ Some influential environment variables:
MAKEINFO Parent configure detects if it is of sufficient version.
MAKEINFOFLAGS
Parameters for MAKEINFO.
+ PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config
+ RPM_LIBS linker flags for RPM, overriding pkg-config
YACC The `Yet Another C Compiler' implementation to use. Defaults to
the first program found out of: `bison -y', `byacc', `yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
@@ -7884,6 +7896,486 @@ _ACEOF
fi
@@ -5015,6 +5035,491 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
$as_echo "$with_auto_load_safe_path" >&6; }
+# Integration with rpm library to support missing debuginfo suggestions.
+# --without-rpm: Disable any rpm support.
@ -997,6 +998,10 @@ Index: gdb-7.2.90.20110429/gdb/configure
+ fi
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
@ -1109,7 +1114,6 @@ Index: gdb-7.2.90.20110429/gdb/configure
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
+ fi
+
+fi
+
+pkg_failed=no
@ -1152,6 +1156,8 @@ Index: gdb-7.2.90.20110429/gdb/configure
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
@ -1166,10 +1172,10 @@ Index: gdb-7.2.90.20110429/gdb/configure
+ # Put the nasty error message in config.log where it belongs
+ echo "$RPM_PKG_ERRORS" >&5
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_LIBRPM=false
+ HAVE_LIBRPM=false
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ HAVE_LIBRPM=false
+else
+ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
@ -1253,13 +1259,13 @@ Index: gdb-7.2.90.20110429/gdb/configure
subdirs="$subdirs testsuite"
Index: gdb-7.2.90.20110429/gdb/configure.ac
Index: gdb-7.4.50.20120602/gdb/configure.ac
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/configure.ac 2011-04-03 18:32:40.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/configure.ac 2011-05-03 05:21:11.000000000 +0200
@@ -108,6 +108,199 @@ AS_HELP_STRING([--with-relocated-sources
[Relocated directory for source files. ])
])
--- gdb-7.4.50.20120602.orig/gdb/configure.ac 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/configure.ac 2012-06-02 21:08:23.560221855 +0200
@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
[Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
+# Integration with rpm library to support missing debuginfo suggestions.
+# --without-rpm: Disable any rpm support.
@ -1457,30 +1463,11 @@ Index: gdb-7.2.90.20110429/gdb/configure.ac
AC_CONFIG_SUBDIRS(testsuite)
# Check whether to support alternative target configurations
Index: gdb-7.2.90.20110429/gdb/acinclude.m4
Index: gdb-7.4.50.20120602/gdb/corelow.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/acinclude.m4 2011-05-03 05:21:11.000000000 +0200
@@ -1,3 +1,5 @@
+# serial 1
+
dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
@@ -81,8 +83,6 @@ AC_MSG_RESULT(yes)
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-# serial 1
-
# @defmac AC_PROG_CC_STDC
# @maindex PROG_CC_STDC
# @ovindex CC
Index: gdb-7.2.90.20110429/gdb/corelow.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/corelow.c 2011-05-03 05:14:57.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/corelow.c 2011-05-03 05:21:11.000000000 +0200
@@ -320,7 +320,7 @@ build_id_locate_exec (int from_tty)
--- gdb-7.4.50.20120602.orig/gdb/corelow.c 2012-06-02 21:08:08.651227347 +0200
+++ gdb-7.4.50.20120602/gdb/corelow.c 2012-06-02 21:08:23.561221855 +0200
@@ -317,7 +317,7 @@ build_id_locate_exec (int from_tty)
symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED;
}
else

View File

@ -0,0 +1,57 @@
--- gdb-7.4.50.20120120/gdb/solib-svr4.c.orig 2012-03-17 10:23:11.000000000 +0100
+++ gdb-7.4.50.20120120/gdb/solib-svr4.c 2012-03-17 10:36:22.265628529 +0100
@@ -1228,14 +1228,27 @@ svr4_read_so_list (CORE_ADDR lm, struct
}
{
- struct build_id *build_id;
+ struct build_id *build_id = NULL;
strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
/* May get overwritten below. */
strcpy (new->so_name, new->so_original_name);
- build_id = build_id_addr_get (new->lm_info->l_ld);
+ /* In the case the main executable was found according to its build-id
+ (from a core file) prevent loading a different build of a library
+ with accidentally the same SO_NAME.
+
+ It suppresses bogus backtraces (and prints "??" there instead) if
+ the on-disk files no longer match the running program version.
+
+ If the main executable was not loaded according to its build-id do
+ not do any build-id checking of the libraries. There may be missing
+ build-ids dumped in the core file and we would map all the libraries
+ to the only existing file loaded that time - the executable. */
+ if (symfile_objfile != NULL
+ && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ build_id = build_id_addr_get (new->lm_info->l_ld);
if (build_id != NULL)
{
char *name, *build_id_filename;
@@ -1250,23 +1263,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
xfree (name);
}
else
- {
- debug_print_missing (new->so_name, build_id_filename);
-
- /* In the case the main executable was found according to
- its build-id (from a core file) prevent loading
- a different build of a library with accidentally the
- same SO_NAME.
-
- It suppresses bogus backtraces (and prints "??" there
- instead) if the on-disk files no longer match the
- running program version. */
-
- if (symfile_objfile != NULL
- && (symfile_objfile->flags
- & OBJF_BUILD_ID_CORE_LOADED) != 0)
- new->so_name[0] = 0;
- }
+ debug_print_missing (new->so_name, build_id_filename);
xfree (build_id_filename);
xfree (build_id);

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.90.20110429/gdb/corelow.c
Index: gdb-7.4.50.20120602/gdb/corelow.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/corelow.c 2011-02-26 03:07:07.000000000 +0100
+++ gdb-7.2.90.20110429/gdb/corelow.c 2011-05-03 05:14:57.000000000 +0200
@@ -47,6 +47,9 @@
--- gdb-7.4.50.20120602.orig/gdb/corelow.c 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/corelow.c 2012-06-02 21:07:16.464246569 +0200
@@ -46,6 +46,9 @@
#include "filenames.h"
#include "progspace.h"
#include "objfiles.h"
@ -10,9 +10,9 @@ Index: gdb-7.2.90.20110429/gdb/corelow.c
+#include "elf/common.h"
+#include "gdbcmd.h"
#ifndef O_LARGEFILE
@@ -278,6 +281,52 @@ add_to_thread_list (bfd *abfd, asection
#define O_LARGEFILE 0
@@ -275,6 +278,52 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current. */
}
@ -65,7 +65,7 @@ Index: gdb-7.2.90.20110429/gdb/corelow.c
/* This routine opens and sets up the core file bfd. */
static void
@@ -379,6 +428,12 @@ core_open (char *filename, int from_tty)
@@ -377,6 +426,12 @@ core_open (char *filename, int from_tty)
push_target (&core_ops);
discard_cleanups (old_chain);
@ -78,7 +78,7 @@ Index: gdb-7.2.90.20110429/gdb/corelow.c
/* Do this before acknowledging the inferior, so if
post_create_inferior throws (can happen easilly if you're loading
a core file with the wrong exec), we aren't left with threads
@@ -932,4 +987,11 @@ _initialize_corelow (void)
@@ -935,4 +990,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target (&core_ops);
@ -90,11 +90,11 @@ Index: gdb-7.2.90.20110429/gdb/corelow.c
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
Index: gdb-7.2.90.20110429/gdb/doc/gdb.texinfo
Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/doc/gdb.texinfo 2011-05-03 05:14:56.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/doc/gdb.texinfo 2011-05-03 05:14:57.000000000 +0200
@@ -15356,6 +15356,27 @@ information files.
--- gdb-7.4.50.20120602.orig/gdb/doc/gdb.texinfo 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/doc/gdb.texinfo 2012-06-02 21:07:16.480246563 +0200
@@ -16502,6 +16502,27 @@ information files.
@end table
@ -122,71 +122,74 @@ Index: gdb-7.2.90.20110429/gdb/doc/gdb.texinfo
@cindex @code{.gnu_debuglink} sections
@cindex debug link sections
A debug link is a special section of the executable file named
Index: gdb-7.2.90.20110429/gdb/solib-svr4.c
Index: gdb-7.4.50.20120602/gdb/solib-svr4.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/solib-svr4.c 2011-05-03 05:14:56.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/solib-svr4.c 2011-05-03 05:14:57.000000000 +0200
@@ -1179,9 +1179,49 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- strcpy (new->so_original_name, new->so_name);
+ struct build_id *build_id;
+
+ strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+ new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+ /* May get overwritten below. */
+ strcpy (new->so_name, new->so_original_name);
+
+ build_id = build_id_addr_get (LM_DYNAMIC_FROM_LINK_MAP (new));
+ if (build_id != NULL)
+ {
+ char *name, *build_id_filename;
+
+ /* Missing the build-id matching separate debug info file
+ would be handled while SO_NAME gets loaded. */
+ name = build_id_to_filename (build_id, &build_id_filename, 0);
+ if (name != NULL)
+ {
+ strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+ xfree (name);
+ }
+ else
+ {
+ debug_print_missing (new->so_name, build_id_filename);
+
+ /* In the case the main executable was found according to
+ its build-id (from a core file) prevent loading
+ a different build of a library with accidentally the
+ same SO_NAME.
+
+ It suppresses bogus backtraces (and prints "??" there
+ instead) if the on-disk files no longer match the
+ running program version. */
+
+ if (symfile_objfile != NULL
+ && (symfile_objfile->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ new->so_name[0] = 0;
+ }
+
+ xfree (build_id_filename);
+ xfree (build_id);
+ }
}
xfree (buffer);
--- gdb-7.4.50.20120602.orig/gdb/solib-svr4.c 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/solib-svr4.c 2012-06-02 21:07:16.510246552 +0200
@@ -1227,9 +1227,52 @@ svr4_read_so_list (CORE_ADDR lm, struct
continue;
}
Index: gdb-7.2.90.20110429/gdb/elfread.c
- strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
- new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- strcpy (new->so_original_name, new->so_name);
+ {
+ struct build_id *build_id;
+
+ strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+ new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+ /* May get overwritten below. */
+ strcpy (new->so_name, new->so_original_name);
+
+ build_id = build_id_addr_get (new->lm_info->l_ld);
+ if (build_id != NULL)
+ {
+ char *name, *build_id_filename;
+
+ /* Missing the build-id matching separate debug info file
+ would be handled while SO_NAME gets loaded. */
+ name = build_id_to_filename (build_id, &build_id_filename, 0);
+ if (name != NULL)
+ {
+ strncpy (new->so_name, name, SO_NAME_MAX_PATH_SIZE - 1);
+ new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+ xfree (name);
+ }
+ else
+ {
+ debug_print_missing (new->so_name, build_id_filename);
+
+ /* In the case the main executable was found according to
+ its build-id (from a core file) prevent loading
+ a different build of a library with accidentally the
+ same SO_NAME.
+
+ It suppresses bogus backtraces (and prints "??" there
+ instead) if the on-disk files no longer match the
+ running program version. */
+
+ if (symfile_objfile != NULL
+ && (symfile_objfile->flags
+ & OBJF_BUILD_ID_CORE_LOADED) != 0)
+ new->so_name[0] = 0;
+ }
+
+ xfree (build_id_filename);
+ xfree (build_id);
+ }
+ }
+
xfree (buffer);
/* If this entry has no name, or its name matches the name
Index: gdb-7.4.50.20120602/gdb/elfread.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/elfread.c 2011-05-03 05:14:56.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/elfread.c 2011-05-03 05:19:27.000000000 +0200
@@ -49,6 +49,11 @@
#include "infcall.h"
--- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:07:56.264232049 +0200
@@ -44,6 +44,11 @@
#include "gdbthread.h"
#include "regcache.h"
#include "bcache.h"
+#include "libbfd.h"
+#include "gdbcore.h"
+#include "gdbcmd.h"
@ -195,7 +198,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
extern void _initialize_elfread (void);
@@ -1077,16 +1082,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
@@ -1072,16 +1077,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
update_breakpoint_locations (b, sals, sals_end);
}
@ -220,8 +223,9 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */
+/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
+ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */
+
+struct build_id *
static struct build_id *
-build_id_bfd_get (bfd *abfd)
+build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size)
+{
+ bfd_byte *p;
@ -256,14 +260,13 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+
+/* Separate debuginfo files have corrupted PHDR but SHDR is correct there.
+ Locate NT_GNU_BUILD_ID from ABFD and return its content. */
static struct build_id *
-build_id_bfd_get (bfd *abfd)
+
+static struct build_id *
+build_id_bfd_shdr_get (bfd *abfd)
{
struct build_id *retval;
@@ -1102,6 +1156,348 @@ build_id_bfd_get (bfd *abfd)
@@ -1097,6 +1151,348 @@ build_id_bfd_get (bfd *abfd)
return retval;
}
@ -359,7 +362,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+/* Translate an ELF program header table entry in external format into an
+ ELF program header table entry in internal format. */
+
+void
+static void
+elf_swap_phdr_in (bfd *abfd,
+ const Elf64_External_Phdr *src64,
+ Elf_Internal_Phdr *dst)
@ -612,7 +615,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
@@ -1116,7 +1512,7 @@ build_id_verify (const char *filename, s
@@ -1111,7 +1507,7 @@ build_id_verify (const char *filename, s
if (abfd == NULL)
return 0;
@ -621,7 +624,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -1134,14 +1530,15 @@ build_id_verify (const char *filename, s
@@ -1129,17 +1525,18 @@ build_id_verify (const char *filename, s
return retval;
}
@ -633,6 +636,9 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
{
char *link, *debugdir, *retval = NULL;
+ char *link_all = NULL;
VEC (char_ptr) *debugdir_vec;
struct cleanup *back_to;
int ix;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
@ -642,29 +648,25 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -1152,6 +1549,8 @@ build_id_to_debug_filename (struct build
char *s, *debugdir_end;
size_t debugdir_len = strlen (debugdir);
gdb_byte *data = build_id->data;
size_t size = build_id->size;
+ unsigned seqno;
+ struct stat statbuf_trash;
char *s;
while (*debugdir == DIRNAME_SEPARATOR)
debugdir++;
@@ -1172,39 +1571,242 @@ build_id_to_debug_filename (struct build
memcpy (link, debugdir, debugdir_len);
@@ -1166,37 +1565,240 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
-
- /* lrealpath() is expensive even for the usually non-existent files. */
- if (access (link, F_OK) == 0)
- retval = lrealpath (link);
- if (retval != NULL && !build_id_verify (retval, build_id))
+ for (seqno = 0;; seqno++)
{
- xfree (retval);
- retval = NULL;
+ {
+ char *s2;
+
+ if (seqno)
@ -682,7 +684,8 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+ strcpy (s2, ".debug");
+ else
+ *s2 = 0;
+
- if (retval != NULL && !build_id_verify (retval, build_id))
+ /* `access' automatically dereferences LINK. */
+ if (lstat (link, &statbuf_trash) != 0)
+ {
@ -700,15 +703,16 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+
+ if (retval)
+ break;
}
if (retval != NULL)
- break;
+ {
+ /* LINK_ALL is not used below in this non-NULL RETVAL case. */
+ break;
+ }
+
+ if (retval != NULL)
{
- xfree (retval);
- retval = NULL;
+ /* LINK_ALL is not used below in this non-NULL RETVAL case. */
+ break;
}
+ if (link_all == NULL)
+ link_all = xstrdup (link);
+ else
@ -723,14 +727,12 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+
+ strcpy (&link_all[len_orig + 1], link);
+ }
debugdir = debugdir_end;
}
while (*debugdir != 0);
+ }
+
+ if (link_return != NULL)
+ {
+ if (retval != NULL)
if (retval != NULL)
- break;
+ {
+ *link_return = link;
+ link = NULL;
@ -740,13 +742,14 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+ *link_return = link_all;
+ link_all = NULL;
+ }
+ }
}
+ xfree (link);
+ xfree (link_all);
+
+ return retval;
+}
+
do_cleanups (back_to);
return retval;
}
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+ Try to install the hash file ...
+ avoidance. */
@ -769,9 +772,9 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+
+ retval = obstack_alloc (&missing_filepair_obstack, size);
+ memset (retval, 0, size);
return retval;
}
+ return retval;
+}
+
+static hashval_t
+missing_filepair_hash_func (const struct missing_filepair *elem)
+{
@ -905,7 +908,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
xfree (build_id);
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL
@@ -1215,7 +1817,7 @@ find_separate_debug_file_by_buildid (str
@@ -1207,7 +1809,7 @@ find_separate_debug_file_by_buildid (str
xfree (build_id_name);
}
else if (build_id_name != NULL)
@ -914,7 +917,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
}
return NULL;
}
@@ -1418,9 +2020,10 @@ elf_symfile_read (struct objfile *objfil
@@ -1427,9 +2029,10 @@ elf_symfile_read (struct objfile *objfil
`.note.gnu.build-id'. */
else if (!objfile_has_partial_symbols (objfile))
{
@ -927,7 +930,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
if (debugfile == NULL)
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -1432,6 +2035,12 @@ elf_symfile_read (struct objfile *objfil
@@ -1441,6 +2044,12 @@ elf_symfile_read (struct objfile *objfil
symbol_file_add_separate (abfd, symfile_flags, objfile);
xfree (debugfile);
}
@ -940,7 +943,7 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
}
}
@@ -1911,4 +2520,16 @@ _initialize_elfread (void)
@@ -1770,4 +2379,16 @@ _initialize_elfread (void)
elf_objfile_gnu_ifunc_cache_data = register_objfile_data ();
gnu_ifunc_fns_p = &elf_gnu_ifunc_fns;
@ -957,11 +960,11 @@ Index: gdb-7.2.90.20110429/gdb/elfread.c
+
+ observer_attach_executable_changed (debug_print_executable_changed);
}
Index: gdb-7.2.90.20110429/gdb/symfile.h
Index: gdb-7.4.50.20120602/gdb/symfile.h
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/symfile.h 2011-05-03 05:14:56.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/symfile.h 2011-05-03 05:14:57.000000000 +0200
@@ -605,6 +605,13 @@ void free_symfile_segment_data (struct s
--- gdb-7.4.50.20120602.orig/gdb/symfile.h 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/symfile.h 2012-06-02 21:07:16.524246547 +0200
@@ -615,6 +615,13 @@ void free_symfile_segment_data (struct s
extern struct cleanup *increment_reading_symtab (void);
@ -974,12 +977,12 @@ Index: gdb-7.2.90.20110429/gdb/symfile.h
+
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
Index: gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp
/* Names for a dwarf2 debugging section. The field NORMAL is the normal
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/testsuite/lib/gdb.exp 2011-05-03 05:14:56.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp 2011-05-03 05:14:57.000000000 +0200
@@ -1381,6 +1381,16 @@ proc default_gdb_start { } {
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 21:07:16.526246546 +0200
@@ -1388,6 +1388,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -996,13 +999,13 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp
return 0;
}
Index: gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/testsuite/lib/mi-support.exp 2011-03-07 17:03:04.000000000 +0100
+++ gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp 2011-05-03 05:14:57.000000000 +0200
@@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
}
}
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:07:16.535246544 +0200
@@ -213,6 +213,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
}
+ # Turn off the missing warnings as the testsuite does not expect it.
+ send_gdb "190-gdb-set build-id-verbose 0\n"
@ -1014,16 +1017,16 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp
+ warning "Could not disable the missing debug infos warnings.."
+ }
+ }
detect_async
Index: gdb-7.2.90.20110429/gdb/objfiles.h
# If allowing the inferior to have its own PTY then assign the inferior
# its own terminal device here.
if { $separate_inferior_pty } {
Index: gdb-7.4.50.20120602/gdb/objfiles.h
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/objfiles.h 2011-03-07 17:17:29.000000000 +0100
+++ gdb-7.2.90.20110429/gdb/objfiles.h 2011-05-03 05:14:57.000000000 +0200
@@ -441,6 +441,10 @@ struct objfile
--- gdb-7.4.50.20120602.orig/gdb/objfiles.h 2012-06-02 21:07:03.695251272 +0200
+++ gdb-7.4.50.20120602/gdb/objfiles.h 2012-06-02 21:07:16.539246541 +0200
@@ -432,6 +432,10 @@ struct objfile
#define OBJF_PSYMTABS_READ (1 << 4)
#define OBJF_MAINLINE (1 << 5)
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
+

View File

@ -1,142 +0,0 @@
2007-07-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* linux-nat.c (linux_lwp_is_zombie): New function.
(wait_lwp): Fix lockup on exit of the thread group leader.
(linux_xfer_partial): Renamed to ...
(linux_xfer_partial_lwp): ... here.
(linux_xfer_partial): New function wrapping LINUX_XFER_PARTIAL_LWP.
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
Index: gdb-6.8.50.20081209/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20081209.orig/gdb/linux-nat.c 2008-12-10 01:27:34.000000000 +0100
+++ gdb-6.8.50.20081209/gdb/linux-nat.c 2008-12-10 01:28:14.000000000 +0100
@@ -1981,6 +1981,31 @@ linux_handle_extended_wait (struct lwp_i
_("unknown ptrace event %d"), event);
}
+static int
+linux_lwp_is_zombie (long lwp)
+{
+ char buffer[MAXPATHLEN];
+ FILE *procfile;
+ int retval = 0;
+
+ sprintf (buffer, "/proc/%ld/status", lwp);
+ procfile = fopen (buffer, "r");
+ if (procfile == NULL)
+ {
+ warning (_("unable to open /proc file '%s'"), buffer);
+ return 0;
+ }
+ while (fgets (buffer, sizeof (buffer), procfile) != NULL)
+ if (strcmp (buffer, "State:\tZ (zombie)\n") == 0)
+ {
+ retval = 1;
+ break;
+ }
+ fclose (procfile);
+
+ return retval;
+}
+
/* Wait for LP to stop. Returns the wait status, or 0 if the LWP has
exited. */
@@ -1988,16 +2013,31 @@ static int
wait_lwp (struct lwp_info *lp)
{
pid_t pid;
- int status;
+ int status = 0;
int thread_dead = 0;
gdb_assert (!lp->stopped);
gdb_assert (lp->status == 0);
- pid = my_waitpid (GET_LWP (lp->ptid), &status, 0);
- if (pid == -1 && errno == ECHILD)
+ /* Thread group leader may have exited but we would lock up by WAITPID as it
+ waits on all its threads; __WCLONE is not applicable for the leader.
+ The thread leader restrictions is only a performance optimization here.
+ LINUX_NAT_THREAD_ALIVE cannot be used here as it requires a STOPPED
+ process; it gets ESRCH both for the zombie and for running processes. */
+ if (is_lwp (lp->ptid) && GET_PID (lp->ptid) == GET_LWP (lp->ptid)
+ && linux_lwp_is_zombie (GET_LWP (lp->ptid)))
+ {
+ thread_dead = 1;
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog, "WL: Threads leader %s vanished.\n",
+ target_pid_to_str (lp->ptid));
+ }
+
+ if (!thread_dead)
{
- pid = my_waitpid (GET_LWP (lp->ptid), &status, __WCLONE);
+ pid = my_waitpid (GET_LWP (lp->ptid), &status, 0);
+ if (pid == -1 && errno == ECHILD)
+ pid = my_waitpid (GET_LWP (lp->ptid), &status, __WCLONE);
if (pid == -1 && errno == ECHILD)
{
/* The thread has previously exited. We need to delete it
@@ -4153,8 +4193,10 @@ linux_nat_xfer_osdata (struct target_ops
return len;
}
+/* Transfer from the specific LWP currently set by PID of INFERIOR_PTID. */
+
static LONGEST
-linux_xfer_partial (struct target_ops *ops, enum target_object object,
+linux_xfer_partial_lwp (struct target_ops *ops, enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
@@ -4201,6 +4243,45 @@ linux_xfer_partial (struct target_ops *o
offset, len);
}
+/* nptl_db expects being able to transfer memory just by specifying PID.
+ After the thread group leader exists the Linux kernel turns the task
+ into zombie no longer permitting accesses to its memory.
+ Transfer the memory from an arbitrary LWP_LIST entry in such case. */
+
+static LONGEST
+linux_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+{
+ LONGEST xfer;
+ struct lwp_info *lp;
+ /* Not using SAVE_INFERIOR_PTID already here for better performance. */
+ struct cleanup *old_chain = NULL;
+ ptid_t inferior_ptid_orig = inferior_ptid;
+
+ errno = 0;
+ xfer = linux_xfer_partial_lwp (ops, object, annex, readbuf, writebuf,
+ offset, len);
+
+ for (lp = lwp_list; xfer == 0 && (errno == EACCES || errno == ESRCH)
+ && lp != NULL; lp = lp->next)
+ {
+ if (!is_lwp (lp->ptid) || ptid_equal (lp->ptid, inferior_ptid_orig))
+ continue;
+
+ if (old_chain == NULL)
+ old_chain = save_inferior_ptid ();
+ inferior_ptid = BUILD_LWP (GET_LWP (lp->ptid), GET_LWP (lp->ptid));
+ errno = 0;
+ xfer = linux_xfer_partial_lwp (ops, object, annex, readbuf, writebuf,
+ offset, len);
+ }
+
+ if (old_chain != NULL)
+ do_cleanups (old_chain);
+ return xfer;
+}
+
/* Create a prototype generic GNU/Linux target. The client can override
it with local methods. */

View File

@ -1,121 +0,0 @@
2007-07-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/leader-exit.c, gdb.threads/leader-exit.exp: New files.
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/leader-exit.c 7 Jul 2007 15:21:57 -0000
@@ -0,0 +1,47 @@
+/* Clean exit of the thread group leader should not break GDB.
+
+ Copyright 2007 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 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+static void *start (void *arg)
+{
+ for (;;)
+ pause ();
+ /* NOTREACHED */
+ assert (0);
+ return arg;
+}
+
+int main (void)
+{
+ pthread_t thread;
+ int i;
+
+ i = pthread_create (&thread, NULL, start, NULL); /* create1 */
+ assert (i == 0);
+
+ pthread_exit (NULL);
+ /* NOTREACHED */
+ assert (0);
+ return 0;
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.threads/leader-exit.exp 7 Jul 2007 15:21:57 -0000
@@ -0,0 +1,64 @@
+# Copyright (C) 2007 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.
+
+# Exit of the thread group leader should not break GDB.
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile "leader-exit"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+gdb_run_cmd
+
+proc stop_process { description } {
+ global gdb_prompt
+
+ # For this to work we must be sure to consume the "Continuing."
+ # message first, or GDB's signal handler may not be in place.
+ after 1000 {send_gdb "\003"}
+ gdb_expect {
+ -re "Program received signal SIGINT.*$gdb_prompt $"
+ {
+ pass $description
+ }
+ timeout
+ {
+ fail "$description (timeout)"
+ }
+ }
+}
+
+# Prevent races.
+sleep 8
+
+stop_process "Threads could be stopped"
+
+gdb_test "info threads" \
+ "\\* 2 Thread \[^\r\n\]* in \[^\r\n\]*" \
+ "Single thread has been left"

View File

@ -1,8 +1,8 @@
Index: gdb-7.1.90.20100711/gdb/infrun.c
Index: gdb-7.3.50.20110722/gdb/infrun.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/infrun.c 2010-07-12 10:05:26.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/infrun.c 2010-07-12 10:58:56.000000000 +0200
@@ -1491,7 +1491,7 @@ static const char *scheduler_enums[] = {
--- gdb-7.3.50.20110722.orig/gdb/infrun.c 2011-07-22 19:12:56.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/infrun.c 2011-07-22 19:17:06.000000000 +0200
@@ -1549,7 +1549,7 @@ static const char *scheduler_enums[] = {
schedlock_step,
NULL
};
@ -11,10 +11,10 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c
static void
show_scheduler_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi-console.exp
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.mi/mi-console.exp 2010-01-01 08:32:03.000000000 +0100
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi-console.exp 2010-07-12 10:58:56.000000000 +0200
--- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-console.exp 2011-01-01 16:33:47.000000000 +0100
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp 2011-07-22 19:17:06.000000000 +0200
@@ -47,6 +47,9 @@ if { [gdb_compile "${srcdir}/${subdir}/
mi_run_to_main
@ -25,10 +25,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi-console.exp
# Next over the hello() call which will produce lots of output
mi_gdb_test "220-exec-next" \
"220\\^running(\r\n\\*running,thread-id=\"all\")?" \
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi2-console.exp
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.mi/mi2-console.exp 2010-05-26 20:12:13.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi2-console.exp 2010-07-12 10:59:14.000000000 +0200
--- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi2-console.exp 2011-06-23 11:40:50.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp 2011-07-22 19:17:27.000000000 +0200
@@ -47,6 +47,9 @@ if { [gdb_compile "${srcdir}/${subdir}/
mi_run_to_main
@ -37,12 +37,12 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi2-console.exp
+mi_gdb_test "210-gdb-set scheduler-locking off" "210\\^done" "set scheduler-locking off"
+
# Next over the hello() call which will produce lots of output
gdb_test_multiple "220-exec-next" "Started step over hello" {
-re "220\\^running\r\n(\\*running,thread-id=\"all\"\r\n)?$mi_gdb_prompt" {
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi-cli.exp
mi_gdb_test "220-exec-next" "220\\^running(\r\n)?(\\*running,thread-id=\"all\")?" \
"Started step over hello"
Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2010-01-19 09:00:39.000000000 +0100
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.mi/mi-cli.exp 2010-07-12 10:58:56.000000000 +0200
--- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2011-04-27 12:17:38.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp 2011-07-22 19:17:06.000000000 +0200
@@ -176,7 +176,7 @@ mi_execute_to "exec-continue" "breakpoin
# Test that the token is output even for CLI commands
# Also test that *stopped includes frame information.

View File

@ -21,15 +21,15 @@
Port to GDB-6.8pre.
Index: gdb-7.2.50.20110117/gdb/inferior.h
Index: gdb-7.4.50.20120602/gdb/inferior.h
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/inferior.h 2011-01-09 04:08:56.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/inferior.h 2011-01-17 15:48:39.000000000 +0100
@@ -186,7 +186,15 @@ extern void reopen_exec_file (void);
--- gdb-7.4.50.20120602.orig/gdb/inferior.h 2012-05-24 18:39:09.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/inferior.h 2012-06-02 18:24:12.875274179 +0200
@@ -159,7 +159,15 @@ extern void reopen_exec_file (void);
/* The `resume' routine should only be called in special circumstances.
Normally, use `proceed', which handles a lot of bookkeeping. */
-extern void resume (int, enum target_signal);
-extern void resume (int, enum gdb_signal);
+enum resume_step
+ {
+ /* currently_stepping () should return non-zero for non-continue. */
@ -38,15 +38,15 @@ Index: gdb-7.2.50.20110117/gdb/inferior.h
+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */
+ };
+
+extern void resume (enum resume_step, enum target_signal);
+extern void resume (enum resume_step, enum gdb_signal);
/* From misc files */
extern ptid_t user_visible_resume_ptid (int step);
Index: gdb-7.2.50.20110117/gdb/infrun.c
Index: gdb-7.4.50.20120602/gdb/infrun.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/infrun.c 2011-01-09 04:08:56.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/infrun.c 2011-01-17 15:49:40.000000000 +0100
@@ -76,7 +76,7 @@ static int follow_fork (void);
--- gdb-7.4.50.20120602.orig/gdb/infrun.c 2012-05-28 22:43:26.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/infrun.c 2012-06-02 18:23:59.339278268 +0200
@@ -79,7 +79,7 @@ static int follow_fork (void);
static void set_schedlock_func (char *args, int from_tty,
struct cmd_list_element *c);
@ -55,46 +55,42 @@ Index: gdb-7.2.50.20110117/gdb/infrun.c
static int currently_stepping_or_nexting_callback (struct thread_info *tp,
void *data);
@@ -1577,7 +1577,7 @@ maybe_software_singlestep (struct gdbarc
@@ -1687,7 +1687,8 @@ user_visible_resume_ptid (int step)
}
else if ((scheduler_mode == schedlock_on)
|| (scheduler_mode == schedlock_step
- && (step || singlestep_breakpoints_inserted_p)))
+ && (step == RESUME_STEP_USER
+ || singlestep_breakpoints_inserted_p)))
{
/* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
@@ -1705,7 +1706,7 @@ user_visible_resume_ptid (int step)
STEP nonzero if we should step (zero to continue instead).
SIG is the signal to give the inferior (zero for none). */
void
-resume (int step, enum target_signal sig)
+resume (enum resume_step step, enum target_signal sig)
-resume (int step, enum gdb_signal sig)
+resume (enum resume_step step, enum gdb_signal sig)
{
int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
@@ -1609,10 +1609,12 @@ resume (int step, enum target_signal sig
}
@@ -1738,9 +1739,13 @@ resume (int step, enum gdb_signal sig)
if (debug_infrun)
- fprintf_unfiltered (gdb_stdlog,
fprintf_unfiltered (gdb_stdlog,
- "infrun: resume (step=%d, signal=%d), "
- "trap_expected=%d\n",
- step, sig, tp->control.trap_expected);
+ fprintf_unfiltered (gdb_stdlog, "infrun: resume (step=%s, signal=%d), "
+ "trap_expected=%d\n",
+ (step == RESUME_STEP_CONTINUE ? "RESUME_STEP_CONTINUE"
+ : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
+ : "RESUME_STEP_NEEDED")),
+ sig, tp->control.trap_expected);
+ "infrun: resume (step=%s, signal=%d), "
"trap_expected=%d, current thread [%s] at %s\n",
- step, sig, tp->control.trap_expected,
+ (step == RESUME_STEP_CONTINUE
+ ? "RESUME_STEP_CONTINUE"
+ : (step == RESUME_STEP_USER ? "RESUME_STEP_USER"
+ : "RESUME_STEP_NEEDED")),
+ sig, tp->control.trap_expected,
target_pid_to_str (inferior_ptid),
paddress (gdbarch, pc));
/* Normally, by the time we reach `resume', the breakpoints are either
removed or inserted, as appropriate. The exception is if we're sitting
@@ -1730,9 +1732,10 @@ a command like `return' or `jump' to con
individually. */
resume_ptid = inferior_ptid;
}
- else if ((scheduler_mode == schedlock_on)
+ else if (scheduler_mode == schedlock_on
|| (scheduler_mode == schedlock_step
- && (step || singlestep_breakpoints_inserted_p)))
+ && (step == RESUME_STEP_USER
+ || singlestep_breakpoints_inserted_p)))
{
/* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
@@ -1941,7 +1944,7 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2117,7 +2122,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
struct thread_info *tp;
CORE_ADDR pc;
struct address_space *aspace;
@ -103,7 +99,7 @@ Index: gdb-7.2.50.20110117/gdb/infrun.c
/* If we're stopped at a fork/vfork, follow the branch set by the
"set follow-fork-mode" command; otherwise, we'll just proceed
@@ -1976,13 +1979,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2157,13 +2162,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
actually be executing the breakpoint insn anyway.
We'll be (un-)executing the previous instruction. */
@ -119,7 +115,7 @@ Index: gdb-7.2.50.20110117/gdb/infrun.c
}
else
{
@@ -2023,13 +2026,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2194,13 +2199,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
is required it returns TRUE and sets the current thread to
the old thread. */
if (prepare_to_proceed (step))
@ -135,7 +131,7 @@ Index: gdb-7.2.50.20110117/gdb/infrun.c
{
tp->control.trap_expected = 1;
/* If displaced stepping is enabled, we can step over the
@@ -2116,8 +2119,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2287,8 +2292,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
/* Reset to normal state. */
init_infwait_state ();
@ -150,7 +146,7 @@ Index: gdb-7.2.50.20110117/gdb/infrun.c
/* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */
@@ -4957,14 +4965,19 @@ process_event_stop_test:
@@ -5249,13 +5259,18 @@ process_event_stop_test:
/* Is thread TP in the middle of single-stepping? */
@ -161,12 +157,10 @@ Index: gdb-7.2.50.20110117/gdb/infrun.c
- return ((tp->control.step_range_end
- && tp->control.step_resume_breakpoint == NULL)
- || tp->control.trap_expected
- || tp->stepping_through_solib_after_catch
- || bpstat_should_step ());
+ if ((tp->control.step_range_end
+ && tp->control.step_resume_breakpoint == NULL)
+ || tp->control.trap_expected
+ || tp->stepping_through_solib_after_catch)
+ || tp->control.trap_expected)
+ return RESUME_STEP_USER;
+
+ if (bpstat_should_step ())
@ -176,27 +170,28 @@ Index: gdb-7.2.50.20110117/gdb/infrun.c
}
/* Returns true if any thread *but* the one passed in "data" is in the
Index: gdb-7.2.50.20110117/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/linux-nat.c 2011-01-17 15:47:37.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/linux-nat.c 2011-01-17 15:48:39.000000000 +0100
@@ -2928,7 +2928,10 @@ count_events_callback (struct lwp_info *
static int
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-05-24 18:51:34.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 18:23:07.409293800 +0200
@@ -3051,7 +3051,11 @@ static int
select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
{
- if (lp->step && lp->status != 0)
+ /* We do not focus on software watchpoints as we would not catch
+ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
+ as they would remain pending due to `Push back breakpoint for %s'. */
+ if (lp->step == RESUME_STEP_USER && lp->status != 0)
if (lp->last_resume_kind == resume_step
- && lp->status != 0)
+ && lp->status != 0
+ /* We do not focus on software watchpoints as we would not catch
+ STEPPING_PAST_SINGLESTEP_BREAKPOINT breakpoints in some other thread
+ as they would remain pending due to `Push back breakpoint for %s'. */
+ && lp->step == RESUME_STEP_USER)
return 1;
else
return 0;
Index: gdb-7.2.50.20110117/gdb/linux-nat.h
Index: gdb-7.4.50.20120602/gdb/linux-nat.h
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/linux-nat.h 2011-01-17 15:47:37.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/linux-nat.h 2011-01-17 15:48:39.000000000 +0100
@@ -55,8 +55,8 @@ struct lwp_info
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.h 2012-03-21 14:43:54.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/linux-nat.h 2012-06-02 18:23:07.411293798 +0200
@@ -73,8 +73,8 @@ struct lwp_info
/* If non-zero, a pending wait status. */
int status;

View File

@ -1,60 +0,0 @@
Index: gdb-7.2.50.20101116/gdb/linux-nat.c
===================================================================
--- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 07:58:15.000000000 +0100
+++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 07:59:06.000000000 +0100
@@ -1863,16 +1863,18 @@ resume_set_callback (struct lwp_info *lp
static void
linux_nat_resume (struct target_ops *ops,
- ptid_t ptid, int step, enum target_signal signo)
+ ptid_t ptid, int step_int, enum target_signal signo)
{
sigset_t prev_mask;
struct lwp_info *lp;
int resume_many;
+ enum resume_step step = step_int;
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: Preparing to %s %s, %s, inferior_ptid %s\n",
- step ? "step" : "resume",
+ (step == RESUME_STEP_NEEDED
+ ? "needed" : (step ? "step" : "resume")),
target_pid_to_str (ptid),
(signo != TARGET_SIGNAL_0
? strsignal (target_signal_to_host (signo)) : "0"),
@@ -3171,10 +3173,34 @@ linux_nat_filter_event (int lwpid, int s
if (num_lwps (GET_PID (lp->ptid)) > 1)
{
+ enum resume_step step = lp->step;
+ pid_t pid = GET_PID (lp->ptid);
+
/* If there is at least one more LWP, then the exit signal
was not the end of the debugged application and should be
ignored. */
exit_lwp (lp);
+
+ if (step == RESUME_STEP_USER)
+ {
+ /* Now stop the closest LWP's ... */
+ lp = find_lwp_pid (pid_to_ptid (pid));
+ if (!lp)
+ lp = lwp_list;
+ gdb_assert (lp != NULL);
+ errno = 0;
+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
+ (void *) (unsigned long) SIGSTOP);
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "PTRACE_CONT %s, 0, 0 (%s)\n",
+ target_pid_to_str (lp->ptid),
+ errno ? safe_strerror (errno)
+ : "OK");
+ /* Avoid the silent `delayed SIGSTOP' handling. */
+ lp->signalled = 0;
+ }
+
return NULL;
}
}

View File

@ -1,42 +1,26 @@
--- ./gdb/testsuite/gdb.base/annota1.exp 10 Jan 2007 03:23:04 -0000 1.23
+++ ./gdb/testsuite/gdb.base/annota1.exp 10 May 2007 12:54:11 -0000
@@ -57,6 +57,8 @@ if [target_info exists gdb_stub] {
gdb_step_for_stub;
}
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota1.exp 2012-03-16 17:47:33.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp 2012-06-02 18:27:46.623210711 +0200
@@ -45,6 +45,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
+
#
# the line at which break main will put the breakpoint
#
--- ./gdb/testsuite/gdb.base/annota3.exp 9 Jan 2007 17:59:09 -0000 1.12
+++ ./gdb/testsuite/gdb.base/annota3.exp 10 May 2007 12:54:11 -0000
@@ -56,6 +56,8 @@ if [target_info exists gdb_stub] {
gdb_step_for_stub;
}
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota3.exp 2012-02-28 23:40:48.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp 2012-06-02 18:28:00.375206457 +0200
@@ -45,6 +45,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
+gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
+
#
# the line at which break main will put the breakpoint
#
--- gdb-6.6/gdb/testsuite/gdb.threads/step-thread-exit.exp-orig 2007-05-10 15:03:15.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.threads/step-thread-exit.exp 2007-05-10 15:04:24.000000000 +0200
@@ -58,6 +58,9 @@ gdb_test "continue" "Break.*thread_funct
# thread to be stopped and a message printed to tell us we have stepped
# over the thread exit.
set test "step over thread exit 1"
+# ppc64 is currently failing:
+set timeout_old $timeout
+set timeout 60
gdb_test_multiple "next" "$test" {
-re "\}.*$gdb_prompt $" {
send_gdb "next\n"
@@ -71,6 +74,7 @@ gdb_test_multiple "next" "$test" {
exp_continue
}
}
+set timeout $timeout_old
# Without this fixup we could end up in:
# #0 0x00110416 in __kernel_vsyscall ()
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"

View File

@ -1,8 +1,8 @@
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp
Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/staticthreads.exp
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.threads/staticthreads.exp 2010-06-02 23:53:28.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp 2010-07-12 11:43:26.000000000 +0200
@@ -44,6 +44,18 @@ gdb_test_no_output "set print sevenbit-s
--- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.threads/staticthreads.exp 2011-12-19 21:07:01.436475201 +0100
+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.threads/staticthreads.exp 2011-12-19 22:08:55.444514127 +0100
@@ -45,6 +45,13 @@ gdb_test_no_output "set print sevenbit-s
# See if the static multi-threaded program runs.
runto_main
@ -11,12 +11,7 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp
+# * 2 Thread 135661664 (LWP 3856) main () at threadloop.c:41
+# 1 process 3856 main () at threadloop.c:41
+
+set test "info threads on start"
+gdb_test_multiple "info threads" "$test" {
+ -re "^info threads\r?\n\[^\r\n\]* Thread \[^\r\n\]*\r?\n$gdb_prompt" {
+ pass "$test"
+ }
+}
+gdb_test "info threads" "^info threads\r\n\[ \t\]*Id\[ \t\]+Target Id\[ \t\]+Frame\[ \t\]*\r\n\[^\r\n\]* Thread \[^\r\n\]*" "info threads on start"
+
gdb_test "break sem_post"
set test "Continue to main's call of sem_post"

View File

@ -20,10 +20,10 @@ random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
frames-invalid can happen asynchronously.
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c
Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c 2010-07-12 11:41:43.000000000 +0200
--- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200
+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.c 2012-01-03 15:21:28.122729249 +0100
@@ -58,6 +58,8 @@ system (const char * string);
1) Invalid string/command. - returns 127. */
static const char *strerrno (int err);
@ -71,10 +71,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c
/* Don't change the order of the calls. They partly depend on each other */
test_open ();
test_write ();
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp
Index: gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/fileio.exp 2010-06-09 00:58:03.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp 2010-07-12 11:42:07.000000000 +0200
--- gdb-7.4.50.20120103.orig/gdb/testsuite/gdb.base/fileio.exp 2011-12-26 12:24:55.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/testsuite/gdb.base/fileio.exp 2012-01-03 15:22:02.716601956 +0100
@@ -42,8 +42,8 @@ if [get_compiler_info ${binfile}] {
return -1;
}
@ -95,9 +95,9 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp
gdb_test continue \
"Continuing\\..*open 5:.*EACCES$stop_msg" \
@@ -250,8 +250,8 @@ gdb_test continue \
send_gdb "quit\n"
send_gdb "y\n"
@@ -251,8 +251,8 @@ gdb_exit
# Wait till GDB really exits.
sleep 1
-remote_exec build {sh -xc test\ -r\ dir2.fileio.test\ &&\ chmod\ -f\ +w\ dir2.fileio.test}
-remote_exec build {sh -xc rm\ -rf\ *.fileio.test}

View File

@ -1,183 +0,0 @@
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 11:53:34.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 12:13:53.000000000 +0100
@@ -208,6 +208,9 @@ blocked. */
static struct target_ops *linux_ops;
static struct target_ops linux_ops_saved;
+/* PID of the inferior stopped by SIGSTOP before attaching (or zero). */
+static pid_t pid_was_stopped;
+
/* The method to call, if any, when a new thread is attached. */
static void (*linux_nat_new_thread) (ptid_t);
@@ -933,7 +936,14 @@ Attaching after process %d fork to child
parent_inf->waiting_for_vfork_done = 0;
}
else if (detach_fork)
- target_detach (NULL, 0);
+ {
+ /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
+ In this point of code it cannot be 1 as we would not get FORK
+ executed without CONTINUE first which resets PID_WAS_STOPPED.
+ We would have to first TARGET_STOP and WAITPID it as with running
+ inferior PTRACE_DETACH, SIGSTOP will ignore the signal. */
+ target_detach (NULL, 0);
+ }
/* Note that the detach above makes PARENT_INF dangling. */
@@ -1427,6 +1437,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n");
+ pid_was_stopped = GET_PID (ptid);
/* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED /
@@ -1757,6 +1768,9 @@ GPT: lwp %s had signal %s, but it is in
target_signal_to_string (signo));
}
+ if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
+ *status = W_STOPCODE (SIGSTOP);
+
return 0;
}
@@ -1866,6 +1880,8 @@ linux_nat_detach (struct target_ops *ops
}
else
linux_ops->to_detach (ops, args, from_tty);
+
+ pid_was_stopped = 0;
}
/* Resume LP. */
@@ -2031,6 +2047,14 @@ linux_nat_resume (struct target_ops *ops
resume_callback. */
lp->stopped = 0;
+ /* At this point, we are going to resume the inferior and if we
+ have attached to a stopped process, we no longer should leave
+ it as stopped if the user detaches. PTID variable has PID set to LWP
+ while we need to check the real PID here. */
+
+ if (!step && lp && pid_was_stopped == GET_PID (lp->ptid))
+ pid_was_stopped = 0;
+
if (resume_many)
iterate_over_lwps (ptid, resume_callback, NULL);
@@ -3923,6 +3947,8 @@ linux_nat_mourn_inferior (struct target_
there are other viable forks to debug. Delete the exiting
one and context-switch to the first available. */
linux_fork_mourn_inferior ();
+
+ pid_was_stopped = 0;
}
/* Convert a native/host siginfo object, into/from the siginfo in the
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-01 08:32:06.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-15 11:54:57.000000000 +0100
@@ -62,7 +62,65 @@ proc corefunc { threadtype } {
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
- # Verify that we can attach to the stopped process.
+ # Verify that we can attach to the process by first giving its
+ # executable name via the file command, and using attach with the
+ # process ID.
+
+ set test "$threadtype: set file, before attach1 to stopped process"
+ gdb_test_multiple "file $binfile" "$test" {
+ -re "Load new symbol table from.*y or n. $" {
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ "$test (re-read)"
+ }
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ set test "$threadtype: attach1 to stopped, after setting file"
+ gdb_test_multiple "attach $testpid" "$test" {
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
+ if {[string equal $threadtype threaded]} {
+ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
+ } else {
+ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
+ }
+
+ # Exit and detach the process.
+
+ gdb_exit
+
+ # Avoid some race:
+ sleep 2
+
+ if [catch {open /proc/${testpid}/status r} fileid] {
+ set line2 "NOTFOUND"
+ } else {
+ gets $fileid line1;
+ gets $fileid line2;
+ close $fileid;
+ }
+
+ set test "$threadtype: attach1, exit leaves process stopped"
+ if {[string match "*(stopped)*" $line2]} {
+ pass $test
+ } else {
+ fail $test
+ }
+
+ # At this point, the process should still be stopped
+
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ # Verify that we can attach to the process just by giving the
+ # process ID.
set test "$threadtype: attach2 to stopped, after setting file"
gdb_test_multiple "attach $testpid" "$test" {
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attachstop-mt.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/attachstop-mt.exp 2010-01-01 08:32:06.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attachstop-mt.exp 2010-01-15 11:54:57.000000000 +0100
@@ -176,12 +176,23 @@ gdb_test "bt" ".*sleep.*(func|main).*" "
# Exit and detach the process.
gdb_exit
-# Stop the program
-remote_exec build "kill -s STOP ${testpid}"
-
# No race
sleep 2
+set fileid3 [open $status2 r];
+gets $fileid3 line1;
+gets $fileid3 line2;
+close $fileid3;
+
+set test "attach3, exit leaves process stopped"
+if {[string match "*(stopped)*" $line2]} {
+ pass $test
+} else {
+ fail $test
+}
+
+# At this point, the process should still be stopped
+
# Continue the test as we would hit another expected bug regarding
# Program received signal SIGSTOP, Stopped (signal).
# across NPTL threads.

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
Index: gdb-7.4.50.20120602/bfd/elf-bfd.h
===================================================================
--- gdb-7.2.50.20110320.orig/bfd/elf-bfd.h 2011-03-20 15:17:42.000000000 +0100
+++ gdb-7.2.50.20110320/bfd/elf-bfd.h 2011-03-20 15:24:02.000000000 +0100
@@ -2193,8 +2193,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
--- gdb-7.4.50.20120602.orig/bfd/elf-bfd.h 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/bfd/elf-bfd.h 2012-06-02 21:27:21.727689625 +0200
@@ -2221,8 +2221,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);
@ -14,17 +14,11 @@ Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
extern char *elfcore_write_prstatus
(bfd *, char *, int *, long, int, const void *);
extern char * elfcore_write_pstatus
Index: gdb-7.2.50.20110320/bfd/elf.c
Index: gdb-7.4.50.20120602/bfd/elf.c
===================================================================
--- gdb-7.2.50.20110320.orig/bfd/elf.c 2011-03-20 15:17:42.000000000 +0100
+++ gdb-7.2.50.20110320/bfd/elf.c 2011-03-20 15:24:02.000000000 +0100
@@ -8814,13 +8814,12 @@ elfcore_write_note (bfd *abfd,
return buf;
}
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
+#if defined (HAVE_PRPSINFO_T)
char *
--- gdb-7.4.50.20120602.orig/bfd/elf.c 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/bfd/elf.c 2012-06-02 21:27:21.732689623 +0200
@@ -8917,56 +8917,61 @@ char *
elfcore_write_prpsinfo (bfd *abfd,
char *buf,
int *bufsiz,
@ -32,9 +26,8 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
- const char *psargs)
+ const prpsinfo_t *input)
{
const char *note_name = "CORE";
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
@@ -8828,48 +8827,55 @@ elfcore_write_prpsinfo (bfd *abfd,
if (bed->elf_backend_write_core_note != NULL)
{
char *ret;
@ -52,7 +45,9 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
return ret;
}
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
+#if defined (HAVE_PRPSINFO_T)
+#if defined (HAVE_PRPSINFO32_T)
if (bed->s->elfclass == ELFCLASS32)
{
@ -64,7 +59,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
int note_type = NT_PRPSINFO;
-#endif
memset (&data, 0, sizeof (data));
- memset (&data, 0, sizeof (data));
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ data.pr_state = input->pr_state;
@ -83,7 +78,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
+ BFD_ASSERT (sizeof (data.pr_psargs) == sizeof (input->pr_psargs));
+ memcpy (data.pr_psargs, input->pr_psargs, sizeof (data.pr_psargs));
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
"CORE", note_type, &data, sizeof (data));
}
else
#endif
@ -100,21 +95,40 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
return elfcore_write_note (abfd, buf, bufsiz,
- note_name, note_type, &data, sizeof (data));
+ note_name, note_type, input, sizeof (*input));
- "CORE", note_type, &data, sizeof (data));
+ "CORE", note_type, input, sizeof (*input));
}
}
-#endif /* PSINFO_T or PRPSINFO_T */
+#endif /* PRPSINFO_T */
#if defined (HAVE_PRSTATUS_T)
char *
Index: gdb-7.2.50.20110320/gdb/linux-nat.c
free (buf);
return NULL;
Index: gdb-7.4.50.20120602/gdb/procfs.c
===================================================================
--- gdb-7.2.50.20110320.orig/gdb/linux-nat.c 2011-03-20 15:17:46.000000000 +0100
+++ gdb-7.2.50.20110320/gdb/linux-nat.c 2011-03-20 15:25:36.000000000 +0100
@@ -4603,6 +4603,131 @@ linux_spu_make_corefile_notes (bfd *obfd
return args.note_data;
--- gdb-7.4.50.20120602.orig/gdb/procfs.c 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/gdb/procfs.c 2012-06-02 21:27:21.745689618 +0200
@@ -5541,6 +5541,7 @@ procfs_make_note_section (bfd *obfd, int
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
note_size,
+ NULL,
fname,
psargs);
Index: gdb-7.4.50.20120602/gdb/linux-tdep.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/linux-tdep.c 2012-06-02 21:26:09.928717069 +0200
+++ gdb-7.4.50.20120602/gdb/linux-tdep.c 2012-06-02 21:31:12.051601510 +0200
@@ -30,6 +30,7 @@
#include "elf-bfd.h" /* for elfcore_write_* */
#include "inferior.h"
#include "cli/cli-utils.h"
+#include <sys/procfs.h>
#include <ctype.h>
@@ -769,6 +770,131 @@ linux_corefile_thread_callback (struct t
return !args->note_data;
}
+/* Should be always true for Linux */
@ -245,45 +259,22 @@ Index: gdb-7.2.50.20110320/gdb/linux-nat.c
/* Fills the "to_make_corefile_note" target vector. Builds the note
section for a corefile, and returns it in a malloc buffer. */
@@ -4621,26 +4746,11 @@ linux_nat_make_corefile_notes (bfd *obfd
@@ -784,16 +910,9 @@ linux_make_corefile_notes (struct gdbarc
/* Process information. */
if (get_exec_file (0))
{
- strncpy (fname, lbasename (get_exec_file (0)), sizeof (fname));
- strncpy (psargs, get_exec_file (0), sizeof (psargs));
- if (get_inferior_args ())
- {
- char *string_end;
- char *psargs_end = psargs + sizeof (psargs);
-
- /* linux_elfcore_write_prpsinfo () handles zero unterminated
- strings fine. */
- string_end = memchr (psargs, 0, sizeof (psargs));
- if (string_end != NULL)
- {
- *string_end++ = ' ';
- strncpy (string_end, get_inferior_args (),
- psargs_end - string_end);
- }
- }
- const char *fname = lbasename (get_exec_file (0));
- char *psargs = xstrdup (fname);
+ const prpsinfo_t *data = fill_prpsinfo ();
+
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
- note_size, fname, psargs);
+ note_size, data);
}
/* Dump information for threads. */
Index: gdb-7.2.50.20110320/gdb/procfs.c
===================================================================
--- gdb-7.2.50.20110320.orig/gdb/procfs.c 2011-03-09 13:48:55.000000000 +0100
+++ gdb-7.2.50.20110320/gdb/procfs.c 2011-03-20 15:24:02.000000000 +0100
@@ -5752,6 +5752,7 @@ procfs_make_note_section (bfd *obfd, int
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
note_size,
+ NULL,
fname,
psargs);
- if (get_inferior_args ())
- psargs = reconcat (psargs, psargs, " ", get_inferior_args (),
- (char *) NULL);
-
- note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
- fname, psargs);
- xfree (psargs);
+ note_data = elfcore_write_prpsinfo (obfd, note_data, note_size, data);
if (!note_data)
return NULL;

View File

@ -1,8 +1,9 @@
diff -up gdb-6.8/gdb/sparc-tdep.c.BAD gdb-6.8/gdb/sparc-tdep.c
--- gdb-6.8/gdb/sparc-tdep.c.BAD 2008-05-15 16:12:58.000000000 -0500
+++ gdb-6.8/gdb/sparc-tdep.c 2008-05-15 16:13:41.000000000 -0500
@@ -1122,6 +1122,7 @@ sparc32_store_return_value (struct type
if (sparc_floating_p (type))
Index: gdb-7.4.50.20111218/gdb/sparc-tdep.c
===================================================================
--- gdb-7.4.50.20111218.orig/gdb/sparc-tdep.c 2011-09-28 19:59:42.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/sparc-tdep.c 2011-12-19 01:25:29.294046199 +0100
@@ -1316,6 +1316,7 @@ sparc32_store_return_value (struct type
if (sparc_floating_p (type) || sparc_complex_floating_p (type))
{
/* Floating return values. */
+ len = (len <= 8) ? len : 8;

View File

@ -1,24 +0,0 @@
Provide `gdb --tui' functionality for the hardlink `gdbtui'.
--- ./gdb/gdb.c 1 Jan 2008 22:53:09 -0000 1.6
+++ ./gdb/gdb.c 20 Jun 2008 08:02:57 -0000
@@ -30,5 +30,19 @@ main (int argc, char **argv)
args.argv = argv;
args.use_windows = 0;
args.interpreter_p = INTERP_CONSOLE;
+
+ if (argv[0])
+ {
+ char *s;
+
+ s = strrchr (argv[0], '/');
+ if (s)
+ s++;
+ else
+ s = argv[0];
+ if (strcmp (s, "gdbtui") == 0)
+ args.interpreter_p = INTERP_TUI;
+ }
+
return gdb_main (&args);
}

View File

@ -1,6 +1,8 @@
--- gdb-7.2.50.20110328.orig/gdb/dwarf2read.c 2011-03-30 12:52:20.395450001 +0200
+++ gdb-7.2.50.20110328/gdb/dwarf2read.c 2011-03-30 13:41:55.485450006 +0200
@@ -66,12 +66,14 @@
Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c 2011-07-22 19:37:15.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/dwarf2read.c 2011-07-22 19:44:42.000000000 +0200
@@ -67,12 +67,14 @@
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
@ -15,7 +17,7 @@
typedef struct symbol *symbolp;
DEF_VEC_P (symbolp);
@@ -1563,6 +1565,7 @@
@@ -1618,6 +1620,7 @@ dwarf2_read_section (struct objfile *obj
}
}
@ -23,7 +25,7 @@
#ifdef HAVE_MMAP
if (pagesize == 0)
pagesize = getpagesize ();
@@ -1589,6 +1592,7 @@
@@ -1641,6 +1644,7 @@ dwarf2_read_section (struct objfile *obj
}
}
#endif
@ -31,15 +33,15 @@
/* If we get here, we are a normal, not-compressed section. */
info->buffer = buf
@@ -15439,6 +15443,7 @@
@@ -15983,6 +15987,7 @@ munmap_section_buffer (struct dwarf2_sec
{
if (info->was_mmapped)
if (info->map_addr != NULL)
{
+#ifndef __sparc__
#ifdef HAVE_MMAP
intptr_t begin = (intptr_t) info->buffer;
intptr_t map_begin = begin & ~(pagesize - 1);
@@ -15449,6 +15454,7 @@
int res;
@@ -15992,6 +15997,7 @@ munmap_section_buffer (struct dwarf2_sec
/* Without HAVE_MMAP, we should never be here to begin with. */
gdb_assert_not_reached ("no mmap support");
#endif

View File

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

View File

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

View File

@ -1,12 +1,11 @@
Index: gdb-7.2.90.20110411/gdb/breakpoint.c
Index: gdb-7.4.50.20120602/gdb/breakpoint.c
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/breakpoint.c 2011-04-11 19:11:55.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/breakpoint.c 2011-04-11 19:18:10.000000000 +0200
@@ -11233,6 +11233,50 @@ re_set_breakpoint (struct breakpoint *b)
do_cleanups (cleanups);
--- gdb-7.4.50.20120602.orig/gdb/breakpoint.c 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/breakpoint.c 2012-06-02 19:52:58.161226506 +0200
@@ -15495,6 +15495,50 @@ initialize_breakpoint_ops (void)
}
+void
void
+breakpoints_relocate (struct objfile *objfile, struct section_offsets *delta)
+{
+ struct bp_location *bl, **blp_tmp;
@ -50,26 +49,27 @@ Index: gdb-7.2.90.20110411/gdb/breakpoint.c
+ bp_location_compare);
+}
+
/* Reset a breakpoint given it's struct breakpoint * BINT.
The value we return ends up being the return value from catch_errors.
Unused in this case. */
Index: gdb-7.2.90.20110411/gdb/breakpoint.h
+void
_initialize_breakpoint (void)
{
struct cmd_list_element *c;
Index: gdb-7.4.50.20120602/gdb/breakpoint.h
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/breakpoint.h 2011-04-11 19:11:55.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/breakpoint.h 2011-04-11 19:17:53.000000000 +0200
@@ -1245,4 +1245,7 @@ extern int user_breakpoint_p (struct bre
--- gdb-7.4.50.20120602.orig/gdb/breakpoint.h 2012-05-16 16:35:03.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/breakpoint.h 2012-06-02 19:53:09.268223263 +0200
@@ -1503,4 +1503,7 @@ extern struct gdbarch *get_sal_arch (str
extern void modify_semaphore (struct bp_location *location, int set);
extern void handle_solib_event (void);
+extern void breakpoints_relocate (struct objfile *objfile,
+ struct section_offsets *delta);
+
#endif /* !defined (BREAKPOINT_H) */
Index: gdb-7.2.90.20110411/gdb/objfiles.c
Index: gdb-7.4.50.20120602/gdb/objfiles.c
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/objfiles.c 2011-04-11 19:11:55.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/objfiles.c 2011-04-11 19:17:53.000000000 +0200
@@ -851,6 +851,11 @@ objfile_relocate1 (struct objfile *objfi
--- gdb-7.4.50.20120602.orig/gdb/objfiles.c 2012-05-10 21:50:08.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/objfiles.c 2012-06-02 19:52:58.202226502 +0200
@@ -802,6 +802,11 @@ objfile_relocate1 (struct objfile *objfi
objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
new_offsets, delta);

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
Index: gdb-7.4.50.20120602/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/dwarf2read.c 2011-05-25 17:10:46.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/dwarf2read.c 2011-05-25 17:12:35.000000000 +0200
@@ -7675,7 +7675,12 @@ read_common_block (struct die_info *die,
--- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 19:14:38.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 19:51:29.977252338 +0200
@@ -9746,7 +9746,12 @@ read_common_block (struct die_info *die,
{
struct attribute *attr;
struct symbol *sym;
@ -16,7 +16,7 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr)
@@ -7684,6 +7689,7 @@ read_common_block (struct die_info *die,
@@ -9755,6 +9760,7 @@ read_common_block (struct die_info *die,
if (attr_form_is_block (attr))
{
base = decode_locdesc (DW_BLOCK (attr), cu);
@ -24,7 +24,7 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
}
else if (attr_form_is_section_offset (attr))
{
@@ -7736,12 +7742,15 @@ read_common_block (struct die_info *die,
@@ -9807,12 +9813,15 @@ read_common_block (struct die_info *die,
if (sym != NULL
&& handle_data_member_location (child_die, cu, &offset))
{
@ -42,7 +42,7 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
else
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
@@ -7755,7 +7764,7 @@ read_common_block (struct die_info *die,
@@ -9826,7 +9835,7 @@ read_common_block (struct die_info *die,
sym = new_symbol (die, type, cu);
/* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
@ -51,35 +51,35 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
set_die_type (die, type, cu);
}
Index: gdb-7.2.90.20110525/gdb/gdbtypes.h
Index: gdb-7.4.50.20120602/gdb/gdbtypes.h
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/gdbtypes.h 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/gdbtypes.h 2011-05-25 17:11:10.000000000 +0200
@@ -396,6 +396,7 @@ enum type_instance_flag_value
enum field_loc_kind
--- gdb-7.4.50.20120602.orig/gdb/gdbtypes.h 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbtypes.h 2012-06-02 19:52:44.990230200 +0200
@@ -401,6 +401,7 @@ enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /* bitpos */
FIELD_LOC_KIND_ENUMVAL, /* enumval */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
FIELD_LOC_KIND_PHYSNAME /* physname */
};
@@ -580,6 +581,7 @@ struct main_type
FIELD_LOC_KIND_PHYSNAME, /* physname */
FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */
@@ -595,6 +596,7 @@ struct main_type
is the location (in the target) of the static field.
Otherwise, physname is the mangled label of the static field. */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
CORE_ADDR physaddr;
char *physname;
}
@@ -1106,6 +1108,7 @@ extern void allocate_gnat_aux_type (stru
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
const char *physname;
@@ -1200,6 +1202,7 @@ extern void allocate_gnat_aux_type (stru
#define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
#define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
@@ -1113,6 +1116,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1211,6 +1214,7 @@ extern void allocate_gnat_aux_type (stru
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
@ -87,19 +87,19 @@ Index: gdb-7.2.90.20110525/gdb/gdbtypes.h
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -1125,6 +1129,7 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
@@ -1227,6 +1231,7 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
Index: gdb-7.2.90.20110525/gdb/jv-lang.c
Index: gdb-7.4.50.20120602/gdb/jv-lang.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/jv-lang.c 2011-03-02 01:42:53.000000000 +0100
+++ gdb-7.2.90.20110525/gdb/jv-lang.c 2011-05-25 17:11:10.000000000 +0200
@@ -414,7 +414,8 @@ java_link_class_type (struct gdbarch *gd
--- gdb-7.4.50.20120602.orig/gdb/jv-lang.c 2012-05-10 21:59:12.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/jv-lang.c 2012-06-02 19:51:53.286245280 +0200
@@ -431,7 +431,8 @@ java_link_class_type (struct gdbarch *gd
fields = NULL;
nfields--; /* First set up dummy "class" field. */
@ -109,7 +109,7 @@ Index: gdb-7.2.90.20110525/gdb/jv-lang.c
TYPE_FIELD_NAME (type, nfields) = "class";
TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
SET_TYPE_FIELD_PRIVATE (type, nfields);
@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gd
@@ -479,7 +480,8 @@ java_link_class_type (struct gdbarch *gd
SET_TYPE_FIELD_PROTECTED (type, i);
}
if (accflags & 0x0008) /* ACC_STATIC */
@ -117,13 +117,13 @@ Index: gdb-7.2.90.20110525/gdb/jv-lang.c
+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset
+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
else
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
Index: gdb-7.2.90.20110525/gdb/value.c
Index: gdb-7.4.50.20120602/gdb/value.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/value.c 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/value.c 2011-05-25 17:11:10.000000000 +0200
@@ -2492,7 +2492,8 @@ value_static_field (struct type *type, i
--- gdb-7.4.50.20120602.orig/gdb/value.c 2012-06-02 19:11:55.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/value.c 2012-06-02 19:51:30.031252317 +0200
@@ -2592,7 +2592,8 @@ value_static_field (struct type *type, i
{
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,238 @@
http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html
Subject: [patch 3/3] attach-fail-reasons: SELinux deny_ptrace
Hi,
and here is the last bit for new SELinux 'deny_ptrace':
https://bugzilla.redhat.com/show_bug.cgi?id=786878
As even PTRACE_TRACEME fails in such case it needs to install hook for even
that event.
Thanks,
Jan
gdb/
2012-03-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include
selinux/selinux.h.
(linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings.
(linux_ptrace_create_warnings): New.
* common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check selinux/selinux.h and the selinux library.
* inf-ptrace.c (inf_ptrace_me): Check the ptrace result.
* linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap
to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings.
gdb/gdbserver/
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check selinux/selinux.h and the selinux library.
* linux-low.c (linux_traceme): New function.
(linux_create_inferior, linux_tracefork_child): Call it instead of
direct ptrace.
Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.c 2012-03-13 16:02:23.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.c 2012-06-02 20:37:53.933828570 +0200
@@ -27,6 +27,10 @@
#include "linux-procfs.h"
#include "buffer.h"
+#ifdef HAVE_SELINUX_SELINUX_H
+# include <selinux/selinux.h>
+#endif /* HAVE_SELINUX_SELINUX_H */
+
/* Find all possible reasons we could fail to attach PID and append these
newline terminated reason strings to initialized BUFFER. '\0' termination
of BUFFER must be done by the caller. */
@@ -46,4 +50,22 @@ linux_ptrace_attach_warnings (pid_t pid,
buffer_xml_printf (buffer, _("warning: process %d is a zombie "
"- the process has already terminated\n"),
(int) pid);
+
+ linux_ptrace_create_warnings (buffer);
+}
+
+/* Print all possible reasons we could fail to create a traced process. */
+
+void
+linux_ptrace_create_warnings (struct buffer *buffer)
+{
+#ifdef HAVE_LIBSELINUX
+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
+ forbidden. */
+ if (security_get_boolean_active ("deny_ptrace") == 1)
+ buffer_xml_printf (buffer,
+ _("the SELinux boolean 'deny_ptrace' is enabled, "
+ "you can disable this process attach protection by: "
+ "(gdb) shell sudo setsebool deny_ptrace=0"));
+#endif /* HAVE_LIBSELINUX */
}
Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.h
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.h 2012-03-13 16:02:23.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.h 2012-06-02 20:37:46.565831956 +0200
@@ -68,5 +68,6 @@ struct buffer;
#endif
extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
+extern void linux_ptrace_create_warnings (struct buffer *buffer);
#endif /* COMMON_LINUX_PTRACE_H */
Index: gdb-7.4.50.20120602/gdb/configure.ac
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/configure.ac 2012-06-02 20:05:08.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/configure.ac 2012-06-02 20:35:06.379798726 +0200
@@ -2002,6 +2002,10 @@ then
[Define if you support the personality syscall.])
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
Index: gdb-7.4.50.20120602/gdb/gdbserver/configure.ac
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure.ac 2012-04-19 21:34:51.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/configure.ac 2012-06-02 20:35:06.408797663 +0200
@@ -438,6 +438,10 @@ if $want_ipa ; then
fi
fi
+dnl Check security_get_boolean_active availability.
+AC_CHECK_HEADERS(selinux/selinux.h)
+AC_CHECK_LIB(selinux, security_get_boolean_active)
+
AC_SUBST(GDBSERVER_DEPFILES)
AC_SUBST(GDBSERVER_LIBS)
AC_SUBST(USE_THREAD_DB)
Index: gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/linux-low.c 2012-05-30 21:51:38.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c 2012-06-02 20:39:49.886785355 +0200
@@ -601,6 +601,28 @@ add_lwp (ptid_t ptid)
return lwp;
}
+/* Execute PTRACE_TRACEME with error checking. */
+
+static void
+linux_traceme (const char *program)
+{
+ int save_errno;
+ struct buffer buffer;
+
+ errno = 0;
+ if (ptrace (PTRACE_TRACEME, 0, NULL, NULL) == 0)
+ return;
+
+ save_errno = errno;
+ buffer_init (&buffer);
+ linux_ptrace_create_warnings (&buffer);
+ buffer_grow_str0 (&buffer, "");
+ fprintf (stderr, _("%sCannot trace created process %s: %s.\n"),
+ buffer_finish (&buffer), program, strerror (save_errno));
+ fflush (stderr);
+ _exit (0177);
+}
+
/* Start an inferior process and returns its pid.
ALLARGS is a vector of program-name and args. */
@@ -641,7 +663,7 @@ linux_create_inferior (char *program, ch
if (pid == 0)
{
- ptrace (PTRACE_TRACEME, 0, 0, 0);
+ linux_traceme (program);
#ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */
signal (__SIGRTMIN + 1, SIG_DFL);
@@ -4567,7 +4589,7 @@ linux_tracefork_grandchild (void *arg)
static int
linux_tracefork_child (void *arg)
{
- ptrace (PTRACE_TRACEME, 0, 0, 0);
+ linux_traceme ("PTRACE_O_TRACEFORK test");
kill (getpid (), SIGSTOP);
#if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
Index: gdb-7.4.50.20120602/gdb/inf-ptrace.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/inf-ptrace.c 2012-05-24 18:51:34.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/inf-ptrace.c 2012-06-02 20:35:06.428797311 +0200
@@ -105,7 +105,15 @@ static void
inf_ptrace_me (void)
{
/* "Trace me, Dr. Memory!" */
+ errno = 0;
ptrace (PT_TRACE_ME, 0, (PTRACE_TYPE_ARG3)0, 0);
+ if (errno != 0)
+ {
+ fprintf_unfiltered (gdb_stderr, _("Cannot create process: %s\n"),
+ safe_strerror (errno));
+ gdb_flush (gdb_stderr);
+ _exit (0177);
+ }
}
/* Start a new inferior Unix child process. EXEC_FILE is the file to
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 20:01:38.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 20:41:18.101751186 +0200
@@ -1572,6 +1572,7 @@ linux_nat_create_inferior (struct target
#ifdef HAVE_PERSONALITY
int personality_orig = 0, personality_set = 0;
#endif /* HAVE_PERSONALITY */
+ volatile struct gdb_exception ex;
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
@@ -1596,7 +1597,10 @@ linux_nat_create_inferior (struct target
/* Make sure we report all signals during startup. */
linux_nat_pass_signals (0, NULL);
- linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty);
+ }
#ifdef HAVE_PERSONALITY
if (personality_set)
@@ -1608,6 +1612,24 @@ linux_nat_create_inferior (struct target
safe_strerror (errno));
}
#endif /* HAVE_PERSONALITY */
+
+ if (ex.reason < 0)
+ {
+ struct buffer buffer;
+ char *message, *buffer_s;
+
+ message = xstrdup (ex.message);
+ make_cleanup (xfree, message);
+
+ buffer_init (&buffer);
+ linux_ptrace_create_warnings (&buffer);
+
+ buffer_grow_str0 (&buffer, "");
+ buffer_s = buffer_finish (&buffer);
+ make_cleanup (xfree, buffer_s);
+
+ throw_error (ex.error, "%s%s", buffer_s, message);
+ }
}
static void

View File

@ -0,0 +1,186 @@
Index: gdb-7.4.50.20120602/gdb/config.in
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/config.in 2012-06-02 21:49:26.147399232 +0200
+++ gdb-7.4.50.20120602/gdb/config.in 2012-06-02 21:49:27.206398845 +0200
@@ -222,6 +222,9 @@
/* Define if librpm library is being used. */
#undef HAVE_LIBRPM
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define to 1 if you have the <libunwind-ia64.h> header file. */
#undef HAVE_LIBUNWIND_IA64_H
@@ -363,6 +366,9 @@
/* Define to 1 if you have the `sbrk' function. */
#undef HAVE_SBRK
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
Index: gdb-7.4.50.20120602/gdb/configure
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/configure 2012-06-02 21:49:27.139398869 +0200
+++ gdb-7.4.50.20120602/gdb/configure 2012-06-02 21:49:50.890390179 +0200
@@ -12745,6 +12745,64 @@ $as_echo "#define HAVE_PERSONALITY 1" >>
fi
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
# except that the argument to --with-sysroot is optional.
Index: gdb-7.4.50.20120602/gdb/gdbserver/config.in
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/config.in 2012-04-19 21:34:51.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/config.in 2012-06-02 21:49:55.945388329 +0200
@@ -69,6 +69,9 @@
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
+/* Define to 1 if you have the `selinux' library (-lselinux). */
+#undef HAVE_LIBSELINUX
+
/* Define to 1 if you have the <linux/elf.h> header file. */
#undef HAVE_LINUX_ELF_H
@@ -130,6 +133,9 @@
/* Define to 1 if you have the `readlink' function. */
#undef HAVE_READLINK
+/* Define to 1 if you have the <selinux/selinux.h> header file. */
+#undef HAVE_SELINUX_SELINUX_H
+
/* Define to 1 if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
Index: gdb-7.4.50.20120602/gdb/gdbserver/configure
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure 2012-04-20 19:58:49.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/gdbserver/configure 2012-06-02 21:49:54.485388864 +0200
@@ -5532,6 +5532,64 @@ if $want_ipa ; then
fi
fi
+for ac_header in selinux/selinux.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
+if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SELINUX_SELINUX_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
+$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
+if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lselinux $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char security_get_boolean_active ();
+int
+main ()
+{
+return security_get_boolean_active ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_selinux_security_get_boolean_active=yes
+else
+ ac_cv_lib_selinux_security_get_boolean_active=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
+$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
+if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSELINUX 1
+_ACEOF
+
+ LIBS="-lselinux $LIBS"
+
+fi
+
+

View File

@ -68,7 +68,7 @@ Index: gdb-7.2.50.20101231/gdb/testsuite/gdb.fortran/omp-step.exp
+
+set testfile "omp-step"
+set srcfile ${testfile}.f90
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77 additional_flags=-fopenmp}] } {
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90 additional_flags=-fopenmp}] } {
+ return -1
+}
+

View File

@ -1,18 +1,20 @@
Index: gdb-7.2.50.20110117/gdb/config/i386/linux64.mh
Index: gdb-7.4.50.20120602/gdb/config/i386/linux64.mh
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/config/i386/linux64.mh 2010-05-28 20:50:31.000000000 +0200
+++ gdb-7.2.50.20110117/gdb/config/i386/linux64.mh 2011-01-17 16:01:48.000000000 +0100
@@ -2,7 +2,7 @@
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o linux-fork.o
--- gdb-7.4.50.20120602.orig/gdb/config/i386/linux64.mh 2012-03-13 16:00:34.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/config/i386/linux64.mh 2012-06-02 19:56:03.196172503 +0200
@@ -4,7 +4,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
linux-nat.o linux-osdata.o \
proc-service.o linux-thread-db.o linux-fork.o \
linux-procfs.o linux-ptrace.o
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux64.h
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
--- 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
Index: gdb-7.4.50.20120602/gdb/config/i386/linux.mh
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/config/i386/linux.mh 2012-03-13 16:00:33.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/config/i386/linux.mh 2012-06-02 19:55:42.418178412 +0200
@@ -1,6 +1,6 @@
# Host: Intel 386 running GNU/Linux.
@ -21,8 +23,10 @@ Index: gdb-7.2.50.20110117/gdb/config/i386/linux64.mh
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o i386-linux-nat.o \
proc-service.o linux-thread-db.o \
Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h
===================================================================
--- /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
+++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h 2012-06-02 19:55:42.433178408 +0200
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux i386.
+
@ -52,10 +56,10 @@ Index: gdb-7.2.50.20110117/gdb/config/i386/linux64.mh
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
Index: gdb-7.2.50.20110117/gdb/config/i386/nm-linux64.h
Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110117/gdb/config/i386/nm-linux64.h 2011-01-17 16:01:48.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h 2012-06-02 19:55:42.434178407 +0200
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux amd64.
+
@ -85,11 +89,11 @@ Index: gdb-7.2.50.20110117/gdb/config/i386/nm-linux64.h
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
Index: gdb-7.2.50.20110117/gdb/target.h
Index: gdb-7.4.50.20120602/gdb/target.h
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/target.h 2011-01-14 14:47:15.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/target.h 2011-01-17 16:02:08.000000000 +0100
@@ -1318,8 +1318,10 @@ extern char *normal_pid_to_str (ptid_t p
--- gdb-7.4.50.20120602.orig/gdb/target.h 2012-06-01 18:37:59.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/target.h 2012-06-02 19:55:42.436178407 +0200
@@ -1470,8 +1470,10 @@ extern char *target_thread_name (struct
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
@ -100,10 +104,10 @@ Index: gdb-7.2.50.20110117/gdb/target.h
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */
Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2011-01-17 16:01:48.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2012-06-02 19:55:42.442178406 +0200
@@ -0,0 +1,40 @@
+# Copyright 2009, 2010 Free Software Foundation, Inc.
+

View File

@ -1,43 +0,0 @@
2010-06-01 Chris Moller <cmoller@redhat.com>
* python/libstdcxx/v6/printers.py (StdVectorPrinter): Add
detection for matrices as nested vectors.
Index: libstdc++-v3/python/libstdcxx/v6/printers.py
===================================================================
--- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (revision 159937)
+++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (working copy)
@@ -19,6 +19,9 @@
import itertools
import re
+vector_sig = 'std::vector'
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
+
class StdPointerPrinter:
"Print a smart pointer of some kind"
@@ -186,7 +189,13 @@
% (self.typename, int (finish - start), int (end - start)))
def display_hint(self):
- return 'array'
+ itype0 = self.val.type.template_argument(0)
+ itag = itype0.tag
+ if itag and re.match(vector_regex, itag):
+ rc = 'matrix'
+ else:
+ rc = 'array'
+ return rc
class StdVectorIteratorPrinter:
"Print std::vector::iterator"
@@ -692,7 +701,7 @@
pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
- pretty_printers_dict[re.compile('^std::vector<.*>$')] = lambda val: StdVectorPrinter("std::vector", val)
+ pretty_printers_dict[vector_regex] = lambda val: StdVectorPrinter(vector_sig, val)
# vector<bool>
# Printer registrations for classes compiled with -D_GLIBCXX_DEBUG.

View File

@ -1,398 +0,0 @@
2010-05-31 Chris Moller <cmoller@redhat.com>
* python/py-prettyprint.c (print_children): Add formatting for
matrices. (apply_val_pretty_printer): Detect and deal with matrix
hints.
2010-05-31 Chris Moller <cmoller@redhat.com>
* gdb.python/Makefile.in (EXECUTABLES): Added pr10659.
* gdb.python/pr10659.cc: New file.
* gdb.python/pr10659.exp. New file.
* gdb.python/pr10659.py: New file.
Index: gdb-7.2.50.20110218/gdb/valprint.h
===================================================================
--- gdb-7.2.50.20110218.orig/gdb/valprint.h 2011-02-14 12:35:45.000000000 +0100
+++ gdb-7.2.50.20110218/gdb/valprint.h 2011-02-18 10:44:32.000000000 +0100
@@ -90,6 +90,9 @@ struct value_print_options
/* If nonzero, print the value in "summary" form. */
int summary;
+
+ /* Affects pretty printing of matrices. */
+ int prettyprint_matrix;
};
/* The global print options set by the user. In general this should
Index: gdb-7.2.50.20110218/gdb/python/py-prettyprint.c
===================================================================
--- gdb-7.2.50.20110218.orig/gdb/python/py-prettyprint.c 2011-02-14 12:10:53.000000000 +0100
+++ gdb-7.2.50.20110218/gdb/python/py-prettyprint.c 2011-02-18 10:45:02.000000000 +0100
@@ -501,7 +501,7 @@ print_children (PyObject *printer, const
/* Use the prettyprint_arrays option if we are printing an array,
and the pretty option otherwise. */
- if (is_array)
+ if (is_array || options->prettyprint_matrix)
pretty = options->prettyprint_arrays;
else
{
@@ -521,6 +521,9 @@ print_children (PyObject *printer, const
goto done;
}
make_cleanup_py_decref (frame);
+
+ if (options->prettyprint_matrix && recurse == 0)
+ fputs_filtered ("\n", stream);
done_flag = 0;
for (i = 0; i < options->print_max; ++i)
@@ -555,12 +558,23 @@ print_children (PyObject *printer, const
3. Other. Always print a ",". */
if (i == 0)
{
- if (is_py_none)
- fputs_filtered ("{", stream);
- else
- fputs_filtered (" = {", stream);
+ if (options->prettyprint_matrix && recurse == 0)
+ print_spaces_filtered (2 + 2 * recurse, stream);
+ if (is_py_none)
+ {
+ if (options->prettyprint_matrix && strcmp (hint, "array"))
+ {
+ fputs_filtered ("{\n", stream);
+ print_spaces_filtered (4 + 2 * recurse, stream);
+ }
+ else
+ fputs_filtered ("{", stream);
+ }
+ else
+ fputs_filtered (" = {", stream);
}
-
+ else if (options->prettyprint_matrix)
+ print_spaces_filtered (4 + 2 * recurse, stream);
else if (! is_map || i % 2 == 0)
fputs_filtered (pretty ? "," : ", ", stream);
@@ -589,6 +603,10 @@ print_children (PyObject *printer, const
if (is_map && i % 2 == 0)
fputs_filtered ("[", stream);
+ else if (options->prettyprint_matrix)
+ {
+ /* Force a do-nothing. */
+ }
else if (is_array)
{
/* We print the index, not whatever the child method
@@ -667,7 +685,12 @@ print_children (PyObject *printer, const
fputs_filtered ("\n", stream);
print_spaces_filtered (2 * recurse, stream);
}
- fputs_filtered ("}", stream);
+ if (options->prettyprint_matrix)
+ {
+ print_spaces_filtered (4 * recurse, stream);
+ fputs_filtered ("}\n", stream);
+ }
+ else fputs_filtered ("}", stream);
}
done:
@@ -689,6 +712,7 @@ apply_val_pretty_printer (struct type *t
char *hint = NULL;
struct cleanup *cleanups;
int result = 0;
+ struct value_print_options *options_copy;
enum string_repr_result print_result;
/* No pretty-printer support for unavailable values. */
@@ -726,9 +750,21 @@ apply_val_pretty_printer (struct type *t
/* If we are printing a map, we want some special formatting. */
hint = gdbpy_get_display_hint (printer);
+
+ if (recurse == 0)
+ {
+ options_copy = alloca (sizeof (struct value_print_options));
+ memcpy (options_copy, options, sizeof (struct value_print_options));
+ options_copy->prettyprint_matrix = hint && !strcmp (hint, "matrix");
+ }
+ else options_copy = (struct value_print_options *)options;
+
make_cleanup (free_current_contents, &hint);
/* Print the section */
+ if (options_copy->prettyprint_matrix)
+ print_result = string_repr_none;
+else /* Red Hat 2D matrix patch */
print_result = print_string_repr (printer, hint, stream, recurse,
options, language, gdbarch);
if (print_result != string_repr_error)
Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.cc
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.cc 2011-02-18 10:44:32.000000000 +0100
@@ -0,0 +1,43 @@
+#include <list>
+#include <vector> // /usr/include/c++/4.4.1/bits/vector.tcc
+#include <iostream>
+
+using namespace std;
+
+int use_windows = 9999;
+
+int
+main(){
+ vector<int> test1(2,0);
+ test1[0]=8;
+ test1[1]=9;
+
+ vector< vector<int> > test2(3, vector<int>(2,0));
+ test2[0][0]=0;
+ test2[0][1]=1;
+ test2[1][0]=2;
+ test2[1][1]=3;
+ test2[2][0]=4;
+ test2[2][1]=5;
+
+#define NR_ROWS 2
+#define NR_COLS 3
+#define NR_PLANES 4
+ vector<int> rows(NR_ROWS, 0);
+ vector< vector<int> > columns(NR_COLS, rows);
+ vector< vector < vector<int> > > test3(NR_PLANES, columns);
+
+ cout << "rows.size() = " << rows.size()
+ << ", columns.size() = " << columns.size()
+ << ", test3.size() = " << test3.size() << "\n";
+
+ for (int i = 0; i < rows.size(); i++) {
+ for (int j = 0; j < columns.size(); j++) {
+ for (int k = 0; k < test3.size(); k++) {
+ test3[k][j][i] = k * 100 + j * 10 + i;
+ }
+ }
+ }
+
+ return 0; // break
+}
Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.exp 2011-02-18 10:44:32.000000000 +0100
@@ -0,0 +1,82 @@
+#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 nl "\[\r\n\]+"
+
+set testfile pr10659
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+ return -1
+}
+
+#if { [skip_python_tests] } { continue }
+
+gdb_test "python execfile(\"$srcdir/$subdir/pr10659.py\")" ""
+gdb_test "python gdb.pretty_printers = \[lookup_function\]" ""
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "break"]
+gdb_continue_to_breakpoint "break"
+
+gdb_test "p test1" "vector of length 2, capacity 2 =.*"
+
+gdb_test "p test2" "= $nl {$nl {.*"
+
+# Complete result is:
+#
+# (gdb) p test2
+# $2 =
+# {
+# {0 1 }
+# {2 3 }
+# {4 5 }
+# }
+
+
+gdb_test "p test3" "= $nl {$nl {$nl {.*"
+
+# Complete result is:
+#
+# (gdb) p test3
+# $3 =
+# {
+# {
+# {0 1 }
+# {10 11 }
+# {20 21 }
+# }
+# {
+# {100 101 }
+# {110 111 }
+# {120 121 }
+# }
+# {
+# {200 201 }
+# {210 211 }
+# {220 221 }
+# }
+# {
+# {300 301 }
+# {310 311 }
+# {320 321 }
+# }
+# }
+#
+
+
Index: gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.py
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110218/gdb/testsuite/gdb.python/pr10659.py 2011-02-18 10:44:32.000000000 +0100
@@ -0,0 +1,109 @@
+# Copyright (C) 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/>.
+
+import gdb
+import itertools
+import re
+
+vector_sig = 'std::vector'
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
+
+class FakeVectorPrinter:
+ "Print a std::vector"
+
+ class _iterator:
+ def __init__ (self, start, finish):
+ self.item = start
+ self.finish = finish
+ self.count = 0
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ if self.item == self.finish:
+ raise StopIteration
+ count = self.count
+ self.count = self.count + 1
+ elt = self.item.dereference()
+ self.item = self.item + 1
+ return ('[%d]' % count, elt)
+
+ def __init__(self, typename, val):
+ self.typename = typename
+ self.val = val
+
+ def children(self):
+ return self._iterator(self.val['_M_impl']['_M_start'],
+ self.val['_M_impl']['_M_finish'])
+
+ def to_string(self):
+ start = self.val['_M_impl']['_M_start']
+ finish = self.val['_M_impl']['_M_finish']
+ end = self.val['_M_impl']['_M_end_of_storage']
+ return ('std::vector of length %d, capacity %d'
+ % (int (finish - start), int (end - start)))
+
+ def display_hint(self):
+ itype0 = self.val.type.template_argument(0)
+ itag = itype0.tag
+ if itag and re.match(vector_regex, itag):
+ rc = 'matrix'
+ else:
+ rc = 'array'
+ return rc
+
+def register_libstdcxx_printers (obj):
+ "Register libstdc++ pretty-printers with objfile Obj."
+
+ if obj == None:
+ obj = gdb
+
+ obj.pretty_printers.append (lookup_function)
+
+def lookup_function (val):
+ "Look-up and return a pretty-printer that can print val."
+
+ # Get the type.
+ type = val.type;
+
+ # If it points to a reference, get the reference.
+ if type.code == gdb.TYPE_CODE_REF:
+ type = type.target ()
+
+ # Get the unqualified type, stripped of typedefs.
+ type = type.unqualified ().strip_typedefs ()
+
+ # Get the type name.
+ typename = type.tag
+ if typename == None:
+ return None
+
+ # Iterate over local dictionary of types to determine
+ # if a printer is registered for that type. Return an
+ # instantiation of the printer if found.
+ for function in fake_pretty_printers_dict:
+ if function.search (typename):
+ return fake_pretty_printers_dict[function] (val)
+
+ # Cannot find a pretty printer. Return None.
+ return None
+
+def build_libfakecxx_dictionary ():
+ fake_pretty_printers_dict[vector_regex] = lambda val: FakeVectorPrinter(vector_sig, val)
+
+fake_pretty_printers_dict = {}
+
+build_libfakecxx_dictionary ()
Index: gdb-7.2.50.20110218/gdb/valprint.c
===================================================================
--- gdb-7.2.50.20110218.orig/gdb/valprint.c 2011-02-18 10:44:16.000000000 +0100
+++ gdb-7.2.50.20110218/gdb/valprint.c 2011-02-18 10:44:32.000000000 +0100
@@ -85,7 +85,8 @@ struct value_print_options user_print_op
1, /* static_field_print */
1, /* pascal_static_field_print */
0, /* raw */
- 0 /* summary */
+ 0, /* summary */
+ 0 /* prettyprint_matrix */
};
/* Initialize *OPTS to be a copy of the user print options. */

View File

@ -46,24 +46,23 @@ gdb/
* utils.c (nomem): Change internal_error to error.
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1265,15 +1265,9 @@ void
nomem (long size)
Index: gdb-7.3.50.20110722/gdb/utils.c
===================================================================
--- gdb-7.3.50.20110722.orig/gdb/utils.c 2011-07-22 19:28:58.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/utils.c 2011-07-22 19:34:25.000000000 +0200
@@ -1219,13 +1219,11 @@ malloc_failure (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);
+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size);
}
else
- {
{
- internal_error (__FILE__, __LINE__, _("virtual memory exhausted."));
- }
+ error (_("virtual memory exhausted."));
+ error (_("virtual memory exhausted."));
}
}
/* The xmalloc() (libiberty.h) family of memory management routines.

View File

@ -78,11 +78,11 @@ gdb/testsuite/
* gdb.threads/sigstep-threads.exp: New file.
* gdb.threads/sigstep-threads.c: New file.
Index: gdb-7.2.50.20110117/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/linux-nat.c 2011-01-17 15:53:14.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/linux-nat.c 2011-01-17 16:05:57.000000000 +0100
@@ -2803,6 +2803,8 @@ stop_wait_callback (struct lwp_info *lp,
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 21:34:51.999517510 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 21:35:59.930491577 +0200
@@ -2856,6 +2856,8 @@ stop_wait_callback (struct lwp_info *lp,
{
int status;
@ -91,7 +91,7 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
status = wait_lwp (lp);
if (status == 0)
return 0;
@@ -2828,110 +2830,61 @@ stop_wait_callback (struct lwp_info *lp,
@@ -2881,110 +2883,61 @@ stop_wait_callback (struct lwp_info *lp,
if (WSTOPSIG (status) != SIGSTOP)
{
@ -146,9 +146,7 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
- status_to_str ((int) status));
- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
- }
+ /* Save the trap's siginfo in case we need it later. */
+ save_siginfo (lp);
-
- /* Save the sigtrap event. */
- lp->status = status;
- return 0;
@ -157,7 +155,8 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
- {
- /* The thread was stopped with a signal other than
- SIGSTOP, and didn't accidentally trip a breakpoint. */
+ save_sigtrap (lp);
+ /* Save the trap's siginfo in case we need it later. */
+ save_siginfo (lp);
- if (debug_linux_nat)
- {
@ -174,7 +173,8 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
- "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
- target_pid_to_str (lp->ptid),
- errno ? safe_strerror (errno) : "OK");
-
+ save_sigtrap (lp);
- /* Hold this event/waitstatus while we check to see if
- there are any more (we still want to get that SIGSTOP). */
- stop_wait_callback (lp, NULL);
@ -228,7 +228,7 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
+
+ registers_changed ();
+ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
+ 1, TARGET_SIGNAL_0);
+ 1, GDB_SIGNAL_0);
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "SWC: %s %s, 0, 0 (discard SIGSTOP)\n",
@ -248,11 +248,11 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
lp->signalled = 0;
}
}
@@ -3514,52 +3467,6 @@ retry:
@@ -3616,54 +3569,6 @@ retry:
lp = NULL;
}
- if (lp && lp->signalled)
- if (lp && lp->signalled && lp->last_resume_kind != resume_stop)
- {
- /* A pending SIGSTOP may interfere with the normal stream of
- events. In a typical case where interference is a problem,
@ -266,8 +266,10 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
- /* Resume the thread. It should halt immediately returning the
- pending SIGSTOP. */
- registers_changed ();
- if (linux_nat_prepare_to_resume != NULL)
- linux_nat_prepare_to_resume (lp);
- linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
- lp->step, TARGET_SIGNAL_0);
- lp->step, GDB_SIGNAL_0);
- if (debug_linux_nat)
- fprintf_unfiltered (gdb_stdlog,
- "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
@ -301,10 +303,10 @@ Index: gdb-7.2.50.20110117/gdb/linux-nat.c
if (!target_can_async_p ())
{
/* Causes SIGINT to be passed on to the attached process. */
Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.c 2011-01-17 16:02:40.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.c 2012-06-02 21:35:40.268499060 +0200
@@ -0,0 +1,447 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -753,10 +755,10 @@ Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.c
+
+ return EXIT_SUCCESS;
+}
Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.exp 2011-01-17 16:02:40.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.exp 2012-06-02 21:35:40.296499050 +0200
@@ -0,0 +1,94 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
@ -852,10 +854,10 @@ Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/siginfo-threads.exp
+}
+
+gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*"
Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.c
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.c 2011-01-17 16:02:40.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.c 2012-06-02 21:35:40.297499050 +0200
@@ -0,0 +1,54 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -911,10 +913,10 @@ Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.c
+ start (NULL); /* main-start */
+ return 0;
+}
Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.exp
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.threads/sigstep-threads.exp 2011-01-17 16:02:40.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.exp 2012-06-02 21:35:40.297499050 +0200
@@ -0,0 +1,74 @@
+# Copyright 2010 Free Software Foundation, Inc.
+

View File

@ -26,27 +26,27 @@ gdb/
(linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
* linux-nat.h (struct lwp_info) <siginfo>: Remove.
Index: gdb-7.2.50.20101116/gdb/linux-nat.c
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
===================================================================
--- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 09:12:26.000000000 +0100
+++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 09:13:21.000000000 +0100
@@ -1850,7 +1850,6 @@ resume_callback (struct lwp_info *lp, vo
target_pid_to_str (lp->ptid));
lp->stopped = 0;
lp->step = 0;
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
lp->stopped_by_watchpoint = 0;
}
else if (lp->stopped && debug_linux_nat)
@@ -1993,7 +1992,6 @@ linux_nat_resume (struct target_ops *ops
ptid = pid_to_ptid (GET_LWP (lp->ptid));
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 21:36:21.067483466 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 21:37:55.345447402 +0200
@@ -1929,7 +1929,6 @@ resume_lwp (struct lwp_info *lp, int ste
step, GDB_SIGNAL_0);
lp->stopped = 0;
lp->step = step;
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
lp->stopped_by_watchpoint = 0;
}
else
@@ -2071,7 +2070,6 @@ linux_nat_resume (struct target_ops *ops
if (linux_nat_prepare_to_resume != NULL)
linux_nat_prepare_to_resume (lp);
linux_ops->to_resume (linux_ops, ptid, step, signo);
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
lp->stopped_by_watchpoint = 0;
if (debug_linux_nat)
@@ -2503,22 +2501,6 @@ wait_lwp (struct lwp_info *lp)
@@ -2625,22 +2623,6 @@ wait_lwp (struct lwp_info *lp)
return status;
}
@ -69,7 +69,7 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c
/* Send a SIGSTOP to LP. */
static int
@@ -2787,9 +2769,6 @@ stop_wait_callback (struct lwp_info *lp,
@@ -2885,9 +2867,6 @@ stop_wait_callback (struct lwp_info *lp,
{
/* The thread was stopped with a signal other than SIGSTOP. */
@ -79,7 +79,7 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c
save_sigtrap (lp);
if (debug_linux_nat)
@@ -3155,12 +3134,7 @@ linux_nat_filter_event (int lwpid, int s
@@ -3291,12 +3270,7 @@ linux_nat_filter_event (int lwpid, int s
}
if (linux_nat_status_is_event (status))
@ -93,20 +93,20 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c
/* Check if the thread has exited. */
if ((WIFEXITED (status) || WIFSIGNALED (status))
@@ -3763,7 +3737,6 @@ resume_stopped_resumed_lwps (struct lwp_
@@ -3950,7 +3924,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->step, GDB_SIGNAL_0);
lp->stopped = 0;
- memset (&lp->siginfo, 0, sizeof (lp->siginfo));
lp->stopped_by_watchpoint = 0;
}
@@ -5932,11 +5905,19 @@ linux_nat_set_siginfo_fixup (struct targ
struct siginfo *
@@ -5227,11 +5200,19 @@ linux_nat_set_prepare_to_resume (struct
siginfo_t *
linux_nat_get_siginfo (ptid_t ptid)
{
- struct lwp_info *lp = find_lwp_pid (ptid);
+ static struct siginfo siginfo;
+ static siginfo_t siginfo;
+ int pid;
- gdb_assert (lp != NULL);
@ -124,17 +124,17 @@ Index: gdb-7.2.50.20101116/gdb/linux-nat.c
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.2.50.20101116/gdb/linux-nat.h
Index: gdb-7.4.50.20120602/gdb/linux-nat.h
===================================================================
--- gdb-7.2.50.20101116.orig/gdb/linux-nat.h 2010-11-16 07:54:36.000000000 +0100
+++ gdb-7.2.50.20101116/gdb/linux-nat.h 2010-11-16 09:12:44.000000000 +0100
@@ -58,10 +58,6 @@ struct lwp_info
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.h 2012-06-02 21:36:21.067483466 +0200
+++ gdb-7.4.50.20120602/gdb/linux-nat.h 2012-06-02 21:36:27.140481144 +0200
@@ -76,10 +76,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;
- siginfo_t siginfo;
-
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
watchpoint trap. */

View File

@ -1,5 +1,7 @@
Fix gdb.solib_address (fix by Phil Muldoon).
s/solib_address/solib_name/ during upstreaming.
--- /dev/null
+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp
@@ -0,0 +1,24 @@
@ -26,4 +28,4 @@ Fix gdb.solib_address (fix by Phil Muldoon).
+# 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"
+gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists"

View File

@ -1,84 +0,0 @@
[patch] Code cleanup: New SYMBOL_HASH_NEXT
http://sourceware.org/ml/gdb-patches/2011-04/msg00022.html
http://sourceware.org/ml/gdb-cvs/2011-04/msg00043.html
### src/gdb/ChangeLog 2011/04/06 03:24:22 1.12908
### src/gdb/ChangeLog 2011/04/06 19:50:03 1.12909
## -1,3 +1,12 @@
+2011-04-06 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup.
+ * dictionary.c (dict_hash): Use SYMBOL_HASH_NEXT.
+ * dwarf2read.c (mapped_index_string_hash): Refer to SYMBOL_HASH_NEXT
+ in the function comment, a new note on values compatibility.
+ * minsyms.c (msymbol_hash_iw, msymbol_hash): Use SYMBOL_HASH_NEXT.
+ * symtab.h (SYMBOL_HASH_NEXT): New.
+
2011-04-06 Thiago Jung Bauermann <bauerman@br.ibm.com>
* ppc-linux-nat.c (check_condition): Add len output parameter.
--- src/gdb/dictionary.c 2011/01/07 19:36:15 1.21
+++ src/gdb/dictionary.c 2011/04/06 19:50:04 1.22
@@ -826,7 +826,7 @@
}
/* FALL THROUGH */
default:
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
string += 1;
break;
}
--- src/gdb/dwarf2read.c 2011/04/04 14:10:12 1.520
+++ src/gdb/dwarf2read.c 2011/04/06 19:50:04 1.521
@@ -1962,11 +1962,11 @@
do_cleanups (cleanup);
}
-/* The hash function for strings in the mapped index. This is the
- same as the hashtab.c hash function, but we keep a separate copy to
- maintain control over the implementation. This is necessary
- because the hash function is tied to the format of the mapped index
- file. */
+/* The hash function for strings in the mapped index. This is the same as
+ SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
+ implementation. This is necessary because the hash function is tied to the
+ format of the mapped index file. The hash values do not have to match with
+ SYMBOL_HASH_NEXT. */
static hashval_t
mapped_index_string_hash (const void *p)
--- src/gdb/minsyms.c 2011/03/28 20:29:51 1.81
+++ src/gdb/minsyms.c 2011/04/06 19:50:05 1.82
@@ -91,7 +91,7 @@
++string;
if (*string && *string != '(')
{
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
++string;
}
}
@@ -106,7 +106,7 @@
unsigned int hash = 0;
for (; *string; ++string)
- hash = hash * 67 + *string - 113;
+ hash = SYMBOL_HASH_NEXT (hash, *string);
return hash;
}
--- src/gdb/symtab.h 2011/04/04 15:19:59 1.177
+++ src/gdb/symtab.h 2011/04/06 19:50:05 1.178
@@ -1004,6 +1004,12 @@
extern unsigned int msymbol_hash (const char *);
+/* Compute the next hash value from previous HASH and the character C. This
+ is only a GDB in-memory computed value with no external files compatibility
+ requirements. */
+
+#define SYMBOL_HASH_NEXT(hash, c) ((hash) * 67 + (c) - 113)
+
extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);
extern void

View File

@ -1,139 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-04/msg00124.html
Subject: [patch 1/3] case insensitive: Reformat code
Hi,
just some reformatting to make the later patch more clear. There should be no
functionality difference by this patch. c1+c2 are a bit ugly but I found any
other solution a bit ugly.
Thanks,
Jan
gdb/
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
Format the code for the next patch.
* dwarf2read.c (struct mapped_index): Include delimiting newlines.
* utils.c (strcmp_iw_ordered): Reformat the code for the next patch.
New variables c1 and c2.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -150,14 +150,19 @@ struct mapped_index
{
/* The total length of the buffer. */
off_t total_size;
+
/* A pointer to the address table data. */
const gdb_byte *address_table;
+
/* Size of the address table data in bytes. */
offset_type address_table_size;
+
/* The symbol table, implemented as a hash table. */
const offset_type *symbol_table;
+
/* Size in slots, each slot is 2 offset_types. */
offset_type symbol_table_slots;
+
/* A pointer to the constant pool. */
const char *constant_pool;
};
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -3023,48 +3023,55 @@ strcmp_iw (const char *string1, const char *string2)
int
strcmp_iw_ordered (const char *string1, const char *string2)
{
- while ((*string1 != '\0') && (*string2 != '\0'))
+ /* Formatting stub. */
+ if (1)
{
- while (isspace (*string1))
- {
- string1++;
- }
- while (isspace (*string2))
- {
- string2++;
- }
- if (*string1 != *string2)
+ /* C1 and C2 are valid only if *string1 != '\0' && *string2 != '\0'.
+ Provide stub characters if we are already at the end of one of the
+ strings. */
+ char c1 = 'X', c2 = 'X';
+
+ while (*string1 != '\0' && *string2 != '\0')
{
- break;
+ while (isspace (*string1))
+ string1++;
+ while (isspace (*string2))
+ string2++;
+
+ c1 = *string1;
+ c2 = *string2;
+ if (c1 != c2)
+ break;
+
+ if (*string1 != '\0')
+ {
+ string1++;
+ string2++;
+ }
}
- if (*string1 != '\0')
+
+ switch (*string1)
{
- string1++;
- string2++;
+ /* Characters are non-equal unless they're both '\0'; we want to
+ make sure we get the comparison right according to our
+ comparison in the cases where one of them is '\0' or '('. */
+ case '\0':
+ if (*string2 == '\0')
+ return 0;
+ else
+ return -1;
+ case '(':
+ if (*string2 == '\0')
+ return 1;
+ else
+ return -1;
+ default:
+ if (*string2 == '\0' || *string2 == '(')
+ return 1;
+ else
+ return c1 - c2;
}
}
-
- switch (*string1)
- {
- /* Characters are non-equal unless they're both '\0'; we want to
- make sure we get the comparison right according to our
- comparison in the cases where one of them is '\0' or '('. */
- case '\0':
- if (*string2 == '\0')
- return 0;
- else
- return -1;
- case '(':
- if (*string2 == '\0')
- return 1;
- else
- return -1;
- default:
- if (*string2 == '(')
- return 1;
- else
- return *string1 - *string2;
- }
}
/* A simple comparison function with opposite semantics to strcmp. */

View File

@ -1,188 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-04/msg00125.html
Subject: [patch 2/3] case insensitive: re_comp->regcomp
Hi,
re_comp cannot be passed REG_ICASE. Therefore change the code. The should
have no functionality impact.
The new boolean field `preg_p' could be maybe replaced by a conditional
`preg.buffer != NULL' which would work with libiberty regcomp implementation
but I do not see it guaranteed anywhere. GDB is always using static libiberty
implementation which I do not see why in the case it is running on glibc.
But if it gets fixed one day and it starts to use externally linked
regcomp/regexec I would find the `preg.buffer != NULL' conditional dangerous.
Thanks,
Jan
gdb/
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
Replace re_comp/re_exec by regcomp/regexec.
* symtab.c (struct search_symbols_data): New fields preg, preg_p.
(search_symbols_name_matches): Use them, use regexec.
(search_symbols): New variable retval_chain, adjust the use of
old_chain against it. Replace re_comp by regcomp. Use the new struct
search_symbols_data fields, use regexec instead of re_exec.
Index: gdb-7.2.90.20110429/gdb/symtab.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/symtab.c 2011-04-29 09:43:33.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/symtab.c 2011-04-29 09:43:55.000000000 +0200
@@ -2958,7 +2958,10 @@ struct search_symbols_data
{
int nfiles;
char **files;
- char *regexp;
+
+ /* It is true if PREG contains valid data, false otherwise. */
+ unsigned preg_p : 1;
+ regex_t preg;
};
/* A callback for expand_symtabs_matching. */
@@ -2976,7 +2979,7 @@ search_symbols_name_matches (const char
{
struct search_symbols_data *data = user_data;
- return data->regexp == NULL || re_exec (symname);
+ return !data->preg_p || regexec (&data->preg, symname, 0, NULL, 0) == 0;
}
/* Search the symbol table for matches to the regular expression REGEXP,
@@ -3023,9 +3026,13 @@ search_symbols (char *regexp, domain_enu
struct symbol_search *sr;
struct symbol_search *psr;
struct symbol_search *tail;
- struct cleanup *old_chain = NULL;
struct search_symbols_data datum;
+ /* OLD_CHAIN .. RETVAL_CHAIN is always freed, RETVAL_CHAIN .. current
+ CLEANUP_CHAIN is freed only in the case of an error. */
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+ struct cleanup *retval_chain;
+
if (kind < VARIABLES_DOMAIN || kind >= ALL_DOMAIN)
error (_("must search on specific domain"));
@@ -3036,6 +3043,7 @@ search_symbols (char *regexp, domain_enu
sr = *matches = NULL;
tail = NULL;
+ datum.preg_p = 0;
if (regexp != NULL)
{
@@ -3045,6 +3053,7 @@ search_symbols (char *regexp, domain_enu
and <TYPENAME> or <OPERATOR>. */
char *opend;
char *opname = operator_chars (regexp, &opend);
+ int errcode;
if (*opname)
{
@@ -3073,8 +3082,16 @@ search_symbols (char *regexp, domain_enu
}
}
- if (0 != (val = re_comp (regexp)))
- error (_("Invalid regexp (%s): %s"), val, regexp);
+ errcode = regcomp (&datum.preg, regexp, REG_NOSUB);
+ if (errcode != 0)
+ {
+ char *err = get_regcomp_error (errcode, &datum.preg);
+
+ make_cleanup (xfree, err);
+ error (_("Invalid regexp (%s): %s"), err, regexp);
+ }
+ datum.preg_p = 1;
+ make_regfree_cleanup (&datum.preg);
}
/* Search through the partial symtabs *first* for all symbols
@@ -3083,7 +3100,6 @@ search_symbols (char *regexp, domain_enu
datum.nfiles = nfiles;
datum.files = files;
- datum.regexp = regexp;
ALL_OBJFILES (objfile)
{
if (objfile->sf)
@@ -3094,6 +3110,8 @@ search_symbols (char *regexp, domain_enu
&datum);
}
+ retval_chain = old_chain;
+
/* Here, we search through the minimal symbol tables for functions
and variables that match, and force their symbols to be read.
This is in particular necessary for demangled variable names,
@@ -3117,8 +3135,9 @@ search_symbols (char *regexp, domain_enu
MSYMBOL_TYPE (msymbol) == ourtype3 ||
MSYMBOL_TYPE (msymbol) == ourtype4)
{
- if (regexp == NULL
- || re_exec (SYMBOL_NATURAL_NAME (msymbol)) != 0)
+ if (!datum.preg_p
+ || regexec (&datum.preg, SYMBOL_NATURAL_NAME (msymbol), 0,
+ NULL, 0) == 0)
{
if (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol)))
{
@@ -3156,8 +3175,9 @@ search_symbols (char *regexp, domain_enu
QUIT;
if (file_matches (real_symtab->filename, files, nfiles)
- && ((regexp == NULL
- || re_exec (SYMBOL_NATURAL_NAME (sym)) != 0)
+ && ((!datum.preg_p
+ || regexec (&datum.preg, SYMBOL_NATURAL_NAME (sym), 0,
+ NULL, 0) == 0)
&& ((kind == VARIABLES_DOMAIN
&& SYMBOL_CLASS (sym) != LOC_TYPEDEF
&& SYMBOL_CLASS (sym) != LOC_UNRESOLVED
@@ -3199,7 +3219,7 @@ search_symbols (char *regexp, domain_enu
tail = sort_search_symbols (&dummy, nfound);
sr = dummy.next;
- old_chain = make_cleanup_free_search_symbols (sr);
+ make_cleanup_free_search_symbols (sr);
}
else
tail = sort_search_symbols (prevtail, nfound);
@@ -3221,8 +3241,9 @@ search_symbols (char *regexp, domain_enu
MSYMBOL_TYPE (msymbol) == ourtype3 ||
MSYMBOL_TYPE (msymbol) == ourtype4)
{
- if (regexp == NULL
- || re_exec (SYMBOL_NATURAL_NAME (msymbol)) != 0)
+ if (!datum.preg_p
+ || regexec (&datum.preg, SYMBOL_NATURAL_NAME (msymbol), 0,
+ NULL, 0) == 0)
{
/* Functions: Look up by address. */
if (kind != FUNCTIONS_DOMAIN ||
@@ -3244,7 +3265,7 @@ search_symbols (char *regexp, domain_enu
if (tail == NULL)
{
sr = psr;
- old_chain = make_cleanup_free_search_symbols (sr);
+ make_cleanup_free_search_symbols (sr);
}
else
tail->next = psr;
@@ -3256,9 +3277,9 @@ search_symbols (char *regexp, domain_enu
}
}
+ discard_cleanups (retval_chain);
+ do_cleanups (old_chain);
*matches = sr;
- if (sr != NULL)
- discard_cleanups (old_chain);
}
/* Helper function for symtab_symbol_info, this function uses

View File

@ -1,669 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-04/msg00418.html
Subject: Re: [patch 3/3] case insensitive: the fix [rediff]
On Fri, 22 Apr 2011 21:05:07 +0200, Eli Zaretskii wrote:
> This @table will look weird in the manual: it produces lines that
> begin with a lower-case letter. Perhaps reorder thusly:
OK, thanks for the review.
Regards,
Jan
gdb/doc/
2011-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Index Section Format): Change the version to 5.
Describe the different formula.
gdb/
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c: Include ctype.h.
(struct mapped_index): New field version.
(mapped_index_string_hash): New parameter index_version. New comment
for it. Call tolower appropriately.
(find_slot_in_mapped_hash): New variable cmp, initialize it, use it.
Choose the right index version for mapped_index_string_hash.
(dwarf2_read_index): Support also the index version 5. Initialize the
new struct mapped_index field version.
(hash_strtab_entry): Pass INT_MAX for the new parameter, explain why.
(find_slot): Explain the version needs. Pass INT_MAX for the new
parameter.
(write_psymtabs_to_index): Produce version 5.
* minsyms.c (lookup_minimal_symbol): New variable cmp, initialize it,
use it. New comment for SYMBOL_MATCHES_SEARCH_NAME.
* psymtab.c (lookup_partial_symbol): Find the
SYMBOL_MATCHES_SEARCH_NAME start of the found block of matching
entries.
* symtab.c (lookup_symbol_in_language): Remove the case_sensitive_off
NAME lowercasing.
(search_symbols): Pass REG_ICASE to regcomp for case_sensitive_off.
(completion_list_add_name): New variable ncmp, initialize it, use it.
* symtab.h (SYMBOL_HASH_NEXT): Always call tolower.
* utils.c (strcmp_iw): Support case_sensitive_off.
(strcmp_iw_ordered): Sort in a way compatible with case_sensitive_off.
New function comment part. New variables saved_string1,
saved_string2 and case_pass. Add a proper second pass.
gdb/testsuite/
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/fortran-sym-case.c: New file.
* gdb.base/fortran-sym-case.exp: New file.
* gdb.dwarf2/dw2-case-insensitive-debug.S: New file.
* gdb.dwarf2/dw2-case-insensitive.c: New file.
* gdb.dwarf2/dw2-case-insensitive.exp: New file.
Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/dwarf2read.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/dwarf2read.c 2011-05-25 19:12:33.000000000 +0200
@@ -152,6 +152,9 @@ DEF_VEC_I (offset_type);
a comment by the code that writes the index. */
struct mapped_index
{
+ /* Index data format version. */
+ int version;
+
/* The total length of the buffer. */
off_t total_size;
@@ -1997,17 +2000,23 @@ create_addrmap_from_index (struct objfil
SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
implementation. This is necessary because the hash function is tied to the
format of the mapped index file. The hash values do not have to match with
- SYMBOL_HASH_NEXT. */
+ SYMBOL_HASH_NEXT.
+
+ Use INT_MAX for INDEX_VERSION if you generate the current index format. */
static hashval_t
-mapped_index_string_hash (const void *p)
+mapped_index_string_hash (int index_version, const void *p)
{
const unsigned char *str = (const unsigned char *) p;
hashval_t r = 0;
unsigned char c;
while ((c = *str++) != 0)
- r = r * 67 + c - 113;
+ {
+ if (index_version >= 5)
+ c = tolower (c);
+ r = r * 67 + c - 113;
+ }
return r;
}
@@ -2023,6 +2032,7 @@ find_slot_in_mapped_hash (struct mapped_
struct cleanup *back_to = make_cleanup (null_cleanup, 0);
offset_type hash;
offset_type slot, step;
+ int (*cmp) (const char *, const char *);
if (current_language->la_language == language_cplus
|| current_language->la_language == language_java
@@ -2045,9 +2055,16 @@ find_slot_in_mapped_hash (struct mapped_
}
}
- hash = mapped_index_string_hash (name);
+ /* Index version 4 did not support case insensitive searches. But the
+ indexes for case insensitive languages are built in lowercase, therefore
+ simulate our NAME being searched is also lowercased. */
+ hash = mapped_index_string_hash ((index->version == 4
+ && case_sensitivity == case_sensitive_off
+ ? 5 : index->version),
+ name);
slot = hash & (index->symbol_table_slots - 1);
step = ((hash * 17) & (index->symbol_table_slots - 1)) | 1;
+ cmp = (case_sensitivity == case_sensitive_on ? strcmp : strcasecmp);
for (;;)
{
@@ -2061,7 +2078,7 @@ find_slot_in_mapped_hash (struct mapped_
}
str = index->constant_pool + MAYBE_SWAP (index->symbol_table[i]);
- if (!strcmp (name, str))
+ if (!cmp (name, str))
{
*vec_out = (offset_type *) (index->constant_pool
+ MAYBE_SWAP (index->symbol_table[i + 1]));
@@ -2105,15 +2122,17 @@ dwarf2_read_index (struct objfile *objfi
/* Versions earlier than 3 emitted every copy of a psymbol. This
causes the index to behave very poorly for certain requests. Version 3
contained incomplete addrmap. So, it seems better to just ignore such
- indices. */
+ indices. Index version 4 uses a different hash function than index
+ version 5 and later. */
if (version < 4)
return 0;
/* Indexes with higher version than the one supported by GDB may be no
longer backward compatible. */
- if (version > 4)
+ if (version > 5)
return 0;
map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
+ map->version = version;
map->total_size = dwarf2_per_objfile->gdb_index.size;
metadata = (offset_type *) (addr + sizeof (offset_type));
@@ -15692,13 +15711,16 @@ struct strtab_entry
const char *str;
};
-/* Hash function for a strtab_entry. */
+/* Hash function for a strtab_entry.
+
+ Function is used only during write_hash_table so no index format backward
+ compatibility is needed. */
static hashval_t
hash_strtab_entry (const void *e)
{
const struct strtab_entry *entry = e;
- return mapped_index_string_hash (entry->str);
+ return mapped_index_string_hash (INT_MAX, entry->str);
}
/* Equality function for a strtab_entry. */
@@ -15836,12 +15858,15 @@ cleanup_mapped_symtab (void *p)
}
/* Find a slot in SYMTAB for the symbol NAME. Returns a pointer to
- the slot. */
+ the slot.
+
+ Function is used only during write_hash_table so no index format backward
+ compatibility is needed. */
static struct symtab_index_entry **
find_slot (struct mapped_symtab *symtab, const char *name)
{
- offset_type index, step, hash = mapped_index_string_hash (name);
+ offset_type index, step, hash = mapped_index_string_hash (INT_MAX, name);
index = hash & (symtab->size - 1);
step = ((hash * 17) & (symtab->size - 1)) | 1;
@@ -16369,7 +16394,7 @@ write_psymtabs_to_index (struct objfile
total_len = size_of_contents;
/* The version number. */
- val = MAYBE_SWAP (4);
+ val = MAYBE_SWAP (5);
obstack_grow (&contents, &val, sizeof (val));
/* The offset of the CU list from the start of the file. */
Index: gdb-7.2.90.20110525/gdb/minsyms.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/minsyms.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/minsyms.c 2011-05-25 17:13:13.000000000 +0200
@@ -239,11 +239,16 @@ lookup_minimal_symbol (const char *name,
if (pass == 1)
{
- match = strcmp (SYMBOL_LINKAGE_NAME (msymbol),
- modified_name) == 0;
+ int (*cmp) (const char *, const char *);
+
+ cmp = (case_sensitivity == case_sensitive_on
+ ? strcmp : strcasecmp);
+ match = cmp (SYMBOL_LINKAGE_NAME (msymbol),
+ modified_name) == 0;
}
else
{
+ /* The function respects CASE_SENSITIVITY. */
match = SYMBOL_MATCHES_SEARCH_NAME (msymbol,
modified_name);
}
Index: gdb-7.2.90.20110525/gdb/psymtab.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/psymtab.c 2011-04-20 22:10:29.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/psymtab.c 2011-05-25 17:13:13.000000000 +0200
@@ -690,8 +690,15 @@ lookup_partial_symbol (struct partial_sy
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
- while (top <= real_top
- && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name))
+ /* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
+ search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
+ while (top >= start && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name))
+ top--;
+
+ /* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */
+ top++;
+
+ while (top <= real_top && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name))
{
if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
SYMBOL_DOMAIN (*top), domain))
Index: gdb-7.2.90.20110525/gdb/symtab.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/symtab.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/symtab.c 2011-05-25 17:13:49.000000000 +0200
@@ -1062,19 +1062,6 @@ lookup_symbol_in_language (const char *n
}
}
- if (case_sensitivity == case_sensitive_off)
- {
- char *copy;
- int len, i;
-
- len = strlen (name);
- copy = (char *) alloca (len + 1);
- for (i= 0; i < len; i++)
- copy[i] = tolower (name[i]);
- copy[len] = 0;
- modified_name = copy;
- }
-
returnval = lookup_symbol_aux (modified_name, block, domain, lang,
is_a_field_of_this);
do_cleanups (cleanup);
@@ -3106,7 +3093,9 @@ search_symbols (char *regexp, domain_enu
}
}
- errcode = regcomp (&datum.preg, regexp, REG_NOSUB);
+ errcode = regcomp (&datum.preg, regexp,
+ REG_NOSUB | (case_sensitivity == case_sensitive_off
+ ? REG_ICASE : 0));
if (errcode != 0)
{
char *err = get_regcomp_error (errcode, &datum.preg);
@@ -3546,7 +3535,11 @@ rbreak_command (char *regexp, int from_t
static int
compare_symbol_name (const char *name, const char *sym_text, int sym_text_len)
{
- if (strncmp (name, sym_text, sym_text_len) != 0)
+ int (*ncmp) (const char *, const char *, size_t);
+
+ ncmp = (case_sensitivity == case_sensitive_on ? strncmp : strncasecmp);
+
+ if (ncmp (name, sym_text, sym_text_len) != 0)
return 0;
if (sym_text[sym_text_len] == '(')
Index: gdb-7.2.90.20110525/gdb/symtab.h
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/symtab.h 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/symtab.h 2011-05-25 17:13:13.000000000 +0200
@@ -1036,7 +1036,8 @@ extern unsigned int msymbol_hash (const
is only a GDB in-memory computed value with no external files compatibility
requirements. */
-#define SYMBOL_HASH_NEXT(hash, c) ((hash) * 67 + (c) - 113)
+#define SYMBOL_HASH_NEXT(hash, c) \
+ ((hash) * 67 + tolower ((unsigned char) (c)) - 113)
extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.c 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,22 @@
+/* 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/>. */
+
+int
+main (int argc, char **aRGv)
+{
+ return 0;
+}
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.exp 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,27 @@
+# Copyright (C) 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/>.
+
+set testfile fortran-sym-case
+if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_test "set language fortran" {Warning: the current language does not match this frame\.}
+
+gdb_test "frame" ", aRGv=.*"
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,102 @@
+/* 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/>. */
+
+ .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 */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 8 /* DW_AT_language (DW_LANG_Fortran90) */
+ .4byte FUNC_lang /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+
+ .uleb128 3 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "FUNC_lang\0" /* DW_AT_name */
+ .4byte FUNC_lang /* DW_AT_low_pc */
+ .4byte main /* DW_AT_high_pc */
+ .byte 1 /* DW_AT_prototyped */
+ .4byte .Ltype - .Lcu1_begin /* DW_AT_type */
+
+.Ltype:
+ .uleb128 0x5 /* Abbrev: DW_TAG_base_type */
+ .byte 0x4 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .ascii "foo\0" /* DW_AT_name */
+
+ .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 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 */
+ .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 */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 0 /* has_children */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x27 /* DW_AT_prototyped */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 0x5 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0x0 /* DW_children_no */
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,38 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Use DW_LANG_Fortran90 for case insensitive DWARF. */
+
+void
+FUNC_lang (void)
+{
+}
+
+/* Symbol is present only in ELF .symtab. */
+
+void
+FUNC_symtab (void)
+{
+}
+
+int
+main (void)
+{
+ FUNC_lang ();
+ FUNC_symtab ();
+ return 0;
+}
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,49 @@
+# 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 dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+set testfile "dw2-case-insensitive"
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
+ return -1
+}
+
+gdb_test "show case-sensitive" {Case sensitivity in name search is "auto; currently on"\.}
+
+gdb_test "info functions fUnC_lang" \
+ "All functions matching regular expression \"fUnC_lang\":" \
+ "regexp case-sensitive on"
+
+gdb_test "set case-sensitive off" {warning: the current case sensitivity setting does not match the language\.}
+
+gdb_test "info functions fUnC_lang" \
+ "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\nfoo FUNC_lang\\(void\\);" \
+ "regexp case-sensitive off"
+
+gdb_test "p fuNC_lang" { = {foo \(void\)} 0x[0-9a-f]+ <FUNC_lang>}
+gdb_test "p fuNC_symtab" { = {<text variable, no debug info>} 0x[0-9a-f]+ <FUNC_symtab>}
+
+if {[gdb_breakpoint "fuNC_lang"] == 1} {
+ pass "setting breakpoint at fuNC_lang"
+}
+
+if {[gdb_breakpoint "fuNC_symtab"] == 1} {
+ pass "setting breakpoint at fuNC_symtab"
+}
Index: gdb-7.2.90.20110525/gdb/utils.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/utils.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/utils.c 2011-05-25 17:13:13.000000000 +0200
@@ -3003,10 +3003,12 @@ strcmp_iw (const char *string1, const ch
{
string2++;
}
- if (*string1 != *string2)
- {
- break;
- }
+ if (case_sensitivity == case_sensitive_on && *string1 != *string2)
+ break;
+ if (case_sensitivity == case_sensitive_off
+ && (tolower ((unsigned char) *string1)
+ != tolower ((unsigned char) *string2)))
+ break;
if (*string1 != '\0')
{
string1++;
@@ -3027,6 +3029,10 @@ strcmp_iw (const char *string1, const ch
strcmp_iw(LIST_ELT, NAME), then the place to start looking is right
where this function would put NAME.
+ This function must be neutral to the CASE_SENSITIVITY setting as the user
+ may choose it during later lookup. Therefore this function always sorts
+ primarily case-insensitively and secondarily case-sensitively.
+
Here are some examples of why using strcmp to sort is a bad idea:
Whitespace example:
@@ -3052,8 +3058,10 @@ strcmp_iw (const char *string1, const ch
int
strcmp_iw_ordered (const char *string1, const char *string2)
{
- /* Formatting stub. */
- if (1)
+ const char *saved_string1 = string1, *saved_string2 = string2;
+ enum case_sensitivity case_pass = case_sensitive_off;
+
+ for (;;)
{
/* C1 and C2 are valid only if *string1 != '\0' && *string2 != '\0'.
Provide stub characters if we are already at the end of one of the
@@ -3067,8 +3075,17 @@ strcmp_iw_ordered (const char *string1,
while (isspace (*string2))
string2++;
+ switch (case_pass)
+ {
+ case case_sensitive_off:
+ c1 = tolower ((unsigned char) *string1);
+ c2 = tolower ((unsigned char) *string2);
+ break;
+ case case_sensitive_on:
c1 = *string1;
c2 = *string2;
+ break;
+ }
if (c1 != c2)
break;
@@ -3086,7 +3103,7 @@ strcmp_iw_ordered (const char *string1,
comparison in the cases where one of them is '\0' or '('. */
case '\0':
if (*string2 == '\0')
- return 0;
+ break;
else
return -1;
case '(':
@@ -3097,9 +3114,22 @@ strcmp_iw_ordered (const char *string1,
default:
if (*string2 == '\0' || *string2 == '(')
return 1;
- else
- return c1 - c2;
+ else if (c1 > c2)
+ return 1;
+ else if (c1 < c2)
+ return -1;
+ /* PASSTHRU */
}
+
+ if (case_pass == case_sensitive_on)
+ return 0;
+
+ /* Otherwise the strings were equal in case insensitive way, make
+ a more fine grained comparison in a case sensitive way. */
+
+ case_pass = case_sensitive_on;
+ string1 = saved_string1;
+ string2 = saved_string2;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,231 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-05/msg00002.html
Subject: [patch] testsuite: Test readline-6.2 "ask" regression
Hi,
this problem does not affect default FSF GDB build as it is using bundled
readline-5.1. But with system readline-6.2 and build using:
--with-system-readline use installed readline library
GDB will no longer ask about displaying too many symbols and dumps them all
immediately.
PASS:
$ gdb gdb
(gdb) p <tab><tab>
Display all 21482 possibilities? (y or n)_
FAIL:
$ gdb gdb
(gdb) p <tab><tab>
Display all 22129 possibilities? (y or n)
../../bfd/aout-target.h cs_to_section
../../bfd/aout32.c ctime
<screens and screens of dumps without any question>
This regression will soon start affecting distros:
FSF GDB HEAD - PASS - using bundled readline-5.1
fedora-15 - FAIL - using system readline-6.2
fedora-14 - PASS - using system readline-6.1
debian-6.0 - PASS - using system readline-6.1
kubuntu-10.10 - PASS - using system readline-6.1
I have asked about it on readline ml:
Re: [Bug-readline] callback mode pager disable status
https://lists.gnu.org/archive/html/bug-readline/2011-04/msg00012.html
The suggested workaround (in fact the readline-5.1 code state) going to patch
into the proposed FSF GDB bundled readline-6.2. Distros then can stop using
--with-system-readline to still feature recent and system matching readline
until readline-7.0 gets released.
This regression has been so far caught only with system debug infos installed:
-PASS: gdb.base/completion.exp: complete (2) 'p no_var_named_this-'
-PASS: gdb.base/completion.exp: complete 'p values[0].a'
-PASS: gdb.base/completion.exp: complete 'p values[0] . a'
-PASS: gdb.base/completion.exp: complete 'p &values[0] -> a'
-PASS: gdb.base/completion.exp: copmletion of field in anonymous union
+FAIL: gdb.base/completion.exp: (timeout) complete (2) 'p no_var_named_this-'
+FAIL: gdb.base/completion.exp: (timeout) complete 'p values[0].a' 2
+FAIL: gdb.base/completion.exp: (timeout) complete 'p values[0] . a' 2
+FAIL: gdb.base/completion.exp: (timeout) complete 'p &values[0] -> a' 2
+FAIL: gdb.base/completion.exp: copmletion of field in anonymous union
I will check it in with no comments.
Thanks,
Jan
gdb/testsuite/
2011-05-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/readline-ask.c: New file.
* gdb.base/readline-ask.exp: New file.
* gdb.base/readline-ask.inputrc: New file.
--- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-ask.c
@@ -0,0 +1,23 @@
+/* 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/>. */
+
+int
+symbol_01_length_40_____________________,
+symbol_02_length_40_____________________,
+symbol_03_length_40_____________________,
+symbol_04_length_40_____________________,
+symbol_10_length_40_____________________;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-ask.exp
@@ -0,0 +1,118 @@
+# Copyright (C) 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/>.
+
+set testfile readline-ask
+set executable ${testfile}.x
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${executable}
+set inputrc ${srcdir}/${subdir}/${testfile}.inputrc
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug}] != "" } {
+ untested ${testfile}.exp
+ return -1
+}
+
+# INPUTRC gets reset for the next testfile.
+setenv INPUTRC $inputrc
+clean_restart ${executable}
+
+gdb_test_no_output "set width 50"
+gdb_test_no_output "set height 3"
+
+set cmd "p symbol_0"
+send_gdb "$cmd\t"
+set test "bell for more message"
+gdb_test_multiple "" $test {
+ -re "$cmd\007$" {
+ pass $test
+ }
+}
+
+send_gdb "\t"
+set test "more message for 01 and 02"
+gdb_test_multiple "" $test {
+ -re "^\r\nsymbol_01_length_40_____________________\r\nsymbol_02_length_40_____________________\r\n--More--$" {
+ pass $test
+ }
+ -re "$gdb_prompt " {
+ fail $test
+ }
+}
+
+# There get some VT100 characters printed.
+
+send_gdb "\r"
+set test "more message for 03"
+gdb_test_multiple "" $test {
+ -re "\rsymbol_03_length_40_____________________\r\n--More--$" {
+ pass $test
+ }
+}
+
+# "$gdb_prompt $" will not match as $cmd gets output: $gdb_prompt p symbol_0
+# And "$gdb_prompt p symbol_0" cannot be matched as the default "$gdb_prompt $"
+# string from gdb_test_multiple could match earlier.
+
+send_gdb "\r"
+set test "more finish for 04"
+gdb_test_multiple "" $test {
+ -re "\rsymbol_04_length_40_____________________\r\n$gdb_prompt " {
+ pass $test
+ }
+}
+
+gdb_test "foo" {No symbol "symbol_0foo" in current context\.} "abort more message"
+
+set cmd "p symbol_"
+send_gdb "$cmd\t"
+set test "bell for ask message"
+gdb_test_multiple "" $test {
+ -re "$cmd\007$" {
+ pass $test
+ }
+}
+
+send_gdb "\t"
+set test "ask message"
+gdb_test_multiple "" $test {
+ -re "^\r\nDisplay all 5 possibilities\\? \\(y or n\\)$" {
+ pass $test
+ }
+ -re "$gdb_prompt " {
+ fail $test
+ return 0
+ }
+}
+
+send_gdb "y"
+set test "ask message for 01 and 02"
+gdb_test_multiple "" $test {
+ -re "^\r\nsymbol_01_length_40_____________________\r\nsymbol_02_length_40_____________________\r\n--More--$" {
+ pass $test
+ }
+}
+
+# There get some VT100 characters printed.
+# See the "$gdb_prompt " match like in "more finish for 04".
+
+send_gdb "n"
+set test "ask message no"
+gdb_test_multiple "" $test {
+ -re "\r$gdb_prompt " {
+ pass $test
+ }
+}
+
+gdb_test "foo" {No symbol "symbol_foo" in current context\.} "abort ask message"
--- /dev/null
+++ b/gdb/testsuite/gdb.base/readline-ask.inputrc
@@ -0,0 +1,16 @@
+# Copyright (C) 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/>.
+
+set completion-query-items 5

View File

@ -1,120 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-05/msg00010.html
Subject: [patch 4/3] readline-6.2: Substitute inc-hist.texinfo
Hi,
forgot the patchset had a `make doc' regression:
make: *** No rule to make target `../../../gdb/doc/../../readline/doc/inc-hist.texinfo', needed by `gdb.info'. Stop.
There was a copy hsuser.texi -> inc-hist.texinfo before with this diff:
@node Using History Interactively
@chapter Using History Interactively
-@ifclear BashFeatures
-@defcodeindex bt
-@end ifclear
+@c @ifclear BashFeatures
+@c @defcodeindex bt
+@c @end ifclear
@ifset BashFeatures
This chapter describes how to use the @sc{gnu} History Library
@end ifset
@ifclear BashFeatures
This chapter describes how to use the @sc{gnu} History Library interactively,
-from a user's standpoint. It should be considered a user's guide. For
-information on using the @sc{gnu} History Library in your own programs,
-@pxref{Programming with GNU History}.
+from a user's standpoint. It should be considered a user's guide.
+For information on using the @sc{gnu} History Library in other programs,
+see the @sc{gnu} Readline Library Manual.
@end ifclear
@ifset BashFeatures
Used slightly alternative one with IMO better reference and I have also kept
hsuser.texi in place as readline/ in src/ is no longer a standalone readline
distribution anyway.
Sorry,
Jan
gdb/doc/
2011-05-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* Makefile.in (GDB_DOC_SOURCE_INCLUDES): Rename inc-hist.texinfo to
hsuser.texi.
* gdb.texinfo <!SYSTEM_READLINE>: Rename inc-hist.texinfo inclusion and
comment to hsuser.texi. Change rluser.texi name in the comment.
readline/doc/
2011-05-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* hsuser.texi (Using History Interactively): Disable !BashFeatures
@defcodeindex. Make the `Programming with GNU History' reference
external.
Index: gdb-7.2.90.20110525/gdb/doc/Makefile.in
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/doc/Makefile.in 2011-01-03 14:01:05.000000000 +0100
+++ gdb-7.2.90.20110525/gdb/doc/Makefile.in 2011-05-25 19:16:35.000000000 +0200
@@ -117,7 +117,7 @@ GDB_DOC_SOURCE_INCLUDES = \
$(srcdir)/gpl.texi \
$(srcdir)/agentexpr.texi \
$(READLINE_DIR)/rluser.texi \
- $(READLINE_DIR)/inc-hist.texinfo
+ $(READLINE_DIR)/hsuser.texi
GDB_DOC_BUILD_INCLUDES = \
gdb-cfg.texi \
GDBvn.texi
Index: gdb-7.2.90.20110525/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/doc/gdb.texinfo 2011-05-25 19:14:36.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/doc/gdb.texinfo 2011-05-25 19:17:01.000000000 +0200
@@ -31095,13 +31095,13 @@ things without first using the debugger
@c The readline documentation is distributed with the readline code
@c and consists of the two following files:
-@c rluser.texinfo
-@c inc-hist.texinfo
+@c rluser.texi
+@c hsuser.texi
@c Use -I with makeinfo to point to the appropriate directory,
@c environment var TEXINPUTS with TeX.
@ifclear SYSTEM_READLINE
@include rluser.texi
-@include inc-hist.texinfo
+@include hsuser.texi
@end ifclear
@node In Memoriam
Index: gdb-7.2.90.20110525/readline/doc/hsuser.texi
===================================================================
--- gdb-7.2.90.20110525.orig/readline/doc/hsuser.texi 2011-05-25 19:16:17.000000000 +0200
+++ gdb-7.2.90.20110525/readline/doc/hsuser.texi 2011-05-25 19:16:35.000000000 +0200
@@ -26,9 +26,10 @@ into another language, under the above c
@node Using History Interactively
@chapter Using History Interactively
-@ifclear BashFeatures
-@defcodeindex bt
-@end ifclear
+@c GDB bundling modification:
+@c @ifclear BashFeatures
+@c @defcodeindex bt
+@c @end ifclear
@ifset BashFeatures
This chapter describes how to use the @sc{gnu} History Library
@@ -41,7 +42,8 @@ see the @sc{gnu} Readline Library Manual
This chapter describes how to use the @sc{gnu} History Library interactively,
from a user's standpoint. It should be considered a user's guide. For
information on using the @sc{gnu} History Library in your own programs,
-@pxref{Programming with GNU History}.
+@c GDB bundling modification:
+@pxref{Programming with GNU History, , , history, GNU History Library}.
@end ifclear
@ifset BashFeatures

View File

@ -7,8 +7,8 @@
+# Workaround ccache making lineno non-zero for command-line definitions.
+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} {
+ set result [catch "exec which gcc" output]
+ if {$result == 0 && [string first "/ccache/" $output] >= -1} {
+ lappend options "compiler=/usr/bin/gcc"
+ if {$result == 0 && [string first "/ccache/" $output] > -1} {
+ lappend options "compiler=/usr/bin/gcc"
+ }
+}
+

View File

@ -33,36 +33,35 @@ gdb/
[ Context backport. ]
Index: gdb-7.1.90.20100711/gdb/solib-svr4.c
Index: gdb-7.4.50.20111218/gdb/solib-svr4.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/solib-svr4.c 2010-07-12 23:07:35.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/solib-svr4.c 2010-07-13 00:19:03.000000000 +0200
@@ -1177,8 +1177,18 @@ svr4_current_sos (void)
target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
+ {
+ /* During the first ever DSO list reading some strings may be
+ unreadable as residing in the ld.so readonly memory not being
+ present in a dumped core file. Delay the error check after
+ the first pass of DSO list scanning when ld.so should be
+ already mapped in and all the DSO list l_name memory gets
+ readable. */
--- gdb-7.4.50.20111218.orig/gdb/solib-svr4.c 2011-12-19 01:14:31.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/solib-svr4.c 2011-12-19 01:31:10.106752164 +0100
@@ -1222,8 +1222,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
{
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
+ /* During the first ever DSO list reading some strings may be
+ unreadable as residing in the ld.so readonly memory not being
+ present in a dumped core file. Delay the error check after
+ the first pass of DSO list scanning when ld.so should be
+ already mapped in and all the DSO list l_name memory gets
+ readable. */
+
+ if (master_so_list () != NULL)
+ warning (_("Can't read pathname for load map: %s."),
+ safe_strerror (errcode));
+ }
else
{
struct build_id *build_id;
Index: gdb-7.1.90.20100711/gdb/solib.c
+ if (master_so_list () != NULL)
+ warning (_("Can't read pathname for load map: %s."),
+ safe_strerror (errcode));
+
do_cleanups (old_chain);
continue;
}
Index: gdb-7.4.50.20111218/gdb/solib.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/solib.c 2010-05-17 01:49:58.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/solib.c 2010-07-13 00:21:01.000000000 +0200
@@ -705,6 +705,7 @@ update_solib_list (int from_tty, struct
--- gdb-7.4.50.20111218.orig/gdb/solib.c 2011-09-12 21:00:22.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/solib.c 2011-12-19 01:29:04.815227898 +0100
@@ -676,6 +676,7 @@ update_solib_list (int from_tty, struct
struct target_so_ops *ops = solib_ops (target_gdbarch);
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
@ -70,7 +69,7 @@ Index: gdb-7.1.90.20100711/gdb/solib.c
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
@@ -844,6 +845,12 @@ Error while mapping shared library secti
@@ -817,6 +818,12 @@ update_solib_list (int from_tty, struct
observer_notify_solib_loaded (i);
}

View File

@ -1,154 +0,0 @@
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.
--- a/gdb/testsuite/gdb.threads/gcore-thread.exp
+++ b/gdb/testsuite/gdb.threads/gcore-thread.exp
@@ -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}/${subdir}/${srcfile}" "${binfile}" executab
# 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)
@@ -53,7 +50,6 @@ set horiz "\[^\n\r\]*"
# regexp for newline
set nl "\[\r\n\]+"
-set prev_timeout $timeout
set timeout 30
gdb_test_multiple "help gcore" "help gcore" {
@@ -92,10 +88,9 @@ delete_breakpoints
gdb_breakpoint "thread2"
gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
-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"
@@ -114,31 +109,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
@@ -158,5 +160,3 @@ gdb_test "info threads" ".* thread2 .*" \
gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
"thread2 is current thread in corefile"
-
-set timeout $prev_timeout

View File

@ -1,102 +0,0 @@
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.
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1335,7 +1335,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
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
@@ -1347,10 +1347,13 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
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;
}
--- a/gdb/testsuite/gdb.threads/gcore-thread.exp
+++ b/gdb/testsuite/gdb.threads/gcore-thread.exp
@@ -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"
@@ -110,6 +111,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}
@@ -160,3 +184,11 @@ gdb_test "info threads" ".* thread2 .*" \
gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
"thread2 is current thread in corefile"
+
+
+# Test the uninitialized thread list.
+
+if {"$core0file" != "" && [load_core $core0file]} {
+
+ gdb_test "info threads" "Cannot find new threads: .*" "zeroed-threads cannot be listed"
+}

View File

@ -1,101 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-02/msg00675.html
Subject: [patch 3/3] Display core reasons even during thread error
[ rediff ]
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 */

42
gdb-dejagnu-go.patch Normal file
View File

@ -0,0 +1,42 @@
http://sourceware.org/ml/gdb-patches/2012-06/msg00050.html
Subject: [patch] dejagnu compat. - missing find_go_linker [Re: [patch, doc RFA] Go language support]
On Wed, 25 Apr 2012 04:17:35 +0200, Doug Evans wrote:
> +if {[info procs find_go_linker] == ""} {
> + rename gdb_find_go find_go
> + rename gdb_find_go_linker find_go_linker
> + # No need to set use_gdb_compile.
> +}
Is there a reason for it? With recent Fedora 17 update
https://bugzilla.redhat.com/show_bug.cgi?id=635651
dejagnu has started to support 'find_gfortran'. But it still does not support
'find_go_linker'. This has resulted in regression failing to compile any
gdb.go/*.exp files.
Thanks,
Jan
gdb/testsuite/
2012-06-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/future.exp: Set $use_gdb_compile even if only find_go_linker is
missing.
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 40456c0..bf47988 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -514,7 +514,7 @@ if {[info procs find_gfortran] == ""} {
if {[info procs find_go_linker] == ""} {
rename gdb_find_go find_go
rename gdb_find_go_linker find_go_linker
- # No need to set use_gdb_compile.
+ set use_gdb_compile 1
}
if {$use_gdb_compile} {

24
gdb-disable-mcheck.patch Normal file
View File

@ -0,0 +1,24 @@
diff -dup -rup gdb-7.4.50.20120603-orig/gdb/configure gdb-7.4.50.20120603/gdb/configure
--- gdb-7.4.50.20120603-orig/gdb/configure 2012-06-06 19:08:32.824824699 +0200
+++ gdb-7.4.50.20120603/gdb/configure 2012-06-06 19:12:12.346992423 +0200
@@ -2706,7 +2706,7 @@ fi
# Provide more thorough testing by -lmcheck.
# Set it to 'true' for development snapshots, 'false' for releases or
# pre-releases.
-development=true
+development=false
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
diff -dup -rup gdb-7.4.50.20120603-orig/gdb/configure.ac gdb-7.4.50.20120603/gdb/configure.ac
--- gdb-7.4.50.20120603-orig/gdb/configure.ac 2012-06-06 19:08:32.817824693 +0200
+++ gdb-7.4.50.20120603/gdb/configure.ac 2012-06-06 19:12:05.545987227 +0200
@@ -26,7 +26,7 @@ AM_MAINTAINER_MODE
# Provide more thorough testing by -lmcheck.
# Set it to 'true' for development snapshots, 'false' for releases or
# pre-releases.
-development=true
+development=false
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS

View File

@ -0,0 +1,409 @@
commit 5bfdc32cd3bf373c3b02e1fd864ed8ceab0292b2
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Aug 8 12:08:53 2011 +0200
+testcase
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2012-06-02 20:03:42.711393776 +0200
@@ -0,0 +1,40 @@
+/* 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/>. */
+
+#include <pthread.h>
+#include <assert.h>
+
+static void *
+tfunc (void *arg)
+{
+ void (*notifyp) (void) = arg;
+
+ notifyp ();
+}
+
+void
+f (void (*notifyp) (void))
+{
+ pthread_t t;
+ int i;
+
+ i = pthread_create (&t, NULL, tfunc, notifyp);
+ assert (i == 0);
+
+ i = pthread_join (t, NULL);
+ assert (i == 0);
+}
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2012-06-02 20:03:42.712393775 +0200
@@ -0,0 +1,46 @@
+/* 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/>. */
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <assert.h>
+
+static const char *volatile filename;
+
+static void
+notify (void)
+{
+ filename = NULL; /* notify-here */
+}
+
+int
+main (void)
+{
+ void *h;
+ void (*fp) (void (*) (void));
+
+ assert (filename != NULL);
+ h = dlopen (filename, RTLD_LAZY);
+ assert (h != NULL);
+
+ fp = dlsym (h, "f");
+ assert (fp != NULL);
+
+ fp (notify);
+
+ return 0;
+}
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2012-06-02 20:03:42.724393771 +0200
@@ -0,0 +1,74 @@
+# 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 {![istarget *-linux*] || [skip_shlib_tests]} {
+ return 0
+}
+
+load_lib prelink-support.exp
+
+set testfile "dlopen-libpthread"
+set srcmainfile ${testfile}.c
+set srclibfile ${testfile}-lib.c
+set executable ${testfile}
+set binfile_lib ${objdir}/${subdir}/${executable}.so
+set binfile ${objdir}/${subdir}/${executable}
+set lib_dlopen [shlib_target_file ${executable}.so]
+
+# Use build_executable_own_libs as prelinked libpthread.so can produce false
+# PASS - it is OK if GDB processes it still before relocation.
+
+set relink_args [build_executable_own_libs ${testfile}.exp ${executable}.so $srclibfile {debug shlib_pthreads} no]
+if {$relink_args == "" || ![prelink_no $relink_args]
+ || [prepare_for_testing ${testfile}.exp ${executable} ${srcmainfile} {debug shlib_load}] } {
+ return -1
+}
+gdb_load_shlibs $binfile_lib
+
+if { ![runto_main] } {
+ return -1
+}
+
+set test "print _dl_debug_notify"
+gdb_test_multiple $test $test {
+ -re " 0x\[0-9a-f\]+ <_dl_debug_notify>\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "No symbol \"_dl_debug_notify\" in current context\\.\r\n$gdb_prompt $" {
+ xfail $test
+ untested ${testfile}.exp
+ return
+ }
+}
+
+set test "libpthread.so not found"
+gdb_test_multiple "info sharedlibrary" $test {
+ -re "/libpthread\\.so.*\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "/libc\\.so.*\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
+gdb_test "set variable filename=\"$lib_dlopen\""
+
+gdb_breakpoint "notify"
+
+# The error was:
+# Cannot find new threads: generic error
+gdb_continue_to_breakpoint "notify" ".* notify-here .*"
+
+gdb_test "info sharedlibrary" {/libpthread\.so.*} "libpthread.so found"
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 19:11:56.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 20:03:42.727393770 +0200
@@ -3693,30 +3693,49 @@ proc build_executable { testname executa
set sources ${executable}.c
}
- set binfile ${objdir}/${subdir}/${executable}
-
- set objects {}
- for {set i 0} "\$i<[llength $sources]" {incr i} {
- set s [lindex $sources $i]
- if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options] != "" } {
- untested $testname
- return -1
- }
- lappend objects "${binfile}${i}.o"
+ # get_compiler_info by gdb_compile_shlib and gdb_compile_shlib_pthreads.
+ set info_options ""
+ if { [lsearch -exact $options "c++"] >= 0 } {
+ set info_options "c++"
}
-
- if { [gdb_compile $objects "${binfile}" executable $options] != "" } {
- untested $testname
+ if [get_compiler_info binfile_unused ${info_options}] {
return -1
}
- set info_options ""
- if { [lsearch -exact $options "c++"] >= 0 } {
- set info_options "c++"
+ set binfile ${objdir}/${subdir}/${executable}
+
+ set func gdb_compile
+ set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}]
+ if {$func_index != -1} {
+ set func "${func}_[lindex $options $func_index]"
}
- if [get_compiler_info ${binfile} ${info_options}] {
+
+ # gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd
+ # parameter. They also requires $sources while gdb_compile and
+ # gdb_compile_pthreads require $objects.
+ if [string match gdb_compile_shlib* $func] {
+ set sources_path {}
+ foreach s $sources {
+ lappend sources_path "${srcdir}/${subdir}/${s}"
+ }
+ set ret [$func $sources_path "${binfile}" $options]
+ } else {
+ set objects {}
+ for {set i 0} "\$i<[llength $sources]" {incr i} {
+ set s [lindex $sources $i]
+ if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options] != "" } {
+ untested $testname
+ return -1
+ }
+ lappend objects "${binfile}${i}.o"
+ }
+ set ret [$func $objects "${binfile}" executable $options]
+ }
+ if { $ret != "" } {
+ untested $testname
return -1
}
+
return 0
}
Index: gdb-7.4.50.20120602/gdb/testsuite/lib/prelink-support.exp
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/prelink-support.exp 2012-01-04 09:27:56.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/lib/prelink-support.exp 2012-06-02 20:03:42.733393768 +0200
@@ -95,8 +95,9 @@ proc file_copy {src dest} {
# Wrap function build_executable so that the resulting executable is fully
# self-sufficient (without dependencies on system libraries). Parameter
# INTERP may be used to specify a loader (ld.so) to be used that is
-# different from the default system one. Libraries on which the executable
-# depends are copied into directory DIR. Default DIR value to
+# different from the default system one. INTERP can be set to "no" if no ld.so
+# copy should be made. Libraries on which the executable depends are copied
+# into directory DIR. Default DIR value to
# `${objdir}/${subdir}/${EXECUTABLE}.d'.
#
# In case of success, return a string containing the arguments to be used
@@ -151,8 +152,15 @@ proc build_executable_own_libs {testname
if {$interp == ""} {
set interp_system [section_get $binfile .interp]
- set interp ${dir}/[file tail $interp_system]
- file_copy $interp_system $interp
+ if {$interp_system == ""} {
+ fail "$test could not find .interp"
+ } else {
+ set interp ${dir}/[file tail $interp_system]
+ file_copy $interp_system $interp
+ }
+ }
+ if {$interp == "no"} {
+ set interp ""
}
set dests {}
@@ -164,13 +172,19 @@ proc build_executable_own_libs {testname
# Do not lappend it so that "-rpath $dir" overrides any possible "-rpath"s
# specified by the caller to be able to link it for ldd" above.
- set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp,-rpath,$dir"]
+ set options [linsert $options 0 "ldflags=-Wl,-rpath,$dir"]
+ if {$interp != ""} {
+ set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp"]
+ }
if {[build_executable $testname $executable $sources $options] == -1} {
return ""
}
- set prelink_args "--dynamic-linker=$interp --ld-library-path=$dir $binfile $interp [concat $dests]"
+ set prelink_args "--ld-library-path=$dir $binfile [concat $dests]"
+ if {$interp != ""} {
+ set prelink_args "--dynamic-linker=$interp $prelink_args $interp"
+ }
return $prelink_args
}
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/break-interp.exp
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/break-interp.exp 2012-02-24 15:09:08.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/break-interp.exp 2012-06-02 20:04:56.135369687 +0200
@@ -109,14 +109,21 @@ proc strip_debug {dest} {
}
}
+# Former symbol for solib changes notifications was _dl_debug_state, newer one
+# is dl_main (in fact _dl_debug_notify but it is inlined without any extra
+# debug info), the right one one traps by `set stop-on-solib-events 1'.
+
+set solib_bp {(_dl_debug_state|dl_main)}
+
# Implementation of reach.
proc reach_1 {func command displacement} {
- global gdb_prompt expect_out
+ global gdb_prompt expect_out solib_bp
- if {$func == "_dl_debug_state"} {
+ if {$func == $solib_bp} {
# Breakpoint on _dl_debug_state can have problems due to its overlap
# with the existing internal breakpoint from GDB.
+ # With also _dl_debug_notify we would need even two breakpoints.
gdb_test_no_output "set stop-on-solib-events 1"
} elseif {! [gdb_breakpoint $func allow-pending]} {
return
@@ -142,21 +149,21 @@ proc reach_1 {func command displacement}
exp_continue
}
-re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
- if {$func == "_dl_debug_state"} {
+ if {$func == $solib_bp} {
fail $test
} else {
pass $test
}
}
-re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" {
- if {$func == "_dl_debug_state"} {
+ if {$func == $solib_bp} {
fail $test
} else {
pass $test
}
}
-re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" {
- if {$func == "_dl_debug_state"} {
+ if {$func == $solib_bp} {
if {$debug_state_count == 0} {
# First stop does not yet relocate the _start function
# descriptor on ppc64.
@@ -175,7 +182,7 @@ proc reach_1 {func command displacement}
fail $test_displacement
}
- if {$func == "_dl_debug_state"} {
+ if {$func == $solib_bp} {
gdb_test_no_output "set stop-on-solib-events 0"
}
}
@@ -357,7 +364,7 @@ proc test_attach {file displacement {rel
}
proc test_ld {file ifmain trynosym displacement} {
- global srcdir subdir gdb_prompt expect_out inferior_exited_re
+ global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp
# First test normal `file'-command loaded $FILE with symbols.
@@ -385,9 +392,9 @@ proc test_ld {file ifmain trynosym displ
gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test"
}
- reach "_dl_debug_state" "run" $displacement
+ reach $solib_bp "run" $displacement
- gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?_dl_debug_state\\M.*" "dl bt"
+ gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt"
if $ifmain {
reach "main" continue "NONE"
@@ -399,7 +406,7 @@ proc test_ld {file ifmain trynosym displ
# 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_debug_state" "run" $displacement
+ reach $solib_bp "run" $displacement
if $ifmain {
test_core $file $displacement
@@ -431,7 +438,7 @@ proc test_ld {file ifmain trynosym displ
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
if $ifmain {
- reach "_dl_debug_state" run $displacement
+ reach $solib_bp run $displacement
# Use two separate gdb_test_multiple statements to avoid timeouts due
# to slow processing of wildcard capturing long output

358
gdb-dlopen-stap-probe.patch Normal file
View File

@ -0,0 +1,358 @@
From: Gary Benson <gbenson@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Message-ID: <20110810133605.GB7294@redhat.com>
Index: gdb-7.4.50.20120602/gdb/infrun.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/infrun.c 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/infrun.c 2012-06-02 21:38:13.450440507 +0200
@@ -361,6 +361,13 @@ static struct symbol *step_start_functio
/* Nonzero if we want to give control to the user when we're notified
of shared library events by the dynamic linker. */
int stop_on_solib_events;
+
+static void
+set_stop_on_solib_events (char *args, int from_tty, struct cmd_list_element *c)
+{
+ update_solib_breakpoints ();
+}
+
static void
show_stop_on_solib_events (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -7267,7 +7274,7 @@ Show stopping for shared library events.
If nonzero, gdb will give control to the user when the dynamic linker\n\
notifies gdb of shared library events. The most common event of interest\n\
to the user would be loading/unloading of a new library."),
- NULL,
+ set_stop_on_solib_events,
show_stop_on_solib_events,
&setlist, &showlist);
Index: gdb-7.4.50.20120602/gdb/solib-svr4.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/solib-svr4.c 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solib-svr4.c 2012-06-02 21:44:23.973298737 +0200
@@ -47,6 +47,8 @@
#include "auxv.h"
#include "exceptions.h"
+#include "probe.h"
+
static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
static int svr4_have_link_map_offsets (void);
static void svr4_relocate_main_executable (void);
@@ -92,6 +94,32 @@ static const char * const solib_break_na
NULL
};
+/* A list of SystemTap probes which, if present in the dynamic linker,
+ allow more fine-grained breakpoints to be placed on shared library
+ events. */
+
+struct probe_info
+ {
+ /* The name of the probe. */
+ const char *name;
+
+ /* Nonzero if this probe must be stopped at even when
+ stop-on-solib-events is off. */
+ int mandatory;
+ };
+
+static const struct probe_info probe_info[] =
+{
+ {"rtld_init_start", 0},
+ {"rtld_init_complete", 1},
+ {"rtld_map_start", 0},
+ {"rtld_reloc_complete", 1},
+ {"rtld_unmap_start", 0},
+ {"rtld_unmap_complete", 1},
+};
+
+#define NUM_PROBES (sizeof(probe_info) / sizeof(probe_info[0]))
+
static const char * const bkpt_names[] =
{
"_start",
@@ -313,6 +341,12 @@ struct svr4_info
CORE_ADDR interp_text_sect_high;
CORE_ADDR interp_plt_sect_low;
CORE_ADDR interp_plt_sect_high;
+
+ /* SystemTap probes. */
+ VEC (probe_p) *probes[NUM_PROBES];
+
+ /* Nonzero if we are using the SystemTap interface. */
+ int using_probes;
};
/* Per-program-space data key. */
@@ -322,8 +356,15 @@ static void
svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
{
struct svr4_info *info;
+ int i;
info = program_space_data (pspace, solib_svr4_pspace_data);
+ if (info == NULL)
+ return;
+
+ for (i = 0; i < NUM_PROBES; i++)
+ VEC_free (probe_p, info->probes[i]);
+
xfree (info);
}
@@ -1449,6 +1490,126 @@ exec_entry_point (struct bfd *abfd, stru
targ);
}
+/* Helper function for svr4_update_solib_event_breakpoints. */
+
+static int
+svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg)
+{
+ struct svr4_info *info = get_svr4_info ();
+ struct bp_location *loc;
+
+ if (b->type != bp_shlib_event)
+ return 0;
+
+ for (loc = b->loc; loc; loc = loc->next)
+ {
+ int i;
+
+ for (i = 0; i < NUM_PROBES; i++)
+ {
+ if (!probe_info[i].mandatory)
+ {
+ struct probe *probe;
+ int ix;
+
+ for (ix = 0;
+ VEC_iterate (probe_p, info->probes[i], ix, probe);
+ ++ix)
+ {
+ if (loc->pspace == current_program_space
+ && loc->address == probe->address)
+ {
+ b->enable_state =
+ stop_on_solib_events ? bp_enabled : bp_disabled;
+ return 0;
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* Enable or disable optional solib event breakpoints as appropriate.
+ Called whenever stop_on_solib_events is changed. */
+
+static void
+svr4_update_solib_event_breakpoints (void)
+{
+ struct svr4_info *info = get_svr4_info ();
+
+ if (info->using_probes)
+ iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL);
+}
+
+/* Both the SunOS and the SVR4 dynamic linkers call a marker function
+ before and after mapping and unmapping shared libraries. The sole
+ purpose of this method is to allow debuggers to set a breakpoint so
+ they can track these changes.
+
+ Some versions of the glibc dynamic linker contain SystemTap probes
+ to allow more fine grained stopping. Given the address of the
+ original marker function, this function attempts to find these
+ probes, and if found, sets breakpoints on those instead. If the
+ probes aren't found, a single breakpoint is set on the original
+ SVR4 marker function. */
+
+static void
+svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch, CORE_ADDR address)
+{
+ struct svr4_info *info = get_svr4_info ();
+ struct obj_section *os;
+
+ os = find_pc_section (address);
+ if (os != NULL)
+ {
+ int all_probes_found = 1;
+ int i;
+
+ for (i = 0; i < NUM_PROBES; i++)
+ {
+ info->probes[i] = find_probes_in_objfile (os->objfile, "rtld",
+ probe_info[i].name);
+
+ if (!VEC_length(probe_p, info->probes[i]))
+ {
+ int j;
+
+ for (j = i - 1; j >= 0; j--)
+ {
+ VEC_free (probe_p, info->probes[j]);
+ info->probes[j] = NULL;
+ }
+
+ all_probes_found = 0;
+ break;
+ }
+ }
+
+ if (all_probes_found)
+ {
+ info->using_probes = 1;
+
+ for (i = 0; i < NUM_PROBES; i++)
+ {
+ struct probe *probe;
+ int ix;
+
+ for (ix = 0;
+ VEC_iterate (probe_p, info->probes[i], ix, probe);
+ ++ix)
+ create_solib_event_breakpoint (gdbarch, probe->address);
+ }
+
+ svr4_update_solib_event_breakpoints ();
+ return;
+ }
+ }
+
+ create_solib_event_breakpoint (gdbarch, address);
+}
+
/* Helper function for gdb_bfd_lookup_symbol. */
static int
@@ -1497,10 +1658,18 @@ enable_break (struct svr4_info *info, in
asection *interp_sect;
gdb_byte *interp_name;
CORE_ADDR sym_addr;
+ int i;
info->interp_text_sect_low = info->interp_text_sect_high = 0;
info->interp_plt_sect_low = info->interp_plt_sect_high = 0;
+ for (i = 0; i < NUM_PROBES; i++)
+ {
+ VEC_free (probe_p, info->probes[i]);
+ info->probes[i] = NULL;
+ }
+ info->using_probes = 0;
+
/* If we already have a shared library list in the target, and
r_debug contains r_brk, set the breakpoint there - this should
mean r_brk has already been relocated. Assume the dynamic linker
@@ -1532,7 +1701,7 @@ enable_break (struct svr4_info *info, in
That knowledge is encoded in the address, if it's Thumb the low bit
is 1. However, we've stripped that info above and it's not clear
what all the consequences are of passing a non-addr_bits_remove'd
- address to create_solib_event_breakpoint. The call to
+ address to svr4_create_solib_event_breakpoints. The call to
find_pc_section verifies we know about the address and have some
hope of computing the right kind of breakpoint to use (via
symbol info). It does mean that GDB needs to be pointed at a
@@ -1570,7 +1739,7 @@ enable_break (struct svr4_info *info, in
+ bfd_section_size (tmp_bfd, interp_sect);
}
- create_solib_event_breakpoint (target_gdbarch, sym_addr);
+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
return 1;
}
}
@@ -1725,7 +1894,8 @@ enable_break (struct svr4_info *info, in
if (sym_addr != 0)
{
- create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr);
+ svr4_create_solib_event_breakpoints (target_gdbarch,
+ load_addr + sym_addr);
xfree (interp_name);
return 1;
}
@@ -1751,7 +1921,7 @@ enable_break (struct svr4_info *info, in
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
sym_addr,
&current_target);
- create_solib_event_breakpoint (target_gdbarch, sym_addr);
+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
return 1;
}
}
@@ -1767,7 +1937,7 @@ enable_break (struct svr4_info *info, in
sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
sym_addr,
&current_target);
- create_solib_event_breakpoint (target_gdbarch, sym_addr);
+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
return 1;
}
}
@@ -2543,4 +2713,5 @@ _initialize_svr4_solib (void)
svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
svr4_so_ops.same = svr4_same;
svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core;
+ svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints;
}
Index: gdb-7.4.50.20120602/gdb/solib.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/solib.c 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solib.c 2012-06-02 21:38:13.455440507 +0200
@@ -1216,6 +1216,18 @@ no_shared_libraries (char *ignored, int
objfile_purge_solibs ();
}
+/* Enable or disable optional solib event breakpoints as appropriate. */
+
+void
+update_solib_breakpoints (void)
+{
+ struct target_so_ops *ops = solib_ops (target_gdbarch);
+
+ if (ops->update_breakpoints != NULL)
+ ops->update_breakpoints ();
+}
+
+
/* Reload shared libraries, but avoid reloading the same symbol file
we already have loaded. */
Index: gdb-7.4.50.20120602/gdb/solib.h
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/solib.h 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solib.h 2012-06-02 21:38:13.464440503 +0200
@@ -91,4 +91,8 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_f
void *),
void *data);
+/* Enable or disable optional solib event breakpoints as appropriate. */
+
+extern void update_solib_breakpoints (void);
+
#endif /* SOLIB_H */
Index: gdb-7.4.50.20120602/gdb/solist.h
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/solist.h 2012-06-02 21:38:07.236442883 +0200
+++ gdb-7.4.50.20120602/gdb/solist.h 2012-06-02 21:38:13.465440503 +0200
@@ -149,6 +149,13 @@ struct target_so_ops
core file (in particular, for readonly sections). */
int (*keep_data_in_core) (CORE_ADDR vaddr,
unsigned long size);
+
+ /* Enable or disable optional solib event breakpoints as
+ appropriate. This should be called whenever
+ stop_on_solib_events is changed. This pointer can be
+ NULL, in which case no enabling or disabling is necessary
+ for this target. */
+ void (*update_breakpoints) (void);
};
/* Free the memory associated with a (so_list *). */

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.50.20110117/gdb/f-lang.c
Index: gdb-7.4.50.20120602/gdb/f-lang.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/f-lang.c 2011-01-07 20:36:16.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/f-lang.c 2011-01-17 15:56:07.000000000 +0100
@@ -57,20 +57,6 @@ typedef struct saved_bf_symnum SAVED_BF,
--- gdb-7.4.50.20120602.orig/gdb/f-lang.c 2012-03-02 20:29:00.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/f-lang.c 2012-06-02 19:13:31.520050654 +0200
@@ -59,20 +59,6 @@ typedef struct saved_bf_symnum SAVED_BF,
/* Local functions */
extern void _initialize_f_language (void);
@ -23,7 +23,7 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
static void f_printchar (int c, struct type *type, struct ui_file * stream);
static void f_emit_char (int c, struct type *type,
@@ -461,185 +447,7 @@ _initialize_f_language (void)
@@ -385,185 +371,7 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
@ -209,7 +209,7 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
/* This routine finds the first encountred COMMON block named "name"
that belongs to function funcname. */
@@ -662,193 +470,3 @@ find_common_for_function (char *name, ch
@@ -586,193 +394,3 @@ find_common_for_function (const char *na
}
return (NULL);
}
@ -403,18 +403,19 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
- saved_function_list = NULL;
-}
-#endif
Index: gdb-7.2.50.20110117/gdb/f-lang.h
Index: gdb-7.4.50.20120602/gdb/f-lang.h
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/f-lang.h 2011-01-17 15:47:37.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/f-lang.h 2011-01-17 15:54:14.000000000 +0100
@@ -76,14 +76,9 @@ typedef struct saved_f77_common SAVED_F7
--- gdb-7.4.50.20120602.orig/gdb/f-lang.h 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/f-lang.h 2012-06-02 19:13:55.345317970 +0200
@@ -76,15 +76,10 @@ typedef struct saved_f77_common SAVED_F7
typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR;
extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */
-extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */
-extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */
extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
const char *);
-#define UNINITIALIZED_SECNUM -1
-#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM)
@ -422,10 +423,10 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.h
#define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */
#define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
#define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */
Index: gdb-7.2.50.20110117/gdb/f-valprint.c
Index: gdb-7.4.50.20120602/gdb/f-valprint.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/f-valprint.c 2011-01-17 15:47:37.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/f-valprint.c 2011-01-17 15:54:36.000000000 +0100
--- gdb-7.4.50.20120602.orig/gdb/f-valprint.c 2012-06-02 19:11:54.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/f-valprint.c 2012-06-02 19:14:11.625313432 +0200
@@ -35,10 +35,6 @@
#include "command.h"
#include "block.h"
@ -436,8 +437,8 @@ Index: gdb-7.2.50.20110117/gdb/f-valprint.c
-
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
static void list_all_visible_commons (char *);
@@ -604,67 +600,6 @@ info_common_command (char *comname, int
static void list_all_visible_commons (const char *);
@@ -535,67 +531,6 @@ info_common_command (char *comname, int
comname, funname);
}

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
Index: gdb-7.4.50.20120602/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/dwarf2read.c 2011-05-25 17:06:19.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/dwarf2read.c 2011-05-25 17:10:46.000000000 +0200
@@ -7665,12 +7665,14 @@ read_set_type (struct die_info *die, str
--- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 21:32:54.304562500 +0200
@@ -9736,12 +9736,14 @@ read_set_type (struct die_info *die, str
return set_die_type (die, set_type, cu);
}
@ -19,7 +19,7 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
struct attribute *attr;
struct symbol *sym;
CORE_ADDR base = (CORE_ADDR) 0;
@@ -7695,20 +7697,67 @@ read_common_block (struct die_info *die,
@@ -9766,20 +9768,67 @@ read_common_block (struct die_info *die,
}
if (die->child != NULL)
{
@ -87,7 +87,7 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
}
}
@@ -11376,6 +11425,13 @@ new_symbol_full (struct die_info *die, s
@@ -13661,6 +13710,13 @@ new_symbol_full (struct die_info *die, s
{
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
@ -101,7 +101,7 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
if (SYMBOL_CLASS (sym) == LOC_STATIC
&& SYMBOL_VALUE_ADDRESS (sym) == 0
&& !dwarf2_per_objfile->has_section_at_zero)
@@ -11548,6 +11604,11 @@ new_symbol_full (struct die_info *die, s
@@ -13825,6 +13881,11 @@ new_symbol_full (struct die_info *die, s
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
list_to_add = &global_symbols;
break;
@ -113,11 +113,11 @@ Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
default:
/* Not a tag we recognize. Hopefully we aren't processing
trash data, but since we must specifically ignore things
Index: gdb-7.2.90.20110525/gdb/f-lang.c
Index: gdb-7.4.50.20120602/gdb/f-lang.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/f-lang.c 2011-05-25 17:06:22.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/f-lang.c 2011-05-25 17:07:02.000000000 +0200
@@ -446,27 +446,3 @@ _initialize_f_language (void)
--- gdb-7.4.50.20120602.orig/gdb/f-lang.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/f-lang.c 2012-06-02 21:32:54.305562499 +0200
@@ -370,27 +370,3 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
@ -128,7 +128,7 @@ Index: gdb-7.2.90.20110525/gdb/f-lang.c
- that belongs to function funcname. */
-
-SAVED_F77_COMMON_PTR
-find_common_for_function (char *name, char *funcname)
-find_common_for_function (const char *name, const char *funcname)
-{
-
- SAVED_F77_COMMON_PTR tmp;
@ -145,11 +145,11 @@ Index: gdb-7.2.90.20110525/gdb/f-lang.c
- }
- return (NULL);
-}
Index: gdb-7.2.90.20110525/gdb/f-lang.h
Index: gdb-7.4.50.20120602/gdb/f-lang.h
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/f-lang.h 2011-05-25 17:06:22.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/f-lang.h 2011-05-25 17:07:02.000000000 +0200
@@ -52,36 +52,8 @@ enum f90_range_type
--- gdb-7.4.50.20120602.orig/gdb/f-lang.h 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/f-lang.h 2012-06-02 21:32:54.322562493 +0200
@@ -52,37 +52,8 @@ enum f90_range_type
NONE_BOUND_DEFAULT /* "(low:high)" */
};
@ -178,7 +178,8 @@ Index: gdb-7.2.90.20110525/gdb/f-lang.h
-
-extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */
-
-extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
-extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
- const char *);
-
#define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */
#define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */
@ -186,11 +187,11 @@ Index: gdb-7.2.90.20110525/gdb/f-lang.h
/* When reasonable array bounds cannot be fetched, such as when
you ask to 'mt print symbols' and there is no stack frame and
Index: gdb-7.2.90.20110525/gdb/f-valprint.c
Index: gdb-7.4.50.20120602/gdb/f-valprint.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/f-valprint.c 2011-05-25 17:06:22.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/f-valprint.c 2011-05-25 17:07:02.000000000 +0200
@@ -34,6 +34,8 @@
--- gdb-7.4.50.20120602.orig/gdb/f-valprint.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/f-valprint.c 2012-06-02 21:33:50.514541286 +0200
@@ -34,10 +34,11 @@
#include "gdbcore.h"
#include "command.h"
#include "block.h"
@ -199,12 +200,16 @@ Index: gdb-7.2.90.20110525/gdb/f-valprint.c
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
@@ -501,22 +503,54 @@ f_val_print (struct type *type, const gd
return 0;
-static void list_all_visible_commons (const char *);
static void f77_create_arrayprint_offset_tbl (struct type *,
struct ui_file *);
static void f77_get_dynamic_length_of_aggregate (struct type *);
@@ -420,22 +421,54 @@ f_val_print (struct type *type, const gd
gdb_flush (stream);
}
-static void
-list_all_visible_commons (char *funname)
-list_all_visible_commons (const char *funname)
+static int
+info_common_command_for_block (struct block *block, struct frame_info *frame,
+ const char *comname)
@ -212,7 +217,7 @@ Index: gdb-7.2.90.20110525/gdb/f-valprint.c
- SAVED_F77_COMMON_PTR tmp;
-
- tmp = head_common_list;
+ struct dict_iterator iter;
+ struct block_iterator iter;
+ struct symbol *sym;
+ int values_printed = 0;
+ const char *name;
@ -267,21 +272,21 @@ Index: gdb-7.2.90.20110525/gdb/f-valprint.c
}
/* This function is used to print out the values in a given COMMON
@@ -526,11 +560,9 @@ list_all_visible_commons (char *funname)
@@ -445,11 +478,9 @@ list_all_visible_commons (const char *fu
static void
info_common_command (char *comname, int from_tty)
{
- SAVED_F77_COMMON_PTR the_common;
- COMMON_ENTRY_PTR entry;
struct frame_info *fi;
- char *funname = 0;
- const char *funname = 0;
- struct symbol *func;
+ struct block *block;
+ int values_printed = 0;
/* We have been told to display the contents of F77 COMMON
block supposedly visible in this function. Let us
@@ -542,74 +574,31 @@ info_common_command (char *comname, int
@@ -461,74 +492,31 @@ info_common_command (char *comname, int
/* The following is generally ripped off from stack.c's routine
print_frame_info(). */
@ -372,11 +377,11 @@ Index: gdb-7.2.90.20110525/gdb/f-valprint.c
}
void
Index: gdb-7.2.90.20110525/gdb/stack.c
Index: gdb-7.4.50.20120602/gdb/stack.c
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/stack.c 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/stack.c 2011-05-25 17:07:02.000000000 +0200
@@ -1525,6 +1525,8 @@ iterate_over_block_locals (struct block
--- gdb-7.4.50.20120602.orig/gdb/stack.c 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/stack.c 2012-06-02 21:32:54.335562488 +0200
@@ -1838,6 +1838,8 @@ iterate_over_block_locals (struct block
case LOC_COMPUTED:
if (SYMBOL_IS_ARGUMENT (sym))
break;
@ -385,26 +390,26 @@ Index: gdb-7.2.90.20110525/gdb/stack.c
(*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
break;
Index: gdb-7.2.90.20110525/gdb/symtab.h
Index: gdb-7.4.50.20120602/gdb/symtab.h
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/symtab.h 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/symtab.h 2011-05-25 17:07:02.000000000 +0200
@@ -411,7 +411,10 @@ typedef enum domain_enum_tag
TYPES_DOMAIN,
--- gdb-7.4.50.20120602.orig/gdb/symtab.h 2012-06-02 21:32:41.746567299 +0200
+++ gdb-7.4.50.20120602/gdb/symtab.h 2012-06-02 21:32:54.342562486 +0200
@@ -389,7 +389,10 @@ typedef enum domain_enum_tag
/* Any type. */
- ALL_DOMAIN
+ ALL_DOMAIN,
/* LABEL_DOMAIN may be used for names of labels (for gotos). */
- LABEL_DOMAIN
+ LABEL_DOMAIN,
+
+ /* Fortran common blocks. Their naming must be separate from VAR_DOMAIN. */
+ COMMON_BLOCK_DOMAIN
}
domain_enum;
} domain_enum;
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp
/* Searching domains, used for `search_symbols'. Element numbers are
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp 2011-05-25 17:07:02.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.exp 2012-06-02 21:32:54.344562484 +0200
@@ -0,0 +1,101 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
@ -428,7 +433,7 @@ Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp
+set srcfile ${testfile}.f90
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
+ untested "Couldn't compile ${srcfile}"
+ return -1
+}
@ -507,10 +512,10 @@ Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp
+gdb_test "p ix_x" " = 1 *" "p ix_x in"
+gdb_test "p iy_y" " = 2 *" "p iy_y in"
+gdb_test "p iz_z2" " = 3 *" "p iz_z2 in"
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.f90
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.f90 2011-05-25 17:07:02.000000000 +0200
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.f90 2012-06-02 21:32:54.345562483 +0200
@@ -0,0 +1,67 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!

View File

@ -1,709 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-07/msg00645.html
Subject: [patch] workaround gcc46: prologue skip skips too far (PR 12435) #2
Hi,
this is an improved patch of a former:
[patch] workaround gcc46: prologue skip skips too far (PR 12435)
http://sourceware.org/ml/gdb-patches/2011-03/msg01108.html
cancel/FYI: Re: [patch] workaround gcc46: prologue skip skips too far (PR 12435)
http://sourceware.org/ml/gdb-patches/2011-03/msg01123.html
For example `break error' does not work for debugging GDB with gcc-4.6.x.
As gcc-4.6.0 and now even 4.6.1 still has this bug and I have seen a user(s?)
on non-Fedora platform asking about this bug and as there may be enough
binaries out there (although it affects only -O0 -g compilation) coded it
properly I have coded the workaround properly this time.
It does not solve overlays well, but the code just does not work for overlays,
it has no other negative effect.
I will update the code after FSF gcc gets fixed to minimize the workaround.
No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu.
I would welcome a comment whether it is suitable for FSF GDB.
Thanks,
Jan
gdb/
2011-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
PR breakpoints/12435
* amd64-tdep.c (amd64_skip_prologue): New variables start_pc_sal,
next_sal, buf, offset and xmmreg. Advance PC if it sees the PR.
* dwarf2read.c (process_full_comp_unit): Initialize
amd64_prologue_line_bug.
* symtab.h (struct symtab): New field amd64_prologue_line_bug.
gdb/testsuite/
2011-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
PR breakpoints/12435
* gdb.arch/amd64-prologue-xmm.c: New file.
* gdb.arch/amd64-prologue-xmm.exp: New file.
* gdb.arch/amd64-prologue-xmm.s: New file.
Index: gdb-7.3/gdb/amd64-tdep.c
===================================================================
--- gdb-7.3.orig/gdb/amd64-tdep.c 2011-03-18 19:52:29.000000000 +0100
+++ gdb-7.3/gdb/amd64-tdep.c 2011-07-26 22:09:15.000000000 +0200
@@ -1902,6 +1902,9 @@ amd64_skip_prologue (struct gdbarch *gdb
{
struct amd64_frame_cache cache;
CORE_ADDR pc;
+ struct symtab_and_line start_pc_sal, next_sal;
+ gdb_byte buf[4 + 8 * 7];
+ int offset, xmmreg;
amd64_init_frame_cache (&cache);
pc = amd64_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffLL,
@@ -1909,7 +1912,71 @@ amd64_skip_prologue (struct gdbarch *gdb
if (cache.frameless_p)
return start_pc;
- return pc;
+ /* GCC PR debug/48827 produced false prologue end:
+ 84 c0 test %al,%al
+ 74 23 je after
+ <-- here is 0 lines advance - the false prologue end marker.
+ 0f 29 85 70 ff ff ff movaps %xmm0,-0x90(%rbp)
+ 0f 29 4d 80 movaps %xmm1,-0x80(%rbp)
+ 0f 29 55 90 movaps %xmm2,-0x70(%rbp)
+ 0f 29 5d a0 movaps %xmm3,-0x60(%rbp)
+ 0f 29 65 b0 movaps %xmm4,-0x50(%rbp)
+ 0f 29 6d c0 movaps %xmm5,-0x40(%rbp)
+ 0f 29 75 d0 movaps %xmm6,-0x30(%rbp)
+ 0f 29 7d e0 movaps %xmm7,-0x20(%rbp)
+ after: */
+
+ if (pc == start_pc)
+ return pc;
+
+ start_pc_sal = find_pc_sect_line (start_pc, NULL, 0);
+ if (start_pc_sal.symtab == NULL
+ || !start_pc_sal.symtab->amd64_prologue_line_bug
+ || start_pc_sal.pc != start_pc || pc >= start_pc_sal.end)
+ return pc;
+
+ next_sal = find_pc_sect_line (start_pc_sal.end, NULL, 0);
+ if (next_sal.line != start_pc_sal.line)
+ return pc;
+
+ /* START_PC can be from overlayed memory, ignored here. */
+ if (target_read_memory (next_sal.pc - 4, buf, sizeof (buf)) != 0)
+ return pc;
+
+ /* test %al,%al */
+ if (buf[0] != 0x84 || buf[1] != 0xc0)
+ return pc;
+ /* je AFTER */
+ if (buf[2] != 0x74)
+ return pc;
+
+ offset = 4;
+ for (xmmreg = 0; xmmreg < 8; xmmreg++)
+ {
+ /* movaps %xmmreg?,-0x??(%rbp) */
+ if (buf[offset] != 0x0f || buf[offset + 1] != 0x29
+ || (buf[offset + 2] & 0b00111111) != (xmmreg << 3 | 0b101))
+ return pc;
+
+ if ((buf[offset + 2] & 0b11000000) == 0b01000000)
+ {
+ /* 8-bit displacement. */
+ offset += 4;
+ }
+ else if ((buf[offset + 2] & 0b11000000) == 0b10000000)
+ {
+ /* 32-bit displacement. */
+ offset += 7;
+ }
+ else
+ return pc;
+ }
+
+ /* je AFTER */
+ if (offset - 4 != buf[3])
+ return pc;
+
+ return next_sal.end;
}
Index: gdb-7.3/gdb/dwarf2read.c
===================================================================
--- gdb-7.3.orig/gdb/dwarf2read.c 2011-07-26 22:08:59.000000000 +0200
+++ gdb-7.3/gdb/dwarf2read.c 2011-07-26 22:11:07.000000000 +0200
@@ -4647,6 +4647,42 @@ producer_is_gcc_ge_4_0 (struct dwarf2_cu
return major >= 4;
}
+static int
+producer_is_gcc_ge_4_6 (struct dwarf2_cu *cu)
+{
+ const char *cs;
+ int major, minor;
+
+ if (cu->producer == NULL)
+ {
+ /* For unknown compilers expect their behavior is not compliant. For GCC
+ this case can also happen for -gdwarf-4 type units supported since
+ gcc-4.5. */
+
+ return 0;
+ }
+
+ /* Skip any identifier after "GNU " - such as "C++" or "Java". */
+
+ if (strncmp (cu->producer, "GNU ", strlen ("GNU ")) != 0)
+ {
+ /* For non-GCC compilers expect their behavior is not compliant. */
+
+ return 0;
+ }
+ cs = &cu->producer[strlen ("GNU ")];
+ while (*cs && !isdigit (*cs))
+ cs++;
+ if (sscanf (cs, "%d.%d", &major, &minor) != 2)
+ {
+ /* Not recognized as GCC. */
+
+ return 0;
+ }
+
+ return major >= 4 && minor >= 6;
+}
+
/* Generate full symbol information for PST and CU, whose DIEs have
already been loaded into memory. */
@@ -4706,6 +4742,9 @@ process_full_comp_unit (struct dwarf2_pe
*/
if (cu->has_loclist && producer_is_gcc_ge_4_0 (cu))
symtab->locations_valid = 1;
+
+ if (producer_is_gcc_ge_4_6 (cu))
+ symtab->amd64_prologue_line_bug = 1;
}
if (dwarf2_per_objfile->using_index)
Index: gdb-7.3/gdb/symtab.h
===================================================================
--- gdb-7.3.orig/gdb/symtab.h 2011-07-26 22:08:57.000000000 +0200
+++ gdb-7.3/gdb/symtab.h 2011-07-26 22:09:39.000000000 +0200
@@ -779,6 +779,11 @@ struct symtab
unsigned int locations_valid : 1;
+ /* At least GCC 4.6.0 and 4.6.1 can produce invalid false prologue and marker
+ on amd64. This flag is set independently of the symtab arch. */
+
+ unsigned amd64_prologue_line_bug : 1;
+
/* The macro table for this symtab. Like the blockvector, this
may be shared between different symtabs --- and normally is for
all the symtabs in a given compilation unit. */
Index: gdb-7.3/gdb/testsuite/gdb.arch/amd64-prologue-xmm.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3/gdb/testsuite/gdb.arch/amd64-prologue-xmm.c 2011-07-26 22:09:15.000000000 +0200
@@ -0,0 +1,38 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+static volatile int v, fail;
+
+static void
+func (int i, ...)
+{
+ v = i;
+}
+
+static void
+marker (void)
+{
+}
+
+int
+main (void)
+{
+ func (1);
+ fail = 1;
+ marker ();
+ return 0;
+}
Index: gdb-7.3/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3/gdb/testsuite/gdb.arch/amd64-prologue-xmm.exp 2011-07-26 22:09:15.000000000 +0200
@@ -0,0 +1,46 @@
+# Copyright 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test GCC PR debug/48827 workaround in GDB.
+
+set testfile "amd64-prologue-xmm"
+set srcfile ${testfile}.s
+set csrcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}.x
+set opts {}
+
+if [info exists COMPILE] {
+ # make check RUNTESTFLAGS='gdb.arch/amd64-prologue-xmm.exp COMPILE=1'
+ set srcfile ${csrcfile}
+ lappend opts debug optimize=-O0
+} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
+ verbose "Skipping amd64-prologue-xmm test."
+ return 0
+}
+
+if {[prepare_for_testing ${testfile}.exp ${testfile} $srcfile $opts]} {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_breakpoint "func"
+gdb_breakpoint "marker"
+
+gdb_continue_to_breakpoint "func"
+
+gdb_test "p fail" " = 0" "stopped at func"
Index: gdb-7.3/gdb/testsuite/gdb.arch/amd64-prologue-xmm.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.3/gdb/testsuite/gdb.arch/amd64-prologue-xmm.s 2011-07-26 22:09:15.000000000 +0200
@@ -0,0 +1,400 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file is compiled from gdb.arch/amd64-prologue-xmm.c
+ using -g -dA -S. */
+
+ .file "amd64-prologue-xmm.c"
+ .text
+.Ltext0:
+ .local v
+ .comm v,4,4
+ .local fail
+ .comm fail,4,4
+ .type func, @function
+func:
+.LFB0:
+ .file 1 "gdb.arch/amd64-prologue-xmm.c"
+ # gdb.arch/amd64-prologue-xmm.c:22
+ .loc 1 22 0
+ .cfi_startproc
+ # basic block 2
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ subq $72, %rsp
+ movq %rsi, -168(%rbp)
+ movq %rdx, -160(%rbp)
+ movq %rcx, -152(%rbp)
+ movq %r8, -144(%rbp)
+ movq %r9, -136(%rbp)
+ testb %al, %al
+ je .L2
+ # basic block 3
+ # gdb.arch/amd64-prologue-xmm.c:22
+ .loc 1 22 0
+ movaps %xmm0, -128(%rbp)
+ movaps %xmm1, -112(%rbp)
+ movaps %xmm2, -96(%rbp)
+ movaps %xmm3, -80(%rbp)
+ movaps %xmm4, -64(%rbp)
+ movaps %xmm5, -48(%rbp)
+ movaps %xmm6, -32(%rbp)
+ movaps %xmm7, -16(%rbp)
+.L2:
+ # basic block 4
+ movl %edi, -180(%rbp)
+ # gdb.arch/amd64-prologue-xmm.c:23
+ .loc 1 23 0
+ movl -180(%rbp), %eax
+ movl %eax, v(%rip)
+ # gdb.arch/amd64-prologue-xmm.c:24
+ .loc 1 24 0
+ leave
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE0:
+ .size func, .-func
+ .type marker, @function
+marker:
+.LFB1:
+ # gdb.arch/amd64-prologue-xmm.c:28
+ .loc 1 28 0
+ .cfi_startproc
+ # basic block 2
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ # gdb.arch/amd64-prologue-xmm.c:29
+ .loc 1 29 0
+ popq %rbp
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE1:
+ .size marker, .-marker
+ .globl main
+ .type main, @function
+main:
+.LFB2:
+ # gdb.arch/amd64-prologue-xmm.c:33
+ .loc 1 33 0
+ .cfi_startproc
+ # basic block 2
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ # gdb.arch/amd64-prologue-xmm.c:34
+ .loc 1 34 0
+ movl $1, %edi
+ movl $0, %eax
+ call func
+ # gdb.arch/amd64-prologue-xmm.c:35
+ .loc 1 35 0
+ movl $1, fail(%rip)
+ # gdb.arch/amd64-prologue-xmm.c:36
+ .loc 1 36 0
+ call marker
+ # gdb.arch/amd64-prologue-xmm.c:37
+ .loc 1 37 0
+ movl $0, %eax
+ # gdb.arch/amd64-prologue-xmm.c:38
+ .loc 1 38 0
+ popq %rbp
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE2:
+ .size main, .-main
+.Letext0:
+ .section .debug_info,"",@progbits
+.Ldebug_info0:
+ .long 0xc0 # Length of Compilation Unit Info
+ .value 0x4 # DWARF version number
+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section
+ .byte 0x8 # Pointer Size (in bytes)
+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
+ .long .LASF1 # DW_AT_producer: "GNU C 4.6.1 20110715 (Red Hat 4.6.1-3)"
+ .byte 0x1 # DW_AT_language
+ .long .LASF2 # DW_AT_name: "gdb.arch/amd64-prologue-xmm.c"
+ .long .LASF3 # DW_AT_comp_dir: ""
+ .quad .Ltext0 # DW_AT_low_pc
+ .quad .Letext0 # DW_AT_high_pc
+ .long .Ldebug_line0 # DW_AT_stmt_list
+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram)
+ .long .LASF4 # DW_AT_name: "func"
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c)
+ .byte 0x15 # DW_AT_decl_line
+ # DW_AT_prototyped
+ .quad .LFB0 # DW_AT_low_pc
+ .quad .LFE0 # DW_AT_high_pc
+ .uleb128 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ # DW_AT_GNU_all_call_sites
+ .long 0x59 # DW_AT_sibling
+ .uleb128 0x3 # (DIE (0x4a) DW_TAG_formal_parameter)
+ .ascii "i\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c)
+ .byte 0x15 # DW_AT_decl_line
+ .long 0x59 # DW_AT_type
+ .uleb128 0x3 # DW_AT_location
+ .byte 0x91 # DW_OP_fbreg
+ .sleb128 -196
+ .uleb128 0x4 # (DIE (0x57) DW_TAG_unspecified_parameters)
+ .byte 0 # end of children of DIE 0x2d
+ .uleb128 0x5 # (DIE (0x59) DW_TAG_base_type)
+ .byte 0x4 # DW_AT_byte_size
+ .byte 0x5 # DW_AT_encoding
+ .ascii "int\0" # DW_AT_name
+ .uleb128 0x6 # (DIE (0x60) DW_TAG_subprogram)
+ .long .LASF5 # DW_AT_name: "marker"
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c)
+ .byte 0x1b # DW_AT_decl_line
+ # DW_AT_prototyped
+ .quad .LFB1 # DW_AT_low_pc
+ .quad .LFE1 # DW_AT_high_pc
+ .uleb128 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ # DW_AT_GNU_all_call_sites
+ .uleb128 0x7 # (DIE (0x79) DW_TAG_subprogram)
+ # DW_AT_external
+ .long .LASF6 # DW_AT_name: "main"
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c)
+ .byte 0x20 # DW_AT_decl_line
+ # DW_AT_prototyped
+ .long 0x59 # DW_AT_type
+ .quad .LFB2 # DW_AT_low_pc
+ .quad .LFE2 # DW_AT_high_pc
+ .uleb128 0x1 # DW_AT_frame_base
+ .byte 0x9c # DW_OP_call_frame_cfa
+ # DW_AT_GNU_all_tail_call_sites
+ .uleb128 0x8 # (DIE (0x96) DW_TAG_variable)
+ .ascii "v\0" # DW_AT_name
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c)
+ .byte 0x12 # DW_AT_decl_line
+ .long 0xa9 # DW_AT_type
+ .uleb128 0x9 # DW_AT_location
+ .byte 0x3 # DW_OP_addr
+ .quad v
+ .uleb128 0x9 # (DIE (0xa9) DW_TAG_volatile_type)
+ .long 0x59 # DW_AT_type
+ .uleb128 0xa # (DIE (0xae) DW_TAG_variable)
+ .long .LASF0 # DW_AT_name: "fail"
+ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-prologue-xmm.c)
+ .byte 0x12 # DW_AT_decl_line
+ .long 0xa9 # DW_AT_type
+ .uleb128 0x9 # DW_AT_location
+ .byte 0x3 # DW_OP_addr
+ .quad fail
+ .byte 0 # end of children of DIE 0xb
+ .section .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+ .uleb128 0x1 # (abbrev code)
+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x25 # (DW_AT_producer)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x13 # (DW_AT_language)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x1b # (DW_AT_comp_dir)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x10 # (DW_AT_stmt_list)
+ .uleb128 0x17 # (DW_FORM_sec_offset)
+ .byte 0
+ .byte 0
+ .uleb128 0x2 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0x1 # DW_children_yes
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x1 # (DW_AT_sibling)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0x3 # (abbrev code)
+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .byte 0
+ .byte 0
+ .uleb128 0x4 # (abbrev code)
+ .uleb128 0x18 # (TAG: DW_TAG_unspecified_parameters)
+ .byte 0 # DW_children_no
+ .byte 0
+ .byte 0
+ .uleb128 0x5 # (abbrev code)
+ .uleb128 0x24 # (TAG: DW_TAG_base_type)
+ .byte 0 # DW_children_no
+ .uleb128 0xb # (DW_AT_byte_size)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3e # (DW_AT_encoding)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .byte 0
+ .byte 0
+ .uleb128 0x6 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .byte 0
+ .byte 0
+ .uleb128 0x7 # (abbrev code)
+ .uleb128 0x2e # (TAG: DW_TAG_subprogram)
+ .byte 0 # DW_children_no
+ .uleb128 0x3f # (DW_AT_external)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x27 # (DW_AT_prototyped)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x11 # (DW_AT_low_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x12 # (DW_AT_high_pc)
+ .uleb128 0x1 # (DW_FORM_addr)
+ .uleb128 0x40 # (DW_AT_frame_base)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
+ .uleb128 0x19 # (DW_FORM_flag_present)
+ .byte 0
+ .byte 0
+ .uleb128 0x8 # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0x8 # (DW_FORM_string)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .byte 0
+ .byte 0
+ .uleb128 0x9 # (abbrev code)
+ .uleb128 0x35 # (TAG: DW_TAG_volatile_type)
+ .byte 0 # DW_children_no
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .byte 0
+ .byte 0
+ .uleb128 0xa # (abbrev code)
+ .uleb128 0x34 # (TAG: DW_TAG_variable)
+ .byte 0 # DW_children_no
+ .uleb128 0x3 # (DW_AT_name)
+ .uleb128 0xe # (DW_FORM_strp)
+ .uleb128 0x3a # (DW_AT_decl_file)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x3b # (DW_AT_decl_line)
+ .uleb128 0xb # (DW_FORM_data1)
+ .uleb128 0x49 # (DW_AT_type)
+ .uleb128 0x13 # (DW_FORM_ref4)
+ .uleb128 0x2 # (DW_AT_location)
+ .uleb128 0x18 # (DW_FORM_exprloc)
+ .byte 0
+ .byte 0
+ .byte 0
+ .section .debug_aranges,"",@progbits
+ .long 0x2c # Length of Address Ranges Info
+ .value 0x2 # DWARF Version
+ .long .Ldebug_info0 # Offset of Compilation Unit Info
+ .byte 0x8 # Size of Address
+ .byte 0 # Size of Segment Descriptor
+ .value 0 # Pad to 16 byte boundary
+ .value 0
+ .quad .Ltext0 # Address
+ .quad .Letext0-.Ltext0 # Length
+ .quad 0
+ .quad 0
+ .section .debug_line,"",@progbits
+.Ldebug_line0:
+ .section .debug_str,"MS",@progbits,1
+.LASF3:
+ .string ""
+.LASF0:
+ .string "fail"
+.LASF4:
+ .string "func"
+.LASF1:
+ .string "GNU C 4.6.1 20110715 (Red Hat 4.6.1-3)"
+.LASF2:
+ .string "gdb.arch/amd64-prologue-xmm.c"
+.LASF5:
+ .string "marker"
+.LASF6:
+ .string "main"
+ .ident "GCC: (GNU) 4.6.1 20110715 (Red Hat 4.6.1-3)"
+ .section .note.GNU-stack,"",@progbits

View File

@ -1,218 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-04/msg00154.html
Subject: [patch] Workaround buggy GCC PR 47510 produced code
Hi,
GCC PR debug/47510 is already fixed and GDB has the proper support for it:
RFC: update for GCC PR 47510
http://sourceware.org/ml/gdb-patches/2011-03/msg00916.html
Still FSF GDB HEAD will crash on a binary produced by older/buggy GCC:
Reading symbols from .../gcc46.o...dwarf2read.c:9329: internal-error: could not find partial DIE 0x9a in cache [from module .../gcc46.o]
Which may not give much clue to the user.
The proposed patch could make false warnings if any code out there has
DW_TAG_typedef with children, it does not check for specific GCC versions.
Still such DWARF is invalid, although in such case complaint() would be more
appropriate than warning(). Does it make sense to differentiate it?
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
Thanks,
Jan
gdb/
2011-04-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (struct dwarf2_per_objfile): New field
typedef_children_warning_printed.
(load_partial_dies): Read in any children of DW_TAG_typedef with
a warning in such case.
gdb/testsuite/
2011-04-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-typedef-children.S: New file.
* gdb.dwarf2/dw2-typedef-children.exp: New file.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -209,6 +209,9 @@ struct dwarf2_per_objfile
or we are faking it for OBJF_READNOW's sake. */
unsigned char using_index;
+ /* Print the GCC PR debug/47510 warning only once per objfile. */
+ unsigned typedef_children_warning_printed : 1;
+
/* The mapped index, or NULL if .gdb_index is missing or not being used. */
struct mapped_index *index_table;
@@ -8951,7 +8954,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
if (parent_die == NULL
&& part_die->has_specification == 0
&& part_die->is_declaration == 0
- && (part_die->tag == DW_TAG_typedef
+ && ((part_die->tag == DW_TAG_typedef && !part_die->has_children)
|| part_die->tag == DW_TAG_base_type
|| part_die->tag == DW_TAG_subrange_type))
{
@@ -8964,6 +8967,20 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
continue;
}
+ /* The exception for DW_TAG_typedef with has_children above is
+ a workaround of GCC PR debug/47510. GDB crashed on broken GCC output
+ as it skipped children of DW_TAG_typedef by the shortcut above and
+ then it could not find the child DIEs referenced later. */
+
+ if (!dwarf2_per_objfile->typedef_children_warning_printed
+ && part_die->tag == DW_TAG_typedef && part_die->has_children)
+ {
+ warning (_("DW_TAG_typedef has childen - GCC PR debug/47510 bug "
+ "- DIE at 0x%x [in module %s]"),
+ part_die->offset, cu->objfile->name);
+ dwarf2_per_objfile->typedef_children_warning_printed = 1;
+ }
+
/* If we're at the second level, and we're an enumerator, and
our parent has no specification (meaning possibly lives in a
namespace elsewhere), then we can add the partial symbol now
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-typedef-children.S
@@ -0,0 +1,92 @@
+/* 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/>. */
+
+/* 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 */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 1 /* DW_AT_language (C) */
+
+.Ltype_int:
+ .uleb128 2 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .uleb128 0x3 /* (DIE (0x38) DW_TAG_typedef) */
+ .ascii "new\0" /* DW_AT_name */
+ .long .Ltype_int - .Lcu1_begin /* DW_AT_type */
+
+ .uleb128 2 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .uleb128 0 /* End of DW_TAG_typedef */
+ .uleb128 0 /* End of DW_TAG_compile_unit */
+.Lcu1_end:
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .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 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 */
+
+ .uleb128 0x3 /* (abbrev code) */
+ .uleb128 0x16 /* (TAG: DW_TAG_typedef) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0x0
+ .byte 0x0
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-typedef-children.exp
@@ -0,0 +1,37 @@
+# Copyright 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# Note: Inspired from dw2-basic.exp.
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+set testfile "dw2-typedef-children"
+set srcfile ${testfile}.S
+set binfile ${objdir}/${subdir}/${testfile}.x
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {nodebug}] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+
+gdb_test "file $binfile" \
+ "warning: DW_TAG_typedef has childen - GCC PR debug/47510 bug - DIE at .*" \
+ "warning message"

View File

@ -40,16 +40,16 @@ Subject: [PATCH 4/4] add gdb-add-index
5 files changed, 57 insertions(+), 1 deletions(-)
create mode 100755 gdb/gdb-add-index
Index: gdb-7.2.50.20101116/gdb/Makefile.in
Index: gdb-7.4.50.20120103/gdb/Makefile.in
===================================================================
--- gdb-7.2.50.20101116.orig/gdb/Makefile.in 2010-11-16 08:03:17.000000000 +0100
+++ gdb-7.2.50.20101116/gdb/Makefile.in 2010-11-16 08:47:45.000000000 +0100
@@ -986,7 +986,16 @@ install-only: install-gstack $(CONFIG_IN
$(SHELL) $(srcdir)/../mkinstalldirs \
$(DESTDIR)$(man1dir) ; \
--- gdb-7.4.50.20120103.orig/gdb/Makefile.in 2012-01-03 05:53:25.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/Makefile.in 2012-01-03 15:24:25.693543435 +0100
@@ -1033,7 +1033,16 @@ install-only: install-gstack $(CONFIG_IN
$(INSTALL_DATA) $(srcdir)/gdb.1 \
- $(DESTDIR)$(man1dir)/$$transformed_name.1
+ $(DESTDIR)$(man1dir)/$$transformed_name.1; \
$(DESTDIR)$(man1dir)/$$transformed_name.1 ; \
$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
- $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
+ $(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h; \
+ transformed_name=`t='$(program_transform_name)'; \
+ echo gdb-add-index | sed -e "$$t"` ; \
+ if test "x$$transformed_name" = x; then \
@ -60,13 +60,13 @@ Index: gdb-7.2.50.20101116/gdb/Makefile.in
+ $(INSTALL_PROGRAM) $(srcdir)/gdb-add-index \
+ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT)
@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
.PHONY: install-tui
install-tui:
Index: gdb-7.2.50.20101116/gdb/doc/gdb.texinfo
install-python:
Index: gdb-7.4.50.20120103/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.2.50.20101116.orig/gdb/doc/gdb.texinfo 2010-11-16 08:04:18.000000000 +0100
+++ gdb-7.2.50.20101116/gdb/doc/gdb.texinfo 2010-11-16 08:56:30.000000000 +0100
@@ -15500,6 +15500,14 @@ There are currently some limitation on i
--- gdb-7.4.50.20120103.orig/gdb/doc/gdb.texinfo 2012-01-03 15:20:54.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/doc/gdb.texinfo 2012-01-03 15:23:43.295231946 +0100
@@ -16228,6 +16228,14 @@ There are currently some limitation on i
for DWARF debugging information, not stabs. And, they do not
currently work for programs using Ada.
@ -81,10 +81,10 @@ Index: gdb-7.2.50.20101116/gdb/doc/gdb.texinfo
@node Symbol Errors
@section Errors Reading Symbol Files
Index: gdb-7.2.50.20101116/gdb/gdb-add-index
Index: gdb-7.4.50.20120103/gdb/gdb-add-index
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.50.20101116/gdb/gdb-add-index 2010-11-16 08:47:45.000000000 +0100
+++ gdb-7.4.50.20120103/gdb/gdb-add-index 2012-01-03 15:23:43.296231942 +0100
@@ -0,0 +1,30 @@
+#! /bin/sh
+

View File

@ -0,0 +1,137 @@
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 53100c5..e7586ac 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -13306,6 +13306,25 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* Cache this symbol's name and the name's demangled form (if any). */
SYMBOL_SET_LANGUAGE (sym, cu->language);
linkagename = dwarf2_physname (name, die, cu);
+
+ /* Workaround for:
+ * invalid IFUNC DW_AT_linkage_name: memmove strstr time
+ * http://sourceware.org/bugzilla/show_bug.cgi?id=14166 */
+ if (strcmp (linkagename, "strstr") == 0
+ && strstr (objfile->name, "/libc") != NULL)
+ {
+ struct objfile *objfile_msym;
+ struct minimal_symbol *msym;
+
+ if (objfile->separate_debug_objfile_backlink)
+ objfile_msym = objfile->separate_debug_objfile_backlink;
+ else
+ objfile_msym = objfile;
+ msym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
+ if (msym && MSYMBOL_TYPE (msym) == mst_text_gnu_ifunc)
+ linkagename = "__strstr";
+ }
+
SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
/* Fortran does not have mangling standard and the mangling does differ
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
new file mode 100644
index 0000000..575071f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
@@ -0,0 +1,101 @@
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (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/>.
+
+# Workaround for:
+# invalid IFUNC DW_AT_linkage_name: memmove strstr time
+# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
+
+if {[skip_shlib_tests]} {
+ return 0
+}
+
+set testfile "gnu-ifunc-strstr-workaround"
+set executable ${testfile}
+set srcfile start.c
+set binfile ${objdir}/${subdir}/${executable}
+
+if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
+ return -1
+}
+
+if ![runto_main] {
+ return 0
+}
+
+set test "ptype atoi"
+gdb_test_multiple $test $test {
+ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "type = int \\(\\)\r\n$gdb_prompt $" {
+ untested "$test (no DWARF)"
+ return 0
+ }
+}
+
+set addr ""
+set test "print strstr"
+gdb_test_multiple $test $test {
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
+ set addr $expect_out(1,string)
+ pass $test
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
+ set addr $expect_out(1,string)
+ pass "$test (GDB workaround or future fixed glibc)"
+ }
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ untested "$test (gnu-ifunc not in use by glibc)"
+ return 0
+ }
+}
+
+set test "info sym"
+gdb_test_multiple "info sym $addr" $test {
+ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ # unexpected
+ xfail "$test (not in libc.so.6)"
+ return 0
+ }
+}
+
+set test "info addr strstr"
+gdb_test_multiple $test $test {
+ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
+ fail "$test (DWARF for strstr)"
+ }
+ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
+ pass "$test"
+ }
+}
+
+set test "print strstr second time"
+gdb_test_multiple "print strstr" $test {
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
+ pass "$test (GDB workaround or future fixed glibc)"
+ }
+ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
+ fail $test
+ }
+}
+
+gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
+gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}

View File

@ -0,0 +1,30 @@
http://sourceware.org/ml/gdb-patches/2011-08/msg00331.html
Subject: [RFC] Work around PR libc/13097 "linux-vdso.so.1" #2
Hi,
missed the x86_64-m32 case:
gdb/
2011-08-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Work around PR libc/13097.
* solib.c (update_solib_list): Ignore "linux-vdso.so.1".
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -783,8 +783,11 @@ update_solib_list (int from_tty, struct target_ops *target)
TRY_CATCH (e, RETURN_MASK_ERROR)
{
- /* Fill in the rest of the `struct so_list' node. */
- if (!solib_map_sections (i))
+ /* Fill in the rest of the `struct so_list' node.
+ Work around PR libc/13097. */
+ if (!solib_map_sections (i)
+ && strcmp (i->so_original_name, "linux-vdso.so.1") != 0
+ && strcmp (i->so_original_name, "linux-gate.so.1") != 0)
{
not_found++;
if (not_found_filename == NULL)

60
gdb-index-assert.patch Normal file
View File

@ -0,0 +1,60 @@
http://sourceware.org/ml/gdb-patches/2012-06/msg00109.html
Subject: [RFA] Fix inconsistency in blockvector addrmap vs non-addrmap handling
Hi.
I was seeing the assert in dw2_find_pc_sect_psymtab trigger
and traced it to the fact that when pending_addrmap_interesting gets
set blockvector.map is used instead of blockvector.block.
The difference is that blockvector.block contains entries for the global
and static blocks whereas pending_addrmap doesn't.
This patch fixes this by making them consistent.
I suspect more work is necessary (e.g. can symtabs "overlap" even though
the individual pieces do not?).
But I first want to fix the regression introduced by the change
to dw2_find_pc_sect_psymtab: There is more code in a symtab than is
documented by function and lexical block pc ranges (e.g. C++ method thunks).
Regression tested on amd64-linux, and by verifying the assert no longer
triggers in the testcase I was using.
Ok to commit?
Note that this obviates the need for the patch in:
http://sourceware.org/ml/gdb-patches/2012-05/msg00958.html
Also note that this accompanies this patch:
http://sourceware.org/ml/gdb-patches/2012-06/msg00105.html
2012-06-04 Doug Evans <dje@google.com>
* buildsym.c (end_symtab): Add the range of the static block to
the pending addrmap.
Index: buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.97
diff -u -p -r1.97 buildsym.c
--- ./gdb/buildsym.c 29 May 2012 20:23:17 -0000 1.97
+++ ./gdb/buildsym.c 5 Jun 2012 00:26:01 -0000
@@ -1024,8 +1027,15 @@ end_symtab (CORE_ADDR end_addr, struct o
{
/* Define the STATIC_BLOCK & GLOBAL_BLOCK, and build the
blockvector. */
- finish_block (0, &file_symbols, 0, last_source_start_addr,
- end_addr, objfile);
+ struct block *static_block;
+
+ static_block = finish_block (0, &file_symbols, 0,
+ last_source_start_addr, end_addr,
+ objfile);
+ /* Mark the range of the static block so that if we end up using
+ blockvector.map then find_block_in_blockvector behaves identically
+ regardless of whether the addrmap is present. */
+ record_block_range (static_block, last_source_start_addr, end_addr - 1);
finish_block_internal (0, &global_symbols, 0, last_source_start_addr,
end_addr, objfile, 1);
blockvector = make_blockvector (objfile);

215
gdb-objfile-order.patch Normal file
View File

@ -0,0 +1,215 @@
http://sourceware.org/ml/gdb-patches/2012-05/msg01105.html
Subject: [RFA/commit 1/3] Revert "Search global symbols from the expression's block objfile first."
The search order used in this patch breaks global symbol lookups
for certain symbols when copy-relocation is used. A slightly different
search order will be implemented later.
gdb/ChangeLog:
Revert the following patch:
* findvar.c (default_read_var_value): For LOC_UNRESOLVED symbols,
try locating the symbol in the symbol's own objfile first, before
extending the search to all objfiles.
* symtab.c (lookup_symbol_aux_objfile): New function, extracted
out of lookup_symbol_aux_symtabs.
(lookup_symbol_aux_symtabs): Add new parameter "exclude_objfile".
Replace extracted-out code by call to lookup_symbol_aux_objfile.
Do not search EXCLUDE_OBJFILE.
(lookup_static_symbol_aux): Update call to lookup_symbol_aux_symtabs.
(lookup_symbol_global): Search for matches in the block's objfile
first, before searching all other objfiles.
Will commit if patches #2 & #3 are OK.
---
gdb/findvar.c | 10 +-----
gdb/symtab.c | 108 +++++++++++++++++----------------------------------------
2 files changed, 33 insertions(+), 85 deletions(-)
diff --git a/gdb/findvar.c b/gdb/findvar.c
index ed7903c..9009e6f 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -562,15 +562,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
struct minimal_symbol *msym;
struct obj_section *obj_section;
- /* First, try locating the associated minimal symbol within
- the same objfile. This prevents us from selecting another
- symbol with the same name but located in a different objfile. */
- msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL,
- SYMBOL_SYMTAB (var)->objfile);
- /* If the lookup failed, try expanding the search to all
- objfiles. */
- if (msym == NULL)
- msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL);
+ msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL);
if (msym == NULL)
error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var));
if (overlay_debugging)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 85ddd1d..39d8c6f 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -95,8 +95,7 @@ struct symbol *lookup_symbol_aux_local (const char *name,
static
struct symbol *lookup_symbol_aux_symtabs (int block_index,
const char *name,
- const domain_enum domain,
- struct objfile *exclude_objfile);
+ const domain_enum domain);
static
struct symbol *lookup_symbol_aux_quick (struct objfile *objfile,
@@ -1360,7 +1359,7 @@ lookup_static_symbol_aux (const char *name, const domain_enum domain)
struct objfile *objfile;
struct symbol *sym;
- sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain, NULL);
+ sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
if (sym != NULL)
return sym;
@@ -1499,61 +1498,40 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
return NULL;
}
-/* Check to see if the symbol is defined in one of the OBJFILE's
- symtabs. BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK,
+/* Check to see if the symbol is defined in one of the symtabs.
+ BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK,
depending on whether or not we want to search global symbols or
static symbols. */
static struct symbol *
-lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
- const char *name, const domain_enum domain)
-{
- struct symbol *sym = NULL;
- struct blockvector *bv;
- const struct block *block;
- struct symtab *s;
-
- if (objfile->sf)
- objfile->sf->qf->pre_expand_symtabs_matching (objfile, block_index,
- name, domain);
-
- ALL_OBJFILE_SYMTABS (objfile, s)
- if (s->primary)
- {
- bv = BLOCKVECTOR (s);
- block = BLOCKVECTOR_BLOCK (bv, block_index);
- sym = lookup_block_symbol (block, name, domain);
- if (sym)
- {
- block_found = block;
- return fixup_symbol_section (sym, objfile);
- }
- }
-
- return NULL;
-}
-
-/* Same as lookup_symbol_aux_objfile, except that it searches all
- objfiles except for EXCLUDE_OBJFILE. Return the first match found.
-
- If EXCLUDE_OBJFILE is NULL, then all objfiles are searched. */
-
-static struct symbol *
lookup_symbol_aux_symtabs (int block_index, const char *name,
- const domain_enum domain,
- struct objfile *exclude_objfile)
+ const domain_enum domain)
{
struct symbol *sym;
struct objfile *objfile;
+ struct blockvector *bv;
+ const struct block *block;
+ struct symtab *s;
ALL_OBJFILES (objfile)
{
- if (objfile != exclude_objfile)
- {
- sym = lookup_symbol_aux_objfile (objfile, block_index, name, domain);
- if (sym)
- return sym;
- }
+ if (objfile->sf)
+ objfile->sf->qf->pre_expand_symtabs_matching (objfile,
+ block_index,
+ name, domain);
+
+ ALL_OBJFILE_SYMTABS (objfile, s)
+ if (s->primary)
+ {
+ bv = BLOCKVECTOR (s);
+ block = BLOCKVECTOR_BLOCK (bv, block_index);
+ sym = lookup_block_symbol (block, name, domain);
+ if (sym)
+ {
+ block_found = block;
+ return fixup_symbol_section (sym, objfile);
+ }
+ }
}
return NULL;
@@ -1679,46 +1657,24 @@ lookup_symbol_global (const char *name,
const domain_enum domain)
{
struct symbol *sym = NULL;
- struct objfile *block_objfile = NULL;
struct objfile *objfile = NULL;
/* Call library-specific lookup procedure. */
- block_objfile = lookup_objfile_from_block (block);
- if (block_objfile != NULL)
- sym = solib_global_lookup (block_objfile, name, domain);
+ objfile = lookup_objfile_from_block (block);
+ if (objfile != NULL)
+ sym = solib_global_lookup (objfile, name, domain);
if (sym != NULL)
return sym;
- /* If BLOCK_OBJFILE is not NULL, then search this objfile first.
- In case the global symbol is defined in multiple objfiles,
- we have a better chance of finding the most relevant symbol. */
-
- if (block_objfile != NULL)
- {
- sym = lookup_symbol_aux_objfile (block_objfile, GLOBAL_BLOCK,
- name, domain);
- if (sym == NULL)
- sym = lookup_symbol_aux_quick (block_objfile, GLOBAL_BLOCK,
- name, domain);
- if (sym != NULL)
- return sym;
- }
-
- /* Symbol not found in the BLOCK_OBJFILE, so try all the other
- objfiles, starting with symtabs first, and then partial symtabs. */
-
- sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain, block_objfile);
+ sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain);
if (sym != NULL)
return sym;
ALL_OBJFILES (objfile)
{
- if (objfile != block_objfile)
- {
- sym = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK, name, domain);
- if (sym)
- return sym;
- }
+ sym = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK, name, domain);
+ if (sym)
+ return sym;
}
return NULL;
--
1.7.1

19
gdb-ppc-ptrace.diff Normal file
View File

@ -0,0 +1,19 @@
Index: gdb-7.4.50.20120603/gdb/ppc-linux-nat.c
===================================================================
--- gdb-7.4.50.20120603.orig/gdb/ppc-linux-nat.c 2012-06-01 00:07:31.000000000 +0200
+++ gdb-7.4.50.20120603/gdb/ppc-linux-nat.c 2012-06-12 15:17:59.537703950 +0200
@@ -1418,8 +1418,12 @@ have_ptrace_booke_interface (void)
if (tid == 0)
tid = PIDGET (inferior_ptid);
- /* Check for kernel support for BOOKE debug registers. */
- if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &booke_debug_info) >= 0)
+ /* Check for kernel support for BOOKE debug registers.
+ As a workaround while the new ptrace interface is not accepted
+ in upstream kernel, server processors still should use the old
+ interface. */
+ if (ptrace (PPC_PTRACE_GETHWDBGINFO, tid, 0, &booke_debug_info) >= 0
+ && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
{
/* Check whether ptrace BOOKE interface is functional and
provides any supported feature. */

View File

@ -1,141 +0,0 @@
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)".

44
gdb-python-rdynamic.patch Normal file
View File

@ -0,0 +1,44 @@
--- a/gdb/configure
+++ b/gdb/configure
@@ -14631,6 +14631,10 @@ rm -f core conftest.err conftest.$ac_objext \
# Problem does not happen for the recommended libpythonX.Y.so linkage.
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+ old_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+ old_LIBS="$LIBS"
+ LIBS="$LIBS $PYTHON_LIBS"
if test "$cross_compiling" = yes; then :
true
else
@@ -14657,6 +14661,8 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
fi
CFLAGS="$old_CFLAGS"
+ CPPFLAGS="$old_CPPFLAGS"
+ LIBS="$old_LIBS"
fi
LDFLAGS="$old_LDFLAGS"
fi
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1576,6 +1576,10 @@ if test "${gdb_native}" = yes; then
# Problem does not happen for the recommended libpythonX.Y.so linkage.
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PYTHON_CFLAGS"
+ old_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+ old_LIBS="$LIBS"
+ LIBS="$LIBS $PYTHON_LIBS"
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
[#include "]${have_libpython}[/Python.h"],
@@ -1586,6 +1590,8 @@ if test "${gdb_native}" = yes; then
return err == 0 ? 0 : 1;]),
[dynamic_list=true], [], [true])
CFLAGS="$old_CFLAGS"
+ CPPFLAGS="$old_CPPFLAGS"
+ LIBS="$old_LIBS"
fi
LDFLAGS="$old_LDFLAGS"
fi

View File

@ -0,0 +1,14 @@
--- gdb-7.4.50.20120103-orig/gdb/event-top.c 2012-01-11 15:14:01.426206439 +0100
+++ gdb-7.4.50.20120103/gdb/event-top.c 2012-01-11 15:18:29.766577551 +0100
@@ -982,6 +982,11 @@ set_async_editing_command (char *args, i
void
gdb_setup_readline (void)
{
+ /* 6.2 regression: no longed asks for --more--
+ gdb.base/readline-ask.exp
+ https://bugzilla.redhat.com/show_bug.cgi?id=701131 */
+ RL_SETSTATE (RL_STATE_FEDORA_GDB);
+
/* This function is a noop for the sync case. The assumption is
that the sync setup is ALL done in gdb_init, and we would only
mess it up here. The sync stuff should really go away over

View File

@ -0,0 +1,40 @@
make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp
gcc -fpic -c -fPIE -pie -o x.o x.c
/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
=> Change the order for overrides.
One has to also use -fPIC rather than -fPIE, -fPIC is stronger.
The correct way would be:
make check//unix RUNTESTFLAGS='CC_FOR_TARGET=gcc\ -fPIC\ -pie CXX_FOR_TARGET=g++\ -fPIC\ -pie solib-display.exp'
But there is a problem with testsuite.unix non-unique subdir name and also
a problem with make -j parallelization of the testsuite.
--- gdb-7.3.50.20110722/gdb/testsuite/lib/future.exp 2011-10-11 16:44:05.000000000 +0200
+++ gdb-7.3.50.20110722/gdb/testsuite/lib/future.exp 2011-10-11 16:44:10.000000000 +0200
@@ -77,6 +77,10 @@ proc gdb_default_target_compile {source
set ldflags ""
set dest [target_info name]
+ if {[board_info $dest exists multilib_flags]} {
+ append add_flags " [board_info $dest multilib_flags]"
+ }
+
if {[info exists CFLAGS_FOR_TARGET]} {
append add_flags " $CFLAGS_FOR_TARGET"
}
@@ -333,10 +337,6 @@ proc gdb_default_target_compile {source
}
}
- if {[board_info $dest exists multilib_flags]} {
- append add_flags " [board_info $dest multilib_flags]"
- }
-
verbose "doing compile"
set sources ""

174
gdb-stale-frame_info.patch Normal file
View File

@ -0,0 +1,174 @@
http://sourceware.org/ml/gdb-patches/2012-04/msg00058.html
Subject: [downstream patch FYI] workaround stale frame_info * (PR 13866)
Hi,
I did not look at which commit caused this regression but apparently it was
introduced at least with multi-inferiors.
I understand this fix is not right fix of the crash; but in most GDB cases one
does not use multi-inferior so why to regress single-inferior by it.
Some more simple solutions still fix the single-inferior mode but they
regressed the multi-inferior mode
gdb.threads/no-unwaited-for-left.exp
gdb.multi/base.exp
so I had to put there that sorting magic.
With proper C++ sanity check of stale live frame_info references the testcase
would be simple without the "frame_garbage_collection" reproducer below.
It is also reproducible just with valgrind but regularly running the whole
testsuite under valgrind I did not find feasible.
No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
Thanks,
Jan
gdb/
2012-04-04 Jan Kratochvil <jan.kratochvil@redhat.com>
Workaround PR backtrace/13866.
* progspace.c (switch_to_program_space_and_thread): Try not to call
switch_to_thread.
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -481,17 +481,28 @@ save_current_space_and_thread (void)
void
switch_to_program_space_and_thread (struct program_space *pspace)
{
- struct inferior *inf;
+ struct inferior *inf = current_inferior ();
- inf = find_inferior_for_program_space (pspace);
+ if (inf->pspace != pspace)
+ inf = find_inferior_for_program_space (pspace);
if (inf != NULL)
{
- struct thread_info *tp;
+ struct thread_info *tp, *current_tp = NULL;
+
+ if (ptid_get_pid (inferior_ptid) == inf->pid)
+ current_tp = find_thread_ptid (inferior_ptid);
tp = any_live_thread_of_process (inf->pid);
if (tp != NULL)
{
- switch_to_thread (tp->ptid);
+ /* Prefer primarily thread not THREAD_EXITED and secondarily thread
+ not EXECUTING. */
+ if (current_tp == NULL
+ || (tp->state != THREAD_EXITED
+ && current_tp->state == THREAD_EXITED)
+ || (!tp->executing && current_tp->executing))
+ switch_to_thread (tp->ptid);
+
/* Switching thread switches pspace implicitly. We're
done. */
return;
Reproducer with:
./gdb -nx ~/t/thread -ex 'b 24' -ex r -ex 'until 25'
Breakpoint 1, main () at /home/jkratoch/t/thread.c:24
24 v++;
Segmentation fault (core dumped)
#include <pthread.h>
#include <assert.h>
#include <unistd.h>
static int v;
static void *start (void *arg)
{
v++;
v++;
v++;
v++;
sleep (100);
return arg;
}
int main (void)
{
pthread_t thread1;
int i;
i = pthread_create (&thread1, NULL, start, NULL);
assert (i == 0);
v++;
v++;
v++;
v++;
i = pthread_join (thread1, NULL);
assert (i == 0);
return 0;
}
### --- a/gdb/frame.c
### +++ b/gdb/frame.c
### @@ -1522,12 +1522,30 @@ frame_observer_target_changed (struct target_ops *target)
### reinit_frame_cache ();
### }
###
### +typedef struct obstack obstack_s;
### +DEF_VEC_O (obstack_s);
### +static VEC (obstack_s) *frame_poison_vec;
### +
### +void frame_garbage_collection (void);
### +void
### +frame_garbage_collection (void)
### +{
### + struct obstack *obstack_p;
### + int ix;
### +
### + for (ix = 0; VEC_iterate (obstack_s, frame_poison_vec, ix, obstack_p); ix++)
### + obstack_free (obstack_p, 0);
### +
### + VEC_free (obstack_s, frame_poison_vec);
### + frame_poison_vec = NULL;
### +}
### +
### /* Flush the entire frame cache. */
###
### void
### reinit_frame_cache (void)
### {
### - struct frame_info *fi;
### + struct frame_info *fi, *fi_prev;
###
### /* Tear down all frame caches. */
### for (fi = current_frame; fi != NULL; fi = fi->prev)
### @@ -1538,8 +1556,14 @@ reinit_frame_cache (void)
### fi->base->unwind->dealloc_cache (fi, fi->base_cache);
### }
###
### + for (fi = current_frame; fi != NULL; fi = fi_prev)
### + {
### + fi_prev = fi->prev;
### + memset (fi, 0, sizeof (*fi));
### + }
### + VEC_safe_push (obstack_s, frame_poison_vec, &frame_cache_obstack);
### +
### /* Since we can't really be sure what the first object allocated was. */
### - obstack_free (&frame_cache_obstack, 0);
### obstack_init (&frame_cache_obstack);
###
### if (current_frame != NULL)
### --- a/gdb/top.c
### +++ b/gdb/top.c
### @@ -359,6 +359,11 @@ prepare_execute_command (void)
### if (non_stop)
### target_dcache_invalidate ();
###
### + {
### + extern void frame_garbage_collection (void);
### + frame_garbage_collection ();
### + }
### +
### return cleanup;
### }
###

View File

@ -1,57 +0,0 @@
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -355,9 +355,7 @@ stap_free_args_info (void *args_info_ptr)
int i;
for (i = 0; i < a->n_args; i++)
- {
- xfree (a->arg[i].arg_str);
- }
+ xfree (a->arg[i].arg_str);
xfree (a->arg);
xfree (a);
@@ -401,6 +399,7 @@ stap_parse_probe_arguments (struct stap_probe *probe)
return;
args_info = xmalloc (sizeof (struct stap_args_info));
+ args_info->n_args = 0;
back_to = make_cleanup (stap_free_args_info, args_info);
args_info->arg = xcalloc (STAP_MAX_ARGS, sizeof (struct stap_probe_arg));
@@ -493,6 +492,7 @@ stap_parse_probe_arguments (struct stap_probe *probe)
args_info->arg[current_arg].arg_str
= savestring (start, cur - start);
+ ++args_info->n_args;
/* Start it over again. */
cur = skip_spaces ((char *) cur);
current_state = NEW_ARG;
@@ -513,7 +513,6 @@ stap_parse_probe_arguments (struct stap_probe *probe)
}
}
- args_info->n_args = current_arg + 1;
args_info->arg = xrealloc (args_info->arg,
args_info->n_args
* sizeof (struct stap_probe_arg));
@@ -1526,8 +1525,9 @@ stap_free_parsed_args (struct stap_args_info *parsed_args)
return;
for (i = 0; i < parsed_args->n_args; i++)
- xfree (parsed_args->arg);
+ xfree (parsed_args->arg[i].arg_str);
+ xfree (parsed_args->arg);
xfree (parsed_args);
}
@@ -1859,7 +1859,7 @@ parse_stap_probe (char **argptr, struct linespec_result *canonical)
if (canonical)
{
canonical->canonical = xrealloc (canonical->canonical,
- result.nelts * sizeof (char **));
+ result.nelts * sizeof (char *));
canonical->canonical[result.nelts - 1] = xstrdup (full_arg);
}
}

View File

@ -1,98 +0,0 @@
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.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.c
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.c 2011-03-31 21:59:26.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.c 2011-04-11 19:42:10.000000000 +0200
@@ -44,6 +44,10 @@ struct lazystring {
const char *lazy_str;
};
+struct hint_error {
+ int x;
+};
+
#ifdef __cplusplus
struct S : public s {
int zs;
@@ -215,6 +219,7 @@ main ()
nostring_type nstype, nstype2;
struct ns ns, ns2;
struct lazystring estring, estring2;
+ struct hint_error hint_error;
nstype.elements = narray;
nstype.len = 0;
Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.exp
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-03-07 17:03:03.000000000 +0100
+++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-04-11 19:41:56.000000000 +0200
@@ -97,6 +97,8 @@ proc run_lang_tests {lang} {
gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>"
+ gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"
+
gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.py
===================================================================
--- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.py 2011-03-31 21:59:26.000000000 +0200
+++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.py 2011-04-11 19:41:56.000000000 +0200
@@ -161,6 +161,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"
@@ -246,6 +258,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 ()

View File

@ -1,44 +0,0 @@
[RFA/commit 5/5] Add -Wunused-function to compile flags.
http://sourceware.org/ml/gdb-patches/2010-01/msg00371.html
http://sourceware.org/ml/gdb-cvs/2010-01/msg00163.html
REVERTED
--- src/gdb/configure.ac 2010/01/15 00:34:37 1.112
+++ src/gdb/configure.ac 2010/01/19 09:52:31 1.113
@@ -1544,8 +1544,7 @@
# gdb/doc/gdbint.texinfo.
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wformat-nonliteral -Wno-pointer-sign \
--Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts"
+-Wno-unused -Wunused-value -Wno-switch -Wno-char-subscripts"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
--- src/gdb/configure 2010/01/15 00:34:37 1.297
+++ src/gdb/configure 2010/01/19 09:52:32 1.298
@@ -13435,8 +13435,7 @@
# gdb/doc/gdbint.texinfo.
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wformat-nonliteral -Wno-pointer-sign \
--Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts"
+-Wno-unused -Wunused-value -Wno-switch -Wno-char-subscripts"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
### src/gdb/ChangeLog 2010/01/19 09:50:48 1.11271
### src/gdb/ChangeLog 2010/01/19 09:52:33 1.11272
## -1,11 +1,5 @@
2010-01-19 Joel Brobecker <brobecker@adacore.com>
- Add -Wunused-function to compile flags.
- * configure.ac: Add -Wunused-function to build_warnings.
- * configure: Regenerate.
-
-2010-01-19 Joel Brobecker <brobecker@adacore.com>
-
"delete" ada-lex.c:input function, not used.
* ada-lex.l: #define YY_NO_INPUT.

293
gdb-upstream.patch Normal file
View File

@ -0,0 +1,293 @@
http://sourceware.org/ml/gdb-patches/2012-06/msg00065.html
Subject: [commit 1/2] testsuite: code_elim.exp: unique names
Hi,
this is just removal of non-unique test names and one small simplification.
Checked in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2012-06/msg00011.html
### src/gdb/testsuite/ChangeLog 2012/05/28 20:37:29 1.3209
### src/gdb/testsuite/ChangeLog 2012/06/03 17:06:04 1.3210
## -1,3 +1,16 @@
+2012-06-03 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.base/code_elim.exp (add-symbol-file ${testfile1} 0x100000):
+ Simplify it to ...
+ (symbol-file ${testfile1}): ... here.
+ (test eliminated var my_global_symbol)
+ (test eliminated var my_static_symbol)
+ (test eliminated var my_global_func, get address of main): Wrap them to
+ 'single psymtabs' and 'single symtabs'
+ (get address of my_global_symbol, get address of my_static_symbol)
+ (get address of my_global_func, get address of main): Wrap them to
+ 'order1' and 'order2'.
+
2012-05-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.server/solib-list-lib.c: New file.
--- src/gdb/testsuite/gdb.base/code_elim.exp 2012/01/16 16:21:44 1.4
+++ src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:06:04 1.5
@@ -95,16 +95,16 @@
gdb_exit
gdb_start
-gdb_test "add-symbol-file ${binfile1} 0x100000" \
+gdb_test "symbol-file ${binfile1}" \
"Reading symbols from .*${testfile1}\\.\\.\\.done\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)" \
- "add-symbol-file ${testfile1} 0x100000" \
- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
- "y"
+ "symbol-file ${testfile1}"
-test_eliminated_var my_global_symbol
-test_eliminated_var my_static_symbol
-test_eliminated_var my_global_func
-not_null_var_address main
+with_test_prefix "single psymtabs" {
+ test_eliminated_var my_global_symbol
+ test_eliminated_var my_static_symbol
+ test_eliminated_var my_global_func
+ not_null_var_address main
+}
# Same thing for symtabs
@@ -115,10 +115,12 @@
gdb_start
set GDBFLAGS $saved_gdbflags
-test_eliminated_var my_global_symbol
-test_eliminated_var my_static_symbol
-test_eliminated_var my_global_func
-not_null_var_address main
+with_test_prefix "single symtabs" {
+ test_eliminated_var my_global_symbol
+ test_eliminated_var my_static_symbol
+ test_eliminated_var my_global_func
+ not_null_var_address main
+}
# binfile2 contains the symbols that have been eliminated in binfile1. Check
# the eliminated symbols does not hide these valid ones.
@@ -138,10 +140,12 @@
"add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \
"y"
-not_null_var_address my_global_symbol
-not_null_var_address my_static_symbol
-not_null_var_address my_global_func
-not_null_var_address main
+with_test_prefix "order1" {
+ not_null_var_address my_global_symbol
+ not_null_var_address my_static_symbol
+ not_null_var_address my_global_func
+ not_null_var_address main
+}
# Same thing, but loading binfile2 before binfile1.
@@ -160,9 +164,9 @@
"add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
"y"
-not_null_var_address my_global_symbol
-not_null_var_address my_static_symbol
-not_null_var_address my_global_func
-not_null_var_address main
-
-
+with_test_prefix "order2" {
+ not_null_var_address my_global_symbol
+ not_null_var_address my_static_symbol
+ not_null_var_address my_global_func
+ not_null_var_address main
+}
http://sourceware.org/ml/gdb-patches/2012-06/msg00066.html
Subject: [commit 2/2] testsuite: code_elim.exp: Fix false FAIL
Hi,
with Fedora 18 x86_64 (Rawhide) there is a false FAIl since:
2167931cf70f91206efb8b01e848a55d82a347ce is the first bad commit
Author: Tom Tromey <tromey@redhat.com>
Date: Fri May 18 15:31:39 2012 +0000
http://sourceware.org/bugzilla/show_bug.cgi?id=13907
print &my_global_symbol
-$1 = (int *) 0x804a004
-(gdb) PASS: gdb.base/code_elim.exp: get address of my_global_symbol
+$1 = (int *) 0x804a004 <completed.5732>
+(gdb) FAIL: gdb.base/code_elim.exp: get address of my_global_symbol
Nothing really changed, just GDB now prints <completed.5732> and the testcase
expects either none or <my_global_symbol> suffix.
This is because the two symbol files (their sections .data/.bss) have
overlapped so GDB chooses randomly which symbol to display. And since
Fedora 18 GCC puts there that "completed.5732" symbol.
This may be because add-symbol-file FILE ADDR relocates to ADDR on the .text
section and leaves other sections at their original place, which is IMO a bit
unexpected; it is a FAQ people expect more ADDR to be relocation displacement
(and not relative to .text and not limited to .text). But this is really
outside of the scope of this testcase false FAIL.
Checked in.
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2012-06/msg00012.html
### src/gdb/testsuite/ChangeLog 2012/06/03 17:06:04 1.3210
### src/gdb/testsuite/ChangeLog 2012/06/03 17:10:28 1.3211
## -11,6 +11,16 @@
(get address of my_global_func, get address of main): Wrap them to
'order1' and 'order2'.
+ * gdb.base/code_elim.exp
+ (add-symbol-file ${testfile1} 0x100000)
+ (add-symbol-file ${testfile2} 0x200000): Wrap them to 'order1' and
+ 'order2'.
+ (order1: add-symbol-file ${testfile1} 0x100000)
+ (order1: add-symbol-file ${testfile2} 0x200000)
+ (order2: add-symbol-file ${testfile2} 0x200000)
+ (order2: add-symbol-file ${testfile1} 0x100000): Add -s .data and -s
+ .bss as appropriate.
+
2012-05-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.server/solib-list-lib.c: New file.
--- src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:06:04 1.5
+++ src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:10:28 1.6
@@ -128,19 +128,19 @@
gdb_exit
gdb_start
-gdb_test "add-symbol-file ${binfile1} 0x100000" \
- "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile1} 0x100000" \
- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
- "y"
-
-gdb_test "add-symbol-file ${binfile2} 0x200000" \
- "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile2} 0x200000" \
- "add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \
- "y"
-
with_test_prefix "order1" {
+ gdb_test "add-symbol-file ${binfile1} 0x100000 -s .bss 0x120000" \
+ "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile1} 0x100000" \
+ "add symbol table from file \".*${testfile1}\" at.*\\(y or n\\) " \
+ "y"
+
+ gdb_test "add-symbol-file ${binfile2} 0x200000 -s .data 0x210000 -s .bss 0x220000" \
+ "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile2} 0x200000" \
+ "add symbol table from file \".*${testfile2}\" at.*\\(y or n\\) " \
+ "y"
+
not_null_var_address my_global_symbol
not_null_var_address my_static_symbol
not_null_var_address my_global_func
@@ -152,19 +152,19 @@
gdb_exit
gdb_start
-gdb_test "add-symbol-file ${binfile2} 0x200000" \
- "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile2} 0x200000" \
- "add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \
- "y"
-
-gdb_test "add-symbol-file ${binfile1} 0x100000" \
- "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
- "add-symbol-file ${testfile1} 0x100000" \
- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \
- "y"
-
with_test_prefix "order2" {
+ gdb_test "add-symbol-file ${binfile2} 0x200000 -s .data 0x210000 -s .bss 0x220000" \
+ "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile2} 0x200000" \
+ "add symbol table from file \".*${testfile2}\" at.*\\(y or n\\) " \
+ "y"
+
+ gdb_test "add-symbol-file ${binfile1} 0x100000 -s .bss 0x120000" \
+ "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \
+ "add-symbol-file ${testfile1} 0x100000" \
+ "add symbol table from file \".*${testfile1}\" at.*\\(y or n\\) " \
+ "y"
+
not_null_var_address my_global_symbol
not_null_var_address my_static_symbol
not_null_var_address my_global_func
http://sourceware.org/ml/gdb-cvs/2012-06/msg00047.html
### src/gdb/ChangeLog 2012/06/06 06:04:42 1.14330
### src/gdb/ChangeLog 2012/06/06 16:57:34 1.14331
## -1,3 +1,8 @@
+2012-06-06 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * configure.ac: Move development=true below AC_INIT.
+ * configure: Regenerate.
+
2012-06-05 Stan Shebs <stan@codesourcery.com>
* mi/mi-interp.c (mi_interpreter_init): Set raw_stdout from
--- src/gdb/configure 2012/06/01 18:20:18 1.366
+++ src/gdb/configure 2012/06/06 16:57:36 1.367
@@ -2683,6 +2683,11 @@
+# Provide more thorough testing by -lmcheck.
+# Set it to 'true' for development snapshots, 'false' for releases or
+# pre-releases.
+development=true
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
--- src/gdb/configure.ac 2012/06/01 18:20:18 1.177
+++ src/gdb/configure.ac 2012/06/06 16:57:38 1.178
@@ -18,16 +18,16 @@
dnl Process this file with autoconf to produce a configure script.
-dnl Provide more thorough testing by -lmcheck.
-dnl Set it to 'true' for development snapshots, 'false' for releases or
-dnl pre-releases.
-development=true
-
AC_PREREQ(2.59)dnl
AC_INIT(main.c)
AC_CONFIG_HEADER(config.h:config.in)
AM_MAINTAINER_MODE
+# Provide more thorough testing by -lmcheck.
+# Set it to 'true' for development snapshots, 'false' for releases or
+# pre-releases.
+development=true
+
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
ACX_LARGEFILE

119
gdb-x86-onstack-1of2.patch Normal file
View File

@ -0,0 +1,119 @@
http://sourceware.org/ml/gdb-patches/2012-03/msg00357.html
Subject: [patch 1/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5
Hi,
posted as a new thread.
As described in
cancel: [patch] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #4 [Re: [revert] Regression on PowerPC]
http://sourceware.org/ml/gdb-patches/2012-03/msg00322.html
just ON_STACK had some regressions.
The expectations in that mail were wrong (at least that cleanup/fix is not
required for gdb.cp/gdb2495.exp).
The problem is that the inferior call return pad breakpoint instruction is
never removed even after inferior call finishes. It is even still visible in
"maintenance info breakpoints". This does not matter much for AT_ENTRY_POINT
but for ON_STACK it just corrupts stack.
No regressions on
{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for
gdbsever non-extended mode.
Thanks,
Jan
gdb/
2012-03-09 Jan Kratochvil <jan.kratochvil@redhat.com>
Remove momentary breakpoints for completed inferior calls.
* dummy-frame.c: Include gdbthread.h.
(pop_dummy_frame_bpt): New function.
(pop_dummy_frame): Initialie DUMMY earlier. Call pop_dummy_frame_bpt.
gdb/testsuite/
2012-03-09 Jan Kratochvil <jan.kratochvil@redhat.com>
Remove momentary breakpoints for completed inferior calls.
* gdb.base/call-signal-resume.exp (maintenance print dummy-frames)
(maintenance info breakpoints): New tests.
Index: gdb-7.4.50.20120602/gdb/dummy-frame.c
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/dummy-frame.c 2012-01-04 09:17:00.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/dummy-frame.c 2012-06-02 20:42:40.907720327 +0200
@@ -29,6 +29,7 @@
#include "gdbcmd.h"
#include "gdb_string.h"
#include "observer.h"
+#include "gdbthread.h"
/* Dummy frame. This saves the processor state just prior to setting
up the inferior function call. Older targets save the registers
@@ -108,19 +109,36 @@ remove_dummy_frame (struct dummy_frame *
xfree (dummy);
}
+/* Delete any breakpoint B which is a momentary breakpoint for return from
+ inferior call matching DUMMY_VOIDP. */
+
+static int
+pop_dummy_frame_bpt (struct breakpoint *b, void *dummy_voidp)
+{
+ struct dummy_frame *dummy = dummy_voidp;
+
+ if (b->disposition == disp_del && frame_id_eq (b->frame_id, dummy->id)
+ && b->thread == pid_to_thread_id (inferior_ptid))
+ delete_breakpoint (b);
+
+ /* Continue the traversal. */
+ return 0;
+}
+
/* Pop *DUMMY_PTR, restoring program state to that before the
frame was created. */
static void
pop_dummy_frame (struct dummy_frame **dummy_ptr)
{
- struct dummy_frame *dummy;
+ struct dummy_frame *dummy = *dummy_ptr;
+
+ restore_infcall_suspend_state (dummy->caller_state);
- restore_infcall_suspend_state ((*dummy_ptr)->caller_state);
+ iterate_over_breakpoints (pop_dummy_frame_bpt, dummy);
/* restore_infcall_control_state frees inf_state,
all that remains is to pop *dummy_ptr. */
- dummy = *dummy_ptr;
*dummy_ptr = dummy->next;
xfree (dummy);
Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/call-signal-resume.exp
===================================================================
--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-01-23 18:11:50.000000000 +0100
+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-06-02 20:43:10.523709052 +0200
@@ -101,6 +101,18 @@ gdb_test "frame $frame_number" ".*"
gdb_test_no_output "set confirm off"
gdb_test "return" ""
+# Verify there are no remains of the dummy frame.
+gdb_test_no_output "maintenance print dummy-frames"
+set test "maintenance info breakpoints"
+gdb_test_multiple $test $test {
+ -re "call dummy.*\r\n$gdb_prompt $" {
+ fail $test
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
+}
+
# Resume execution, the program should continue without any signal.
gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*"

166
gdb-x86-onstack-2of2.patch Normal file
View File

@ -0,0 +1,166 @@
http://sourceware.org/ml/gdb-patches/2012-03/msg00358.html
Subject: [patch 2/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5
Hi,
here is the ON_STACK code again, with fixed alignment for i386 SSE.
It is generalized for all OSes on i386/amd64. I can move it to
{i386,amd64)-linux-tdep.c but I find this code much more lightweight than
i386_push_dummy_call which is already present in i386-tdep.
No regressions on
{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for
gdbsever non-extended mode.
For x86_64-fedora17-linux-gnu it fixes:
-FAIL: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
-FAIL: gdb.cp/gdb2495.exp: bt after returning from a popped frame
+PASS: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
+PASS: gdb.cp/gdb2495.exp: bt after returning from a popped frame
Thanks,
Jan
gdb/
2012-03-09 Jan Kratochvil <jan.kratochvil@redhat.com>
* amd64-dicos-tdep.c (amd64_dicos_push_dummy_code): Remove.
(amd64_dicos_init_abi): Remove its installment.
* dicos-tdep.c (dicos_init_abi): Remove the
set_gdbarch_call_dummy_location call. Update the comment here.
* i386-dicos-tdep.c (i386_dicos_push_dummy_code): Remove.
(i386_dicos_init_abi): Remove its installment.
* i386-tdep.c (i386_push_dummy_code): New function.
(i386_gdbarch_init): Call set_gdbarch_call_dummy_location, install
i386_push_dummy_code.
--- a/gdb/amd64-dicos-tdep.c
+++ b/gdb/amd64-dicos-tdep.c
@@ -23,24 +23,6 @@
#include "amd64-tdep.h"
#include "dicos-tdep.h"
-static CORE_ADDR
-amd64_dicos_push_dummy_code (struct gdbarch *gdbarch,
- CORE_ADDR sp, CORE_ADDR funaddr,
- struct value **args, int nargs,
- struct type *value_type,
- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
- struct regcache *regcache)
-{
- int bplen;
- CORE_ADDR bppc = sp;
-
- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
- *bp_addr = sp - bplen;
- *real_pc = funaddr;
-
- return *bp_addr;
-}
-
static void
amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -49,8 +31,6 @@ amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64_init_abi (info, gdbarch);
dicos_init_abi (gdbarch);
-
- set_gdbarch_push_dummy_code (gdbarch, amd64_dicos_push_dummy_code);
}
static enum gdb_osabi
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -43,8 +43,8 @@ dicos_init_abi (struct gdbarch *gdbarch)
/* There's no (standard definition of) entry point or a guaranteed
text location with a symbol where to place the call dummy, so we
- put it on the stack. */
- set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+ need it on the stack. Rely on i386_gdbarch_init used also for
+ amd64 to set up ON_STACK inferior calls. */
/* DICOS rewinds the PC itself. */
set_gdbarch_decr_pc_after_break (gdbarch, 0);
--- a/gdb/i386-dicos-tdep.c
+++ b/gdb/i386-dicos-tdep.c
@@ -22,32 +22,12 @@
#include "gdb_string.h"
#include "dicos-tdep.h"
-static CORE_ADDR
-i386_dicos_push_dummy_code (struct gdbarch *gdbarch,
- CORE_ADDR sp, CORE_ADDR funaddr,
- struct value **args, int nargs,
- struct type *value_type,
- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
- struct regcache *regcache)
-{
- int bplen;
- CORE_ADDR bppc = sp;
-
- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
- *bp_addr = sp - bplen;
- *real_pc = funaddr;
-
- return *bp_addr;
-}
-
static void
i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
dicos_init_abi (gdbarch);
-
- set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code);
}
static enum gdb_osabi
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2326,6 +2326,30 @@ i386_16_byte_align_p (struct type *type)
return 0;
}
+/* Implementation for set_gdbarch_push_dummy_code. */
+
+static CORE_ADDR
+i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs, struct type *value_type,
+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
+ struct regcache *regcache)
+{
+ int bplen;
+ CORE_ADDR bppc = sp;
+
+ gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
+ sp -= bplen;
+
+ /* amd64_push_dummy_call does alignment on its own but i386_push_dummy_call
+ does not. ABI requires stack alignment for executables using SSE. */
+ if (gdbarch_frame_align_p (gdbarch))
+ sp = gdbarch_frame_align (gdbarch, sp);
+
+ *bp_addr = sp;
+ *real_pc = funaddr;
+ return sp;
+}
+
static CORE_ADDR
i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
@@ -7372,6 +7396,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
/* Call dummy code. */
+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+ set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code);
set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
set_gdbarch_frame_align (gdbarch, i386_frame_align);

View File

@ -1,3 +1,259 @@
-------------------------------------------------------------------
Tue Jun 12 13:00:14 UTC 2012 - rguenther@suse.com
- Merge from gdb-7.4.50.20120603-3.fc18.src.rpm.
* Wed Jun 6 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120603-3.fc18
- Disable -lmcheck in the development builds.
- Fix assertion on some files as glibc-2.15.90-8.fc18 (Doug Evans).
* Sun Jun 3 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120603-2.fc18
- Fix Release.
- Make yum --enablerepo compatible with at least mock-1.1.21-1.fc16 Rawhide cfg.
* Sun Jun 3 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120602-1.fc18
- Rebase to FSF GDB 7.4.50.20120602.
- [testsuite] BuildRequire gcc-go.
- Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763).
- Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651).
- Use librpm.so.3 for rpm-4.10.0 in Fedora 18.
- Revert recent breakage of UNIX objfiles order for symbols lookup.
* Sat Jun 2 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-48.fc17
- [ppc] Fix hardware watchpoints on PowerPC (BZ 827600, Edjunior Machado).
* Mon May 28 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-47.fc17
- Workaround PR libc/14166 for inferior calls of strstr.
* Mon May 14 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-46.fc17
- [RHEL5] Workaround doc build race.
* Mon May 14 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-45.fc17
- Rename "set auto-load" patchset variable $ddir to $datadir.
* Wed May 9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-44.fc17
- Fix in "set auto-load" patchset for SCL scripts inheritance (BZ 815910).
* Wed Apr 25 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-43.fc17
- [RHEL5] Workaround kernel for detaching SIGSTOPped processes (BZ 809382).
* Tue Apr 24 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-42.fc17
- Update "set auto-load" patchset and the --with-auto-load-safe-path setting.
- [RHEL] Disable gdb-add-index even on RHEL-6 as RHEL-6.0 had too old elfutils.
* Wed Apr 18 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-41.fc17
- [RHEL] Fix --with-auto-load-safe-path systems prior to /usr move.
* Wed Apr 18 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-40.fc17
- Security fix for loading untrusted inferiors, see "set auto-load" (BZ 756117).
* Fri Apr 13 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-39.fc17
- [RHEL7] Fix/remove readline-devel BuildRequires redundant distro suffic .fc17.
* Wed Apr 4 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-38.fc17
- Workaround crashes from stale frame_info pointer (BZ 804256).
* Wed Apr 4 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-37.fc17
- testsuite: Fix break-interp.exp expections for updated glibc (BZ 752834).
* Wed Apr 4 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-36.fc17
- [RHEL5,RHEL6] Reintroduce fix attaching to stopped processes.
* Fri Mar 30 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-35.fc17
- Fix performance regressions with .gdb_index (Tom Tromey, BZ 805274).
* Fri Mar 30 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-34.fc17
- Fixup %{_datadir}/gdb timestamps for multilib conflicts on RHELs.
* Mon Mar 26 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-33.fc17
- [vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920).
* Sat Mar 17 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-32.fc17
- Fix loading of core files without build-ids but with build-ids in executables.
* Fri Mar 9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-31.fc17
- Fix an implied regression by the inferior calls fix below (BZ 799531).
* Fri Mar 9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-30.fc17
- Fix SELinux deny_ptrace .spec build rules (BZ 786878).
* Tue Mar 6 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-29.fc17
- Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531).
- Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me).
* Tue Mar 6 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-28.fc17
- Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878).
* Sun Mar 4 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-27.fc17
- [rhel5] Fix up the previous commit (BZ 799318).
* Sun Mar 4 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-26.fc17
- [rhel5] Fix up the previous commit (BZ 799318).
* Sun Mar 4 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-25.fc17
- [rhel5] Workaround rpmbuild to make the doc subpkg noarch again (BZ 799318).
* Fri Mar 2 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-24.fc17
- [vla] Fix crash for dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64.
- Reintroduce RHEL-5 glibc workaround for bt-clone-stop.exp.
- testsuite: Update/fix rh634108-solib_address.exp for the upstreamed API.
* Wed Feb 29 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-23.fc17
- Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875).
- Fix skipping of prologues on RHEL-5 gcc-4.1 -O2 -g code (BZ 797889).
- Fix breakpoint warning during 'next' over exit() (Tom Tromey, BZ 797892).
* Tue Feb 28 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-22.fc17
- testsuite: Fix gdb.base/macscp.exp ccache workaround in SCL mode.
- Adjust the RHEL/F version string automatically (BZ 797651, BZ 797646).
- Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664).
* Fri Feb 24 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-21.fc17
- testsuite: Do not use gcc44/gfortran44 on RHEL-5 if in SCL mode.
* Wed Feb 22 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-20.fc17
- Fix libinproctrace.so build on RHEL-5 i386 (disable it on RHEL-5).
* Wed Feb 22 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-19.fc17
- Implement SCL (scl-utils-build) macros.
* Tue Feb 21 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-18.fc17
- Fix debuginfo gdb-gdb.py build without redhat-rpm-config and on RHEL-5.
- Provide precompiled variants of gdb-gdb.py.
* Mon Feb 13 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-17.fc17
- gstack: Turn off --readnever (suggested by Oliver Henshaw).
* Fri Feb 10 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-16.fc17
- [RHELs] Drop simulation of legacy behavior - new GDB should behave as new GDB.
* Fri Feb 10 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-15.fc17
- Simplify %%setup .spec rule.
* Fri Feb 10 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-14.fc17
- Drop --with upstream .spec rules.
* Fri Feb 10 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-13.fc17
- Drop --with debug .spec rules.
* Thu Feb 9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-12.fc17
- Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487).
- Install also gdb-gdb.py pretty printers.
* Thu Feb 9 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-11.fc17
- Fix possible NULL crash in find_charset_names (Tom Tromey, BZ 786091).
- [ppc*] Fix build failure due to GCC aliasing warning (BZ 786504).
-------------------------------------------------------------------
Tue Jun 12 07:41:22 UTC 2012 - cfarrell@suse.com
- license update: GPL-3.0+ and GPL-3.0-with-GCC-exception and LGPL-2.1+ and
LGPL-3.0+
SPDX format
-------------------------------------------------------------------
Wed May 9 05:13:38 UTC 2012 - coolo@suse.com
- Fix the minimum to get it through factory-auto
-------------------------------------------------------------------
Tue Apr 3 14:08:43 UTC 2012 - rguenther@suse.com
- Fixup missed debuginfo handling SUSE specifics.
-------------------------------------------------------------------
Thu Jan 26 09:42:11 UTC 2012 - rguenther@suse.com
- Merge from gdb-7.4.50.20120120-10.fc17.src.rpm.
* Sat Jan 21 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120120-10.fc17
- Rebase to FSF GDB 7.4.50.20120120.
- Drop the g77 .spec provisioning as it has been fixed in FSF GDB.
* Thu Jan 19 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-9.fc17
- Enable smaller %{_bindir}/gdb in future by no longer using -rdynamic.
- Make --enablerepo to use '*-debug*' for RHEL compatibility (BZ 781571).
- On older RHELs make readline bundled again (BZ 701131).
- Fix build compatibility with RHEL-5 due to false noarch build.
* Wed Jan 11 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-8.fc17
- Disable unexpected GDB directories relocatability.
* Wed Jan 11 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-7.fc17
- Fix BuildRequires for RHEL compatibility (BZ 701131).
* Wed Jan 11 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-6.fc17
- Provide %%snap timestamp for: Provides: bundled(librarypackage)
- Replace %%define by %%global.
- Replace Java in Summary with Fortran (only GCC-compiled Java is supported).
- Unbundle readline-6.2 with a workaround of skipped "ask" (BZ 701131).
- Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131).
* Sat Jan 7 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-5.fc17
- Mark %{_sysconfdir}/gdbinit as %%config(noreplace).
- Add appropriate: Provides: bundled(librarypackage).
- Remove excessive explicit Requires: librarypackage.
* Thu Jan 5 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-4.fc17
- Fix linking on non-x86* (such as s390*) after libgdb.a removal.
* Wed Jan 4 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-3.fc17
- Reinclude gdb-dlopen-stap-probe.patch (missing in Fedora glibc - BZ 752476).
* Tue Jan 3 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-2.fc17
- Fix SystemTap support regression on i686 (Sergio Durigan Junior).
* Tue Jan 3 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120103-1.fc17
- Rebase to FSF GDB 7.4.50.20120103.
* Mon Nov 28 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-11.fc17
- No longer build bundled libstdc++ pretty printers on RHELs >= 7.
* Sat Nov 5 2011 Sergio Durigan Junior <sergiodj@redhat.com> - 7.3.50.20110722-10.fc16
- Backport fix for crash in cp_scan_for_anonymous_namespace
(Aleksandar Ristovski, BZ 750341).
* Fri Oct 14 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-9.fc16
- Backport `info os processes' crash fix - for Eclipse (Pedro Alves, BZ 746294).
* Tue Oct 11 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-8.fc16
- Fix PIE testsuite run; new lib/future.exp hack and use -fPIC instead of -fPIE.
* Mon Sep 26 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-7.fc16
- [vla] Fix VLA arrays displayed in `bt full' (BZ 738482).
- Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches.
- Fix internal error on some optimized-out values.
* Tue Aug 16 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-6.fc16
- Python command/function auto-loading (Phil Muldoon, BZ 730976).
- Work around PR libc/13097 "linux-vdso.so.1" warning message.
- [TUI] Fix stepi on stripped code.
- Add BuildRequires: systemtap-sdt-devel for archer-sergiodj-stap-patch-split.
* Wed Aug 10 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-5.fc16
- Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432).
* Tue Aug 9 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-4.fc16
- Improve GDB performance on inferior dlopen calls (Gary Benson, BZ 698001).
- [python] Fix crash when pretty printer fails (Phil Muldoon, BZ 712715).
- Fix crash on invalid C++ mangled names (BZ 729283).
* Fri Jul 29 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-3.fc16
- Fix regression from VLA merge affecting -O0 -g watchpoints.
* Fri Jul 29 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-2.fc16
- Include gcc -g3 .debug_macro implementation by Tom Tromey.
* Sat Jul 23 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.3.50.20110722-1.fc16
- Rebase to FSF GDB 7.3.50.20110722.
- Improve gcc-4.6 stdarg false prologue end workaround (GDB PR 12435 + GCC PR 47471).
-------------------------------------------------------------------
Wed Oct 12 12:09:41 UTC 2011 - rguenther@suse.com
- Add patch to use old ptrace interface on powerpc to fix watchpoint
issues. [bnc#718313]
-------------------------------------------------------------------
Thu Aug 4 10:28:50 UTC 2011 - rguenther@novell.com

3815
gdb.spec

File diff suppressed because it is too large Load Diff

2
gdbtui Normal file
View File

@ -0,0 +1,2 @@
#! /bin/sh
exec gdb -tui "$@"