SHA256
1
0
forked from pool/gdb

Accepting request 38053 from devel:gcc

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

OBS-URL: https://build.opensuse.org/request/show/38053
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=72
This commit is contained in:
OBS User autobuild 2010-04-16 16:29:50 +00:00 committed by Git OBS Bridge
parent a86c952226
commit d30d33dd0d
95 changed files with 25612 additions and 17955 deletions

View File

@ -1,20 +0,0 @@
Index: gdb/i386-tdep.c
===================================================================
--- gdb/i386-tdep.c.orig 2009-08-06 12:26:45.000000000 +0200
+++ gdb/i386-tdep.c 2009-08-06 12:27:37.000000000 +0200
@@ -1394,12 +1394,14 @@ i386_frame_cache (struct frame_info *thi
/* This will be added back below. */
cache->saved_regs[I386_EIP_REGNUM] -= cache->base;
}
- else
+ else if (cache->pc)
{
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4, byte_order)
+ cache->sp_offset;
}
+ else
+ cache->saved_regs[I386_EBP_REGNUM] = 0;
}
/* Now that we have the base address for the stack frame we can

View File

@ -4,10 +4,9 @@
to install and uninstall.
* gstack.sh, gstack.1: New files.
Index: gdb-6.8.91.20090917/gdb/Makefile.in
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/Makefile.in 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/Makefile.in 2009-09-17 12:47:38.000000000 +0200
diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
--- gdb-7.0.1-empty/gdb/Makefile.in 2010-04-07 20:36:04.000000000 +0200
+++ gdb-7.0.1/gdb/Makefile.in 2010-04-07 20:36:42.000000000 +0200
@@ -989,7 +989,7 @@ install: all install-only
# The "install-only" target also installs the syscalls' XML files in
@ -63,10 +62,9 @@ Index: gdb-6.8.91.20090917/gdb/Makefile.in
# The C++ name parser can be built standalone for testing.
test-cp-name-parser.o: cp-name-parser.c
Index: gdb-6.8.91.20090917/gdb/gstack.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.91.20090917/gdb/gstack.sh 2009-09-17 12:47:14.000000000 +0200
diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
--- gdb-7.0.1-empty/gdb/gstack.sh 1970-01-01 01:00:00.000000000 +0100
+++ gdb-7.0.1/gdb/gstack.sh 2010-04-07 20:36:47.000000000 +0200
@@ -0,0 +1,48 @@
+#!/bin/sh
+
@ -87,17 +85,17 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
+backtrace="bt"
+if test -d /proc/$1/task ; then
+ # Newer kernel; has a task/ directory.
+ if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
+ backtrace="thread apply all bt"
+ fi
+elif test -f /proc/$1/maps ; then
+ # Older kernel; go by it loading libpthread.
+ if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ backtrace="thread apply all bt"
+ fi
+fi
+
+GDB=${GDB:-gdb}
+GDB=${GDB:-/usr/bin/gdb}
+
+if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
+ readnever=--readnever
@ -112,7 +110,127 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
+set pagination no
+$backtrace
+EOF
+sed -n \
+ -e 's/^(gdb) //' \
+/bin/sed -n \
+ -e 's/^\((gdb) \)*//' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.exp 2010-04-07 21:53:57.000000000 +0200
@@ -0,0 +1,71 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile gstack
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/$executable
+if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
+ return -1
+}
+
+set test "spawn inferior"
+set command "${binfile}"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+ return
+}
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re "looping\r\n" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ return
+ }
+ timeout {
+ fail "$test (timeout)"
+ return
+ }
+}
+gdb_exit
+
+# Testcase uses the most simple notification not to get caught by attach on
+# exiting the function. Still we could retry the gstack command if we fail.
+
+set test "spawn gstack"
+set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
+set res [remote_spawn host $command];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ 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$} {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+}
+gdb_exit
+
+remote_exec host "kill -9 $pid"
--- /dev/null 2010-04-07 06:20:52.289994508 +0200
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.c 2010-04-07 21:46:52.000000000 +0200
@@ -0,0 +1,43 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+void
+func (void)
+{
+ const char msg[] = "looping\n";
+
+ /* Use the most simple notification not to get caught by attach on exiting
+ the function. */
+ write (1, msg, strlen (msg));
+
+ for (;;);
+}
+
+int
+main (void)
+{
+ alarm (60);
+ nice (100);
+
+ func ();
+
+ return 0;
+}

View File

@ -1,34 +0,0 @@
Index: gdb-6.3/gdb/gstack.sh
===================================================================
--- gdb-6.3.orig/gdb/gstack.sh 2006-02-14 17:21:05.000000000 -0200
+++ gdb-6.3/gdb/gstack.sh 2006-04-14 03:17:12.000000000 -0300
@@ -17,17 +17,17 @@ fi
backtrace="bt"
if test -d /proc/$1/task ; then
# Newer kernel; has a task/ directory.
- if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
backtrace="thread apply all bt"
fi
elif test -f /proc/$1/maps ; then
# Older kernel; go by it loading libpthread.
- if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
backtrace="thread apply all bt"
fi
fi
-GDB=${GDB:-gdb}
+GDB=${GDB:-/usr/bin/gdb}
if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
readnever=--readnever
@@ -39,7 +39,7 @@ fi
set pagination no
$backtrace
EOF
-sed -n \
+/bin/sed -n \
-e 's/^(gdb) //' \
-e '/^#/p' \
-e '/^Thread/p'

View File

@ -25,11 +25,11 @@
Port to GDB-6.7.
Index: gdb-6.8.50.20090909/gdb/symfile-mem.c
Index: gdb-7.0.50.20100115/gdb/symfile-mem.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/symfile-mem.c 2009-07-02 19:21:06.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/symfile-mem.c 2009-09-09 19:06:57.000000000 +0200
@@ -56,6 +56,14 @@
--- gdb-7.0.50.20100115.orig/gdb/symfile-mem.c 2010-01-01 08:31:42.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/symfile-mem.c 2010-01-15 03:22:23.000000000 +0100
@@ -57,6 +57,14 @@
#include "elf/common.h"
@ -44,7 +44,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile-mem.c
/* Read inferior memory at ADDR to find the header of a loaded object file
and read its in-core symbols out of inferior memory. TEMPL is a bfd
representing the target's format. NAME is the name to use for this
@@ -76,7 +84,7 @@ symbol_file_add_from_memory (struct bfd
@@ -77,7 +85,7 @@ symbol_file_add_from_memory (struct bfd
error (_("add-symbol-file-from-memory not supported for this target"));
nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
@ -53,10 +53,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile-mem.c
if (nbfd == NULL)
error (_("Failed to read a valid object file image from memory."));
Index: gdb-6.8.50.20090909/gdb/target.c
Index: gdb-7.0.50.20100115/gdb/target.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/target.c 2009-09-09 19:05:56.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/target.c 2009-09-09 19:08:11.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/target.c 2010-01-15 03:22:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/target.c 2010-01-15 03:22:23.000000000 +0100
@@ -59,7 +59,7 @@ static int nosymbol (char *, CORE_ADDR *
static void tcomplain (void) ATTR_NORETURN;
@ -66,7 +66,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c
static int return_zero (void);
@@ -492,7 +492,7 @@ target_terminal_inferior (void)
@@ -494,7 +494,7 @@ target_terminal_inferior (void)
(*current_target.to_terminal_inferior) ();
}
@ -75,7 +75,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c
nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct target_ops *t)
{
@@ -711,7 +711,7 @@ update_current_target (void)
@@ -726,7 +726,7 @@ update_current_target (void)
(void (*) (struct regcache *))
noprocess);
de_fault (deprecated_xfer_memory,
@ -84,7 +84,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c
nomemory);
de_fault (to_files_info,
(void (*) (struct target_ops *))
@@ -1443,7 +1443,7 @@ target_xfer_partial (struct target_ops *
@@ -1497,7 +1497,7 @@ target_xfer_partial (struct target_ops *
it makes no progress, and then return how much was transferred). */
int
@ -93,7 +93,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c
{
/* Dispatch to the topmost target, not the flattened current_target.
Memory accesses check target->to_has_(all_)memory, and the
@@ -1459,7 +1459,7 @@ target_read_memory (CORE_ADDR memaddr, g
@@ -1513,7 +1513,7 @@ target_read_memory (CORE_ADDR memaddr, g
the target's stack. This may trigger different cache behavior. */
int
@ -102,8 +102,8 @@ Index: gdb-6.8.50.20090909/gdb/target.c
{
/* Dispatch to the topmost target, not the flattened current_target.
Memory accesses check target->to_has_(all_)memory, and the
@@ -1473,7 +1473,7 @@ target_read_stack (CORE_ADDR memaddr, gd
}
@@ -1532,7 +1532,7 @@ target_read_stack (CORE_ADDR memaddr, gd
Callers that can deal with partial writes should call target_write. */
int
-target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
@ -111,7 +111,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c
{
/* Dispatch to the topmost target, not the flattened current_target.
Memory accesses check target->to_has_(all_)memory, and the
@@ -2964,8 +2964,8 @@ debug_to_prepare_to_store (struct regcac
@@ -3098,8 +3098,8 @@ debug_to_prepare_to_store (struct regcac
fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
}
@ -122,7 +122,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c
int write, struct mem_attrib *attrib,
struct target_ops *target)
{
@@ -2975,8 +2975,8 @@ deprecated_debug_xfer_memory (CORE_ADDR
@@ -3109,8 +3109,8 @@ deprecated_debug_xfer_memory (CORE_ADDR
attrib, target);
fprintf_unfiltered (gdb_stdlog,
@ -133,11 +133,11 @@ Index: gdb-6.8.50.20090909/gdb/target.c
write ? "write" : "read", retval);
if (retval > 0)
Index: gdb-6.8.50.20090909/gdb/target.h
Index: gdb-7.0.50.20100115/gdb/target.h
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/target.h 2009-09-09 19:05:56.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/target.h 2009-09-09 19:07:36.000000000 +0200
@@ -366,10 +366,10 @@ struct target_ops
--- gdb-7.0.50.20100115.orig/gdb/target.h 2010-01-15 03:22:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/target.h 2010-01-15 03:22:23.000000000 +0100
@@ -406,10 +406,10 @@ struct target_ops
NOTE: cagney/2004-10-01: This has been entirely superseeded by
to_xfer_partial and inferior inheritance. */
@ -152,7 +152,7 @@ Index: gdb-6.8.50.20090909/gdb/target.h
void (*to_files_info) (struct target_ops *);
int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *);
@@ -680,12 +680,12 @@ extern void target_dcache_invalidate (vo
@@ -786,12 +786,12 @@ extern void target_dcache_invalidate (vo
extern int target_read_string (CORE_ADDR, char **, int, int *);
@ -168,13 +168,13 @@ Index: gdb-6.8.50.20090909/gdb/target.h
/* Fetches the target's memory map. If one is found it is sorted
and returned, after some consistency checking. Otherwise, NULL
Index: gdb-6.8.50.20090909/gdb/dcache.c
Index: gdb-7.0.50.20100115/gdb/dcache.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/dcache.c 2009-08-31 22:18:45.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/dcache.c 2009-09-09 19:09:21.000000000 +0200
@@ -390,10 +390,10 @@ dcache_free (DCACHE *dcache)
The meaning of the result is the same as for target_write. */
--- gdb-7.0.50.20100115.orig/gdb/dcache.c 2010-01-01 08:31:30.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/dcache.c 2010-01-15 03:22:23.000000000 +0100
@@ -468,10 +468,10 @@ dcache_free (DCACHE *dcache)
NOTE: This is different than the to_xfer_partial interface, in which
positive values less than LEN mean further transfers may be possible. */
-int
+LONGEST
@ -185,10 +185,10 @@ Index: gdb-6.8.50.20090909/gdb/dcache.c
{
int i;
int res;
Index: gdb-6.8.50.20090909/gdb/dcache.h
Index: gdb-7.0.50.20100115/gdb/dcache.h
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/dcache.h 2009-08-31 22:18:45.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/dcache.h 2009-09-09 19:08:54.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/dcache.h 2010-01-01 08:31:30.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/dcache.h 2010-01-15 03:22:23.000000000 +0100
@@ -35,8 +35,8 @@ void dcache_free (DCACHE *);
/* Simple to call from <remote>_xfer_memory */
@ -200,11 +200,11 @@ Index: gdb-6.8.50.20090909/gdb/dcache.h
void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
int len);
Index: gdb-6.8.50.20090909/gdb/exec.c
Index: gdb-7.0.50.20100115/gdb/exec.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/exec.c 2009-07-02 19:21:06.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/exec.c 2009-09-09 19:06:57.000000000 +0200
@@ -560,7 +560,7 @@ map_vmap (bfd *abfd, bfd *arch)
--- gdb-7.0.50.20100115.orig/gdb/exec.c 2010-01-14 22:01:24.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/exec.c 2010-01-15 03:22:23.000000000 +0100
@@ -578,7 +578,7 @@ map_vmap (bfd *abfd, bfd *arch)
}
@ -213,11 +213,11 @@ Index: gdb-6.8.50.20090909/gdb/exec.c
section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, LONGEST len,
struct target_section *sections,
Index: gdb-6.8.50.20090909/gdb/linux-nat.c
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/linux-nat.c 2009-09-09 19:06:46.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/linux-nat.c 2009-09-09 19:06:57.000000000 +0200
@@ -4622,7 +4622,7 @@ linux_xfer_partial (struct target_ops *o
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:22:14.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:22:23.000000000 +0100
@@ -5117,7 +5117,7 @@ linux_xfer_partial (struct target_ops *o
#endif
if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
{ /* This region contains ia64 rse registers, we have to re-read. */
@ -226,10 +226,10 @@ Index: gdb-6.8.50.20090909/gdb/linux-nat.c
/* Re-read register stack area. */
xxfer = super_xfer_partial (ops, object, annex,
Index: gdb-6.8.50.20090909/gdb/remote.c
Index: gdb-7.0.50.20100115/gdb/remote.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/remote.c 2009-08-18 18:17:16.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/remote.c 2009-09-09 19:06:57.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/remote.c 2010-01-12 22:40:24.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/remote.c 2010-01-15 03:22:23.000000000 +0100
@@ -25,6 +25,7 @@
#include "gdb_string.h"
#include <ctype.h>
@ -238,7 +238,7 @@ Index: gdb-6.8.50.20090909/gdb/remote.c
#include "inferior.h"
#include "bfd.h"
#include "symfile.h"
@@ -5764,12 +5765,19 @@ handle_notification (char *buf, size_t l
@@ -6175,12 +6176,19 @@ handle_notification (char *buf, size_t l
if SHOULD_WRITE is nonzero. Returns length of data written or
read; 0 for error. TARGET is unused. */
@ -260,7 +260,7 @@ Index: gdb-6.8.50.20090909/gdb/remote.c
set_general_thread (inferior_ptid);
@@ -5778,7 +5786,7 @@ remote_xfer_memory (CORE_ADDR mem_addr,
@@ -6189,7 +6197,7 @@ remote_xfer_memory (CORE_ADDR mem_addr,
else
res = remote_read_bytes (mem_addr, buffer, mem_len);
@ -269,10 +269,10 @@ Index: gdb-6.8.50.20090909/gdb/remote.c
}
/* Sends a packet with content determined by the printf format string
Index: gdb-6.8.50.20090909/gdb/remote-sim.c
Index: gdb-7.0.50.20100115/gdb/remote-sim.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/remote-sim.c 2009-07-02 19:21:06.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/remote-sim.c 2009-09-09 19:06:57.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/remote-sim.c 2010-01-01 08:31:40.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/remote-sim.c 2010-01-15 03:22:23.000000000 +0100
@@ -752,11 +752,14 @@ gdbsim_prepare_to_store (struct regcache
Returns the number of bytes transferred. */
@ -290,11 +290,11 @@ Index: gdb-6.8.50.20090909/gdb/remote-sim.c
/* If no program is running yet, then ignore the simulator for
memory. Pass the request down to the next target, hopefully
an exec file. */
Index: gdb-6.8.50.20090909/gdb/exec.h
Index: gdb-7.0.50.20100115/gdb/exec.h
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/exec.h 2009-06-12 20:38:36.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/exec.h 2009-09-09 19:06:57.000000000 +0200
@@ -56,7 +56,7 @@ extern int resize_section_table (struct
--- gdb-7.0.50.20100115.orig/gdb/exec.h 2010-01-01 08:31:31.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/exec.h 2010-01-15 03:22:23.000000000 +0100
@@ -60,7 +60,7 @@ extern int resize_section_table (struct
One, and only one, of readbuf or writebuf must be non-NULL. */

View File

@ -11,11 +11,11 @@
* gdb.texinfo (File Options): Document --readnever.
Index: gdb-6.8.50.20090811/gdb/doc/gdb.texinfo
Index: gdb-7.0.90.20100306/gdb/doc/gdb.texinfo
===================================================================
--- gdb-6.8.50.20090811.orig/gdb/doc/gdb.texinfo 2009-08-13 10:14:15.000000000 +0200
+++ gdb-6.8.50.20090811/gdb/doc/gdb.texinfo 2009-08-13 10:14:18.000000000 +0200
@@ -991,6 +991,12 @@ Read each symbol file's entire symbol ta
--- gdb-7.0.90.20100306.orig/gdb/doc/gdb.texinfo 2010-03-06 23:19:13.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/doc/gdb.texinfo 2010-03-06 23:20:35.000000000 +0100
@@ -995,6 +995,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,10 +28,10 @@ Index: gdb-6.8.50.20090811/gdb/doc/gdb.texinfo
@end table
@node Mode Options
Index: gdb-6.8.50.20090811/gdb/main.c
Index: gdb-7.0.90.20100306/gdb/main.c
===================================================================
--- gdb-6.8.50.20090811.orig/gdb/main.c 2009-08-13 10:14:15.000000000 +0200
+++ gdb-6.8.50.20090811/gdb/main.c 2009-08-13 10:14:18.000000000 +0200
--- gdb-7.0.90.20100306.orig/gdb/main.c 2010-03-06 23:20:23.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/main.c 2010-03-06 23:20:35.000000000 +0100
@@ -382,6 +382,7 @@ captured_main (void *data)
{"xdb", no_argument, &xdb_commands, 1},
{"dbx", no_argument, &dbx_commands, 1},
@ -40,7 +40,7 @@ Index: gdb-6.8.50.20090811/gdb/main.c
{"r", no_argument, &readnow_symbol_files, 1},
{"quiet", no_argument, &quiet, 1},
{"q", no_argument, &quiet, 1},
@@ -1030,6 +1031,7 @@ Options:\n\n\
@@ -1033,6 +1034,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,10 +48,10 @@ Index: gdb-6.8.50.20090811/gdb/main.c
"), stream);
fputs_unfiltered (_("\
--se=FILE Use FILE as symbol file and executable file.\n\
Index: gdb-6.8.50.20090811/gdb/symfile.c
Index: gdb-7.0.90.20100306/gdb/symfile.c
===================================================================
--- gdb-6.8.50.20090811.orig/gdb/symfile.c 2009-08-13 10:14:15.000000000 +0200
+++ gdb-6.8.50.20090811/gdb/symfile.c 2009-08-13 10:14:18.000000000 +0200
--- gdb-7.0.90.20100306.orig/gdb/symfile.c 2010-03-06 23:19:13.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/symfile.c 2010-03-06 23:20:35.000000000 +0100
@@ -79,6 +79,7 @@ static void clear_symtab_users_cleanup (
/* Global variables owned by this file */
@ -60,19 +60,19 @@ Index: gdb-6.8.50.20090811/gdb/symfile.c
/* External variables and functions referenced. */
Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
===================================================================
--- gdb-6.8.50.20090811.orig/gdb/dwarf2read.c 2009-08-13 10:14:15.000000000 +0200
+++ gdb-6.8.50.20090811/gdb/dwarf2read.c 2009-08-13 10:14:29.000000000 +0200
@@ -53,6 +53,7 @@
--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c 2010-03-06 23:19:13.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/dwarf2read.c 2010-03-06 23:20:54.000000000 +0100
@@ -52,6 +52,7 @@
#include "f-lang.h"
#include "typeprint.h"
#include "jv-lang.h"
#include "vec.h"
#include "block.h"
+#include "top.h"
#include <fcntl.h>
#include "gdb_string.h"
@@ -1245,7 +1246,8 @@ dwarf2_has_info (struct objfile *objfile
@@ -1222,7 +1223,8 @@ dwarf2_has_info (struct objfile *objfile
bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
}
@ -82,11 +82,11 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
&& dwarf2_per_objfile->abbrev.asection != NULL);
}
Index: gdb-6.8.50.20090811/gdb/top.h
Index: gdb-7.0.90.20100306/gdb/top.h
===================================================================
--- gdb-6.8.50.20090811.orig/gdb/top.h 2009-01-03 06:57:53.000000000 +0100
+++ gdb-6.8.50.20090811/gdb/top.h 2009-08-13 10:14:18.000000000 +0200
@@ -59,6 +59,7 @@ extern void set_prompt (char *);
--- gdb-7.0.90.20100306.orig/gdb/top.h 2010-01-01 08:31:42.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/top.h 2010-03-06 23:20:35.000000000 +0100
@@ -63,6 +63,7 @@ extern void set_prompt (char *);
/* From random places. */
extern int readnow_symbol_files;

View File

@ -19,30 +19,21 @@ Proposed upstream but never committed upstream.
(source_command): Update documentation. Check permissions if
FROM_TTY is -1.
Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c
Index: gdb-7.0.50.20100121/gdb/cli/cli-cmds.c
===================================================================
--- gdb-6.8.50.20090226.orig/gdb/cli/cli-cmds.c 2009-02-27 00:04:32.000000000 +0100
+++ gdb-6.8.50.20090226/gdb/cli/cli-cmds.c 2009-02-28 07:17:49.000000000 +0100
@@ -36,6 +36,7 @@
--- gdb-7.0.50.20100121.orig/gdb/cli/cli-cmds.c 2010-01-18 07:25:22.000000000 +0100
+++ gdb-7.0.50.20100121/gdb/cli/cli-cmds.c 2010-01-21 15:12:28.000000000 +0100
@@ -38,6 +38,7 @@
#include "objfiles.h"
#include "source.h"
#include "disasm.h"
+#include "gdb_stat.h"
extern void disconnect_or_stop_tracing (int from_tty);
#include "ui-out.h"
@@ -466,7 +467,7 @@ source_script (char *file, int from_tty)
if (fd == -1)
{
- if (from_tty)
+ if (from_tty > 0)
perror_with_name (file);
else
{
@@ -475,6 +476,29 @@ source_script (char *file, int from_tty)
}
}
@@ -488,6 +489,29 @@ find_and_open_script (int from_tty, char
file, O_RDONLY, &full_pathname);
make_cleanup (xfree, full_pathname);
+#ifdef HAVE_GETUID
+ if (from_tty == -1)
@ -62,15 +53,24 @@ Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c
+ warning (_("not using untrusted file \"%s\""), file);
+ close (fd);
+ do_cleanups (old_cleanups);
+ return;
+ return 0;
+ }
+ }
+#endif
+
is_python = source_python;
if (strlen (file) > 3 && !strcmp (&file[strlen (file) - 3], ".py"))
is_python = 1;
@@ -486,6 +510,7 @@ source_script (char *file, int from_tty)
/* Use the full path name, if it is found. */
if (full_pathname != NULL && fd != -1)
{
@@ -496,7 +520,7 @@ find_and_open_script (int from_tty, char
if (fd == -1)
{
- if (from_tty)
+ if (from_tty > 0)
perror_with_name (file);
else
{
@@ -554,6 +578,7 @@ source_script (char *file, int from_tty)
else
script_from_file (stream, file);
@ -78,10 +78,10 @@ Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c
do_cleanups (old_cleanups);
}
Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp 2009-02-28 07:15:57.000000000 +0100
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.exp 2010-01-21 15:11:18.000000000 +0100
@@ -0,0 +1,98 @@
+# Copyright 2005
+# Free Software Foundation, Inc.
@ -181,17 +181,17 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp
+}
+
+remote_exec build "rm .gdbinit"
Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.sample
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.sample
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.sample 2009-02-28 07:15:57.000000000 +0100
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.sample 2010-01-21 15:11:18.000000000 +0100
@@ -0,0 +1 @@
+echo "\nin gdbinit"
Index: gdb-6.8.50.20090226/gdb/main.c
Index: gdb-7.0.50.20100121/gdb/main.c
===================================================================
--- gdb-6.8.50.20090226.orig/gdb/main.c 2009-02-27 00:04:32.000000000 +0100
+++ gdb-6.8.50.20090226/gdb/main.c 2009-02-28 07:15:57.000000000 +0100
@@ -855,7 +855,7 @@ Excess command line arguments ignored. (
--- gdb-7.0.50.20100121.orig/gdb/main.c 2010-01-21 15:11:09.000000000 +0100
+++ gdb-7.0.50.20100121/gdb/main.c 2010-01-21 15:11:18.000000000 +0100
@@ -818,7 +818,7 @@ Excess command line arguments ignored. (
debugging or what directory you are in. */
if (home_gdbinit && !inhibit_gdbinit)
@ -200,7 +200,7 @@ Index: gdb-6.8.50.20090226/gdb/main.c
/* Now perform all the actions indicated by the arguments. */
if (cdarg != NULL)
@@ -924,7 +924,7 @@ Can't attach to process and specify a co
@@ -887,7 +887,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)

View File

@ -1,29 +1,29 @@
Index: gdb-6.8.50.20090909/gdb/testsuite/configure.ac
Index: gdb-7.0.90.20100306/gdb/testsuite/configure.ac
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/testsuite/configure.ac 2009-07-31 17:38:16.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/testsuite/configure.ac 2009-09-09 19:06:01.000000000 +0200
--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure.ac 2010-02-19 20:16:36.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/testsuite/configure.ac 2010-03-06 23:19:56.000000000 +0100
@@ -144,6 +144,6 @@ AC_OUTPUT([Makefile \
gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
gdb.fortran/Makefile gdb.server/Makefile \
gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile \
gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \
gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
- gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
+ gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
gdb.python/Makefile gdb.reverse/Makefile \
gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
Index: gdb-6.8.50.20090909/gdb/testsuite/configure
Index: gdb-7.0.90.20100306/gdb/testsuite/configure
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/testsuite/configure 2009-08-22 18:56:43.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/testsuite/configure 2009-09-09 19:06:27.000000000 +0200
--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure 2010-02-19 20:16:36.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/testsuite/configure 2010-03-06 23:20:12.000000000 +0100
@@ -3515,7 +3515,7 @@ done
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/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
@@ -4231,6 +4231,7 @@ do
@@ -4232,6 +4232,7 @@ do
"gdb.objc/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.objc/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-6.8.50.20090909/gdb/testsuite/configure
"gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
"gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
"gdb.threads/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;;
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,20 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -56,10 +56,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
+ }
+ return 0;
+}
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,24 @@
+/* This program is intended to be started outside of gdb, and then
+ attached to by gdb. Thus, it simply spins in a loop. The loop
@ -85,10 +85,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
+ }
+ return (0);
+}
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,146 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -236,10 +236,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
+ }
+ return 0;
+}
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,44 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -285,10 +285,10 @@ Index: gdb-6.8.50.20090909/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-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,142 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
+ Free Software Foundation, Inc.
@ -432,10 +432,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
+ return 0;
+}
+
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,433 @@
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+
@ -870,10 +870,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
+do_call_attach_tests
+
+return 0
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,977 @@
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2002, 2003, 2004
@ -1852,10 +1852,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
+ send_gdb "set args main\n"
+ gdb_expect -re ".*$gdb_prompt $" {}
+}
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,243 @@
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
@ -2097,13 +2097,13 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp
+# test reinit_frame_cache
+
+gdb_load ${binfile}
+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp (reinit)"
+gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)"
+
+gdb_test "core" "No core file now."
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in
Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in 2009-09-09 19:06:01.000000000 +0200
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,19 @@
+VPATH = @srcdir@
+srcdir = @srcdir@

View File

@ -30,11 +30,11 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug:
<81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location
<81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location
Index: gdb-6.8.50.20090802/gdb/gdbtypes.c
Index: gdb-7.0.50.20100128/gdb/gdbtypes.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/gdbtypes.c 2009-08-03 09:50:57.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/gdbtypes.c 2009-08-03 15:42:51.000000000 +0200
@@ -3769,6 +3769,9 @@ gdbtypes_post_init (struct gdbarch *gdba
--- gdb-7.0.50.20100128.orig/gdb/gdbtypes.c 2010-01-28 12:52:17.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/gdbtypes.c 2010-01-28 12:52:48.000000000 +0100
@@ -3978,6 +3978,9 @@ gdbtypes_post_init (struct gdbarch *gdba
= arch_type (gdbarch, TYPE_CODE_INTERNAL_FUNCTION, 0,
"<internal function>");
@ -44,11 +44,11 @@ Index: gdb-6.8.50.20090802/gdb/gdbtypes.c
return builtin_type;
}
Index: gdb-6.8.50.20090802/gdb/gdbtypes.h
Index: gdb-7.0.50.20100128/gdb/gdbtypes.h
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/gdbtypes.h 2009-08-03 09:50:57.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/gdbtypes.h 2009-08-03 15:40:02.000000000 +0200
@@ -1128,6 +1128,8 @@ struct builtin_type
--- gdb-7.0.50.20100128.orig/gdb/gdbtypes.h 2010-01-28 12:52:17.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/gdbtypes.h 2010-01-28 12:52:48.000000000 +0100
@@ -1245,6 +1245,8 @@ struct builtin_type
/* This type is used to represent a GDB internal function. */
struct type *internal_fn;
@ -57,11 +57,11 @@ Index: gdb-6.8.50.20090802/gdb/gdbtypes.h
};
/* Return the type table for the specified architecture. */
Index: gdb-6.8.50.20090802/gdb/parse.c
Index: gdb-7.0.50.20100128/gdb/parse.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/parse.c 2009-08-03 09:50:57.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/parse.c 2009-08-03 15:41:54.000000000 +0200
@@ -510,7 +510,11 @@ write_exp_msymbol (struct minimal_symbol
--- gdb-7.0.50.20100128.orig/gdb/parse.c 2010-01-28 12:52:19.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/parse.c 2010-01-28 12:53:20.000000000 +0100
@@ -509,7 +509,11 @@ write_exp_msymbol (struct minimal_symbol
case mst_text:
case mst_file_text:
case mst_solib_trampoline:
@ -73,12 +73,12 @@ Index: gdb-6.8.50.20090802/gdb/parse.c
+ write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
break;
case mst_data:
Index: gdb-6.8.50.20090802/gdb/target.c
case mst_text_gnu_ifunc:
Index: gdb-7.0.50.20100128/gdb/target.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/target.c 2009-08-03 12:38:47.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/target.c 2009-08-03 12:49:33.000000000 +0200
@@ -933,6 +933,25 @@ pop_all_targets (int quitting)
--- gdb-7.0.50.20100128.orig/gdb/target.c 2010-01-28 12:52:29.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/target.c 2010-01-28 12:52:48.000000000 +0100
@@ -1000,6 +1000,25 @@ pop_all_targets (int quitting)
pop_all_targets_above (dummy_stratum, quitting);
}
@ -104,7 +104,7 @@ Index: gdb-6.8.50.20090802/gdb/target.c
/* Using the objfile specified in OBJFILE, find the address for the
current thread's thread-local storage with offset OFFSET. */
CORE_ADDR
@@ -1023,7 +1042,28 @@ target_translate_tls_address (struct obj
@@ -1090,7 +1109,28 @@ target_translate_tls_address (struct obj
/* It wouldn't be wrong here to try a gdbarch method, too; finding
TLS is an ABI-specific thing. But we don't do that yet. */
else
@ -134,10 +134,10 @@ Index: gdb-6.8.50.20090802/gdb/target.c
return addr;
}
Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.dwarf2/dw2-errno.c
Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2009-08-03 12:49:33.000000000 +0200
+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2010-01-28 12:52:48.000000000 +0100
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -167,10 +167,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.dwarf2/dw2-errno.c
+
+ return 0; /* breakpoint */
+}
Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2009-08-03 12:49:33.000000000 +0200
+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2010-01-28 12:52:48.000000000 +0100
@@ -0,0 +1,67 @@
+# Copyright 2007 Free Software Foundation, Inc.
+

View File

@ -1,11 +1,11 @@
Index: gdb-6.8.50.20090802/gdb/symfile.c
Index: gdb-7.0.90.20100306/gdb/symfile.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/symfile.c 2009-08-03 12:29:58.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/symfile.c 2009-08-03 12:40:58.000000000 +0200
@@ -4012,6 +4012,12 @@ symfile_dummy_outputs (bfd *abfd, asecti
bfd_byte *
symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
--- 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;
+ /* Executable files have all the relocations already resolved.
+ * Handle files linked with --emit-relocs.
+ * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */

View File

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

View File

@ -23,10 +23,10 @@
Port to GDB-6.8pre.
Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c
Index: gdb-7.0.50.20100115/gdb/amd64-linux-nat.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/amd64-linux-nat.c 2009-06-17 20:44:23.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/amd64-linux-nat.c 2009-08-03 15:49:33.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/amd64-linux-nat.c 2010-01-15 03:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/amd64-linux-nat.c 2010-01-15 03:20:58.000000000 +0100
@@ -51,6 +51,9 @@
#include "i386-linux-tdep.h"
#include "amd64-nat.h"
@ -170,7 +170,7 @@ Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
@@ -682,6 +804,11 @@ _initialize_amd64_linux_nat (void)
@@ -727,6 +849,11 @@ _initialize_amd64_linux_nat (void)
t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
t->to_store_registers = amd64_linux_store_inferior_registers;
@ -182,11 +182,11 @@ Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c
/* Register the target. */
linux_nat_add_target (t);
linux_nat_set_new_thread (t, amd64_linux_new_thread);
Index: gdb-6.8.50.20090802/gdb/config.in
Index: gdb-7.0.50.20100115/gdb/config.in
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/config.in 2009-08-03 09:50:57.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/config.in 2009-08-03 15:48:31.000000000 +0200
@@ -146,6 +146,9 @@
--- gdb-7.0.50.20100115.orig/gdb/config.in 2010-01-15 03:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/config.in 2010-01-15 03:20:58.000000000 +0100
@@ -149,6 +149,9 @@
/* Define to 1 if you have the <elf_hp.h> header file. */
#undef HAVE_ELF_HP_H
@ -196,7 +196,7 @@ Index: gdb-6.8.50.20090802/gdb/config.in
/* Define to 1 if your system has the etext variable. */
#undef HAVE_ETEXT
@@ -487,6 +490,9 @@
@@ -490,6 +493,9 @@
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
@ -206,7 +206,7 @@ Index: gdb-6.8.50.20090802/gdb/config.in
/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
@@ -514,6 +520,9 @@
@@ -517,6 +523,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
@ -216,11 +216,11 @@ Index: gdb-6.8.50.20090802/gdb/config.in
/* Define to 1 if you have the <sys/user.h> header file. */
#undef HAVE_SYS_USER_H
Index: gdb-6.8.50.20090802/gdb/configure
Index: gdb-7.0.50.20100115/gdb/configure
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/configure 2009-08-03 09:50:57.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/configure 2009-08-03 15:48:31.000000000 +0200
@@ -12545,6 +12545,268 @@ _ACEOF
--- gdb-7.0.50.20100115.orig/gdb/configure 2010-01-15 03:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/configure 2010-01-15 03:20:58.000000000 +0100
@@ -10043,6 +10043,268 @@ $as_echo "#define STDC_HEADERS 1" >>conf
fi
@ -489,11 +489,11 @@ Index: gdb-6.8.50.20090802/gdb/configure
# elf_hp.h is for HP/UX 64-bit shared library support.
# FIXME: kettenis/20030102: In most cases we include these (ctype.h, time.h)
# unconditionally, so what's the point in checking these?
Index: gdb-6.8.50.20090802/gdb/configure.ac
Index: gdb-7.0.50.20100115/gdb/configure.ac
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/configure.ac 2009-08-03 09:50:57.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/configure.ac 2009-08-03 15:48:31.000000000 +0200
@@ -744,6 +744,11 @@ AC_SUBST(PYTHON_CFLAGS)
--- gdb-7.0.50.20100115.orig/gdb/configure.ac 2010-01-15 03:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/configure.ac 2010-01-15 03:20:58.000000000 +0100
@@ -758,6 +758,11 @@ AC_SUBST(PYTHON_CFLAGS)
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_STDC
@ -505,11 +505,11 @@ Index: gdb-6.8.50.20090802/gdb/configure.ac
# elf_hp.h is for HP/UX 64-bit shared library support.
# FIXME: kettenis/20030102: In most cases we include these (ctype.h, time.h)
# unconditionally, so what's the point in checking these?
Index: gdb-6.8.50.20090802/gdb/gcore.c
Index: gdb-7.0.50.20100115/gdb/gcore.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/gcore.c 2009-08-03 12:28:56.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/gcore.c 2009-08-03 15:48:31.000000000 +0200
@@ -324,6 +324,11 @@ gcore_create_callback (CORE_ADDR vaddr,
--- gdb-7.0.50.20100115.orig/gdb/gcore.c 2010-01-15 03:17:59.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/gcore.c 2010-01-15 03:20:58.000000000 +0100
@@ -376,6 +376,11 @@ gcore_create_callback (CORE_ADDR vaddr,
asection *osec;
flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD;
@ -521,10 +521,10 @@ Index: gdb-6.8.50.20090802/gdb/gcore.c
/* If the memory segment has no permissions set, ignore it, otherwise
when we later try to access it for read/write, we'll get an error
or jam the kernel. */
Index: gdb-6.8.50.20090802/gdb/gdb_procfs32.h
Index: gdb-7.0.50.20100115/gdb/gdb_procfs32.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090802/gdb/gdb_procfs32.h 2009-08-03 15:48:31.000000000 +0200
+++ gdb-7.0.50.20100115/gdb/gdb_procfs32.h 2010-01-15 03:20:58.000000000 +0100
@@ -0,0 +1,128 @@
+#ifdef HAVE_SYS_PROCFS32_H
+#include <sys/procfs32.h>
@ -654,10 +654,10 @@ Index: gdb-6.8.50.20090802/gdb/gdb_procfs32.h
+#endif /* _SYS_PROCFS32_H */
+
+#endif /* HAVE_SYS_PROCFS32_H */
Index: gdb-6.8.50.20090802/gdb/gdb_user32.h
Index: gdb-7.0.50.20100115/gdb/gdb_user32.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090802/gdb/gdb_user32.h 2009-08-03 15:48:31.000000000 +0200
+++ gdb-7.0.50.20100115/gdb/gdb_user32.h 2010-01-15 03:20:58.000000000 +0100
@@ -0,0 +1,108 @@
+#ifdef HAVE_SYS_USER32_H
+#include <sys/user32.h>
@ -767,11 +767,11 @@ Index: gdb-6.8.50.20090802/gdb/gdb_user32.h
+#endif /* _SYS_USER32_H */
+
+#endif /* HAVE_SYS_USER32_H */
Index: gdb-6.8.50.20090802/gdb/linux-nat.c
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/linux-nat.c 2009-08-03 12:31:26.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/linux-nat.c 2009-08-03 15:48:31.000000000 +0200
@@ -219,6 +219,21 @@ static LONGEST (*super_xfer_partial) (st
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:20:45.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:20:58.000000000 +0100
@@ -225,6 +225,21 @@ static LONGEST (*super_xfer_partial) (st
const gdb_byte *,
ULONGEST, LONGEST);
@ -793,7 +793,7 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c
static int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -3586,7 +3601,7 @@ linux_nat_do_thread_registers (bfd *obfd
@@ -4187,7 +4202,7 @@ linux_nat_do_thread_registers (bfd *obfd
else
fill_gregset (regcache, &gregs, -1);
@ -802,7 +802,7 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c
note_data,
note_size,
lwp,
@@ -3636,10 +3651,10 @@ linux_nat_do_thread_registers (bfd *obfd
@@ -4237,10 +4252,10 @@ linux_nat_do_thread_registers (bfd *obfd
else
fill_fpregset (regcache, &fpregs, -1);
@ -815,7 +815,7 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c
}
return note_data;
@@ -3822,9 +3837,9 @@ linux_nat_make_corefile_notes (bfd *obfd
@@ -4423,9 +4438,9 @@ linux_nat_make_corefile_notes (bfd *obfd
psargs_end - string_end);
}
}
@ -828,14 +828,14 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c
}
/* Dump information for threads. */
Index: gdb-6.8.50.20090802/gdb/linux-nat.h
Index: gdb-7.0.50.20100115/gdb/linux-nat.h
===================================================================
--- gdb-6.8.50.20090802.orig/gdb/linux-nat.h 2009-08-03 10:52:00.000000000 +0200
+++ gdb-6.8.50.20090802/gdb/linux-nat.h 2009-08-03 15:48:31.000000000 +0200
@@ -144,3 +144,12 @@ void linux_nat_switch_fork (ptid_t new_p
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.h 2010-01-15 03:17:07.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.h 2010-01-15 03:21:26.000000000 +0100
@@ -169,3 +169,12 @@ struct siginfo *linux_nat_get_siginfo (p
/* Return the saved siginfo associated with PTID. */
struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
/* Compute and return the processor core of a given thread. */
int linux_nat_core_of_thread_1 (ptid_t ptid);
+
+/* These functions make elfcore note sections.
+ They may get overriden by code adjusting data for multi-target builds. */

View File

@ -0,0 +1,190 @@
http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html
Subject: Re: [patch] print a more useful error message for "gdb core"
[ Fixed up since the mail. ]
On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote:
> Not an exhaustive list, but if we go down the path of converting "gdb
> corefile" to "gdb -c corefile", then we also need to think about "file
> corefile" being converted to "core corefile" [or "target core
> corefile", "core" is apparently deprecated in favor of "target core"]
> and "target exec corefile" -> "target core corefile". Presumably
> "file corefile" (and "target exec corefile") would discard the
> currently selected executable. But maybe not. Will that be confusing
> for users? I don't know.
While thinking about it overriding some GDB _commands_ was not my intention.
There is a general assumption if I have a shell COMMAND and some FILE I can do
$ COMMAND FILE
and COMMAND will appropriately load the FILE.
FSF GDB currently needs to specify also the executable file for core files
which already inhibits this intuitive expectation. OTOH with the build-id
locating patch which could allow such intuitive start notneeding the
executable file. Still it currently did not work due to the required "-c":
$ COMMAND -c COREFILE
Entering "file", "core-file" or "attach" commands is already explicit enough
so that it IMO should do what the command name says without any
autodetections. The second command line argument
(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but
neither "attach" accepts a core file nor "core-file" accepts a PID.
The patch makes sense only with the build-id patchset so this is not submit
for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending
bfd_check_format_matches) as the patch below is its natural extension.
Sorry for the delay,
Jan
2010-01-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* exceptions.h (enum errors <IS_CORE_ERROR>): New.
* exec.c: Include exceptions.h.
(exec_file_attach <bfd_core>): Call throw_error (IS_CORE_ERROR, ...).
* main.c (exec_or_core_file_attach): New.
(captured_main <optind < argc>): Set also corearg.
(captured_main <strcmp (execarg, symarg) == 0>): New variable func.
Call exec_or_core_file_attach if COREARG matches EXECARG. Call
symbol_file_add_main only if CORE_BFD remained NULL.
Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
2010-01-20 Doug Evans <dje@google.com>
* exec.c (exec_file_attach): Print a more useful error message if the
user did "gdb core".
--- ./gdb/exceptions.h 2010-04-11 22:31:30.000000000 +0200
+++ ./gdb/exceptions.h 2010-04-11 22:31:47.000000000 +0200
@@ -78,6 +78,9 @@ enum errors {
/* Feature is not supported in this copy of GDB. */
UNSUPPORTED_ERROR,
+ /* Attempt to load a core file as executable. */
+ IS_CORE_ERROR,
+
/* Add more errors here. */
NR_ERRORS
};
--- ./gdb/exec.c 2010-04-11 22:31:30.000000000 +0200
+++ ./gdb/exec.c 2010-04-11 22:41:26.000000000 +0200
@@ -34,6 +34,7 @@
#include "arch-utils.h"
#include "gdbthread.h"
#include "progspace.h"
+#include "exceptions.h"
#include <fcntl.h>
#include "readline/readline.h"
@@ -256,12 +257,27 @@ exec_file_attach (char *filename, int fr
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
{
+ int is_core;
+
+ /* If the user accidentally did "gdb core", print a useful
+ error message. Check it only after bfd_object has been checked as
+ a valid executable may get recognized for example also as
+ "trad-core". */
+ is_core = bfd_check_format (exec_bfd, bfd_core);
+
/* Make sure to close exec_bfd, or else "run" might try to use
it. */
exec_close ();
- error (_("\"%s\": not in executable format: %s"),
- scratch_pathname,
- gdb_bfd_errmsg (bfd_get_error (), matching));
+
+ if (is_core != 0)
+ throw_error (IS_CORE_ERROR,
+ _("\"%s\" is a core file.\n"
+ "Please specify an executable to debug."),
+ scratch_pathname);
+ else
+ error (_("\"%s\": not in executable format: %s"),
+ scratch_pathname,
+ gdb_bfd_errmsg (bfd_get_error (), matching));
}
/* FIXME - This should only be run for RS6000, but the ifdef is a poor
--- ./gdb/main.c 2010-04-11 22:31:30.000000000 +0200
+++ ./gdb/main.c 2010-04-11 22:31:47.000000000 +0200
@@ -241,6 +241,36 @@ captured_command_loop (void *data)
return 1;
}
+/* Call exec_file_attach. If it detected FILENAME is a core file call
+ core_file_command. Print the original exec_file_attach error only if
+ core_file_command failed to find a matching executable. */
+
+static void
+exec_or_core_file_attach (char *filename, int from_tty)
+{
+ volatile struct gdb_exception e;
+
+ gdb_assert (exec_bfd == NULL);
+
+ TRY_CATCH (e, RETURN_MASK_ALL)
+ {
+ exec_file_attach (filename, from_tty);
+ }
+ if (e.reason < 0)
+ {
+ if (e.error == IS_CORE_ERROR)
+ {
+ core_file_command (filename, from_tty);
+
+ /* Iff the core file found its executable suppress the error message
+ from exec_file_attach. */
+ if (exec_bfd != NULL)
+ return;
+ }
+ throw_exception (e);
+ }
+}
+
static int
captured_main (void *data)
{
@@ -703,6 +733,8 @@ extern int gdbtk_test (char *);
{
symarg = argv[optind];
execarg = argv[optind];
+ if (optind + 1 == argc && corearg == NULL)
+ corearg = argv[optind];
optind++;
}
@@ -835,10 +867,25 @@ Excess command line arguments ignored. (
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{
+ catch_command_errors_ftype *func;
+
+ /* Call exec_or_core_file_attach only if the file was specified as
+ a command line argument (and not an a command line option). */
+ if (corearg != NULL && strcmp (corearg, execarg) == 0)
+ {
+ func = exec_or_core_file_attach;
+ corearg = NULL;
+ }
+ else
+ func = exec_file_attach;
+
/* The exec file and the symbol-file are the same. If we can't
- open it, better only print one error message.
- catch_command_errors returns non-zero on success! */
- if (catch_command_errors (exec_file_attach, execarg, !batch, RETURN_MASK_ALL))
+ open it, better only print one error message.
+ catch_command_errors returns non-zero on success!
+ Do not load EXECARG as a symbol file if it has been already processed
+ as a core file. */
+ if (catch_command_errors (func, execarg, !batch, RETURN_MASK_ALL)
+ && core_bfd == NULL)
catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL);
}
else

View File

@ -1,20 +1,28 @@
Index: gdb-7.0.1/gdb/symfile.c
Index: gdb-7.1/gdb/elfread.c
===================================================================
--- gdb-7.0.1.orig/gdb/symfile.c 2010-03-11 15:49:51.000000000 +0100
+++ gdb-7.0.1/gdb/symfile.c 2010-03-11 15:51:47.000000000 +0100
@@ -2308,9 +2308,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='*-debuginfo'"
- " 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);
+ }
}
}
*** 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);
! }
}
}

View File

@ -1,7 +1,7 @@
Index: gdb-6.8.50.20090909/gdb/event-top.c
Index: gdb-7.0.50.20100115/gdb/event-top.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/event-top.c 2009-09-09 20:05:48.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/event-top.c 2009-09-09 20:08:04.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/event-top.c 2010-01-01 08:31:31.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/event-top.c 2010-01-15 11:45:20.000000000 +0100
@@ -33,6 +33,7 @@
#include "cli/cli-script.h" /* for reset_command_nest_depth */
#include "main.h"
@ -28,27 +28,19 @@ Index: gdb-6.8.50.20090909/gdb/event-top.c
/* Each interpreter has its own rules on displaying the command
prompt. */
if (!current_interp_display_prompt_p ())
Index: gdb-6.8.50.20090909/gdb/symfile.c
Index: gdb-7.0.50.20100115/gdb/elfread.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200
@@ -57,6 +57,7 @@
#include "solib.h"
#include "remote.h"
#include "libbfd.h"
--- gdb-7.0.50.20100115.orig/gdb/elfread.c 2010-01-15 11:43:30.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/elfread.c 2010-01-15 11:45:34.000000000 +0100
@@ -40,6 +40,7 @@
#include "gdbcore.h"
#include "gdbcmd.h"
#include "observer.h"
+#include "elf/external.h"
#include <sys/types.h>
#include <fcntl.h>
@@ -65,6 +66,7 @@
#include <ctype.h>
#include <time.h>
#include <sys/time.h>
+#include <sys/param.h>
extern void _initialize_elfread (void);
int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num);
@@ -1673,8 +1675,353 @@ build_id_to_filename (struct build_id *b
@@ -1119,8 +1120,353 @@ build_id_to_filename (struct build_id *b
return retval;
}
@ -403,7 +395,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
avoidance. */
struct missing_filepair
@@ -1728,11 +2074,17 @@ missing_filepair_change (void)
@@ -1174,11 +1520,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
@ -421,7 +413,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
missing_filepair_change ();
}
@@ -1799,14 +2151,34 @@ debug_print_missing (const char *binary,
@@ -1245,14 +1597,34 @@ debug_print_missing (const char *binary,
*slot = missing_filepair;
@ -463,11 +455,11 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c
}
static char *
Index: gdb-6.8.50.20090909/gdb/symfile.h
Index: gdb-7.0.50.20100115/gdb/symfile.h
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200
@@ -387,6 +387,7 @@ extern struct build_id *build_id_addr_ge
--- gdb-7.0.50.20100115.orig/gdb/symfile.h 2010-01-15 11:12:33.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/symfile.h 2010-01-15 11:45:20.000000000 +0100
@@ -398,6 +398,7 @@ 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);
@ -475,10 +467,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile.h
/* From dwarf2read.c */
Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/gdb.exp 2010-01-15 11:12:33.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp 2010-01-15 11:45:20.000000000 +0100
@@ -1248,7 +1248,7 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
@ -488,10 +480,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp
send_gdb "set build-id-verbose 0\n"
gdb_expect 10 {
-re "$gdb_prompt $" {
Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/mi-support.exp 2010-01-15 11:12:33.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp 2010-01-15 11:45:20.000000000 +0100
@@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
}
}
@ -501,10 +493,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp
send_gdb "190-gdb-set build-id-verbose 0\n"
gdb_expect 10 {
-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
Index: gdb-6.8.50.20090909/gdb/tui/tui-interp.c
Index: gdb-7.0.50.20100115/gdb/tui/tui-interp.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/tui/tui-interp.c 2009-09-09 20:05:48.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/tui/tui-interp.c 2009-09-09 20:08:04.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/tui/tui-interp.c 2010-01-01 08:32:07.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/tui/tui-interp.c 2010-01-15 11:45:20.000000000 +0100
@@ -30,6 +30,7 @@
#include "tui/tui.h"
#include "tui/tui-io.h"
@ -522,10 +514,10 @@ Index: gdb-6.8.50.20090909/gdb/tui/tui-interp.c
/* Tell readline what the prompt to display is and what function
it will need to call after a whole line is read. This also
displays the first prompt. */
Index: gdb-6.8.50.20090909/gdb/aclocal.m4
Index: gdb-7.0.50.20100115/gdb/aclocal.m4
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/aclocal.m4 2009-09-09 20:05:48.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/aclocal.m4 2009-09-09 20:09:32.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/aclocal.m4 2009-11-11 05:42:39.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/aclocal.m4 2010-01-15 11:45:20.000000000 +0100
@@ -19,6 +19,162 @@ You have another version of autoconf. I
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
@ -689,10 +681,10 @@ Index: gdb-6.8.50.20090909/gdb/aclocal.m4
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
Index: gdb-6.8.50.20090909/gdb/config.in
Index: gdb-7.0.50.20100115/gdb/config.in
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:08:04.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/config.in 2010-01-15 03:22:31.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/config.in 2010-01-15 11:45:20.000000000 +0100
@@ -42,6 +42,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
@ -713,10 +705,10 @@ Index: gdb-6.8.50.20090909/gdb/config.in
/* Define if libunwind library is being used. */
#undef HAVE_LIBUNWIND
Index: gdb-6.8.50.20090909/gdb/configure
Index: gdb-7.0.50.20100115/gdb/configure
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:09:35.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/configure 2010-01-15 03:22:31.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/configure 2010-01-15 11:45:20.000000000 +0100
@@ -676,6 +676,9 @@ REPORT_BUGS_TO
PKGVERSION
TARGET_OBS
@ -727,7 +719,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
pythondir
GDB_DATADIR_PATH
GDB_DATADIR
@@ -886,6 +889,7 @@ with_separate_debug_dir
@@ -888,6 +891,7 @@ with_separate_debug_dir
with_gdb_datadir
with_relocated_sources
with_pythondir
@ -735,7 +727,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
enable_targets
enable_64_bit_bfd
enable_gdbcli
@@ -925,6 +929,9 @@ LDFLAGS
@@ -928,6 +932,9 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
@ -745,7 +737,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
YACC
YFLAGS
XMKMF'
@@ -1588,6 +1595,8 @@ Optional Packages:
@@ -1593,6 +1600,8 @@ Optional Packages:
[DATADIR/gdb]
--with-pythondir install Python data files in this path
[DATADIR/gdb/python]
@ -754,7 +746,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
--with-libunwind use libunwind frame unwinding support
--with-curses use the curses library instead of the termcap
library
@@ -1621,6 +1630,9 @@ Some influential environment variables:
@@ -1627,6 +1636,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
@ -764,7 +756,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
YACC The `Yet Another C Compiler' implementation to use. Defaults to
the first program found out of: `bison -y', `byacc', `yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
@@ -6675,6 +6687,486 @@ _ACEOF
@@ -6760,6 +6772,486 @@ else
fi
@ -933,7 +925,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Duplicate here the declarations to verify they match "symfile.c". */
+/* Duplicate here the declarations to verify they match "elfread.c". */
+#include <rpm/rpmlib.h>
+#include <rpm/rpmts.h>
+#include <rpm/rpmdb.h>
@ -1187,7 +1179,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Duplicate here the declarations to verify they match "symfile.c". */
+/* Duplicate here the declarations to verify they match "elfread.c". */
+#include <rpm/rpmlib.h>
+#include <rpm/rpmts.h>
+#include <rpm/rpmdb.h>
@ -1251,7 +1243,7 @@ Index: gdb-6.8.50.20090909/gdb/configure
@@ -9721,265 +10213,25 @@ $as_echo "#define STDC_HEADERS 1" >>conf
@@ -10043,265 +10535,25 @@ $as_echo "#define STDC_HEADERS 1" >>conf
fi
@ -1527,11 +1519,11 @@ Index: gdb-6.8.50.20090909/gdb/configure
fi
Index: gdb-6.8.50.20090909/gdb/configure.ac
Index: gdb-7.0.50.20100115/gdb/configure.ac
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200
@@ -151,6 +151,199 @@ else
--- gdb-7.0.50.20100115.orig/gdb/configure.ac 2010-01-15 03:22:31.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/configure.ac 2010-01-15 11:45:20.000000000 +0100
@@ -152,6 +152,199 @@ else
fi
AC_SUBST(pythondir)
@ -1664,7 +1656,7 @@ Index: gdb-6.8.50.20090909/gdb/configure.ac
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
+/* Duplicate here the declarations to verify they match "symfile.c". */
+/* Duplicate here the declarations to verify they match "elfread.c". */
+#include <rpm/rpmlib.h>
+#include <rpm/rpmts.h>
+#include <rpm/rpmdb.h>
@ -1731,17 +1723,17 @@ Index: gdb-6.8.50.20090909/gdb/configure.ac
AC_CONFIG_SUBDIRS(doc testsuite)
Index: gdb-6.8.50.20090909/gdb/acinclude.m4
Index: gdb-7.0.50.20100115/gdb/acinclude.m4
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/acinclude.m4 2009-09-09 20:05:48.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/acinclude.m4 2009-09-09 20:08:04.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/acinclude.m4 2010-01-08 08:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/acinclude.m4 2010-01-15 11:45:20.000000000 +0100
@@ -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>
@@ -79,8 +81,6 @@ AC_MSG_RESULT(yes)
@@ -81,8 +83,6 @@ AC_MSG_RESULT(yes)
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.

View File

@ -1,11 +1,11 @@
Index: gdb-7.0/gdb/corelow.c
Index: gdb-7.0.50.20100115/gdb/corelow.c
===================================================================
--- gdb-7.0.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200
+++ gdb-7.0/gdb/corelow.c 2009-10-23 00:17:29.000000000 +0200
@@ -45,6 +45,10 @@
#include "exceptions.h"
--- gdb-7.0.50.20100115.orig/gdb/corelow.c 2010-01-04 15:57:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/corelow.c 2010-01-15 11:14:05.000000000 +0100
@@ -46,6 +46,10 @@
#include "solib.h"
#include "filenames.h"
#include "progspace.h"
+#include "auxv.h"
+#include "elf/common.h"
+#include "objfiles.h"
@ -13,7 +13,7 @@ Index: gdb-7.0/gdb/corelow.c
#ifndef O_LARGEFILE
@@ -273,6 +277,52 @@ add_to_thread_list (bfd *abfd, asection
@@ -290,6 +294,52 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current */
}
@ -66,7 +66,7 @@ Index: gdb-7.0/gdb/corelow.c
/* This routine opens and sets up the core file bfd. */
static void
@@ -371,6 +421,12 @@ core_open (char *filename, int from_tty)
@@ -387,6 +437,12 @@ core_open (char *filename, int from_tty)
push_target (&core_ops);
discard_cleanups (old_chain);
@ -76,10 +76,10 @@ Index: gdb-7.0/gdb/corelow.c
+ if (build_id_core_loads != 0)
+ build_id_locate_exec (from_tty);
+
add_inferior_silent (corelow_pid);
/* Do this before acknowledging the inferior, so if
@@ -878,4 +934,11 @@ _initialize_corelow (void)
post_create_inferior throws (can happen easilly if you're loading
a core file with the wrong exec), we aren't left with threads
@@ -925,4 +981,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target (&core_ops);
@ -91,11 +91,11 @@ Index: gdb-7.0/gdb/corelow.c
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
Index: gdb-7.0/gdb/doc/gdb.texinfo
Index: gdb-7.0.50.20100115/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.0.orig/gdb/doc/gdb.texinfo 2009-10-23 00:12:39.000000000 +0200
+++ gdb-7.0/gdb/doc/gdb.texinfo 2009-10-23 00:17:29.000000000 +0200
@@ -13896,6 +13896,27 @@ information files.
--- gdb-7.0.50.20100115.orig/gdb/doc/gdb.texinfo 2010-01-15 03:23:50.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/doc/gdb.texinfo 2010-01-15 11:12:33.000000000 +0100
@@ -14258,6 +14258,27 @@ information files.
@end table
@ -123,11 +123,11 @@ Index: gdb-7.0/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.0/gdb/solib-svr4.c
Index: gdb-7.0.50.20100115/gdb/solib-svr4.c
===================================================================
--- gdb-7.0.orig/gdb/solib-svr4.c 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/solib-svr4.c 2009-10-23 00:17:29.000000000 +0200
@@ -1101,9 +1101,49 @@ svr4_current_sos (void)
--- gdb-7.0.50.20100115.orig/gdb/solib-svr4.c 2010-01-15 03:22:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/solib-svr4.c 2010-01-15 11:12:33.000000000 +0100
@@ -1116,9 +1116,49 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
@ -180,22 +180,25 @@ Index: gdb-7.0/gdb/solib-svr4.c
}
xfree (buffer);
Index: gdb-7.0/gdb/symfile.c
Index: gdb-7.0.50.20100115/gdb/elfread.c
===================================================================
--- gdb-7.0.orig/gdb/symfile.c 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/symfile.c 2009-10-23 00:43:28.000000000 +0200
@@ -56,6 +56,7 @@
#include "elf-bfd.h"
#include "solib.h"
#include "remote.h"
--- gdb-7.0.50.20100115.orig/gdb/elfread.c 2010-01-15 03:22:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/elfread.c 2010-01-15 11:43:30.000000000 +0100
@@ -36,6 +36,10 @@
#include "gdb-stabs.h"
#include "complaints.h"
#include "demangle.h"
+#include "libbfd.h"
+#include "gdbcore.h"
+#include "gdbcmd.h"
+#include "observer.h"
#include <sys/types.h>
#include <fcntl.h>
@@ -1173,16 +1174,65 @@ symbol_file_clear (int from_tty)
printf_unfiltered (_("No symbol file now.\n"));
extern void _initialize_elfread (void);
@@ -567,6 +571,20 @@ elf_symtab_read (struct objfile *objfile
}
}
}
+/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
+ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */
+
@ -210,10 +213,10 @@ Index: gdb-7.0/gdb/symfile.c
+ fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"),
+ value);
+}
+
struct build_id
{
size_t size;
@@ -574,10 +592,44 @@ struct build_id
gdb_byte data[1];
};
@ -260,7 +263,7 @@ Index: gdb-7.0/gdb/symfile.c
{
struct build_id *retval;
@@ -1198,6 +1248,348 @@ build_id_bfd_get (bfd *abfd)
@@ -593,6 +645,348 @@ build_id_bfd_get (bfd *abfd)
return retval;
}
@ -609,7 +612,7 @@ Index: gdb-7.0/gdb/symfile.c
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
@@ -1215,7 +1607,7 @@ build_id_verify (const char *filename, s
@@ -607,7 +1001,7 @@ build_id_verify (const char *filename, s
if (abfd == NULL)
return 0;
@ -618,7 +621,7 @@ Index: gdb-7.0/gdb/symfile.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -1234,14 +1626,16 @@ build_id_verify (const char *filename, s
@@ -626,14 +1020,16 @@ build_id_verify (const char *filename, s
return retval;
}
@ -639,7 +642,7 @@ Index: gdb-7.0/gdb/symfile.c
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -1272,7 +1666,10 @@ build_id_to_debug_filename (struct build
@@ -664,7 +1060,10 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
@ -651,7 +654,7 @@ Index: gdb-7.0/gdb/symfile.c
/* lrealpath() is expensive even for the usually non-existent files. */
if (access (link, F_OK) == 0)
@@ -1285,15 +1682,185 @@ build_id_to_debug_filename (struct build
@@ -677,17 +1076,188 @@ build_id_to_debug_filename (struct build
}
if (retval != NULL)
@ -696,9 +699,9 @@ Index: gdb-7.0/gdb/symfile.c
+ xfree (link);
+ xfree (link_all);
+
+ return retval;
+}
+
return retval;
}
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+ Try to install the hash file ...
+ avoidance. */
@ -721,9 +724,9 @@ Index: gdb-7.0/gdb/symfile.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)
+{
@ -836,70 +839,88 @@ Index: gdb-7.0/gdb/symfile.c
+}
+
static char *
get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
-find_separate_debug_file_by_buildid (struct objfile *objfile)
+find_separate_debug_file_by_buildid (struct objfile *objfile,
+ char **build_id_filename_return)
{
@@ -1384,13 +1951,14 @@ find_separate_debug_file (struct objfile
unsigned long crc32;
asection *sect;
char *basename, *name_copy, *debugdir;
@@ -699,12 +1269,16 @@ find_separate_debug_file_by_buildid (str
int i;
struct build_id *build_id;
+ char *build_id_filename = NULL;
- build_id = build_id_bfd_get (objfile->obfd);
+ if (build_id_filename_return)
+ *build_id_filename_return = NULL;
+
+ build_id = build_id_bfd_shdr_get (objfile->obfd);
if (build_id != NULL)
{
char *build_id_name;
- build_id_name = build_id_to_debug_filename (build_id);
+ build_id_name = build_id_to_filename (build_id, &build_id_filename, 1);
+ build_id_name = build_id_to_filename (build_id, build_id_filename_return,
+ 1);
xfree (build_id);
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
@@ -1400,7 +1968,10 @@ find_separate_debug_file (struct objfile
@@ -714,7 +1288,7 @@ find_separate_debug_file_by_buildid (str
xfree (build_id_name);
}
else if (build_id_name != NULL)
- return build_id_name;
+ {
+ xfree (build_id_filename);
+ return build_id_name;
+ }
+ return build_id_name;
}
basename = get_debug_link_info (objfile, &crc32);
@@ -1501,8 +2072,10 @@ find_separate_debug_file (struct objfile
xfree (debugfile);
debugfile = NULL;
+ debug_print_missing (objfile->name, build_id_filename);
cleanup_return_debugfile:
+ xfree (build_id_filename);
xfree (canon_name);
xfree (basename);
xfree (dir);
@@ -4256,4 +4829,16 @@ each global debug-file-directory compone
NULL,
show_debug_file_directory,
&setlist, &showlist);
+
+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
+ _("\
+ Set debugging level of the build-id locator."), _("\
+ Show debugging level of the build-id locator."), _("\
+ Level 1 (default) enables printing the missing debug filenames,\n\
+ level 2 also prints the parsing of binaries to find the identificators."),
+ NULL,
+ show_build_id_verbose,
+ &setlist, &showlist);
+
+ observer_attach_executable_changed (debug_print_executable_changed);
return NULL;
}
Index: gdb-7.0/gdb/symfile.h
@@ -887,9 +1461,10 @@ elf_symfile_read (struct objfile *objfil
`.gnu_debuglink' may no longer be present with `.note.gnu.build-id'. */
else
{
- char *debugfile;
+ char *debugfile, *build_id_filename;
- debugfile = find_separate_debug_file_by_buildid (objfile);
+ debugfile = find_separate_debug_file_by_buildid (objfile,
+ &build_id_filename);
if (debugfile == NULL)
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -900,6 +1475,12 @@ elf_symfile_read (struct objfile *objfil
symbol_file_add_separate (abfd, symfile_flags, objfile);
xfree (debugfile);
}
+ /* Check if any separate debug info has been extracted out. */
+ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
+ != NULL)
+ debug_print_missing (objfile->name, build_id_filename);
+
+ xfree (build_id_filename);
}
}
@@ -1072,4 +1653,16 @@ void
_initialize_elfread (void)
{
add_symtab_fns (&elf_sym_fns);
+
+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
+ _("\
+Set debugging level of the build-id locator."), _("\
+Show debugging level of the build-id locator."), _("\
+Level 1 (default) enables printing the missing debug filenames,\n\
+level 2 also prints the parsing of binaries to find the identificators."),
+ NULL,
+ show_build_id_verbose,
+ &setlist, &showlist);
+
+ observer_attach_executable_changed (debug_print_executable_changed);
}
Index: gdb-7.0.50.20100115/gdb/symfile.h
===================================================================
--- gdb-7.0.orig/gdb/symfile.h 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/symfile.h 2009-10-23 00:17:29.000000000 +0200
@@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen
--- gdb-7.0.50.20100115.orig/gdb/symfile.h 2010-01-15 03:22:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/symfile.h 2010-01-15 11:12:33.000000000 +0100
@@ -392,6 +392,13 @@ extern int symfile_map_offsets_to_segmen
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
void free_symfile_segment_data (struct symfile_segment_data *data);
@ -913,10 +934,10 @@ Index: gdb-7.0/gdb/symfile.h
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
Index: gdb-7.0/gdb/testsuite/lib/gdb.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.0.orig/gdb/testsuite/lib/gdb.exp 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/testsuite/lib/gdb.exp 2009-10-23 00:17:29.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/gdb.exp 2010-01-15 03:22:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp 2010-01-15 11:12:33.000000000 +0100
@@ -1248,6 +1248,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
@ -934,10 +955,10 @@ Index: gdb-7.0/gdb/testsuite/lib/gdb.exp
return 0;
}
Index: gdb-7.0/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.0.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200
+++ gdb-7.0/gdb/testsuite/lib/mi-support.exp 2009-10-23 00:17:29.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/mi-support.exp 2010-01-12 22:40:25.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp 2010-01-15 11:12:33.000000000 +0100
@@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
}
}
@ -955,11 +976,11 @@ Index: gdb-7.0/gdb/testsuite/lib/mi-support.exp
detect_async
Index: gdb-7.0/gdb/objfiles.h
Index: gdb-7.0.50.20100115/gdb/objfiles.h
===================================================================
--- gdb-7.0.orig/gdb/objfiles.h 2009-10-23 00:12:38.000000000 +0200
+++ gdb-7.0/gdb/objfiles.h 2009-10-23 00:17:29.000000000 +0200
@@ -428,6 +428,10 @@ struct objfile
--- gdb-7.0.50.20100115.orig/gdb/objfiles.h 2010-01-15 03:22:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/objfiles.h 2010-01-15 11:14:42.000000000 +0100
@@ -440,6 +440,10 @@ struct objfile
#define OBJF_MAIN (1 << 7)
@ -967,6 +988,6 @@ Index: gdb-7.0/gdb/objfiles.h
+
+#define OBJF_BUILD_ID_CORE_LOADED (1 << 12)
+
/* The object file that the main symbol table was loaded from (e.g. the
argument to the "symbol-file" or "file" command). */
/* The object file that contains the runtime common minimal symbols
for SunOS4. Note that this objfile has no associated BFD. */

View File

@ -3,23 +3,23 @@
Port to GDB-6.8pre.
Remove the `[' character from the GDB-6.8 default message.
Index: gdb-6.7.50.20080227/gdb/linux-nat.c
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- gdb-6.7.50.20080227.orig/gdb/linux-nat.c 2008-03-01 10:30:48.000000000 +0100
+++ gdb-6.7.50.20080227/gdb/linux-nat.c 2008-03-01 10:48:25.000000000 +0100
@@ -415,7 +415,7 @@ linux_child_follow_fork (struct target_o
/* Detach new forked process? */
if (detach_fork)
{
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:22:31.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:23:28.000000000 +0100
@@ -724,7 +724,7 @@ holding the child stopped. Try \"set de
remove_breakpoints_pid (GET_PID (inferior_ptid));
}
- if (info_verbose || debug_linux_nat)
+ if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat)
{
target_terminal_ours ();
fprintf_filtered (gdb_stdlog,
Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c 2008-03-01 10:30:49.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.c 2010-01-15 03:22:52.000000000 +0100
@@ -0,0 +1,57 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -78,10 +78,10 @@ Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c
+ }
+ return 0;
+}
Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.exp 2008-03-01 10:49:36.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp 2010-01-15 03:22:52.000000000 +0100
@@ -0,0 +1,43 @@
+# Copyright 2007 Free Software Foundation, Inc.
+

View File

@ -3,11 +3,11 @@ Test GCORE on 32bit inferiors on 64bit platforms.
UNSUPPORTED results are valid for `-m64' on 32bit targets.
Index: gdb-6.8/gdb/testsuite/gdb.base/gcore.exp
Index: gdb-7.0.50.20100203/gdb/testsuite/gdb.base/gcore.exp
===================================================================
--- gdb-6.8.orig/gdb/testsuite/gdb.base/gcore.exp 2008-01-01 23:53:19.000000000 +0100
+++ gdb-6.8/gdb/testsuite/gdb.base/gcore.exp 2008-07-14 10:28:05.000000000 +0200
@@ -30,9 +30,14 @@ set testfile "gcore"
--- gdb-7.0.50.20100203.orig/gdb/testsuite/gdb.base/gcore.exp 2010-02-01 18:15:36.000000000 +0100
+++ gdb-7.0.50.20100203/gdb/testsuite/gdb.base/gcore.exp 2010-02-03 06:39:54.000000000 +0100
@@ -28,9 +28,14 @@ set testfile "gcore"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
@ -25,7 +25,7 @@ Index: gdb-6.8/gdb/testsuite/gdb.base/gcore.exp
}
# Start with a fresh gdb.
@@ -47,23 +52,23 @@ send_gdb "help gcore\n"
@@ -45,23 +50,23 @@ send_gdb "help gcore\n"
gdb_expect {
-re "Undefined command: .gcore.*$gdb_prompt $" {
# gcore command not supported -- nothing to test here.
@ -56,16 +56,16 @@ Index: gdb-6.8/gdb/testsuite/gdb.base/gcore.exp
}
proc capture_command_output { command prefix } {
@@ -77,7 +82,7 @@ proc capture_command_output { command pr
@@ -69,7 +74,7 @@ proc capture_command_output { command pr
global expect_out
set output_string ""
- gdb_test_multiple "$command" "capture_command_output for $command" {
+ gdb_test_multiple "$command" "${prefix} capture_command_output for $command" {
-re "${command}\[\r\n\]+${prefix}(.*)\[\r\n\]+$gdb_prompt $" {
set output_string $expect_out(1,string)
}
default {
- fail "capture_command_output failed on $command."
+ fail "${prefix} capture_command_output failed on $command."
}
}
return $output_string
@@ -109,22 +114,22 @@ set escapedfilename [string_to_regexp ${
@@ -103,22 +108,22 @@ set escapedfilename [string_to_regexp ${
set core_supported 0
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
@ -92,7 +92,7 @@ Index: gdb-6.8/gdb/testsuite/gdb.base/gcore.exp
}
# Now restart gdb and load the corefile.
@@ -136,31 +141,31 @@ gdb_load ${binfile}
@@ -130,31 +135,31 @@ gdb_load ${binfile}
send_gdb "core ${objdir}/${subdir}/gcore.test\n"
gdb_expect {
-re ".* is not a core dump:.*$gdb_prompt $" {
@ -133,7 +133,7 @@ Index: gdb-6.8/gdb/testsuite/gdb.base/gcore.exp
".*\[\r\n\]+#0 .* terminal_func \\(\\) at "
".*\[\r\n\]+#1 .* array_func \\(\\) at "
".*\[\r\n\]+#2 .* factorial_func \\(value=1\\) at "
@@ -174,61 +179,64 @@ gdb_expect_list "where in corefile" ".*$
@@ -168,61 +173,64 @@ gdb_expect_list "where in corefile" ".*$
set post_corefile_regs [capture_command_output "info registers" ""]
if ![string compare $pre_corefile_regs $post_corefile_regs] then {

View File

@ -21,11 +21,11 @@
Port to GDB-6.8pre.
Index: gdb-6.8.50.20090803/gdb/inferior.h
Index: gdb-7.0.50.20100115/gdb/inferior.h
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/inferior.h 2009-06-28 02:20:22.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/inferior.h 2009-08-03 17:19:56.000000000 +0200
@@ -181,7 +181,15 @@ extern void reopen_exec_file (void);
--- gdb-7.0.50.20100115.orig/gdb/inferior.h 2010-01-15 03:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/inferior.h 2010-01-15 03:17:07.000000000 +0100
@@ -188,7 +188,15 @@ extern void reopen_exec_file (void);
/* The `resume' routine should only be called in special circumstances.
Normally, use `proceed', which handles a lot of bookkeeping. */
@ -42,11 +42,11 @@ Index: gdb-6.8.50.20090803/gdb/inferior.h
/* From misc files */
Index: gdb-6.8.50.20090803/gdb/infrun.c
Index: gdb-7.0.50.20100115/gdb/infrun.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/infrun.c 2009-07-31 01:01:27.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/infrun.c 2009-08-03 21:39:28.000000000 +0200
@@ -74,7 +74,7 @@ static int follow_fork (void);
--- gdb-7.0.50.20100115.orig/gdb/infrun.c 2010-01-15 03:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/infrun.c 2010-01-15 03:17:32.000000000 +0100
@@ -77,7 +77,7 @@ static int follow_fork (void);
static void set_schedlock_func (char *args, int from_tty,
struct cmd_list_element *c);
@ -55,7 +55,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
static int currently_stepping_or_nexting_callback (struct thread_info *tp,
void *data);
@@ -1137,7 +1137,7 @@ maybe_software_singlestep (struct gdbarc
@@ -1363,7 +1363,7 @@ maybe_software_singlestep (struct gdbarc
STEP nonzero if we should step (zero to continue instead).
SIG is the signal to give the inferior (zero for none). */
void
@ -64,7 +64,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
{
int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
@@ -1149,10 +1149,12 @@ resume (int step, enum target_signal sig
@@ -1376,10 +1376,12 @@ resume (int step, enum target_signal sig
QUIT;
if (debug_infrun)
@ -81,7 +81,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
/* Some targets (e.g. Solaris x86) have a kernel bug when stepping
over an instruction that causes a page fault without triggering
@@ -1271,9 +1273,10 @@ a command like `return' or `jump' to con
@@ -1501,9 +1503,10 @@ a command like `return' or `jump' to con
individually. */
resume_ptid = inferior_ptid;
}
@ -94,16 +94,16 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
{
/* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
@@ -1474,7 +1477,7 @@ proceed (CORE_ADDR addr, enum target_sig
struct gdbarch *gdbarch;
@@ -1709,7 +1712,7 @@ proceed (CORE_ADDR addr, enum target_sig
struct thread_info *tp;
CORE_ADDR pc;
struct address_space *aspace;
- int oneproc = 0;
+ enum resume_step resume_step = RESUME_STEP_CONTINUE;
/* If we're stopped at a fork/vfork, follow the branch set by the
"set follow-fork-mode" command; otherwise, we'll just proceed
@@ -1508,13 +1511,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -1744,13 +1747,13 @@ proceed (CORE_ADDR addr, enum target_sig
actually be executing the breakpoint insn anyway.
We'll be (un-)executing the previous instruction. */
@ -119,7 +119,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
}
else
{
@@ -1545,13 +1548,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -1781,13 +1784,13 @@ proceed (CORE_ADDR addr, enum target_sig
is required it returns TRUE and sets the current thread to
the old thread. */
if (prepare_to_proceed (step))
@ -135,7 +135,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
{
tp->trap_expected = 1;
/* If displaced stepping is enabled, we can step over the
@@ -1637,8 +1640,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -1873,8 +1876,13 @@ proceed (CORE_ADDR addr, enum target_sig
/* Reset to normal state. */
init_infwait_state ();
@ -150,7 +150,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
/* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */
@@ -4171,13 +4179,18 @@ infrun: not switching back to stepped th
@@ -4655,13 +4663,18 @@ infrun: not switching back to stepped th
/* Is thread TP in the middle of single-stepping? */
@ -174,11 +174,11 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c
}
/* Returns true if any thread *but* the one passed in "data" is in the
Index: gdb-6.8.50.20090803/gdb/linux-nat.c
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-07-31 17:25:21.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-03 21:39:10.000000000 +0200
@@ -2351,7 +2351,10 @@ count_events_callback (struct lwp_info *
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:16:43.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:17:07.000000000 +0100
@@ -2883,7 +2883,10 @@ count_events_callback (struct lwp_info *
static int
select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
{
@ -190,10 +190,10 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
return 1;
else
return 0;
Index: gdb-6.8.50.20090803/gdb/linux-nat.h
Index: gdb-7.0.50.20100115/gdb/linux-nat.h
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/linux-nat.h 2009-05-18 19:11:25.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/linux-nat.h 2009-08-03 21:39:09.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.h 2010-01-12 22:40:24.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.h 2010-01-15 03:17:07.000000000 +0100
@@ -55,8 +55,8 @@ struct lwp_info
/* If non-zero, a pending wait status. */
int status;

View File

@ -0,0 +1,68 @@
http://sourceware.org/ml/gdb-patches/2010-03/msg01006.html
Subject: [patch or FYI] testsuite: Fix prelink.exp on system w/unprelinked system libs
Hi,
this is a more conservative variant superseded by:
[patch 4/6] testsuite: Unify to lib/prelink-support.exp
http://sourceware.org/ml/gdb-patches/2010-03/msg01002.html
where gdb.base/prelink.exp is reworked on generic lib/prelink-support.exp.
I prefer the [patch 4/6] over this patch but this mail can serve also as an
illustration of the current problem.
------------------------------------------------------------------------------
If your system for some reason currently does not have all the libraries
prelinked gdb.base/prelink.exp will get UNRESOLVED randomly also affecting
testsuite results diff.
Apparently the testcase already tried to avoid any system libraries
dependencies by "-nodefaultlibs". But currently it does has not worked that
way.
"-lm" is contained already even in dejagnu's default_target_compile (not just
in gdb/testsuite/lib/ada.exp). But I do not know why it is there and which
systems would get broken by some global gdb/testsuite/ "-lm" removal.
Thanks,
Jan
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix testcase false UNRESOLVED if system libraries are not prelinked.
* gdb.base/prelink.exp: New variables compile, board, err and mathlib.
Set clear board mathlib for ${libfile} compilation.
--- a/gdb/testsuite/gdb.base/prelink.exp
+++ b/gdb/testsuite/gdb.base/prelink.exp
@@ -42,7 +42,25 @@ set testfile "prelink"
set libsrcfile ${testfile}-lib.c
set libfile ${objdir}/${subdir}/${testfile}.so
-if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
+
+# default_target_compile would otherwise add "-lm" making the testcase
+# dependent on whether the system libraries are already prelinked.
+# prelink: Could not set /lib64/libm-2.11.1.so owner or mode: Operation not permitted
+set compile {
+ gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]
+}
+set board [target_info name]
+if [board_info $board exists mathlib] {
+ set mathlib [board_info $dest mathlib]
+ set_board_info mathlib ""
+ set err [eval $compile]
+ set_board_info mathlib $mathlib
+} else {
+ set_board_info mathlib ""
+ set err [eval $compile]
+ unset_board_info mathlib
+}
+if {$err != ""} {
# If creating the shared library fails, maybe we don't have the right tools
return -1
}

View File

@ -102,154 +102,3 @@ frames-invalid can happen asynchronously.
set timeout $oldtimeout
return 0
http://sourceware.org/ml/gdb-patches/2009-12/msg00234.html
Subject: [patch] testsuite: Fix a race by me - watchthreads-reorder.exp
Hi,
there is a bug explainable by man pthread_cond_signal:
The [...] pthread_cond_signal() functions shall have no effect if
there are no threads currently blocked on cond.
meaning a race for the testcase.
+FAIL: gdb.threads/watchthreads-reorder.exp: reorder1: continue a (timeout)
One can reproduce the race on CVS HEAD by:
# --- a/gdb/testsuite/gdb.threads/watchthreads-reorder.c
# +++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
# @@ -89,6 +89,7 @@ thread1_func (void *unused)
# int i;
# volatile int rwatch_store;
#
# +sleep(1);
# thread1_tid = gettid ();
# i = pthread_cond_signal (&thread1_tid_cond);
# assert (i == 0);
# @@ -317,6 +318,7 @@ main (int argc, char **argv)
#
# if (thread1_tid == 0)
# {
# +sleep(2);
# i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
# assert (i == 0);
#
Fixed; gdbstop_mutex got removed as it became redundant there.
Going to check it in as obvious in several days (code is by me + it is just
a testcase).
Sorry,
Jan
gdb/testsuite/
2009-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/watchthreads-reorder.c (gdbstop_mutex): Remove.
(thread1_func): Protect thread1_tid_cond by thread1_tid_mutex. Remove
gdbstop_mutex handling.
(thread2_func): Protect thread2_tid_cond by thread2_tid_mutex. Remove
gdbstop_mutex handling.
(main): Move thread1_tid_mutex and thread2_tid_mutex locks before
pthread_create. Remove gdbstop_mutex handling. New comment. Remove
pthread_cond_wait conditionalizations.
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.c
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c
@@ -34,8 +34,6 @@
otherwise. */
#define TIMEOUT (gettid () == getpid() ? 10 : 15)
-static pthread_mutex_t gdbstop_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-
static pid_t thread1_tid;
static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
@@ -90,12 +88,11 @@ thread1_func (void *unused)
volatile int rwatch_store;
thread1_tid = gettid ();
+
+ timed_mutex_lock (&thread1_tid_mutex);
i = pthread_cond_signal (&thread1_tid_cond);
assert (i == 0);
-
- /* Be sure GDB is already stopped before continuing. */
- timed_mutex_lock (&gdbstop_mutex);
- i = pthread_mutex_unlock (&gdbstop_mutex);
+ i = pthread_mutex_unlock (&thread1_tid_mutex);
assert (i == 0);
rwatch_store = thread1_rwatch;
@@ -115,12 +112,11 @@ thread2_func (void *unused)
volatile int rwatch_store;
thread2_tid = gettid ();
+
+ timed_mutex_lock (&thread2_tid_mutex);
i = pthread_cond_signal (&thread2_tid_cond);
assert (i == 0);
-
- /* Be sure GDB is already stopped before continuing. */
- timed_mutex_lock (&gdbstop_mutex);
- i = pthread_mutex_unlock (&gdbstop_mutex);
+ i = pthread_mutex_unlock (&thread2_tid_mutex);
assert (i == 0);
rwatch_store = thread2_rwatch;
@@ -267,7 +263,8 @@ main (int argc, char **argv)
setbuf (stdout, NULL);
- timed_mutex_lock (&gdbstop_mutex);
+ timed_mutex_lock (&thread1_tid_mutex);
+ timed_mutex_lock (&thread2_tid_mutex);
timed_mutex_lock (&terminate_mutex);
@@ -306,30 +303,21 @@ main (int argc, char **argv)
state_wait (tracer, "T (stopped)");
}
- timed_mutex_lock (&thread1_tid_mutex);
- timed_mutex_lock (&thread2_tid_mutex);
-
- /* Let the threads start. */
- i = pthread_mutex_unlock (&gdbstop_mutex);
- assert (i == 0);
+ /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so
+ they could not trigger the watchpoints before GDB gets unstopped later.
+ Threads get resumed at pthread_cond_wait below. */
printf ("Waiting till the threads initialize their TIDs.\n");
- if (thread1_tid == 0)
- {
- i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
- assert (i == 0);
+ i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
+ assert (i == 0);
- assert (thread1_tid > 0);
- }
+ assert (thread1_tid > 0);
- if (thread2_tid == 0)
- {
- i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
- assert (i == 0);
+ i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
+ assert (i == 0);
- assert (thread2_tid > 0);
- }
+ assert (thread2_tid > 0);
printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n",
(unsigned long) thread1_tid, (unsigned long) thread2_tid,

View File

@ -1,8 +1,8 @@
Index: gdb-6.8.50.20090803/gdb/linux-nat.c
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-03 17:24:03.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-03 17:27:23.000000000 +0200
@@ -202,6 +202,9 @@ blocked. */
--- 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;
@ -12,8 +12,8 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
/* The method to call, if any, when a new thread is attached. */
static void (*linux_nat_new_thread) (ptid_t);
@@ -790,7 +793,14 @@ linux_child_follow_fork (struct target_o
linux_parent_pid = parent_pid;
@@ -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);
@ -26,9 +26,9 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
+ target_detach (NULL, 0);
+ }
inferior_ptid = ptid_build (child_pid, child_pid, 0);
add_thread (inferior_ptid);
@@ -1231,6 +1241,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
/* 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");
@ -36,8 +36,8 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
/* The process is definitely stopped. It is in a job control
stop, unless the kernel predates the TASK_STOPPED /
@@ -1512,6 +1523,9 @@ GPT: lwp %s had signal %s, but it is in
*status = lp->status;
@@ -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)
@ -46,7 +46,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
return 0;
}
@@ -1621,6 +1635,8 @@ linux_nat_detach (struct target_ops *ops
@@ -1866,6 +1880,8 @@ linux_nat_detach (struct target_ops *ops
}
else
linux_ops->to_detach (ops, args, from_tty);
@ -55,7 +55,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
}
/* Resume LP. */
@@ -1774,6 +1790,14 @@ linux_nat_resume (struct target_ops *ops
@@ -2031,6 +2047,14 @@ linux_nat_resume (struct target_ops *ops
resume_callback. */
lp->stopped = 0;
@ -70,7 +70,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
if (resume_many)
iterate_over_lwps (ptid, resume_callback, NULL);
@@ -3322,6 +3346,8 @@ linux_nat_mourn_inferior (struct target_
@@ -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 ();
@ -79,10 +79,10 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c
}
/* Convert a native/host siginfo object, into/from the siginfo in the
Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attach-stopped.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2009-01-03 06:58:07.000000000 +0100
+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attach-stopped.exp 2009-08-03 17:26:22.000000000 +0200
--- 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}
@ -150,10 +150,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attach-stopped.exp
set test "$threadtype: attach2 to stopped, after setting file"
gdb_test_multiple "attach $testpid" "$test" {
Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attachstop-mt.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attachstop-mt.exp
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.threads/attachstop-mt.exp 2009-01-03 06:58:07.000000000 +0100
+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attachstop-mt.exp 2009-08-03 17:26:22.000000000 +0200
--- 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

View File

@ -1,8 +1,8 @@
Index: gdb-6.8.50.20090910/bfd/elf-bfd.h
Index: gdb-7.0.50.20100203/bfd/elf-bfd.h
===================================================================
--- gdb-6.8.50.20090910.orig/bfd/elf-bfd.h 2009-09-09 23:38:57.000000000 +0200
+++ gdb-6.8.50.20090910/bfd/elf-bfd.h 2009-09-10 23:01:15.000000000 +0200
@@ -2121,7 +2121,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
--- gdb-7.0.50.20100203.orig/bfd/elf-bfd.h 2010-02-02 13:37:39.000000000 +0100
+++ gdb-7.0.50.20100203/bfd/elf-bfd.h 2010-02-03 07:28:20.000000000 +0100
@@ -2140,7 +2140,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
extern char *elfcore_write_prpsinfo
@ -11,11 +11,11 @@ Index: gdb-6.8.50.20090910/bfd/elf-bfd.h
extern char *elfcore_write_prstatus
(bfd *, char *, int *, long, int, const void *);
extern char * elfcore_write_pstatus
Index: gdb-6.8.50.20090910/bfd/elf.c
Index: gdb-7.0.50.20100203/bfd/elf.c
===================================================================
--- gdb-6.8.50.20090910.orig/bfd/elf.c 2009-09-09 23:38:57.000000000 +0200
+++ gdb-6.8.50.20090910/bfd/elf.c 2009-09-10 23:04:17.000000000 +0200
@@ -8398,6 +8398,7 @@ char *
--- gdb-7.0.50.20100203.orig/bfd/elf.c 2010-02-02 13:37:39.000000000 +0100
+++ gdb-7.0.50.20100203/bfd/elf.c 2010-02-03 07:28:20.000000000 +0100
@@ -8459,6 +8459,7 @@ char *
elfcore_write_prpsinfo (bfd *abfd,
char *buf,
int *bufsiz,
@ -23,7 +23,7 @@ Index: gdb-6.8.50.20090910/bfd/elf.c
const char *fname,
const char *psargs)
{
@@ -8424,9 +8425,15 @@ elfcore_write_prpsinfo (bfd *abfd,
@@ -8485,9 +8486,15 @@ elfcore_write_prpsinfo (bfd *abfd,
int note_type = NT_PRPSINFO;
#endif
@ -42,7 +42,7 @@ Index: gdb-6.8.50.20090910/bfd/elf.c
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
}
@@ -8441,9 +8448,15 @@ elfcore_write_prpsinfo (bfd *abfd,
@@ -8502,9 +8509,15 @@ elfcore_write_prpsinfo (bfd *abfd,
int note_type = NT_PRPSINFO;
#endif
@ -61,10 +61,10 @@ Index: gdb-6.8.50.20090910/bfd/elf.c
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
}
Index: gdb-6.8.50.20090910/gdb/amd64-linux-nat.c
Index: gdb-7.0.50.20100203/gdb/amd64-linux-nat.c
===================================================================
--- gdb-6.8.50.20090910.orig/gdb/amd64-linux-nat.c 2009-09-10 23:01:07.000000000 +0200
+++ gdb-6.8.50.20090910/gdb/amd64-linux-nat.c 2009-09-10 23:01:15.000000000 +0200
--- gdb-7.0.50.20100203.orig/gdb/amd64-linux-nat.c 2010-02-03 07:28:20.000000000 +0100
+++ gdb-7.0.50.20100203/gdb/amd64-linux-nat.c 2010-02-03 07:28:20.000000000 +0100
@@ -140,6 +140,7 @@ static int amd64_linux_gregset32_reg_off
static char *
@ -98,10 +98,10 @@ Index: gdb-6.8.50.20090910/gdb/amd64-linux-nat.c
}
static void
Index: gdb-6.8.50.20090910/gdb/fbsd-nat.c
Index: gdb-7.0.50.20100203/gdb/fbsd-nat.c
===================================================================
--- gdb-6.8.50.20090910.orig/gdb/fbsd-nat.c 2009-07-02 19:21:06.000000000 +0200
+++ gdb-6.8.50.20090910/gdb/fbsd-nat.c 2009-09-10 23:01:15.000000000 +0200
--- gdb-7.0.50.20100203.orig/gdb/fbsd-nat.c 2010-01-01 08:31:31.000000000 +0100
+++ gdb-7.0.50.20100203/gdb/fbsd-nat.c 2010-02-03 07:28:20.000000000 +0100
@@ -211,6 +211,7 @@ fbsd_make_corefile_notes (bfd *obfd, int
psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL);
@ -110,19 +110,19 @@ Index: gdb-6.8.50.20090910/gdb/fbsd-nat.c
fname, psargs);
}
Index: gdb-6.8.50.20090910/gdb/linux-nat.c
Index: gdb-7.0.50.20100203/gdb/linux-nat.c
===================================================================
--- gdb-6.8.50.20090910.orig/gdb/linux-nat.c 2009-09-10 23:01:06.000000000 +0200
+++ gdb-6.8.50.20090910/gdb/linux-nat.c 2009-09-10 23:01:15.000000000 +0200
@@ -55,6 +55,7 @@
#include "xml-support.h"
--- gdb-7.0.50.20100203.orig/gdb/linux-nat.c 2010-02-03 07:28:20.000000000 +0100
+++ gdb-7.0.50.20100203/gdb/linux-nat.c 2010-02-03 07:28:20.000000000 +0100
@@ -56,6 +56,7 @@
#include "terminal.h"
#include <sys/vfs.h>
#include "solib.h"
+#include "gdb_procfs32.h" /* for struct elf_prpsinfo32 */
#ifndef SPUFS_MAGIC
#define SPUFS_MAGIC 0x23c9b64e
@@ -222,7 +223,7 @@ static LONGEST (*super_xfer_partial) (st
@@ -228,7 +229,7 @@ static LONGEST (*super_xfer_partial) (st
/* This functions make elfcore note sections.
They may get overriden by code adjusting data for multi-target builds. */
char *(*linux_elfcore_write_prpsinfo)
@ -131,7 +131,7 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.c
char *(*linux_elfcore_write_prstatus)
(bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus;
static char *
@@ -3946,6 +3947,159 @@ linux_spu_make_corefile_notes (bfd *obfd
@@ -4422,6 +4423,159 @@ linux_spu_make_corefile_notes (bfd *obfd
return args.note_data;
}
@ -291,7 +291,7 @@ Index: gdb-6.8.50.20090910/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. */
@@ -3966,8 +4120,14 @@ linux_nat_make_corefile_notes (bfd *obfd
@@ -4442,8 +4596,14 @@ linux_nat_make_corefile_notes (bfd *obfd
if (get_exec_file (0))
{
@ -306,7 +306,7 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.c
if (get_inferior_args ())
{
char *string_end;
@@ -3983,9 +4143,15 @@ linux_nat_make_corefile_notes (bfd *obfd
@@ -4459,9 +4619,15 @@ linux_nat_make_corefile_notes (bfd *obfd
psargs_end - string_end);
}
}
@ -324,11 +324,11 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.c
}
/* Dump information for threads. */
Index: gdb-6.8.50.20090910/gdb/linux-nat.h
Index: gdb-7.0.50.20100203/gdb/linux-nat.h
===================================================================
--- gdb-6.8.50.20090910.orig/gdb/linux-nat.h 2009-09-10 23:01:06.000000000 +0200
+++ gdb-6.8.50.20090910/gdb/linux-nat.h 2009-09-10 23:01:15.000000000 +0200
@@ -154,7 +154,7 @@ struct siginfo *linux_nat_get_siginfo (p
--- gdb-7.0.50.20100203.orig/gdb/linux-nat.h 2010-02-03 07:28:19.000000000 +0100
+++ gdb-7.0.50.20100203/gdb/linux-nat.h 2010-02-03 07:28:20.000000000 +0100
@@ -173,7 +173,7 @@ int linux_nat_core_of_thread_1 (ptid_t p
/* These functions make elfcore note sections.
They may get overriden by code adjusting data for multi-target builds. */
extern char *(*linux_elfcore_write_prpsinfo)
@ -337,11 +337,11 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.h
extern char *(*linux_elfcore_write_prstatus)
(bfd *, char *, int *, long, int, const void *);
extern char *(*linux_elfcore_write_prfpreg)
Index: gdb-6.8.50.20090910/gdb/procfs.c
Index: gdb-7.0.50.20100203/gdb/procfs.c
===================================================================
--- gdb-6.8.50.20090910.orig/gdb/procfs.c 2009-08-01 02:02:04.000000000 +0200
+++ gdb-6.8.50.20090910/gdb/procfs.c 2009-09-10 23:01:15.000000000 +0200
@@ -6147,6 +6147,7 @@ procfs_make_note_section (bfd *obfd, int
--- gdb-7.0.50.20100203.orig/gdb/procfs.c 2010-01-28 09:19:29.000000000 +0100
+++ gdb-7.0.50.20100203/gdb/procfs.c 2010-02-03 07:28:20.000000000 +0100
@@ -6186,6 +6186,7 @@ procfs_make_note_section (bfd *obfd, int
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
note_size,

View File

@ -61,7 +61,7 @@
+# "\r\nCore was generated by `\[^\r\n\]*'\\.\r\nProgram terminated with signal 11, Segmentation fault\\.\r\n.*"
+gdb_test "core-file ${corefile}"
+
+gdb_test "x/i $address" "\r\n$address:\[ \t\]*hlt\[ \t\]*" ".text is readable"
+gdb_test "x/i $address" "\r\n\[ \t\]*$address:\[ \t\]*hlt\[ \t\]*" ".text is readable"
--- /dev/null 2009-04-19 14:49:00.974648389 +0200
+++ gdb-6.8/gdb/testsuite/gdb.arch/i386-biarch-core.S 2009-04-19 14:52:28.000000000 +0200
@@ -0,0 +1,22 @@

View File

@ -1,265 +0,0 @@
gdb/
2009-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* configure.ac: Call AC_SYS_LARGEFILE.
* config.in: Regenerate.
* configure: Regenerate.
Index: gdb-6.8.50.20090909/gdb/configure.ac
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:11:04.000000000 +0200
@@ -28,6 +28,7 @@ AM_MAINTAINER_MODE
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
gl_EARLY
+AC_SYS_LARGEFILE
AM_PROG_CC_STDC
AC_CONFIG_AUX_DIR(..)
Index: gdb-6.8.50.20090909/gdb/config.in
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:08:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:11:33.000000000 +0200
@@ -751,10 +751,16 @@
# endif
#endif
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
/* Define to 1 so <sys/proc.h> gets a definition of anon_hdl. Works around a
<sys/proc.h> problem on IRIX 5. */
#undef _KMEMUSER
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
/* Define to 1 if on MINIX. */
#undef _MINIX
Index: gdb-6.8.50.20090909/gdb/configure
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:10:45.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:11:07.000000000 +0200
@@ -884,6 +884,7 @@ ac_subst_files='host_makefile_frag'
ac_user_opts='
enable_option_checking
enable_maintainer_mode
+enable_largefile
enable_dependency_tracking
with_separate_debug_dir
with_gdb_datadir
@@ -1562,6 +1563,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
+ --disable-largefile omit support for large files
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-targets=TARGETS
@@ -4100,6 +4102,204 @@ fi
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ if ac_fn_c_try_compile "$LINENO"; then :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_file_offset_bits=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_large_files=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ fi
+fi
+

View File

@ -18,11 +18,11 @@
gdb.base/watchpoint.c (global_ptr_ptr): New variable.
(func4): New testing code for GLOBAL_PTR_PTR.
Index: gdb-6.8.50.20090803/gdb/breakpoint.c
Index: gdb-7.0.50.20100115/gdb/breakpoint.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/breakpoint.c 2009-08-04 06:29:47.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/breakpoint.c 2009-08-04 06:32:50.000000000 +0200
@@ -823,7 +823,15 @@ is_hardware_watchpoint (struct breakpoin
--- gdb-7.0.50.20100115.orig/gdb/breakpoint.c 2010-01-15 11:46:29.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/breakpoint.c 2010-01-15 11:49:49.000000000 +0100
@@ -947,7 +947,15 @@ is_hardware_watchpoint (struct breakpoin
If VAL_CHAIN is non-NULL, *VAL_CHAIN will be released from the
value chain. The caller must free the values individually. If
VAL_CHAIN is NULL, all generated values will be left on the value
@ -39,8 +39,8 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c
static void
fetch_watchpoint_value (struct expression *exp, struct value **valp,
@@ -6301,7 +6309,7 @@ watch_command_1 (char *arg, int accessfl
struct symtab_and_line sal;
@@ -7264,7 +7272,7 @@ watch_command_1 (char *arg, int accessfl
struct breakpoint *b, *scope_breakpoint = NULL;
struct expression *exp;
struct block *exp_valid_block;
- struct value *val, *mark;
@ -48,7 +48,7 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c
struct frame_info *frame;
char *exp_start = NULL;
char *exp_end = NULL;
@@ -6392,6 +6400,27 @@ watch_command_1 (char *arg, int accessfl
@@ -7352,6 +7360,27 @@ watch_command_1 (char *arg, int accessfl
exp_valid_block = innermost_block;
mark = value_mark ();
fetch_watchpoint_value (exp, &val, NULL, NULL);
@ -76,11 +76,11 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c
if (val != NULL)
release_value (val);
Index: gdb-6.8.50.20090803/gdb/gdbtypes.h
Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/gdbtypes.h 2009-08-04 06:31:58.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/gdbtypes.h 2009-08-04 06:32:50.000000000 +0200
@@ -71,7 +71,22 @@ enum type_code
--- gdb-7.0.50.20100115.orig/gdb/gdbtypes.h 2010-01-15 03:22:31.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/gdbtypes.h 2010-01-15 11:49:26.000000000 +0100
@@ -72,7 +72,22 @@ enum type_code
TYPE_CODE_UNION, /* C union or Pascal variant part */
TYPE_CODE_ENUM, /* Enumeration type */
TYPE_CODE_FLAGS, /* Bit flags type */
@ -104,11 +104,11 @@ Index: gdb-6.8.50.20090803/gdb/gdbtypes.h
TYPE_CODE_INT, /* Integer type */
/* Floating type. This is *NOT* a complex type. Beware, there are parts
Index: gdb-6.8.50.20090803/gdb/doc/gdb.texinfo
Index: gdb-7.0.50.20100115/gdb/doc/gdb.texinfo
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/doc/gdb.texinfo 2009-08-04 06:32:39.000000000 +0200
+++ gdb-6.8.50.20090803/gdb/doc/gdb.texinfo 2009-08-04 06:32:50.000000000 +0200
@@ -3517,6 +3517,18 @@ This command prints a list of watchpoint
--- gdb-7.0.50.20100115.orig/gdb/doc/gdb.texinfo 2010-01-15 11:12:33.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/doc/gdb.texinfo 2010-01-15 11:49:26.000000000 +0100
@@ -3723,6 +3723,18 @@ This command prints a list of watchpoint
it is the same as @code{info break} (@pxref{Set Breaks}).
@end table
@ -127,10 +127,10 @@ Index: gdb-6.8.50.20090803/gdb/doc/gdb.texinfo
@value{GDBN} sets a @dfn{hardware watchpoint} if possible. Hardware
watchpoints execute very quickly, and the debugger reports a change in
value at the exact instruction where the change occurs. If @value{GDBN}
Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.c
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.base/watchpoint.c 2008-03-03 14:24:12.000000000 +0100
+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c 2009-08-04 06:32:50.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/watchpoint.c 2009-12-30 18:33:35.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.c 2010-01-15 11:49:26.000000000 +0100
@@ -40,6 +40,7 @@ struct foo struct1, struct2, *ptr1, *ptr
int doread = 0;
@ -139,7 +139,7 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c
void marker1 ()
{
@@ -118,6 +119,10 @@ func4 ()
@@ -119,6 +120,10 @@ func4 ()
buf[0] = 3;
global_ptr = buf;
buf[0] = 7;
@ -150,10 +150,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c
}
int main ()
Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.exp
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.exp
===================================================================
--- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.base/watchpoint.exp 2009-01-03 06:58:03.000000000 +0100
+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.exp 2009-08-04 06:32:50.000000000 +0200
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/watchpoint.exp 2010-01-01 08:32:01.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.exp 2010-01-15 11:50:21.000000000 +0100
@@ -641,7 +641,21 @@ proc test_watchpoint_and_breakpoint {} {
}
}
@ -216,10 +216,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.exp
}
}
@@ -842,6 +879,17 @@ if [initialize] then {
}
@@ -851,6 +888,17 @@ if [initialize] then {
test_watchpoint_and_breakpoint
test_watchpoint_in_big_blob
+
+ # See above.
+ if [istarget "mips-idt-*"] then {

View File

@ -1,8 +1,8 @@
Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
===================================================================
--- gdb-6.8.50.20090811.orig/gdb/dwarf2read.c 2009-08-13 10:14:45.000000000 +0200
+++ gdb-6.8.50.20090811/gdb/dwarf2read.c 2009-08-13 10:22:36.000000000 +0200
@@ -2480,6 +2480,7 @@ scan_partial_symbols (struct partial_die
--- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 11:52:59.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 11:53:57.000000000 +0100
@@ -2529,6 +2529,7 @@ scan_partial_symbols (struct partial_die
add_partial_subprogram (pdi, lowpc, highpc, need_pc, cu);
break;
case DW_TAG_variable:
@ -10,7 +10,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
case DW_TAG_typedef:
case DW_TAG_union_type:
if (!pdi->is_declaration)
@@ -2675,6 +2676,7 @@ add_partial_symbol (struct partial_die_i
@@ -2719,6 +2720,7 @@ add_partial_symbol (struct partial_die_i
}
break;
case DW_TAG_variable:
@ -18,15 +18,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
if (pdi->is_external)
{
/* Global Variable.
@@ -2805,6 +2807,7 @@ die_needs_namespace (struct die_info *di
return 1;
case DW_TAG_variable:
+ case DW_TAG_constant:
{
struct attribute *attr;
attr = dwarf2_attr (die, DW_AT_specification, cu);
@@ -4741,7 +4744,8 @@ dwarf2_add_field (struct field_info *fip
@@ -4770,7 +4772,8 @@ dwarf2_add_field (struct field_info *fip
fip->non_public_fields = 1;
}
}
@ -36,7 +28,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
{
/* C++ static member. */
@@ -5233,7 +5237,8 @@ read_structure_type (struct die_info *di
@@ -5339,7 +5342,8 @@ read_structure_type (struct die_info *di
while (child_die && child_die->tag)
{
if (child_die->tag == DW_TAG_member
@ -46,7 +38,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
{
/* NOTE: carlton/2002-11-05: A C++ static data member
should be a DW_TAG_member that is a declaration, but
@@ -5352,6 +5357,7 @@ process_structure_scope (struct die_info
@@ -5459,6 +5463,7 @@ process_structure_scope (struct die_info
{
if (child_die->tag == DW_TAG_member
|| child_die->tag == DW_TAG_variable
@ -54,7 +46,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
|| child_die->tag == DW_TAG_inheritance)
{
/* Do nothing. */
@@ -6980,6 +6986,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
@@ -7134,6 +7139,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
&& abbrev->tag != DW_TAG_subprogram
&& abbrev->tag != DW_TAG_lexical_block
&& abbrev->tag != DW_TAG_variable
@ -62,7 +54,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
&& abbrev->tag != DW_TAG_namespace
&& abbrev->tag != DW_TAG_module
&& abbrev->tag != DW_TAG_member)
@@ -7088,6 +7095,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
@@ -7242,6 +7248,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
if (load_all
|| abbrev->tag == DW_TAG_subprogram
|| abbrev->tag == DW_TAG_variable
@ -70,7 +62,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c
|| abbrev->tag == DW_TAG_namespace
|| part_die->is_declaration)
{
@@ -8901,6 +8909,11 @@ new_symbol (struct die_info *die, struct
@@ -9016,6 +9023,11 @@ new_symbol (struct die_info *die, struct
/* Do not add the symbol to any lists. It will be found via
BLOCK_FUNCTION from the blockvector. */
break;

View File

@ -1,571 +0,0 @@
infcall.c <unwind_on_signal_p>:
Revert the change of: gdb-6.8-inlining.patch
causing: FAIL: gdb.base/unwindonsignal.exp: unwindonsignal, stack unwound
resume() -> target_resume() move of clear_inline_frame_state() is for:
gdb.mi/mi-nsmoribund.exp
Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-bt.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-bt.c 2009-06-28 02:20:24.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-bt.c 2009-09-17 12:49:01.000000000 +0200
@@ -13,10 +13,16 @@
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 x, y;
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
+ gets optimized by CSE to just simple assignments of the results. */
+volatile int x, y;
volatile int result;
-void bar(void);
+inline void bar(void)
+{
+ x += y; /* set breakpoint 1 here */
+}
+
inline int func1(void)
{
Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-cmds.c 2009-06-28 02:20:24.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.c 2009-09-17 12:49:01.000000000 +0200
@@ -13,13 +13,19 @@
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 x, y;
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
+ gets optimized by CSE to just simple assignments of the results. */
+volatile int x, y;
volatile int result;
-void bar(void);
void marker(void);
void noinline(void);
+inline void bar(void)
+{
+ x += y; /* set breakpoint 1 here */
+}
+
inline int func1(void)
{
bar ();
Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.exp
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-06-28 02:20:24.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-09-17 12:49:01.000000000 +0200
@@ -230,7 +230,7 @@ set line3 [gdb_get_line_number "set brea
gdb_breakpoint $line3
gdb_continue_to_breakpoint "consecutive func1"
-gdb_test "next" ".*func1 .*first call.*" "next to first func1"
+gdb_test "next" "func1 .*first call.*" "next to first func1"
set msg "next to second func1"
gdb_test_multiple "next" $msg {
-re ".*func1 .*second call.*$gdb_prompt $" {
@@ -253,16 +253,16 @@ set line4 [gdb_get_line_number "set brea
gdb_breakpoint $line4
gdb_continue_to_breakpoint "func1 then func3"
-gdb_test "next" ".*func1 \\\(\\\);" "next to func1 before func3"
-gdb_test "next" ".*func3 \\\(\\\);" "next to func3"
+gdb_test "next" "func1 \\\(\\\);" "next to func1 before func3"
+gdb_test "next" "func3 \\\(\\\);" "next to func3"
# Test finishing out of one thing and into another.
set line5 [gdb_get_line_number "set breakpoint 5 here"]
gdb_breakpoint $line5
gdb_continue_to_breakpoint "finish into func1"
-gdb_test "next" ".*marker \\\(\\\);" "next to finish marker"
-gdb_test "step" ".*set breakpoint 2 here.*" "step into finish marker"
+gdb_test "next" "marker \\\(\\\);" "next to finish marker"
+gdb_test "step" "set breakpoint 2 here.*" "step into finish marker"
gdb_test "finish" "func1 \\\(\\\);" "finish from marker to func1"
gdb_test "step" "bar \\\(\\\);" "step into func1 for finish"
@@ -297,12 +297,12 @@ gdb_test "step" "noinline \\\(\\\) at .*
gdb_test "bt" "#0 noinline.*#1 .*outer_inline1.*#2 .*outer_inline2.*#3 main.*" "backtrace at noinline from outer_inline1"
gdb_test "step" "inlined_fn \\\(\\\) at .*" "enter inlined_fn from noinline"
gdb_test "bt" "#0 inlined_fn.*#1 noinline.*#2 .*outer_inline1.*#3 .*outer_inline2.*#4 main.*" "backtrace at inlined_fn from noinline"
-gdb_test "info frame" ".*inlined into frame.*" "inlined_fn from noinline inlined"
-gdb_test "up" "#1 noinline.*" "up to noinline"
-gdb_test "info frame" ".*\n called by frame.*" "noinline from outer_inline1 not inlined"
-gdb_test "up" "#2 .*outer_inline1.*" "up to outer_inline1"
-gdb_test "info frame" ".*inlined into frame.*" "outer_inline1 inlined"
-gdb_test "up" "#3 .*outer_inline2.*" "up to outer_inline2"
-gdb_test "info frame" ".*inlined into frame.*" "outer_inline2 inlined"
-gdb_test "up" "#4 main.*" "up from outer_inline2"
-gdb_test "info frame" ".*\n caller of frame.*" "main not inlined"
+gdb_test "info frame" "inlined into frame.*" "inlined_fn from noinline inlined"
+gdb_test "fini" "" "up to noinline"
+gdb_test "info frame" "\n called by frame.*" "noinline from outer_inline1 not inlined"
+gdb_test "fini" "" "up to outer_inline1"
+gdb_test "info frame" "inlined into frame.*" "outer_inline1 inlined"
+gdb_test "fini" "" "up to outer_inline2"
+gdb_test "info frame" "inlined into frame.*" "outer_inline2 inlined"
+gdb_test "fini" "" "up from outer_inline2"
+gdb_test "info frame" " in main \[^\n\]*\n source language.*" "main not inlined"
Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-locals.c 2009-06-28 02:20:24.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.c 2009-09-17 12:49:01.000000000 +0200
@@ -13,11 +13,16 @@
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 x, y;
+/* VOLATILE forces all the inlining to happen as otherwise the whole program
+ gets optimized by CSE to just simple assignments of the results. */
+volatile int x, y;
volatile int result;
volatile int *array_p;
-void bar(void);
+inline void bar(void)
+{
+ x += y; /* set breakpoint 1 here */
+}
inline int func1(int arg1)
{
Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.exp
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-locals.exp 2009-06-30 17:50:27.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.exp 2009-09-17 12:49:01.000000000 +0200
@@ -77,6 +77,9 @@ if { ! $no_frames } {
# Make sure that locals on the stack are found. This is an array to
# prevent it from living in a register.
+if [test_compiler_info "gcc-4-3-*"] {
+ setup_kfail *-*-* "gcc/debug.optimization"
+}
gdb_test "print array\[0\]" "\\\$$decimal = 0" "print local (2)"
if { ! $no_frames } {
@@ -115,4 +118,7 @@ if { ! $no_frames } {
gdb_test "info locals" ".*arg2 = 184.*" "info locals above bar (3b)"
}
+if [test_compiler_info "gcc-4-3-*"] {
+ setup_kfail *-*-* "gcc/debug.optimization"
+}
gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)"
Index: gdb-6.8.91.20090917/gdb/frame.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/frame.c 2009-09-17 12:48:49.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/frame.c 2009-09-17 12:49:01.000000000 +0200
@@ -310,7 +310,7 @@ fprint_frame (struct ui_file *file, stru
static struct frame_info *
skip_inlined_frames (struct frame_info *frame)
{
- while (get_frame_type (frame) == INLINE_FRAME)
+ while (frame && get_frame_type (frame) == INLINE_FRAME)
frame = get_prev_frame (frame);
return frame;
@@ -1778,6 +1778,7 @@ get_frame_address_in_block (struct frame
{
/* A draft address. */
CORE_ADDR pc = get_frame_pc (this_frame);
+ struct thread_info *tp = inferior_thread ();
struct frame_info *next_frame = this_frame->next;
@@ -1820,6 +1821,9 @@ get_frame_address_in_block (struct frame
while in an inlined function, then the code address of the
"calling" normal function should not be adjusted either. */
+ if (tp->current_pc_is_notcurrent)
+ return pc - 1;
+
while (get_frame_type (next_frame) == INLINE_FRAME)
next_frame = next_frame->next;
@@ -1851,7 +1855,7 @@ find_frame_sal (struct frame_info *frame
sym = inline_skipped_symbol (inferior_ptid);
init_sal (sal);
- if (SYMBOL_LINE (sym) != 0)
+ if (sym != NULL && SYMBOL_LINE (sym) != 0)
{
sal->symtab = SYMBOL_SYMTAB (sym);
sal->line = SYMBOL_LINE (sym);
Index: gdb-6.8.91.20090917/gdb/breakpoint.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/breakpoint.c 2009-09-17 12:48:51.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/breakpoint.c 2009-09-17 12:49:12.000000000 +0200
@@ -62,6 +62,7 @@
#include "jit.h"
#include "xml-syscall.h"
#include "parser-defs.h"
+#include "inline-frame.h"
/* readline include files */
#include "readline/readline.h"
@@ -3220,10 +3221,24 @@ bpstat_check_breakpoint_conditions (bpst
const struct bp_location *bl = bs->breakpoint_at;
struct breakpoint *b = bl->owner;
- if (frame_id_p (b->frame_id)
- && !frame_id_eq (b->frame_id, get_stack_frame_id (get_current_frame ())))
- bs->stop = 0;
- else if (bs->stop)
+ if (frame_id_p (b->frame_id))
+ {
+ struct frame_info *b_frame, *frame;
+ struct frame_id b_frame_id, current_frame_id;
+
+ b_frame = frame_find_by_id (b->frame_id);
+
+ /* get_stack_frame_id normalizes the id to the real non-inlined function
+ by skip_inlined_frames. */
+ b_frame_id = get_stack_frame_id (b_frame);
+ current_frame_id = get_stack_frame_id (get_current_frame ());
+
+ /* Completely different (inlining notwithstanding) frames? */
+ if (!frame_id_eq (b_frame_id, current_frame_id))
+ bs->stop = 0;
+ }
+
+ if (bs->stop)
{
int value_is_zero = 0;
@@ -3399,6 +3399,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bs->print = 0;
}
bs->commands = copy_command_lines (bs->commands);
+
+ /* Display the innermost inlined frame at a breakpont as it gives to
+ most of the available information. */
+ if (b->type != bp_until && b->type != bp_finish)
+ while (inline_skipped_frames (ptid))
+ step_into_inline_frame (ptid);
}
/* Print nothing for this entry if we dont stop or if we dont print. */
@@ -5572,9 +5593,9 @@ set_momentary_breakpoint (struct gdbarch
{
struct breakpoint *b;
- /* If FRAME_ID is valid, it should be a real frame, not an inlined
- one. */
- gdb_assert (!frame_id_inlined_p (frame_id));
+ /* We can be returning even into an inline frame. While finish_command will
+ shortcut the case of returning _from_ an inline frame we still may be
+ returning from non-inlined frame _to_ an inlined frame. */
b = set_raw_breakpoint (gdbarch, sal, type);
b->enable_state = bp_enabled;
Index: gdb-6.8.91.20090917/gdb/inline-frame.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/inline-frame.c 2009-09-13 18:28:28.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/inline-frame.c 2009-09-17 12:49:01.000000000 +0200
@@ -199,6 +199,12 @@ inline_frame_sniffer (const struct frame
if (frame_block == NULL)
return 0;
+ /* For >=2 inlined functions SKIPPED_SYMBOL needs to be different after each
+ step_into_inline_frame call. But skip_inline_frames is called only once
+ and thus SKIPPED_SYMBOL needs to be calculated by INLINE_FRAME_SNIFFER. */
+ if (state)
+ state->skipped_symbol = NULL;
+
/* Calculate DEPTH, the number of inlined functions at this
location. */
depth = 0;
@@ -208,6 +214,10 @@ inline_frame_sniffer (const struct frame
if (block_inlined_p (cur_block))
depth++;
+ if (state && depth == state->skipped_frames
+ && state->skipped_symbol == NULL)
+ state->skipped_symbol = BLOCK_FUNCTION (cur_block);
+
cur_block = BLOCK_SUPERBLOCK (cur_block);
}
@@ -291,7 +301,6 @@ skip_inline_frames (ptid_t ptid)
{
CORE_ADDR this_pc;
struct block *frame_block, *cur_block;
- struct symbol *last_sym = NULL;
int skip_count = 0;
struct inline_state *state;
@@ -312,10 +321,7 @@ skip_inline_frames (ptid_t ptid)
of BLOCK_START. */
if (BLOCK_START (cur_block) == this_pc
|| block_starting_point_at (this_pc, cur_block))
- {
- skip_count++;
- last_sym = BLOCK_FUNCTION (cur_block);
- }
+ skip_count++;
else
break;
}
@@ -327,7 +333,6 @@ skip_inline_frames (ptid_t ptid)
state = allocate_inline_frame_state (ptid);
state->skipped_frames = skip_count;
state->saved_pc = this_pc;
- state->skipped_symbol = last_sym;
if (skip_count != 0)
reinit_frame_cache ();
@@ -345,6 +350,23 @@ step_into_inline_frame (ptid_t ptid)
reinit_frame_cache ();
}
+/* Step out of an inlined function by hiding it. */
+
+void
+step_out_of_inline_frame (ptid_t ptid)
+{
+ struct inline_state *state = find_inline_frame_state (ptid);
+
+ gdb_assert (state != NULL);
+
+ /* Simulate the caller adjustment. */
+ if (state->skipped_frames == 0)
+ state->saved_pc--;
+
+ state->skipped_frames++;
+ reinit_frame_cache ();
+}
+
/* Return the number of hidden functions inlined into the current
frame. */
Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-markers.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-markers.c 2009-06-28 02:20:24.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-markers.c 2009-09-17 12:49:01.000000000 +0200
@@ -15,11 +15,6 @@
extern int x, y;
-void bar(void)
-{
- x += y; /* set breakpoint 1 here */
-}
-
void marker(void)
{
x += y; /* set breakpoint 2 here */
Index: gdb-6.8.91.20090917/gdb/gdbthread.h
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/gdbthread.h 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/gdbthread.h 2009-09-17 12:49:01.000000000 +0200
@@ -191,6 +191,12 @@ struct thread_info
/* Private data used by the target vector implementation. */
struct private_thread_info *private;
+
+ /* Nonzero if the current frame PC should be unwound as the caller. It is
+ used to keep the backtrace upper levels existing after finish_command into
+ an inlined frame if the current inlined function/block was ending at the
+ current PC. */
+ int current_pc_is_notcurrent;
};
/* Create an empty thread list, or empty the existing one. */
Index: gdb-6.8.91.20090917/gdb/infcmd.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/infcmd.c 2009-09-17 12:47:07.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/infcmd.c 2009-09-17 12:49:01.000000000 +0200
@@ -1434,11 +1434,11 @@ finish_command_continuation (void *arg)
struct type *value_type;
value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function));
- if (!value_type)
+ if (!SYMBOL_INLINED (a->function) && !value_type)
internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type"));
- if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
+ if (value_type && TYPE_CODE (value_type) != TYPE_CODE_VOID)
print_return_value (SYMBOL_TYPE (a->function), value_type);
}
@@ -1546,6 +1546,16 @@ finish_forward (struct symbol *function,
tp->initiating_frame = get_frame_id (frame);
make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
+ /* We should _always_ set CURRENT_PC_IS_NOTCURRENT here to always see the
+ calling line with the message `Value returned is ...'. Currently it is
+ seen only if at least one instruction is on that source line after the
+ call instruction. We would also need to hook step_once and only clear
+ CURRENT_PC_IS_NOTCURRENT on the first step. But it would be a change of
+ general non-inlining behavior against upstream. */
+
+ if (get_frame_type (frame) == INLINE_FRAME)
+ tp->current_pc_is_notcurrent = 1;
+
tp->proceed_to_finish = 1; /* We want stop_registers, please... */
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
@@ -1567,7 +1577,9 @@ finish_forward (struct symbol *function,
static void
finish_command (char *arg, int from_tty)
{
- struct frame_info *frame;
+ /* FIXME: Rename `current_frame' to `frame' upon a merge. */
+ struct frame_info *current_frame, *prev_frame;
+ CORE_ADDR frame_pc;
struct symbol *function;
int async_exec = 0;
@@ -1598,45 +1610,63 @@ finish_command (char *arg, int from_tty)
if (!target_has_execution)
error (_("The program is not running."));
- frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
- if (frame == 0)
+ current_frame = get_selected_frame (_("No selected frame."));
+ frame_pc = get_frame_pc (current_frame);
+ prev_frame = get_prev_frame (current_frame);
+ if (prev_frame == 0)
error (_("\"finish\" not meaningful in the outermost frame."));
- clear_proceed_status ();
-
/* Finishing from an inline frame is completely different. We don't
try to show the "return value" - no way to locate it. So we do
not need a completion. */
- if (get_frame_type (get_selected_frame (_("No selected frame.")))
- == INLINE_FRAME)
+ if (get_frame_type (current_frame) == INLINE_FRAME)
{
- /* Claim we are stepping in the calling frame. An empty step
- range means that we will stop once we aren't in a function
- called by that frame. We don't use the magic "1" value for
- step_range_end, because then infrun will think this is nexti,
- and not step over the rest of this inlined function call. */
struct thread_info *tp = inferior_thread ();
struct symtab_and_line empty_sal;
- init_sal (&empty_sal);
- set_step_info (frame, empty_sal);
- tp->step_range_start = tp->step_range_end = get_frame_pc (frame);
- tp->step_over_calls = STEP_OVER_ALL;
+ struct block *frame_block;
/* Print info on the selected frame, including level number but not
source. */
if (from_tty)
{
printf_filtered (_("Run till exit from "));
- print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
+ print_stack_frame (current_frame, 1, LOCATION);
+ }
+
+ /* Even just a single stepi would get us out of the caller function PC
+ range. */
+
+ frame_block = get_frame_block (current_frame, NULL);
+
+ /* FRAME_BLOCK must be initialized and also the frame printing above must
+ be done still with the original CURRENT_PC_IS_NOTCURRENT setting. */
+ clear_proceed_status ();
+
+ if (frame_block && BLOCK_END (frame_block) == frame_pc)
+ {
+ step_out_of_inline_frame (tp->ptid);
+ tp->current_pc_is_notcurrent = 1;
+ normal_stop ();
+ return;
}
+ /* Claim we are stepping in the calling frame. An empty step
+ range means that we will stop once we aren't in a function
+ called by that frame. We don't use the magic "1" value for
+ step_range_end, because then infrun will think this is nexti,
+ and not step over the rest of this inlined function call. */
+ init_sal (&empty_sal);
+ set_step_info (prev_frame, empty_sal);
+ tp->step_range_start = tp->step_range_end = get_frame_pc (prev_frame);
+ tp->step_over_calls = STEP_OVER_ALL;
+
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
return;
}
/* Find the function we will return from. */
- function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
+ function = find_pc_function (frame_pc);
/* Print info on the selected frame, including level number but not
source. */
@@ -1650,10 +1680,14 @@ finish_command (char *arg, int from_tty)
print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
}
+ /* Frames printing above must be done still with the original
+ CURRENT_PC_IS_NOTCURRENT setting. */
+ clear_proceed_status ();
+
if (execution_direction == EXEC_REVERSE)
finish_backward (function);
else
- finish_forward (function, frame);
+ finish_forward (function, prev_frame);
}
Index: gdb-6.8.91.20090917/gdb/target.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/target.c 2009-09-17 12:48:49.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/target.c 2009-09-17 12:49:01.000000000 +0200
@@ -2187,6 +2187,7 @@ target_resume (ptid_t ptid, int step, en
{
struct target_ops *t;
+ clear_inline_frame_state (ptid);
target_dcache_invalidate ();
for (t = current_target.beneath; t != NULL; t = t->beneath)
Index: gdb-6.8.91.20090917/gdb/inline-frame.h
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/inline-frame.h 2009-06-28 02:20:22.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/inline-frame.h 2009-09-17 12:49:01.000000000 +0200
@@ -43,6 +43,10 @@ void clear_inline_frame_state (ptid_t pt
void step_into_inline_frame (ptid_t ptid);
+/* Step out of an inlined function by hiding it. */
+
+void step_out_of_inline_frame (ptid_t ptid);
+
/* Return the number of hidden functions inlined into the current
frame. */
Index: gdb-6.8.91.20090917/gdb/dwarf2read.c
===================================================================
--- gdb-6.8.91.20090917.orig/gdb/dwarf2read.c 2009-09-17 12:48:51.000000000 +0200
+++ gdb-6.8.91.20090917/gdb/dwarf2read.c 2009-09-17 12:49:01.000000000 +0200
@@ -4128,6 +4128,7 @@ read_func_scope (struct die_info *die, s
struct block *block;
unsigned die_children = 0;
int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
+ struct type *type;
if (inlined_func)
{
@@ -4169,7 +4170,10 @@ read_func_scope (struct die_info *die, s
add_to_cu_func_list (name, lowpc, highpc, cu);
new = push_context (0, lowpc);
- new->name = new_symbol (die, read_type_die (die, cu), cu);
+ type = read_type_die (die, cu);
+ gdb_assert (type != NULL);
+ new->name = new_symbol (die, type, cu);
+ gdb_assert (TYPE_CODE (SYMBOL_TYPE (new->name)) == TYPE_CODE_FUNC);
/* If there is a location expression for DW_AT_frame_base, record
it. */

View File

@ -1,104 +0,0 @@
Implement `b <funcname>' for <funcname> with concete inlined instances by
a multiple-PC breakpoint.
Index: gdb-6.8.50.20081128/gdb/ada-lang.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/ada-lang.c 2008-11-25 00:21:15.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/ada-lang.c 2008-12-06 21:39:56.000000000 +0100
@@ -4614,7 +4614,7 @@ remove_irrelevant_renamings (struct ada_
if (current_block == NULL)
return nsyms;
- current_function = block_linkage_function (current_block);
+ current_function = block_function (current_block);
if (current_function == NULL)
return nsyms;
@@ -6625,7 +6625,7 @@ ada_find_renaming_symbol (const char *na
static struct symbol *
find_old_style_renaming_symbol (const char *name, struct block *block)
{
- const struct symbol *function_sym = block_linkage_function (block);
+ const struct symbol *function_sym = block_function (block);
char *rename;
if (function_sym != NULL)
Index: gdb-6.8.50.20081128/gdb/block.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/block.c 2008-12-06 14:06:16.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/block.c 2008-12-06 21:40:29.000000000 +0100
@@ -75,6 +75,19 @@ block_linkage_function (const struct blo
return BLOCK_FUNCTION (bl);
}
+/* Return the symbol for the function which contains a specified
+ lexical block, described by a struct block BL. Inlined functions
+ can be returned. */
+
+struct symbol *
+block_function (const struct block *bl)
+{
+ while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
+ bl = BLOCK_SUPERBLOCK (bl);
+
+ return BLOCK_FUNCTION (bl);
+}
+
/* Return one if BL represents an inlined function. */
int
Index: gdb-6.8.50.20081128/gdb/block.h
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/block.h 2008-12-06 14:06:16.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/block.h 2008-12-06 21:39:56.000000000 +0100
@@ -133,6 +133,7 @@ struct blockvector
enum { GLOBAL_BLOCK = 0, STATIC_BLOCK = 1, FIRST_LOCAL_BLOCK = 2 };
extern struct symbol *block_linkage_function (const struct block *);
+extern struct symbol *block_function (const struct block *bl);
extern int block_inlined_p (const struct block *block);
Index: gdb-6.8.50.20081128/gdb/blockframe.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/blockframe.c 2008-12-06 14:06:16.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/blockframe.c 2008-12-06 21:39:56.000000000 +0100
@@ -143,7 +143,7 @@ find_pc_sect_function (CORE_ADDR pc, str
struct block *b = block_for_pc_sect (pc, section);
if (b == 0)
return 0;
- return block_linkage_function (b);
+ return block_function (b);
}
/* Return the function containing pc value PC.
Index: gdb-6.8.50.20081128/gdb/breakpoint.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/breakpoint.c 2008-12-06 14:06:17.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/breakpoint.c 2008-12-06 21:39:56.000000000 +0100
@@ -5712,7 +5712,7 @@ resolve_sal_pc (struct symtab_and_line *
bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab);
if (bv != NULL)
{
- sym = block_linkage_function (b);
+ sym = block_function (b);
if (sym != NULL)
{
fixup_symbol_section (sym, sal->symtab->objfile);
Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2008-12-06 21:37:27.000000000 +0100
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp 2008-12-06 21:41:37.000000000 +0100
@@ -45,8 +45,10 @@ if { [skip_inline_frame_tests] } {
# First, check that the things we expected to be inlined really were,
# and those that shouldn't be weren't.
-set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
-gdb_breakpoint $srcfile2:$line1
+# We test also inlining by the function name, otherwise we would use:
+# set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
+# gdb_breakpoint $srcfile2:$line1
+gdb_breakpoint "bar"
set line2 [gdb_get_line_number "set breakpoint 2 here" ${srcfile2}]
gdb_breakpoint $srcfile2:$line2

View File

@ -1,229 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-11/msg00388.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00156.html
Subject: [patch] Fix crash on reading stabs
Hi,
there is a crash on reading stabs fpc binary:
https://bugzilla.redhat.com/show_bug.cgi?id=537837
Program received signal SIGSEGV, Segmentation fault.
0x000000000069db3d in read_dbx_symtab (objfile=0x1daf5f0) at dbxread.c:1369
1369 if ((namestring[0] == '-' && namestring[1] == 'l')
(gdb) p/x nlist.n_strx
$7 = 0xfffffff8
(gdb) p sizeof(nlist.n_strx)
$10 = 8
Below the patch context is:
namestring = (nlist->n_strx + file_string_table_offset
+ DBX_STRINGTAB (objfile));
so IMO the `(unsigned)' cast is excessive as it does not match the expression
below. Such cast is there since the GDB "Initial revision" (1999).
`n_strx' type:
struct internal_nlist
{
unsigned long n_strx; /* Index into string table of name. */
...
};
Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu which does not
mean anything with the default DWARF debug info. It was hanging for stabs so
tried just a large part of gdb.base/*.exp on x86_64-m32 - `unix/-gstabs+/-m32'.
If it isn't obviously approved please feel free to drop it as one should not
use STABS in the first place.
Regards,
Jan
gdb/
2009-11-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* dbxread.c (set_namestring): Remove cast to unsigned. Check N_STRX
overflow.
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -965,8 +965,9 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
{
char *namestring;
- if (((unsigned) nlist->n_strx + file_string_table_offset)
- >= DBX_STRINGTAB_SIZE (objfile))
+ if (nlist->n_strx + file_string_table_offset
+ >= DBX_STRINGTAB_SIZE (objfile)
+ || nlist->n_strx + file_string_table_offset < nlist->n_strx)
{
complaint (&symfile_complaints, _("bad string table offset in symbol %d"),
symnum);
Re: [RFA] Fix "show convenience" test
http://sourceware.org/ml/gdb-patches/2009-09/msg00565.html
http://sourceware.org/ml/gdb-cvs/2009-09/msg00099.html
### src/gdb/testsuite/ChangeLog 2009/09/15 18:51:25 1.1960
### src/gdb/testsuite/ChangeLog 2009/09/17 17:49:46 1.1961
## -1,3 +1,7 @@
+2009-09-17 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * gdb.base/default.exp: Fix "show convenience".
+
2009-09-15 Tom Tromey <tromey@redhat.com>
* lib/mi-support.exp (mi_create_varobj): Update.
--- src/gdb/testsuite/gdb.base/default.exp 2009/08/13 14:58:27 1.31
+++ src/gdb/testsuite/gdb.base/default.exp 2009/09/17 17:49:46 1.32
@@ -598,7 +598,7 @@
#test show confirm
gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm"
#test show convenience
-gdb_test "show convenience" "No debugger convenience variables now defined.(\[^\r\n\]*\[\r\n\])+Convenience variables have names starting with \".\";(\[^\r\n\]*\[\r\n\])+use \"set\" as in \"set .foo = 5\" to define them." "show convenience"
+gdb_test "show convenience" "\\\$_siginfo = void" "show convenience"
#test show directories
gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd" "show directories"
#test show editing
### src/gdb/doc/ChangeLog 2009/09/15 18:51:24 1.953
### src/gdb/doc/ChangeLog 2009/09/17 17:49:46 1.954
## -1,3 +1,8 @@
+2009-09-17 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * gdb.texinfo (convenince variables): Mention
+ $_siginfo could be empty.
+
2009-09-15 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (GDB/MI Variable Objects): Document
--- src/gdb/doc/gdb.texinfo 2009/09/15 18:51:25 1.624
+++ src/gdb/doc/gdb.texinfo 2009/09/17 17:49:46 1.625
@@ -7819,8 +7819,10 @@
@item $_siginfo
@vindex $_siginfo@r{, convenience variable}
-The variable @code{$_siginfo} is bound to extra signal information
-inspection (@pxref{extra signal information}).
+The variable @code{$_siginfo} contains extra signal information
+(@pxref{extra signal information}). Note that @code{$_siginfo}
+could be empty, if the application has not yet received any signals.
+For example, it will be empty before you execute the @code{run} command.
@end table
On HP-UX systems, if you refer to a function or variable name that
http://sourceware.org/ml/gdb-cvs/2009-12/msg00128.html
### src/gdb/testsuite/ChangeLog 2009/12/23 23:18:08 1.2054
### src/gdb/testsuite/ChangeLog 2009/12/24 21:57:06 1.2055
## -1,3 +1,10 @@
+2009-12-24 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix compatibility with G++-4.5.
+ * gdb.cp/expand-sals.cc (main): Remove the "exit-line" comment.
+ * gdb.cp/expand-sals.exp: Remove breakpoint on "exit-line".
+ (uncaught return): Remove.
+
2009-12-23 Jan Kratochvil <jan.kratochvil@redhat.com>
Phil Muldoon <pmuldoon@redhat.com>
--- src/gdb/testsuite/gdb.cp/expand-sals.cc 2009/05/11 15:05:56 1.1
+++ src/gdb/testsuite/gdb.cp/expand-sals.cc 2009/12/24 21:57:06 1.2
@@ -49,5 +49,5 @@
A a;
B b;
- return 0; /* exit-line */
+ return 0;
}
--- src/gdb/testsuite/gdb.cp/expand-sals.exp 2009/05/11 15:05:56 1.1
+++ src/gdb/testsuite/gdb.cp/expand-sals.exp 2009/12/24 21:57:06 1.2
@@ -23,8 +23,6 @@
return -1
}
-gdb_breakpoint [gdb_get_line_number "exit-line"]
-
gdb_breakpoint [gdb_get_line_number "func-line"]
gdb_continue_to_breakpoint "func" ".*func-line.*"
@@ -52,7 +50,3 @@
"bt from A"
gdb_continue_to_breakpoint "next caller func" ".*func-line.*"
-
-# Verify GDB really could not catch any other breakpoint location.
-
-gdb_continue_to_breakpoint "uncaught return" ".*exit-line.*"
http://sourceware.org/ml/gdb-cvs/2009-11/msg00213.html
[ cut ]
--- src/gdb/testsuite/gdb.base/condbreak.exp 2009/01/03 05:58:03 1.13
+++ src/gdb/testsuite/gdb.base/condbreak.exp 2009/11/25 20:43:29 1.14
@@ -207,10 +207,10 @@
setup_xfail hppa2.0w-*-* 11512CLLbs
send_gdb "continue\n"
gdb_expect {
- -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
pass "run until breakpoint at marker2"
}
- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
xfail "run until breakpoint at marker2"
}
-re "$gdb_prompt $" {
Fix for gfortran-4.1:
-PASS: gdb.mi/mi-var-child-f.exp: mi runto MAIN__
+FAIL: gdb.mi/mi-var-child-f.exp: mi runto MAIN__ (unknown output after running)
RFC: Move language-changed message to verbose
http://sourceware.org/ml/gdb-patches/2009-11/msg00031.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00034.html
### src/gdb/ChangeLog 2009/11/05 19:53:03 1.11030
### src/gdb/ChangeLog 2009/11/05 20:43:52 1.11031
## -1,3 +1,8 @@
+2009-11-05 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * top.c (execute_command): Select a frame before checking the current
+ language. Only output a message if verbose.
+
2009-11-05 Tom Tromey <tromey@redhat.com>
* symtab.h (SYMBOL_SET_LINKAGE_NAME): Update comment.
--- src/gdb/top.c 2009/10/19 09:51:42 1.172
+++ src/gdb/top.c 2009/11/05 20:43:52 1.173
@@ -457,10 +457,13 @@
}
- /* Tell the user if the language has changed (except first time). */
+ /* Tell the user if the language has changed (except first time).
+ First make sure that a new frame has been selected, in case this
+ command or the hooks changed the program state. */
+ deprecated_safe_get_selected_frame ();
if (current_language != expected_language)
{
- if (language_mode == language_mode_auto)
+ if (language_mode == language_mode_auto && info_verbose)
{
language_info (1); /* Print what changed. */
}

View File

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

3
gdb-7.1.tar.bz2 Normal file
View File

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

View File

@ -1,19 +1,10 @@
From: Keith Seitz <keiths@redhat.com>
Message-ID: <4B7F207A.7020102@redhat.com>
[ read_partial_die part dropped in the port to Rawhide ]
--- gdb-7.0.1-orig/gdb/dwarf2read.c 2010-02-20 01:06:44.000000000 +0100
+++ gdb-7.0.1/gdb/dwarf2read.c 2010-02-20 01:08:28.000000000 +0100
@@ -7362,6 +7362,10 @@ read_partial_die (struct partial_die_inf
break;
}
break;
+ case DW_AT_MIPS_linkage_name:
+ if (cu->language == language_ada)
+ part_die->name = DW_STRING (&attr);
+ break;
case DW_AT_comp_dir:
if (part_die->dirname == NULL)
part_die->dirname = DW_STRING (&attr);
@@ -9924,9 +9928,13 @@ dwarf2_canonicalize_name (char *name, st
static char *
dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)

View File

@ -1,639 +0,0 @@
Remove some files accidentally created (and not used) by gdb-archer.patch.
diff -up -ruNp gdb-7.0.1-orig/gdb/config/i386/nm-i386.h gdb-7.0.1/gdb/config/i386/nm-i386.h
--- gdb-7.0.1-orig/gdb/config/i386/nm-i386.h 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/config/i386/nm-i386.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,125 +0,0 @@
-/* Native macro definitions for GDB on an Intel i[3456]86.
- Copyright 2001, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef NM_I386_H
-#define NM_I386_H 1
-
-/* Hardware-assisted breakpoints and watchpoints. */
-
-/* Targets should define this to use the generic x86 watchpoint support. */
-#ifdef I386_USE_GENERIC_WATCHPOINTS
-
-/* Add watchpoint methods to the provided target_ops. Targets which call
- this should also define I386_WATCHPOINTS_IN_TARGET_VECTOR. */
-struct target_ops;
-void i386_use_watchpoints (struct target_ops *);
-
-/* Clear the reference counts and forget everything we knew about DRi. */
-extern void i386_cleanup_dregs (void);
-
-/* Insert a watchpoint to watch a memory region which starts at
- address ADDR and whose length is LEN bytes. Watch memory accesses
- of the type TYPE. Return 0 on success, -1 on failure. */
-extern int i386_insert_watchpoint (CORE_ADDR addr, int len, int type);
-
-/* Remove a watchpoint that watched the memory region which starts at
- address ADDR, whose length is LEN bytes, and for accesses of the
- type TYPE. Return 0 on success, -1 on failure. */
-extern int i386_remove_watchpoint (CORE_ADDR addr, int len, int type);
-
-/* Return non-zero if we can watch a memory region that starts at
- address ADDR and whose length is LEN bytes. */
-extern int i386_region_ok_for_watchpoint (CORE_ADDR addr, int len);
-
-/* Return non-zero if the inferior has some break/watchpoint that
- triggered. */
-extern int i386_stopped_by_hwbp (void);
-
-/* If the inferior has some break/watchpoint that triggered, set
- the address associated with that break/watchpoint and return
- true. Otherwise, return false. */
-extern int i386_stopped_data_address (struct target_ops *, CORE_ADDR *);
-
-/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
- Return 0 on success, EBUSY on failure. */
-struct bp_target_info;
-extern int i386_insert_hw_breakpoint (struct bp_target_info *bp_tgt);
-
-/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
- Return 0 on success, -1 on failure. */
-extern int i386_remove_hw_breakpoint (struct bp_target_info *bp_tgt);
-
-extern int i386_stopped_by_watchpoint (void);
-
-#ifndef I386_WATCHPOINTS_IN_TARGET_VECTOR
-
-/* Returns the number of hardware watchpoints of type TYPE that we can
- set. Value is positive if we can set CNT watchpoints, zero if
- setting watchpoints of type TYPE is not supported, and negative if
- CNT is more than the maximum number of watchpoints of type TYPE
- that we can support. TYPE is one of bp_hardware_watchpoint,
- bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint.
- CNT is the number of such watchpoints used so far (including this
- one). OTHERTYPE is non-zero if other types of watchpoints are
- currently enabled.
-
- We always return 1 here because we don't have enough information
- about possible overlap of addresses that they want to watch. As an
- extreme example, consider the case where all the watchpoints watch
- the same address and the same region length: then we can handle a
- virtually unlimited number of watchpoints, due to debug register
- sharing implemented via reference counts in i386-nat.c. */
-
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
-
-/* Returns non-zero if we can use hardware watchpoints to watch a
- region whose address is ADDR and whose length is LEN. */
-
-#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) \
- i386_region_ok_for_watchpoint (addr, len)
-
-/* After a watchpoint trap, the PC points to the instruction after the
- one that caused the trap. Therefore we don't need to step over it.
- But we do need to reset the status register to avoid another trap. */
-
-#define HAVE_CONTINUABLE_WATCHPOINT 1
-
-#define STOPPED_BY_WATCHPOINT(W) (i386_stopped_by_watchpoint () != 0)
-
-#define target_stopped_data_address(target, x) \
- i386_stopped_data_address(target, x)
-
-/* Use these macros for watchpoint insertion/removal. */
-
-#define target_insert_watchpoint(addr, len, type) \
- i386_insert_watchpoint (addr, len, type)
-
-#define target_remove_watchpoint(addr, len, type) \
- i386_remove_watchpoint (addr, len, type)
-
-#define target_insert_hw_breakpoint(bp_tgt) \
- i386_insert_hw_breakpoint (bp_tgt)
-
-#define target_remove_hw_breakpoint(bp_tgt) \
- i386_remove_hw_breakpoint (bp_tgt)
-
-#endif /* I386_WATCHPOINTS_IN_TARGET_VECTOR */
-
-#endif /* I386_USE_GENERIC_WATCHPOINTS */
-
-#endif /* NM_I386_H */
diff -up -ruNp gdb-7.0.1-orig/gdb/config/i386/nm-linux64.h gdb-7.0.1/gdb/config/i386/nm-linux64.h
--- gdb-7.0.1-orig/gdb/config/i386/nm-linux64.h 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/config/i386/nm-linux64.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,54 +0,0 @@
-/* Native support for GNU/Linux x86-64.
-
- Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
- Contributed by Jiri Smid, SuSE Labs.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef NM_LINUX64_H
-#define NM_LINUX64_H
-
-/* GNU/Linux supports the i386 hardware debugging registers. */
-#define I386_USE_GENERIC_WATCHPOINTS
-#define I386_WATCHPOINTS_IN_TARGET_VECTOR
-
-#include "i386/nm-i386.h"
-#include "config/nm-linux.h"
-
-/* Support for 8-byte wide hardware watchpoints. */
-#define TARGET_HAS_DR_LEN_8 1
-
-/* Provide access to the i386 hardware debugging registers. */
-
-extern void amd64_linux_dr_set_control (unsigned long control);
-#define I386_DR_LOW_SET_CONTROL(control) \
- amd64_linux_dr_set_control (control)
-
-extern void amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr);
-#define I386_DR_LOW_SET_ADDR(regnum, addr) \
- amd64_linux_dr_set_addr (regnum, addr)
-
-extern void amd64_linux_dr_reset_addr (int regnum);
-#define I386_DR_LOW_RESET_ADDR(regnum) \
- amd64_linux_dr_reset_addr (regnum)
-
-extern unsigned long amd64_linux_dr_get_status (void);
-#define I386_DR_LOW_GET_STATUS() \
- amd64_linux_dr_get_status ()
-
-#endif /* nm-linux64.h */
diff -up -ruNp gdb-7.0.1-orig/gdb/config/mips/nm-irix5.h gdb-7.0.1/gdb/config/mips/nm-irix5.h
--- gdb-7.0.1-orig/gdb/config/mips/nm-irix5.h 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/config/mips/nm-irix5.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-/* Definitions for native support of irix5.
-
- Copyright 1993, 1996, 1998, 1999, 2000, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#define TARGET_HAS_HARDWARE_WATCHPOINTS
-
-/* TARGET_CAN_USE_HARDWARE_WATCHPOINT is now defined to go through
- the target vector. For Irix5, procfs_can_use_hw_watchpoint()
- should be invoked. */
-
-/* When a hardware watchpoint fires off the PC will be left at the
- instruction which caused the watchpoint. It will be necessary for
- GDB to step over the watchpoint. */
-
-#define STOPPED_BY_WATCHPOINT(W) \
- procfs_stopped_by_watchpoint(inferior_ptid)
-extern int procfs_stopped_by_watchpoint (ptid_t);
-
-/* Use these macros for watchpoint insertion/deletion. */
-/* type can be 0: write watch, 1: read watch, 2: access watch (read/write) */
-#define target_insert_watchpoint(ADDR, LEN, TYPE) \
- procfs_set_watchpoint (inferior_ptid, ADDR, LEN, TYPE, 0)
-#define target_remove_watchpoint(ADDR, LEN, TYPE) \
- procfs_set_watchpoint (inferior_ptid, ADDR, 0, 0, 0)
-extern int procfs_set_watchpoint (ptid_t, CORE_ADDR, int, int, int);
-
-#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1
-
diff -up -ruNp gdb-7.0.1-orig/gdb/gdbserver/linux-i386-low.c gdb-7.0.1/gdb/gdbserver/linux-i386-low.c
--- gdb-7.0.1-orig/gdb/gdbserver/linux-i386-low.c 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/gdbserver/linux-i386-low.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,210 +0,0 @@
-/* GNU/Linux/i386 specific low level interface, for the remote server for GDB.
- Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
- 2007, 2008, 2009 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "server.h"
-#include "linux-low.h"
-#include "i387-fp.h"
-
-#include "gdb_proc_service.h"
-
-#include <sys/ptrace.h>
-
-#ifdef HAVE_SYS_REG_H
-#include <sys/reg.h>
-#endif
-
-#ifndef PTRACE_GET_THREAD_AREA
-#define PTRACE_GET_THREAD_AREA 25
-#endif
-
-/* Defined in auto-generated file reg-i386-linux.c. */
-void init_registers_i386_linux (void);
-
-
-/* This module only supports access to the general purpose registers. */
-
-#define i386_num_regs 16
-
-/* This stuff comes from i386-linux-nat.c. */
-
-/* Mapping between the general-purpose registers in `struct user'
- format and GDB's register array layout. */
-static int i386_regmap[] =
-{
- EAX * 4, ECX * 4, EDX * 4, EBX * 4,
- UESP * 4, EBP * 4, ESI * 4, EDI * 4,
- EIP * 4, EFL * 4, CS * 4, SS * 4,
- DS * 4, ES * 4, FS * 4, GS * 4
-};
-
-/* Called by libthread_db. */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
-{
- unsigned int desc[4];
-
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
- (void *) idx, (unsigned long) &desc) < 0)
- return PS_ERR;
-
- *(int *)base = desc[1];
- return PS_OK;
-}
-
-static int
-i386_cannot_store_register (int regno)
-{
- return (regno >= i386_num_regs);
-}
-
-static int
-i386_cannot_fetch_register (int regno)
-{
- return (regno >= i386_num_regs);
-}
-
-
-#ifdef HAVE_PTRACE_GETREGS
-#include <sys/procfs.h>
-#include <sys/ptrace.h>
-
-static void
-i386_fill_gregset (void *buf)
-{
- int i;
-
- for (i = 0; i < i386_num_regs; i++)
- collect_register (i, ((char *) buf) + i386_regmap[i]);
-
- collect_register_by_name ("orig_eax", ((char *) buf) + ORIG_EAX * 4);
-}
-
-static void
-i386_store_gregset (const void *buf)
-{
- int i;
-
- for (i = 0; i < i386_num_regs; i++)
- supply_register (i, ((char *) buf) + i386_regmap[i]);
-
- supply_register_by_name ("orig_eax", ((char *) buf) + ORIG_EAX * 4);
-}
-
-static void
-i386_fill_fpregset (void *buf)
-{
- i387_cache_to_fsave (buf);
-}
-
-static void
-i386_store_fpregset (const void *buf)
-{
- i387_fsave_to_cache (buf);
-}
-
-static void
-i386_fill_fpxregset (void *buf)
-{
- i387_cache_to_fxsave (buf);
-}
-
-static void
-i386_store_fpxregset (const void *buf)
-{
- i387_fxsave_to_cache (buf);
-}
-
-#endif /* HAVE_PTRACE_GETREGS */
-
-struct regset_info target_regsets[] = {
-#ifdef HAVE_PTRACE_GETREGS
- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
- GENERAL_REGS,
- i386_fill_gregset, i386_store_gregset },
-# ifdef HAVE_PTRACE_GETFPXREGS
- { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t),
- EXTENDED_REGS,
- i386_fill_fpxregset, i386_store_fpxregset },
-# endif
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
- FP_REGS,
- i386_fill_fpregset, i386_store_fpregset },
-#endif /* HAVE_PTRACE_GETREGS */
- { 0, 0, -1, -1, NULL, NULL }
-};
-
-static const unsigned char i386_breakpoint[] = { 0xCC };
-#define i386_breakpoint_len 1
-
-extern int debug_threads;
-
-static CORE_ADDR
-i386_get_pc ()
-{
- unsigned long pc;
-
- collect_register_by_name ("eip", &pc);
-
- if (debug_threads)
- fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc);
- return pc;
-}
-
-static void
-i386_set_pc (CORE_ADDR newpc)
-{
- if (debug_threads)
- fprintf (stderr, "set pc to %08lx\n", (long) newpc);
- supply_register_by_name ("eip", &newpc);
-}
-
-static int
-i386_breakpoint_at (CORE_ADDR pc)
-{
- unsigned char c;
-
- read_inferior_memory (pc, &c, 1);
- if (c == 0xCC)
- return 1;
-
- return 0;
-}
-
-struct linux_target_ops the_low_target = {
- init_registers_i386_linux,
- i386_num_regs,
- i386_regmap,
- i386_cannot_fetch_register,
- i386_cannot_store_register,
- i386_get_pc,
- i386_set_pc,
- i386_breakpoint,
- i386_breakpoint_len,
- NULL,
- 1,
- i386_breakpoint_at,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-};
diff -up -ruNp gdb-7.0.1-orig/gdb/gdbserver/linux-x86-64-low.c gdb-7.0.1/gdb/gdbserver/linux-x86-64-low.c
--- gdb-7.0.1-orig/gdb/gdbserver/linux-x86-64-low.c 2010-02-09 11:22:39.000000000 +0100
+++ gdb-7.0.1/gdb/gdbserver/linux-x86-64-low.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,184 +0,0 @@
-/* GNU/Linux/x86-64 specific low level interface, for the remote server
- for GDB.
- Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include "server.h"
-#include "linux-low.h"
-#include "i387-fp.h"
-
-#include "gdb_proc_service.h"
-
-/* Defined in auto-generated file reg-x86-64-linux.c. */
-void init_registers_x86_64_linux (void);
-
-#include <sys/reg.h>
-#include <sys/procfs.h>
-#include <sys/ptrace.h>
-
-/* This definition comes from prctl.h, but some kernels may not have it. */
-#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL 30
-#endif
-
-/* The following definitions come from prctl.h, but may be absent
- for certain configurations. */
-#ifndef ARCH_GET_FS
-#define ARCH_SET_GS 0x1001
-#define ARCH_SET_FS 0x1002
-#define ARCH_GET_FS 0x1003
-#define ARCH_GET_GS 0x1004
-#endif
-
-static int x86_64_regmap[] = {
- RAX * 8, RBX * 8, RCX * 8, RDX * 8,
- RSI * 8, RDI * 8, RBP * 8, RSP * 8,
- R8 * 8, R9 * 8, R10 * 8, R11 * 8,
- R12 * 8, R13 * 8, R14 * 8, R15 * 8,
- RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
- DS * 8, ES * 8, FS * 8, GS * 8,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- ORIG_RAX * 8
-};
-
-#define X86_64_NUM_GREGS (sizeof(x86_64_regmap)/sizeof(int))
-
-/* Called by libthread_db. */
-
-ps_err_e
-ps_get_thread_area (const struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
-{
- switch (idx)
- {
- case FS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
- return PS_OK;
- break;
- case GS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
- return PS_OK;
- break;
- default:
- return PS_BADADDR;
- }
- return PS_ERR;
-}
-
-static void
-x86_64_fill_gregset (void *buf)
-{
- int i;
-
- for (i = 0; i < X86_64_NUM_GREGS; i++)
- if (x86_64_regmap[i] != -1)
- collect_register (i, ((char *) buf) + x86_64_regmap[i]);
-}
-
-static void
-x86_64_store_gregset (const void *buf)
-{
- int i;
-
- for (i = 0; i < X86_64_NUM_GREGS; i++)
- if (x86_64_regmap[i] != -1)
- supply_register (i, ((char *) buf) + x86_64_regmap[i]);
-}
-
-static void
-x86_64_fill_fpregset (void *buf)
-{
- i387_cache_to_fxsave (buf);
-}
-
-static void
-x86_64_store_fpregset (const void *buf)
-{
- i387_fxsave_to_cache (buf);
-}
-
-struct regset_info target_regsets[] = {
- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t),
- GENERAL_REGS,
- x86_64_fill_gregset, x86_64_store_gregset },
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t),
- FP_REGS,
- x86_64_fill_fpregset, x86_64_store_fpregset },
- { 0, 0, -1, -1, NULL, NULL }
-};
-
-static const unsigned char x86_64_breakpoint[] = { 0xCC };
-#define x86_64_breakpoint_len 1
-
-extern int debug_threads;
-
-static CORE_ADDR
-x86_64_get_pc ()
-{
- unsigned long pc;
-
- collect_register_by_name ("rip", &pc);
-
- if (debug_threads)
- fprintf (stderr, "stop pc (before any decrement) is %08lx\n", pc);
- return pc;
-}
-
-static void
-x86_64_set_pc (CORE_ADDR newpc)
-{
- if (debug_threads)
- fprintf (stderr, "set pc to %08lx\n", (long) newpc);
- supply_register_by_name ("rip", &newpc);
-}
-
-static int
-x86_64_breakpoint_at (CORE_ADDR pc)
-{
- unsigned char c;
-
- read_inferior_memory (pc, &c, 1);
- if (c == 0xCC)
- return 1;
-
- return 0;
-}
-
-struct linux_target_ops the_low_target = {
- init_registers_x86_64_linux,
- -1,
- NULL,
- NULL,
- NULL,
- x86_64_get_pc,
- x86_64_set_pc,
- x86_64_breakpoint,
- x86_64_breakpoint_len,
- NULL,
- 1,
- x86_64_breakpoint_at,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-};

View File

@ -1,6 +1,8 @@
--- ./gdb/breakpoint.c 2009-12-18 00:13:49.000000000 +0100
+++ ./gdb/breakpoint.c 2009-12-18 00:13:16.000000000 +0100
@@ -8563,6 +8563,49 @@ update_breakpoint_locations (struct brea
Index: gdb-7.0.50.20100115/gdb/breakpoint.c
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/breakpoint.c 2010-01-15 21:35:16.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/breakpoint.c 2010-01-15 21:51:20.000000000 +0100
@@ -9167,6 +9167,49 @@ update_breakpoint_locations (struct brea
update_global_location_list (1);
}
@ -45,14 +47,16 @@
+
+ if (changed)
+ qsort (bp_location, bp_location_count, sizeof (*bp_location),
+ bp_location_compare_for_qsort);
+ 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.
--- ./gdb/breakpoint.h 2009-12-18 00:13:48.000000000 +0100
+++ ./gdb/breakpoint.h 2009-12-17 22:11:10.000000000 +0100
@@ -970,4 +970,7 @@ extern struct breakpoint *get_tracepoint
Index: gdb-7.0.50.20100115/gdb/breakpoint.h
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/breakpoint.h 2010-01-15 21:35:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/breakpoint.h 2010-01-15 21:50:12.000000000 +0100
@@ -1015,4 +1015,7 @@ extern struct breakpoint *get_tracepoint
is newly allocated; the caller should free when done with it. */
extern VEC(breakpoint_p) *all_tracepoints (void);
@ -60,63 +64,19 @@
+ struct section_offsets *delta);
+
#endif /* !defined (BREAKPOINT_H) */
--- ./gdb/objfiles.c 2009-12-18 00:13:48.000000000 +0100
+++ ./gdb/objfiles.c 2009-12-17 23:19:22.000000000 +0100
@@ -546,7 +546,7 @@ free_all_objfiles (void)
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
entries in new_offsets. SEPARATE_DEBUG_OBJFILE is not touched here. */
-static void
+static int
objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
{
struct obj_section *s;
@@ -565,7 +565,7 @@ objfile_relocate1 (struct objfile *objfi
something_changed = 1;
}
if (!something_changed)
- return;
+ return 0;
}
/* OK, get all the symtabs. */
@@ -706,6 +706,13 @@ objfile_relocate1 (struct objfile *objfi
exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
Index: gdb-7.0.50.20100115/gdb/objfiles.c
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/objfiles.c 2010-01-15 21:35:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/objfiles.c 2010-01-15 21:50:45.000000000 +0100
@@ -856,6 +856,11 @@ objfile_relocate1 (struct objfile *objfi
obj_section_addr (s));
}
+
+ /* Final call of breakpoint_re_set can keep breakpoint locations disabled if
+ their addresses match. */
+ if (objfile->separate_debug_objfile_backlink == NULL)
+ breakpoints_relocate (objfile, delta);
+
+ return 1;
/* Data changed. */
return 1;
}
/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS
@@ -720,7 +727,9 @@ objfile_relocate1 (struct objfile *objfi
void
objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
{
- objfile_relocate1 (objfile, new_offsets);
+ int changed = 0;
+
+ changed |= objfile_relocate1 (objfile, new_offsets);
if (objfile->separate_debug_objfile != NULL)
{
@@ -747,11 +756,12 @@ objfile_relocate (struct objfile *objfil
objfile_addrs);
do_cleanups (my_cleanups);
- objfile_relocate1 (debug_objfile, new_debug_offsets);
+ changed |= objfile_relocate1 (debug_objfile, new_debug_offsets);
}
/* Relocate breakpoints as necessary, after things are relocated. */
- breakpoint_re_set ();
+ if (changed)
+ breakpoint_re_set ();
}
/* Return non-zero if OBJFILE has partial symbols. */

View File

@ -1,6 +1,8 @@
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5754,7 +5754,12 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
===================================================================
--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c 2010-03-06 23:27:30.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/dwarf2read.c 2010-03-06 23:28:43.000000000 +0100
@@ -5910,7 +5910,12 @@ read_common_block (struct die_info *die,
{
struct attribute *attr;
struct symbol *sym;
@ -14,15 +16,15 @@
attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr)
@@ -5763,6 +5768,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
@@ -5919,6 +5924,7 @@ read_common_block (struct die_info *die,
if (attr_form_is_block (attr))
{
base = decode_locdesc (DW_BLOCK (attr), cu);
{
base = decode_locdesc (DW_BLOCK (attr), cu);
+ base_p = 1;
}
}
else if (attr_form_is_section_offset (attr))
{
@@ -5824,12 +5830,15 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
{
@@ -5980,12 +5986,15 @@ read_common_block (struct die_info *die,
else
dwarf2_complex_location_expr_complaint ();
@ -40,7 +42,7 @@
else
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
@@ -5843,7 +5852,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
@@ -5999,7 +6008,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. */
@ -49,64 +51,35 @@
set_die_type (die, type, cu);
}
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -32,6 +32,7 @@
#include "exec.h"
#include "observer.h"
#include "arch-utils.h"
+#include "solib.h"
Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
===================================================================
--- gdb-7.0.90.20100306.orig/gdb/gdbtypes.h 2010-03-06 23:26:34.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/gdbtypes.h 2010-03-06 23:28:43.000000000 +0100
@@ -412,6 +412,7 @@ enum type_instance_flag_value
enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /* bitpos */
+ /* This address is unrelocated by the objfile's ANOFFSET. */
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
FIELD_LOC_KIND_PHYSNAME /* physname */
};
@@ -591,6 +592,7 @@ struct main_type
is the location (in the target) of the static field.
Otherwise, physname is the mangled label of the static field. */
#include <fcntl.h>
#include "readline/readline.h"
@@ -220,6 +221,10 @@ exec_file_attach (char *filename, int from_tty)
char *scratch_pathname;
int scratch_chan;
struct target_section *sections = NULL, *sections_end = NULL;
+ struct target_section *p;
+ int addr_bit;
+ CORE_ADDR mask = CORE_ADDR_MAX;
+ CORE_ADDR displacement;
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
@@ -288,12 +293,23 @@ exec_file_attach (char *filename, int from_tty)
scratch_pathname, bfd_errmsg (bfd_get_error ()));
}
+ set_gdbarch_from_file (exec_bfd);
+
+ addr_bit = gdbarch_addr_bit (target_gdbarch);
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+ mask = ((CORE_ADDR) 1 << addr_bit) - 1;
+
+ displacement = solib_exec_displacement ();
+ for (p = sections; p < sections_end; p++)
+ {
+ p->addr = (p->addr + displacement) & mask;
+ p->endaddr = (p->endaddr + displacement) & mask;
+ }
+
exec_bfd_mtime = bfd_get_mtime (exec_bfd);
validate_files ();
- set_gdbarch_from_file (exec_bfd);
-
/* Add the executable's sections to the current address spaces'
list of sections. */
add_target_sections (sections, sections_end);
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -966,6 +966,7 @@ extern void allocate_cplus_struct_type (struct type *);
+ /* This address is unrelocated by the objfile's ANOFFSET. */
CORE_ADDR physaddr;
char *physname;
}
@@ -1091,6 +1093,7 @@ extern void allocate_gnat_aux_type (stru
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
@@ -974,6 +975,7 @@ extern void allocate_cplus_struct_type (struct type *);
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
@@ -1098,6 +1101,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))
@ -114,17 +87,19 @@
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -989,6 +991,7 @@ extern void allocate_cplus_struct_type (struct type *);
@@ -1110,6 +1114,7 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gdbarch,
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
Index: gdb-7.0.90.20100306/gdb/jv-lang.c
===================================================================
--- gdb-7.0.90.20100306.orig/gdb/jv-lang.c 2010-03-06 23:19:13.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/jv-lang.c 2010-03-06 23:28:43.000000000 +0100
@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gd
fields = NULL;
nfields--; /* First set up dummy "class" field. */
@ -134,7 +109,7 @@
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 *gdbarch,
@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gd
SET_TYPE_FIELD_PROTECTED (type, i);
}
if (accflags & 0x0008) /* ACC_STATIC */
@ -144,142 +119,11 @@
else
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1672,15 +1672,20 @@ static CORE_ADDR
svr4_exec_displacement (void)
{
int found;
+ /* ENTRY_POINT is a possible function descriptor - before
+ a call to gdbarch_convert_from_func_ptr_addr. */
CORE_ADDR entry_point;
if (exec_bfd == NULL)
return 0;
if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
- return entry_point - exec_entry_point (exec_bfd, &current_target);
+ return entry_point - bfd_get_start_address (exec_bfd);
- return svr4_static_exec_displacement ();
+ if (!ptid_equal (inferior_ptid, null_ptid))
+ return svr4_static_exec_displacement ();
+
+ return 0;
}
/* Relocate the main executable. This function should be called upon
@@ -1632,7 +1635,7 @@ svr4_exec_displacement (void)
static void
svr4_relocate_main_executable (void)
{
- CORE_ADDR displacement = svr4_exec_displacement ();
+ CORE_ADDR displacement = solib_exec_displacement ();
/* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
difference of in-memory vs. in-file addresses and we could already
@@ -1975,6 +1978,7 @@ _initialize_svr4_solib (void)
svr4_so_ops.free_so = svr4_free_so;
svr4_so_ops.clear_solib = svr4_clear_solib;
svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
+ svr4_so_ops.exec_displacement = svr4_exec_displacement;
svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
svr4_so_ops.current_sos = svr4_current_sos;
svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1014,6 +1014,19 @@ solib_create_inferior_hook (int from_tty)
ops->solib_create_inferior_hook (from_tty);
}
+/* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
+
+CORE_ADDR
+solib_exec_displacement (void)
+{
+ struct target_so_ops *ops = solib_ops (target_gdbarch);
+
+ if (ops->exec_displacement != NULL)
+ return (*ops->exec_displacement) ();
+ else
+ return 0;
+}
+
/* GLOBAL FUNCTION
in_solib_dynsym_resolve_code -- check to see if an address is in
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -43,6 +43,8 @@ extern int solib_read_symbols (struct so_list *, int);
extern void solib_create_inferior_hook (int from_tty);
+extern CORE_ADDR solib_exec_displacement (void);
+
/* If ADDR lies in a shared library, return its name. */
extern char *solib_name_from_address (CORE_ADDR);
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -89,6 +89,9 @@ struct target_so_ops
/* Target dependent code to run after child process fork. */
void (*solib_create_inferior_hook) (int from_tty);
+ /* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
+ CORE_ADDR (*exec_displacement) (void);
+
/* Do additional symbol handling, lookup, etc. after symbols
for a shared object have been loaded. */
void (*special_symbol_handling) (void);
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -873,15 +873,36 @@ syms_from_objfile (struct objfile *objfile,
if an error occurs during symbol reading. */
old_chain = make_cleanup_free_objfile (objfile);
- /* If ADDRS and OFFSETS are both NULL, put together a dummy address
- list. We now establish the convention that an addr of zero means
- no load address was specified. */
+ /* If ADDRS and OFFSETS are both NULL, put together a dummy offset list. */
+
if (! addrs && ! offsets)
{
- local_addr
- = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
- make_cleanup (xfree, local_addr);
- addrs = local_addr;
+ /* Relocateble files have an exception in default_symfile_offsets which
+ applies only for ADDRS. But calling solib_exec_displacement is more
+ suitable for OFFSETS. Fortunately we never need the both
+ functionalities simultaneously and in other cases zeroed ADDRS and
+ zeroed OFFSETS are equivalent. */
+
+ if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
+ {
+ local_addr
+ = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
+ make_cleanup (xfree, local_addr);
+ addrs = local_addr;
+ }
+ else
+ {
+ CORE_ADDR displacement = 0;
+ int i;
+
+ if (mainline)
+ displacement = solib_exec_displacement ();
+
+ num_offsets = bfd_count_sections (objfile->obfd);
+ offsets = alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets));
+ for (i = 0; i < num_offsets; i++)
+ offsets->offsets[i] = displacement;
+ }
}
/* Now either addrs or offsets is non-zero. */
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1890,7 +1890,8 @@ value_static_field (struct type *type, int fieldno)
Index: gdb-7.0.90.20100306/gdb/value.c
===================================================================
--- gdb-7.0.90.20100306.orig/gdb/value.c 2010-03-06 23:19:13.000000000 +0100
+++ gdb-7.0.90.20100306/gdb/value.c 2010-03-06 23:28:43.000000000 +0100
@@ -1897,7 +1897,8 @@ value_static_field (struct type *type, i
if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
{
retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
@ -289,7 +133,7 @@
}
else
{
@@ -1920,7 +1921,8 @@ value_static_field (struct type *type, int fieldno)
@@ -1927,7 +1928,8 @@ value_static_field (struct type *type, i
}
if (retval && VALUE_LVAL (retval) == lval_memory)
SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
@ -299,14 +143,3 @@
}
return retval;
}
--- gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp-orig 2009-12-21 16:50:42.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp 2009-12-21 16:51:24.000000000 +0100
@@ -67,6 +67,8 @@ gdb_test_multiple "" $test {
}
}
+gdb_test "" "" "eat first prompt"
+
# Initialization from default_gdb_start.
gdb_test "set height 0"
gdb_test "set width 0"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,101 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-01/msg00030.html
Subject: [patch] Re: Regression: field type preservation: 7.0 -> 7.0.1+HEAD
On Friday 01 January 2010 21:45:05 Jan Kratochvil wrote:
> -PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> +FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> -PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> +FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
> -PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
> +FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
>
> due to:
> Re: RFA: unbreak typedefed bitfield
> http://sourceware.org/ml/gdb-patches/2009-12/msg00295.html
> commit fc85da4ee2a7c32afc53b1b334a4f84e2e9bd84e
> http://sourceware.org/ml/gdb-cvs/2009-12/msg00100.html
attached a fix on top of existing HEAD.
Original PR gdb/10884 was a regression 6.8 -> 7.0 due to:
RFC: Lazy bitfields
http://sourceware.org/ml/gdb-patches/2009-07/msg00437.html
http://sourceware.org/ml/gdb-cvs/2009-07/msg00143.html
07491b3409f6ace0b7a9a707775a56ce10fece1c
No regressions for HEAD on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. Plus:
-FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
+PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
Going to check it in also for gdb_7_0-branch after an approval.
Thanks,
Jan
gdb/
2010-01-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* value.c (value_primitive_field): Remove one check_typedef call.
Move bitpos and container_bitsize initialization after
allocate_value_lazy. New comment before accessing TYPE_LENGTH.
gdb/testsuite/
2010-01-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.mi/var-cmd.c (do_bitfield_tests): Change "V.sharable" type to
"uint_for_mi_testing".
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -494,7 +494,7 @@ void do_bitfield_tests ()
mi_create_varobj V d "create varobj for Data"
mi_list_varobj_children "V" {
{"V.alloc" "alloc" "0" "int"}
- {"V.sharable" "sharable" "0" "unsigned int"}
+ {"V.sharable" "sharable" "0" "uint_for_mi_testing"}
} "list children of Data"
mi_check_varobj_value V.sharable 3 "access bitfield"
:*/
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1873,7 +1873,6 @@ value_primitive_field (struct value *arg1, int offset,
CHECK_TYPEDEF (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno);
- type = check_typedef (type);
/* Handle packed fields */
@@ -1885,10 +1884,14 @@ value_primitive_field (struct value *arg1, int offset,
Otherwise, adjust offset to the byte containing the first
bit. Assume that the address, offset, and embedded offset
are sufficiently aligned. */
- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
- int container_bitsize = TYPE_LENGTH (type) * 8;
+ int bitpos, container_bitsize;
v = allocate_value_lazy (type);
+
+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value_lazy. */
+ bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+ container_bitsize = TYPE_LENGTH (type) * 8;
+
v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize
&& TYPE_LENGTH (type) <= (int) sizeof (LONGEST))
@@ -1939,6 +1942,8 @@ value_primitive_field (struct value *arg1, int offset,
else
{
v = allocate_value (type);
+
+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value. */
memcpy (value_contents_raw (v),
value_contents_raw (arg1) + offset,
TYPE_LENGTH (type));

View File

@ -1,137 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00509.html
Subject: [patch 2/3] find_separate_debug_file cleanup
Hi,
current code was:
* difficult to maintain as a new variable required xfree on many places
* was causing memory corruptions due to silently misapplied 3rd party patches
as the close code fragments unfortunately match patch context
Thanks,
Jan
gdb/
2009-10-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (find_separate_debug_file): Initialize dir, debugfile and
canon_name to NULL. Change alloca to xmalloc, newly call xfree for it.
New label cleanup_return_debugfile, jump to it from the failure paths.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1333,11 +1333,10 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename;
- char *dir;
- char *debugfile;
- char *name_copy;
- char *canon_name;
+ char *basename, *name_copy;
+ char *dir = NULL;
+ char *debugfile = NULL;
+ char *canon_name = NULL;
bfd_size_type debuglink_size;
unsigned long crc32;
int i;
@@ -1366,7 +1365,7 @@ find_separate_debug_file (struct objfile *objfile)
if (basename == NULL)
/* There's no separate debug info, hence there's no way we could
load it => no warning. */
- return NULL;
+ goto cleanup_return_debugfile;
dir = xstrdup (objfile->name);
@@ -1388,24 +1387,19 @@ find_separate_debug_file (struct objfile *objfile)
if (canon_name && strlen (canon_name) > i)
i = strlen (canon_name);
- debugfile = alloca (strlen (debug_file_directory) + 1
- + i
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (basename)
- + 1);
+ debugfile = xmalloc (strlen (debug_file_directory) + 1
+ + i
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (basename)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
strcpy (debugfile, dir);
@@ -1414,12 +1408,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
@@ -1428,12 +1417,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* If the file is in the sysroot, try using its base path in the
global debugfile directory. */
@@ -1447,20 +1431,17 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (canon_name);
- xfree (basename);
- xfree (dir);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
}
- if (canon_name)
- xfree (canon_name);
+ xfree (debugfile);
+ debugfile = NULL;
+cleanup_return_debugfile:
+ xfree (canon_name);
xfree (basename);
xfree (dir);
- return NULL;
+ return debugfile;
}

View File

@ -1,271 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00508.html
Subject: [patch 3/3] debug-file-directory with multiple components
Hi,
for various reasons `debug-file-directory' would be sometimes useful to have
multiple components such as `solib-search-path' has.
I found it useful myself during various separate debuginfo tests/scripts.
It was requested for the ABRT bugreporting project at the preceding mail of:
https://fedorahosted.org/pipermail/crash-catcher/2009-October/000054.html
It should be a backward compatible extension as DIRNAME_SEPARATOR should never
be a valid part of a single DEBUG_FILE_DIRECTORY component.
Thanks,
Jan
gdb/doc/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (set debug-file-directory, show debug-file-directory)
(Auto-loading): Use plural and note one can use multiple components now.
gdb/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (build_id_to_debug_filename): New variable debugdir. Move
variables size, s and data into a new inner block. Change xmalloc for
alloca, use direct BUILDID->SIZE there now. Loop for the
DEBUG_FILE_DIRECTORY components.
(find_separate_debug_file): New variable debugdir and debugdir_end.
Loop for the DEBUG_FILE_DIRECTORY components.
(_initialize_symfile): For "debug-file-directory" use plural and note
one can use multiple components now.
gdb/testsuite/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/sepdebug.exp: New test_different_dir call for multiple-dirs.
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14066,13 +14066,14 @@ name @value{GDBN} is currently using.
@table @code
@kindex set debug-file-directory
-@item set debug-file-directory @var{directory}
-Set the directory which @value{GDBN} searches for separate debugging
-information files to @var{directory}.
+@item set debug-file-directory @var{directories}
+Set the directories which @value{GDBN} searches for separate debugging
+information files to @var{directory}. Multiple directory components can be set
+concatenating them by a directory separator.
@kindex show debug-file-directory
@item show debug-file-directory
-Show the directory @value{GDBN} searches for separate debugging
+Show the directories @value{GDBN} searches for separate debugging
information files.
@end table
@@ -19336,8 +19337,8 @@ readable, @value{GDBN} will evaluate it as a Python script.
If this file does not exist, and if the parameter
@code{debug-file-directory} is set (@pxref{Separate Debug Files}),
-then @value{GDBN} will use the file named
-@file{@var{debug-file-directory}/@var{real-name}}, where
+then @value{GDBN} will use for its each separated directory component
+@code{component} the file named @file{@code{component}/@var{real-name}}, where
@var{real-name} is the object file's real name, as described above.
Finally, if this file does not exist, then @value{GDBN} will look for
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1218,35 +1218,59 @@ build_id_verify (const char *filename, struct build_id *check)
static char *
build_id_to_debug_filename (struct build_id *build_id)
{
- char *link, *s, *retval = NULL;
- gdb_byte *data = build_id->data;
- size_t size = build_id->size;
+ char *link, *debugdir, *retval = NULL;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
- + 2 * size + (sizeof ".debug" - 1) + 1);
- s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
- if (size > 0)
- {
- size--;
- s += sprintf (s, "%02x", (unsigned) *data++);
- }
- if (size > 0)
- *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);
- xfree (link);
-
- if (retval != NULL && !build_id_verify (retval, build_id))
+ link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+ + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
+
+ /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+ cause "/.build-id/..." lookups. */
+
+ debugdir = debug_file_directory;
+ do
{
- xfree (retval);
- retval = NULL;
+ char *s, *debugdir_end;
+ gdb_byte *data = build_id->data;
+ size_t size = build_id->size;
+
+ while (*debugdir == DIRNAME_SEPARATOR)
+ debugdir++;
+
+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
+ if (debugdir_end == NULL)
+ debugdir_end = &debugdir[strlen (debugdir)];
+
+ memcpy (link, debugdir, debugdir_end - debugdir);
+ s = &link[debugdir_end - debugdir];
+ s += sprintf (s, "/.build-id/");
+ if (size > 0)
+ {
+ size--;
+ s += sprintf (s, "%02x", (unsigned) *data++);
+ }
+ if (size > 0)
+ *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))
+ {
+ xfree (retval);
+ retval = NULL;
+ }
+
+ if (retval != NULL)
+ break;
+
+ debugdir = debugdir_end;
}
+ while (*debugdir != 0);
return retval;
}
@@ -1333,7 +1357,7 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename, *name_copy;
+ char *basename, *name_copy, *debugdir;
char *dir = NULL;
char *debugfile = NULL;
char *canon_name = NULL;
@@ -1410,29 +1434,51 @@ find_separate_debug_file (struct objfile *objfile)
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
goto cleanup_return_debugfile;
- /* Then try in the global debugfile directory. */
- strcpy (debugfile, debug_file_directory);
- strcat (debugfile, "/");
- strcat (debugfile, dir);
- strcat (debugfile, basename);
-
- if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- goto cleanup_return_debugfile;
+ /* Then try in the global debugfile directories.
+
+ Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+ cause "/..." lookups. */
- /* If the file is in the sysroot, try using its base path in the
- global debugfile directory. */
- if (canon_name
- && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
- && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
+ debugdir = debug_file_directory;
+ do
{
- strcpy (debugfile, debug_file_directory);
- strcat (debugfile, canon_name + strlen (gdb_sysroot));
+ char *debugdir_end;
+
+ while (*debugdir == DIRNAME_SEPARATOR)
+ debugdir++;
+
+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
+ if (debugdir_end == NULL)
+ debugdir_end = &debugdir[strlen (debugdir)];
+
+ memcpy (debugfile, debugdir, debugdir_end - debugdir);
+ debugfile[debugdir_end - debugdir] = 0;
strcat (debugfile, "/");
+ strcat (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
goto cleanup_return_debugfile;
+
+ /* If the file is in the sysroot, try using its base path in the
+ global debugfile directory. */
+ if (canon_name
+ && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
+ && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
+ {
+ memcpy (debugfile, debugdir, debugdir_end - debugdir);
+ debugfile[debugdir_end - debugdir] = 0;
+ strcat (debugfile, canon_name + strlen (gdb_sysroot));
+ strcat (debugfile, "/");
+ strcat (debugfile, basename);
+
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+ goto cleanup_return_debugfile;
+ }
+
+ debugdir = debugdir_end;
}
+ while (*debugdir != 0);
xfree (debugfile);
debugfile = NULL;
@@ -4173,12 +4219,12 @@ Usage: set extension-language .foo bar"),
add_setshow_optional_filename_cmd ("debug-file-directory", class_support,
&debug_file_directory, _("\
-Set the directory where separate debug symbols are searched for."), _("\
-Show the directory where separate debug symbols are searched for."), _("\
+Set the directories where separate debug symbols are searched for."), _("\
+Show the directories where separate debug symbols are searched for."), _("\
Separate debug symbols are first searched for in the same\n\
directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\
and lastly at the path of the directory of the binary with\n\
-the global debug-file directory prepended."),
+each global debug-file-directory component prepended."),
NULL,
show_debug_file_directory,
&setlist, &showlist);
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -995,6 +995,12 @@ if ![string compare $build_id_debug_filename ""] then {
test_different_dir build-id "${objdir}/${subdir}" $xfail
+ # Test also multiple directories can be specified. Without the build-id
+ # reference GDB would find the separate debug info just at the same
+ # location as the executable file.
+
+ test_different_dir multiple-dirs "/doesnotexist:${objdir}/${subdir}" $xfail
+
# Spare debug files may confuse testsuite runs in the future.
remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
}

View File

@ -1,151 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00507.html
Subject: [patch 1/3] print the .debug file name having CRC mismatch
Hi,
this patch is left as is from Andrew Cagney.
Thanks,
Jan
gdb/
2005-04-02 Andrew Cagney <cagney@gnu.org>
* symfile.c (separate_debug_file_exists): When the CRCs mismatch
print a warning.
(find_separate_debug_file): Pass in the objfile's name.
gdb/testsuite/
2009-10-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/sepdebug.exp (CRC mismatch is reported): New test.
* gdb.base/sepdebug2.c: New file.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1283,7 +1283,8 @@ get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
}
static int
-separate_debug_file_exists (const char *name, unsigned long crc)
+separate_debug_file_exists (const char *name, unsigned long crc,
+ const char *parent_name)
{
unsigned long file_crc = 0;
bfd *abfd;
@@ -1303,7 +1304,15 @@ separate_debug_file_exists (const char *name, unsigned long crc)
bfd_close (abfd);
- return crc == file_crc;
+ if (crc != file_crc)
+ {
+ warning (_("the debug information found in \"%s\""
+ " does not match \"%s\" (CRC mismatch).\n"),
+ name, parent_name);
+ return 0;
+ }
+
+ return 1;
}
char *debug_file_directory = NULL;
@@ -1355,6 +1364,8 @@ find_separate_debug_file (struct objfile *objfile)
basename = get_debug_link_info (objfile, &crc32);
if (basename == NULL)
+ /* There's no separate debug info, hence there's no way we could
+ load it => no warning. */
return NULL;
dir = xstrdup (objfile->name);
@@ -1388,7 +1399,7 @@ find_separate_debug_file (struct objfile *objfile)
strcpy (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1402,7 +1413,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1416,7 +1427,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1435,7 +1446,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (canon_name);
xfree (basename);
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -952,6 +952,23 @@ set debugfile "${objdir}/${subdir}/${testfile}.debug"
test_different_dir debuglink "${objdir}/${subdir}" 0
+# Test CRC mismatch is reported.
+
+if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
+ && ![gdb_gnu_strip_debug ${objdir}/${subdir}/sepdebug2]} {
+
+ remote_exec build "cp ${debugfile} ${objdir}/${subdir}/.debug/sepdebug2.debug"
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+
+ set escapedobjdirsubdir [string_to_regexp ${objdir}/${subdir}]
+
+ gdb_test "file ${objdir}/${subdir}/sepdebug2" "warning: the debug information found in \"${escapedobjdirsubdir}/\\.debug/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported"
+}
+
+
# NT_GNU_BUILD_ID / .note.gnu.build-id test:
set build_id_debug_filename [build_id_debug_filename_get $binfile]
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sepdebug2.c
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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/>. */
+
+int
+main (void)
+{
+ return 0;
+}

View File

@ -1,317 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00180.html
Subject: [patch] Fix a regression by me on breakpoint-cond-infcall
Hi,
GDB has now a regression since:
Re: [patch] Performance optimize large bp_location count
http://sourceware.org/ml/gdb-patches/2009-10/msg00632.html
=
2009-10-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Performance optimize large bp_location count.
on breakpoints with conditions calling inferior.
Bringing the code back to the state before my acceleration patch.
The code before already assumed no breakpoints or their bp_locations can
change across the inferior call which should be true - trying to do some:
break a if b()
break b
command 1
delete 2
end
or similar cannot work as inside "if b()" evaluation no breakpoints can be
added or removed.
update_global_location_list also does not removed/add `struct bp_location's
themselves but only pointers to them in the bp_location array. As the new
iteration no longer uses the bp_location array it is no longer a problem.
Original problem was found by and fixed differently by Phil Muldoon.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2009-12-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (bpstat_stop_status): Iterate using ALL_BREAKPOINTS and
the B->LOC list. Remove gdb_assert on B. Change bp_hardware_watchpoint
continue to break. Remove variable update_locations. Remove HIT_COUNT
increment protection by an ENABLE_STATE check. Inline the delayed
update_global_location_list call.
gdb/testsuite/
2009-12-13 Jan Kratochvil <jan.kratochvil@redhat.com>
Phil Muldoon <pmuldoon@redhat.com>
* gdb.base/condbreak.exp: Put breakpoint on marker3 and marker4.
(bp_location13, bp_location14, bp_location17, bp_location18)
(marker3_proto, marker4_proto): New variables.
(breakpoint info): Update output.
(run until breakpoint at marker3, run until breakpoint at marker4): New
tests.
[ Backported for F-12. ]
--- ./gdb/breakpoint.c 2009-12-14 00:25:55.000000000 +0100
+++ ./gdb/breakpoint.c 2009-12-14 00:32:32.000000000 +0100
@@ -3298,93 +3298,93 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
/* Pointer to the last thing in the chain currently. */
bpstat bs = root_bs;
int ix;
- int need_remove_insert, update_locations = 0;
+ int need_remove_insert;
- ALL_BP_LOCATIONS (bl, blp_tmp)
- {
- bpstat bs_prev = bs;
+ /* ALL_BP_LOCATIONS iteration would break across
+ update_global_location_list possibly executed by
+ bpstat_check_breakpoint_conditions's inferior call. */
- b = bl->owner;
- gdb_assert (b);
- if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
- continue;
-
- /* For hardware watchpoints, we look only at the first location.
- The watchpoint_check function will work on entire expression,
- not the individual locations. For read watchopints, the
- watchpoints_triggered function have checked all locations
- alrea
- */
- if (b->type == bp_hardware_watchpoint && bl != b->loc)
- continue;
-
- if (!bpstat_check_location (bl, bp_addr))
- continue;
-
- /* Come here if it's a watchpoint, or if the break address matches */
-
- bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
- gdb_assert (bs_prev->next == bs);
-
- /* Assume we stop. Should we find watchpoint that is not actually
- triggered, or if condition of breakpoint is false, we'll reset
- 'stop' to 0. */
- bs->stop = 1;
- bs->print = 1;
+ ALL_BREAKPOINTS (b)
+ {
+ if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
+ continue;
- if (!bpstat_check_watchpoint (bs))
- {
- /* Ensure bpstat_explains_signal stays false if this BL could not be
- the cause of this trap. */
+ for (bl = b->loc; bl != NULL; bl = bl->next)
+ {
+ bpstat bs_prev = bs;
+
+ /* For hardware watchpoints, we look only at the first location.
+ The watchpoint_check function will work on entire expression,
+ not the individual locations. For read watchopints, the
+ watchpoints_triggered function have checked all locations
+ alrea
+ */
+ if (b->type == bp_hardware_watchpoint && bl != b->loc)
+ break;
- gdb_assert (bs->print_it == print_it_noop);
- gdb_assert (!bs->stop);
- xfree (bs);
- bs = bs_prev;
- bs->next = NULL;
- continue;
- }
+ if (!bpstat_check_location (bl, bp_addr))
+ continue;
- if (b->type == bp_thread_event || b->type == bp_overlay_event
- || b->type == bp_longjmp_master || b->type == bp_exception_master)
- /* We do not stop for these. */
- bs->stop = 0;
- else
- bpstat_check_breakpoint_conditions (bs, ptid);
-
- if (bs->stop)
- {
- if (b->enable_state != bp_disabled)
- ++(b->hit_count);
+ /* Come here if it's a watchpoint, or if the break address matches */
- /* We will stop here */
- if (b->disposition == disp_disable)
- {
- if (b->enable_state != bp_permanent)
- b->enable_state = bp_disabled;
- update_locations = 1;
- }
- if (b->silent)
- bs->print = 0;
- bs->commands = b->commands;
- if (bs->commands
- && (strcmp ("silent", bs->commands->line) == 0
- || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
- {
- bs->commands = bs->commands->next;
- bs->print = 0;
- }
- bs->commands = copy_command_lines (bs->commands);
- }
+ bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
+ gdb_assert (bs_prev->next == bs);
- /* Print nothing for this entry if we dont stop or if we dont print. */
- if (bs->stop == 0 || bs->print == 0)
- bs->print_it = print_it_noop;
- }
+ /* Assume we stop. Should we find watchpoint that is not actually
+ triggered, or if condition of breakpoint is false, we'll reset
+ 'stop' to 0. */
+ bs->stop = 1;
+ bs->print = 1;
- /* Delay this call which would break the ALL_BP_LOCATIONS iteration above. */
- if (update_locations)
- update_global_location_list (0);
+ if (!bpstat_check_watchpoint (bs))
+ {
+ /* Ensure bpstat_explains_signal stays false if this BL could not be
+ the cause of this trap. */
+
+ gdb_assert (bs->print_it == print_it_noop);
+ gdb_assert (!bs->stop);
+ xfree (bs);
+ bs = bs_prev;
+ bs->next = NULL;
+ continue;
+ }
+
+ if (b->type == bp_thread_event || b->type == bp_overlay_event
+ || b->type == bp_longjmp_master || b->type == bp_exception_master)
+ /* We do not stop for these. */
+ bs->stop = 0;
+ else
+ bpstat_check_breakpoint_conditions (bs, ptid);
+
+ if (bs->stop)
+ {
+ ++(b->hit_count);
+
+ /* We will stop here */
+ if (b->disposition == disp_disable)
+ {
+ if (b->enable_state != bp_permanent)
+ b->enable_state = bp_disabled;
+ update_global_location_list (0);
+ }
+ if (b->silent)
+ bs->print = 0;
+ bs->commands = b->commands;
+ if (bs->commands
+ && (strcmp ("silent", bs->commands->line) == 0
+ || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
+ {
+ bs->commands = bs->commands->next;
+ bs->print = 0;
+ }
+ bs->commands = copy_command_lines (bs->commands);
+ }
+
+ /* Print nothing for this entry if we dont stop or if we dont print. */
+ if (bs->stop == 0 || bs->print == 0)
+ bs->print_it = print_it_noop;
+ }
+ }
for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
{
--- ./gdb/testsuite/gdb.base/condbreak.exp 2009-01-03 06:58:03.000000000 +0100
+++ ./gdb/testsuite/gdb.base/condbreak.exp 2009-12-14 00:27:21.000000000 +0100
@@ -68,8 +68,12 @@ set bp_location1 [gdb_get_line_number "
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
+set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
+set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
#
# test break at function
@@ -110,15 +114,29 @@ gdb_test "break marker2 if (a==43)" \
"Breakpoint.*at.* file .*$srcfile1, line.*"
#
+# Check break involving inferior function call.
+# Ensure there is at least one additional breakpoint with higher VMA.
+#
+gdb_test "break marker3 if (multi_line_if_conditional(1,1,1)==0)" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*"
+gdb_test "break marker4" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*"
+
+#
# check to see what breakpoints are set
#
if {$hp_aCC_compiler} {
set marker1_proto "\\(void\\)"
set marker2_proto "\\(int\\)"
+ # Not checked.
+ set marker3_proto "\\(char \\*, char \\*\\)"
+ set marker4_proto "\\(long\\)"
} else {
set marker1_proto ""
set marker2_proto ""
+ set marker3_proto ""
+ set marker4_proto ""
}
gdb_test "info break" \
@@ -129,7 +147,10 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
\[\t \]+stop only if \\(1==1\\).*
\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
-\[\t \]+stop only if \\(a==43\\).*" \
+\[\t \]+stop only if \\(a==43\\).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker3$marker3_proto at .*$srcfile1:($bp_location17|$bp_location18).*
+\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*" \
"breakpoint info"
@@ -220,3 +241,23 @@ gdb_expect {
fail "(timeout) run until breakpoint at marker2"
}
}
+
+set test "run until breakpoint at marker3"
+gdb_test_multiple "continue" $test {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ xfail $test
+ }
+}
+
+set test "run until breakpoint at marker4"
+gdb_test_multiple "continue" $test {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ xfail $test
+ }
+}

View File

@ -1,974 +0,0 @@
http://sourceware.org/gdb/wiki/ProjectArcher
http://sourceware.org/gdb/wiki/ArcherBranchManagement
GIT snapshot:
commit 791165df07fd22d381def1318954c389a606f81a
archer-jankratochvil-ifunc
Index: gdb-7.0.1/gdb/alpha-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/alpha-linux-tdep.c 2009-07-02 19:25:52.000000000 +0200
+++ gdb-7.0.1/gdb/alpha-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -25,6 +25,7 @@
#include "symtab.h"
#include "regset.h"
#include "regcache.h"
+#include "linux-tdep.h"
#include "alpha-tdep.h"
@@ -235,6 +236,9 @@ alpha_linux_init_abi (struct gdbarch_inf
set_gdbarch_regset_from_core_section
(gdbarch, alpha_linux_regset_from_core_section);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/amd64-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/amd64-linux-tdep.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/amd64-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -1557,6 +1557,9 @@ amd64_linux_init_abi (struct gdbarch_inf
amd64_linux_record_tdep.arg6 = AMD64_R9_REGNUM;
tdep->i386_syscall_record = amd64_linux_syscall_record;
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
Index: gdb-7.0.1/gdb/arm-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/arm-linux-tdep.c 2009-07-31 01:05:03.000000000 +0200
+++ gdb-7.0.1/gdb/arm-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -873,6 +873,9 @@ arm_linux_init_abi (struct gdbarch_info
set_gdbarch_displaced_step_free_closure (gdbarch,
simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/elfread.c
===================================================================
--- gdb-7.0.1.orig/gdb/elfread.c 2010-01-21 20:45:21.000000000 +0100
+++ gdb-7.0.1/gdb/elfread.c 2010-01-21 20:46:30.000000000 +0100
@@ -168,7 +168,8 @@ record_minimal_symbol (char *name, CORE_
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- if (ms_type == mst_text || ms_type == mst_file_text)
+ if (ms_type == mst_text || ms_type == mst_file_text
+ || ms_type == mst_text_gnu_ifunc)
address = gdbarch_smash_text_address (gdbarch, address);
return prim_record_minimal_symbol_and_info
@@ -373,7 +374,10 @@ elf_symtab_read (struct objfile *objfile
{
if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
{
- ms_type = mst_text;
+ if (sym->flags & BSF_GNU_INDIRECT_FUNCTION)
+ ms_type = mst_text_gnu_ifunc;
+ else
+ ms_type = mst_text;
}
else if ((sym->name[0] == '.' && sym->name[1] == 'L')
|| ((sym->flags & BSF_LOCAL)
Index: gdb-7.0.1/gdb/frv-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/frv-linux-tdep.c 2009-07-02 19:25:53.000000000 +0200
+++ gdb-7.0.1/gdb/frv-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -31,6 +31,7 @@
#include "frame-unwind.h"
#include "regset.h"
#include "gdb_string.h"
+#include "linux-tdep.h"
/* Define the size (in bytes) of an FR-V instruction. */
static const int frv_instr_size = 4;
@@ -485,7 +486,21 @@ frv_linux_regset_from_core_section (stru
return NULL;
}
-
+static CORE_ADDR
+frv_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ)
+{
+ CORE_ADDR pc = frv_convert_from_func_ptr_addr (gdbarch, addr, targ);
+ CORE_ADDR resolved;
+
+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
+ if (resolved != pc)
+ pc = frv_convert_from_func_ptr_addr (gdbarch, resolved, targ);
+
+ return pc;
+}
+
static void
frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -493,6 +508,10 @@ frv_linux_init_abi (struct gdbarch_info
frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
set_gdbarch_regset_from_core_section (gdbarch,
frv_linux_regset_from_core_section);
+
+ if (frv_abi (gdbarch) == FRV_ABI_FDPIC)
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ frv_linux_convert_from_func_ptr_addr);
}
static enum gdb_osabi
Index: gdb-7.0.1/gdb/frv-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/frv-tdep.c 2009-07-02 19:25:53.000000000 +0200
+++ gdb-7.0.1/gdb/frv-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -1169,7 +1169,7 @@ find_func_descr (struct gdbarch *gdbarch
return descr;
}
-static CORE_ADDR
+CORE_ADDR
frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
struct target_ops *targ)
{
Index: gdb-7.0.1/gdb/frv-tdep.h
===================================================================
--- gdb-7.0.1.orig/gdb/frv-tdep.h 2009-01-03 06:57:51.000000000 +0100
+++ gdb-7.0.1/gdb/frv-tdep.h 2010-01-21 20:45:32.000000000 +0100
@@ -118,3 +118,6 @@ CORE_ADDR frv_fetch_objfile_link_map (st
struct target_so_ops;
extern struct target_so_ops frv_so_ops;
+CORE_ADDR frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ);
Index: gdb-7.0.1/gdb/gdbtypes.c
===================================================================
--- gdb-7.0.1.orig/gdb/gdbtypes.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/gdbtypes.c 2010-01-21 20:45:32.000000000 +0100
@@ -1904,6 +1904,8 @@ init_type (enum type_code code, int leng
TYPE_NOTTEXT (type) = 1;
if (flags & TYPE_FLAG_FIXED_INSTANCE)
TYPE_FIXED_INSTANCE (type) = 1;
+ if (flags & TYPE_FLAG_GNU_IFUNC)
+ TYPE_GNU_IFUNC (type) = 1;
if (name)
TYPE_NAME (type) = obsavestring (name, strlen (name),
@@ -3762,6 +3764,8 @@ gdbtypes_post_init (struct gdbarch *gdba
= lookup_pointer_type (builtin_type->builtin_void);
builtin_type->builtin_func_ptr
= lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
+ builtin_type->builtin_func_func
+ = lookup_function_type (builtin_type->builtin_func_ptr);
/* This type represents a GDB internal function. */
builtin_type->internal_fn
@@ -3878,6 +3882,11 @@ objfile_type (struct objfile *objfile)
"<text variable, no debug info>", objfile);
TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
= objfile_type->builtin_int;
+ objfile_type->nodebug_text_gnu_ifunc_symbol
+ = init_type (TYPE_CODE_FUNC, 1, TYPE_FLAG_GNU_IFUNC,
+ "<text gnu-ifunc variable, no debug info>", objfile);
+ TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol)
+ = objfile_type->nodebug_text_symbol;
objfile_type->nodebug_data_symbol
= init_type (TYPE_CODE_INT,
gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
Index: gdb-7.0.1/gdb/gdbtypes.h
===================================================================
--- gdb-7.0.1.orig/gdb/gdbtypes.h 2010-01-21 20:45:23.000000000 +0100
+++ gdb-7.0.1/gdb/gdbtypes.h 2010-01-21 20:45:32.000000000 +0100
@@ -187,6 +187,7 @@ enum type_flag_value
TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
TYPE_FLAG_NOTTEXT = (1 << 17),
+ TYPE_FLAG_GNU_IFUNC = (1 << 18),
/* Used for error-checking. */
TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
@@ -292,6 +293,12 @@ enum type_instance_flag_value
#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext)
+/* Currently used only for TYPE_CODE_FUNC where specifies the real function
+ address is returned by this function call. TYPE_TARGET_TYPE determines the
+ final returned function type to be presented to user. */
+
+#define TYPE_GNU_IFUNC(t) (TYPE_MAIN_TYPE (t)->flag_gnu_ifunc)
+
/* Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by
the objfile retrieved as TYPE_OBJFILE. Otherweise, the type is
owned by an architecture; TYPE_OBJFILE is NULL in this case. */
@@ -427,6 +434,7 @@ struct main_type
unsigned int flag_vector : 1;
unsigned int flag_stub_supported : 1;
unsigned int flag_nottext : 1;
+ unsigned int flag_gnu_ifunc : 1;
unsigned int flag_fixed_instance : 1;
unsigned int flag_objfile_owned : 1;
unsigned int flag_discardable : 1;
@@ -1144,6 +1152,10 @@ struct builtin_type
(*) () can server as a generic function pointer. */
struct type *builtin_func_ptr;
+ /* `function returning pointer to function (returning void)' type.
+ The final void return type is not significant for it. */
+ struct type *builtin_func_func;
+
/* Special-purpose types. */
@@ -1186,6 +1198,7 @@ struct objfile_type
/* Types used for symbols with no debug information. */
struct type *nodebug_text_symbol;
+ struct type *nodebug_text_gnu_ifunc_symbol;
struct type *nodebug_data_symbol;
struct type *nodebug_unknown_symbol;
struct type *nodebug_tls_symbol;
Index: gdb-7.0.1/gdb/hppa-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/hppa-linux-tdep.c 2009-07-02 19:25:54.000000000 +0200
+++ gdb-7.0.1/gdb/hppa-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -31,6 +31,7 @@
#include "regset.h"
#include "regcache.h"
#include "hppa-tdep.h"
+#include "linux-tdep.h"
#include "elf/common.h"
@@ -512,7 +513,21 @@ hppa_linux_regset_from_core_section (str
return NULL;
}
-
+
+static CORE_ADDR
+hppa32_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ)
+{
+ CORE_ADDR pc = hppa32_convert_from_func_ptr_addr (gdbarch, addr, targ);
+ CORE_ADDR resolved;
+
+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
+ if (resolved != pc)
+ pc = hppa32_convert_from_func_ptr_addr (gdbarch, resolved, targ);
+
+ return pc;
+}
/* Forward declarations. */
extern initialize_file_ftype _initialize_hppa_linux_tdep;
@@ -554,6 +569,10 @@ hppa_linux_init_abi (struct gdbarch_info
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+
+ if (tdep->bytes_per_address == 4)
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ hppa32_linux_convert_from_func_ptr_addr);
}
void
Index: gdb-7.0.1/gdb/hppa-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/hppa-tdep.c 2009-09-13 18:28:28.000000000 +0200
+++ gdb-7.0.1/gdb/hppa-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -1247,7 +1247,7 @@ hppa64_return_value (struct gdbarch *gdb
}
-static CORE_ADDR
+CORE_ADDR
hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
struct target_ops *targ)
{
Index: gdb-7.0.1/gdb/hppa-tdep.h
===================================================================
--- gdb-7.0.1.orig/gdb/hppa-tdep.h 2009-07-02 19:25:54.000000000 +0200
+++ gdb-7.0.1/gdb/hppa-tdep.h 2010-01-21 20:45:32.000000000 +0100
@@ -246,4 +246,8 @@ extern int hppa_in_solib_call_trampoline
CORE_ADDR pc, char *name);
extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc);
+extern CORE_ADDR hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ);
+
#endif /* hppa-tdep.h */
Index: gdb-7.0.1/gdb/i386-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/i386-linux-tdep.c 2009-09-21 08:57:03.000000000 +0200
+++ gdb-7.0.1/gdb/i386-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -798,6 +798,9 @@ i386_linux_init_abi (struct gdbarch_info
i386_linux_get_syscall_number);
set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/ia64-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/ia64-linux-tdep.c 2009-07-02 19:25:55.000000000 +0200
+++ gdb-7.0.1/gdb/ia64-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -26,6 +26,7 @@
#include "osabi.h"
#include "solib-svr4.h"
#include "symtab.h"
+#include "linux-tdep.h"
/* The sigtramp code is in a non-readable (executable-only) region
of memory called the ``gate page''. The addresses in question
@@ -139,6 +140,9 @@ ia64_linux_init_abi (struct gdbarch_info
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/infcall.c
===================================================================
--- gdb-7.0.1.orig/gdb/infcall.c 2010-01-21 20:45:21.000000000 +0100
+++ gdb-7.0.1/gdb/infcall.c 2010-01-21 20:45:32.000000000 +0100
@@ -252,9 +252,17 @@ find_function_addr (struct value *functi
if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
{
- funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
- &current_target);
- value_type = TYPE_TARGET_TYPE (ftype);
+ CORE_ADDR funaddr2;
+
+ funaddr2 = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
+ &current_target);
+
+ /* If TYPE_GNU_IFUNC is currently not resolvable keep its type. */
+ if (funaddr2 != funaddr || !TYPE_GNU_IFUNC (ftype))
+ {
+ funaddr = funaddr2;
+ value_type = TYPE_TARGET_TYPE (ftype);
+ }
}
}
else if (code == TYPE_CODE_INT)
Index: gdb-7.0.1/gdb/linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/linux-tdep.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/linux-tdep.c 2010-01-21 20:47:02.000000000 +0100
@@ -20,6 +20,9 @@
#include "defs.h"
#include "gdbtypes.h"
#include "linux-tdep.h"
+#include "value.h"
+#include "infcall.h"
+#include "target.h"
/* This function is suitable for architectures that don't
extend/override the standard siginfo structure. */
@@ -134,3 +136,43 @@ linux_get_siginfo_type (struct gdbarch *
return siginfo_type;
}
+
+/* Call gnu-ifunc to resolve breakpoint at its returned function. */
+
+CORE_ADDR
+linux_convert_from_func_and_ptr (struct gdbarch *gdbarch, CORE_ADDR func_ptr,
+ CORE_ADDR pc)
+{
+ struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func;
+ struct minimal_symbol *msymbol;
+ struct value *function, *address;
+
+ if (!target_has_execution)
+ return pc;
+
+ msymbol = lookup_minimal_symbol_by_pc (func_ptr);
+ if (msymbol == NULL)
+ return pc;
+ if (MSYMBOL_TYPE (msymbol) != mst_text_gnu_ifunc)
+ return pc;
+
+ /* Not at the gnu-ifunc entry point? */
+ if (SYMBOL_VALUE_ADDRESS (msymbol) != func_ptr)
+ return pc;
+
+ function = allocate_value (func_func_type);
+ set_value_address (function, pc);
+
+ /* gnu-ifuncs have no arguments. FUNCTION is the code instruction address
+ while ADDRESS is a function descriptor. */
+ address = call_function_by_hand (function, 0, NULL);
+
+ return value_as_address (address);
+}
+
+CORE_ADDR
+linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct target_ops *targ)
+{
+ return linux_convert_from_func_and_ptr (gdbarch, addr, addr);
+}
Index: gdb-7.0.1/gdb/linux-tdep.h
===================================================================
--- gdb-7.0.1.orig/gdb/linux-tdep.h 2009-02-06 23:59:00.000000000 +0100
+++ gdb-7.0.1/gdb/linux-tdep.h 2010-01-21 20:45:32.000000000 +0100
@@ -22,4 +22,11 @@
struct type *linux_get_siginfo_type (struct gdbarch *);
+CORE_ADDR linux_convert_from_func_and_ptr (struct gdbarch *gdbarch,
+ CORE_ADDR func_ptr, CORE_ADDR pc);
+
+CORE_ADDR linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ);
+
#endif /* linux-tdep.h */
Index: gdb-7.0.1/gdb/m32r-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/m32r-linux-tdep.c 2009-01-03 06:57:52.000000000 +0100
+++ gdb-7.0.1/gdb/m32r-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -30,6 +30,7 @@
#include "gdb_string.h"
#include "glibc-tdep.h"
+#include "linux-tdep.h"
#include "solib-svr4.h"
#include "symtab.h"
@@ -422,6 +423,9 @@ m32r_linux_init_abi (struct gdbarch_info
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/minsyms.c
===================================================================
--- gdb-7.0.1.orig/gdb/minsyms.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/minsyms.c 2010-01-21 20:45:32.000000000 +0100
@@ -331,8 +331,9 @@ lookup_minimal_symbol_text (const char *
msymbol = msymbol->hash_next)
{
if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 &&
- (MSYMBOL_TYPE (msymbol) == mst_text ||
- MSYMBOL_TYPE (msymbol) == mst_file_text))
+ (MSYMBOL_TYPE (msymbol) == mst_text
+ || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
+ || MSYMBOL_TYPE (msymbol) == mst_file_text))
{
switch (MSYMBOL_TYPE (msymbol))
{
@@ -699,6 +700,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR p
{
return lookup_minimal_symbol_by_pc_section (pc, NULL);
}
+
+/* Return non-zero iff PC is in function implementing gnu-ifunc selection. */
+
+int
+in_gnu_ifunc_stub (CORE_ADDR pc)
+{
+ struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
+
+ return msymbol && MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc;
+}
/* Return leading symbol character for a BFD. If BFD is NULL,
@@ -738,6 +749,7 @@ prim_record_minimal_symbol (const char *
switch (ms_type)
{
case mst_text:
+ case mst_text_gnu_ifunc:
case mst_file_text:
case mst_solib_trampoline:
section = SECT_OFF_TEXT (objfile);
@@ -1184,7 +1196,8 @@ find_solib_trampoline_target (struct fra
{
ALL_MSYMBOLS (objfile, msymbol)
{
- if (MSYMBOL_TYPE (msymbol) == mst_text
+ if ((MSYMBOL_TYPE (msymbol) == mst_text
+ || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc)
&& strcmp (SYMBOL_LINKAGE_NAME (msymbol),
SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
return SYMBOL_VALUE_ADDRESS (msymbol);
Index: gdb-7.0.1/gdb/mips-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/mips-linux-tdep.c 2009-07-02 19:25:55.000000000 +0200
+++ gdb-7.0.1/gdb/mips-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -38,6 +38,7 @@
#include "target-descriptions.h"
#include "mips-linux-tdep.h"
#include "glibc-tdep.h"
+#include "linux-tdep.h"
static struct target_so_ops mips_svr4_so_ops;
@@ -1225,6 +1226,9 @@ mips_linux_init_abi (struct gdbarch_info
tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM,
"restart");
}
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/mn10300-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/mn10300-linux-tdep.c 2009-02-22 02:02:19.000000000 +0100
+++ gdb-7.0.1/gdb/mn10300-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -32,6 +32,7 @@
#include "frame.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "linux-tdep.h"
#include <stdlib.h>
@@ -718,6 +719,9 @@ am33_linux_init_osabi (struct gdbarch_in
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe);
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/parse.c
===================================================================
--- gdb-7.0.1.orig/gdb/parse.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/parse.c 2010-01-21 20:45:32.000000000 +0100
@@ -517,6 +517,11 @@ write_exp_msymbol (struct minimal_symbol
write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
break;
+ case mst_text_gnu_ifunc:
+ write_exp_elt_type (objfile_type (objfile)
+ ->nodebug_text_gnu_ifunc_symbol);
+ break;
+
case mst_data:
case mst_file_data:
case mst_bss:
Index: gdb-7.0.1/gdb/ppc-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/ppc-linux-tdep.c 2009-09-15 05:30:06.000000000 +0200
+++ gdb-7.0.1/gdb/ppc-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -48,6 +48,7 @@
#include "arch-utils.h"
#include "spu-tdep.h"
#include "xml-syscall.h"
+#include "linux-tdep.h"
#include "features/rs6000/powerpc-32l.c"
#include "features/rs6000/powerpc-altivec32l.c"
@@ -672,8 +673,19 @@ ppc64_linux_convert_from_func_ptr_addr (
res = bfd_get_section_contents (s->bfd, s->the_bfd_section,
&buf, addr - s->addr, 8);
if (res != 0)
- return extract_unsigned_integer (buf, 8, byte_order)
- - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
+ {
+ CORE_ADDR pc, resolved;
+
+ pc = extract_unsigned_integer (buf, 8, byte_order)
+ - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
+
+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc);
+ if (resolved != pc)
+ pc = ppc64_linux_convert_from_func_ptr_addr (gdbarch, resolved,
+ targ);
+
+ return pc;
+ }
}
return addr;
Index: gdb-7.0.1/gdb/solib-svr4.c
===================================================================
--- gdb-7.0.1.orig/gdb/solib-svr4.c 2010-01-21 20:45:23.000000000 +0100
+++ gdb-7.0.1/gdb/solib-svr4.c 2010-01-21 20:46:04.000000000 +0100
@@ -1250,7 +1250,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR p
{
return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
|| (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
- || in_plt_section (pc, NULL));
+ || in_plt_section (pc, NULL)
+ || in_gnu_ifunc_stub (pc));
}
/* Given an executable's ABFD and target, compute the entry-point
Index: gdb-7.0.1/gdb/sparc-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/sparc-linux-tdep.c 2009-07-02 19:25:58.000000000 +0200
+++ gdb-7.0.1/gdb/sparc-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -32,6 +32,7 @@
#include "symtab.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "linux-tdep.h"
#include "sparc-tdep.h"
@@ -279,6 +280,9 @@ sparc32_linux_init_abi (struct gdbarch_i
dwarf2_append_unwinders (gdbarch);
set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
Index: gdb-7.0.1/gdb/sparc64-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/sparc64-linux-tdep.c 2009-07-02 19:25:58.000000000 +0200
+++ gdb-7.0.1/gdb/sparc64-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -31,6 +31,7 @@
#include "symtab.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "linux-tdep.h"
#include "sparc64-tdep.h"
@@ -244,6 +245,9 @@ sparc64_linux_init_abi (struct gdbarch_i
tdep->step_trap = sparc64_linux_step_trap;
set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
Index: gdb-7.0.1/gdb/symmisc.c
===================================================================
--- gdb-7.0.1.orig/gdb/symmisc.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/symmisc.c 2010-01-21 20:45:32.000000000 +0100
@@ -287,6 +287,9 @@ dump_msymbols (struct objfile *objfile,
case mst_text:
ms_type = 'T';
break;
+ case mst_text_gnu_ifunc:
+ ms_type = 'i';
+ break;
case mst_solib_trampoline:
ms_type = 'S';
break;
Index: gdb-7.0.1/gdb/symtab.c
===================================================================
--- gdb-7.0.1.orig/gdb/symtab.c 2010-01-21 20:45:22.000000000 +0100
+++ gdb-7.0.1/gdb/symtab.c 2010-01-21 20:45:32.000000000 +0100
@@ -3160,7 +3160,7 @@ search_symbols (char *regexp, domain_enu
{mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
static enum minimal_symbol_type types4[]
=
- {mst_file_bss, mst_text, mst_abs, mst_unknown};
+ {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown};
enum minimal_symbol_type ourtype;
enum minimal_symbol_type ourtype2;
enum minimal_symbol_type ourtype3;
Index: gdb-7.0.1/gdb/symtab.h
===================================================================
--- gdb-7.0.1.orig/gdb/symtab.h 2010-01-21 20:45:21.000000000 +0100
+++ gdb-7.0.1/gdb/symtab.h 2010-01-21 20:45:32.000000000 +0100
@@ -275,6 +275,8 @@ enum minimal_symbol_type
{
mst_unknown = 0, /* Unknown type, the default */
mst_text, /* Generally executable instructions */
+ mst_text_gnu_ifunc, /* Executable code returning address
+ of executable code */
mst_data, /* Generally initialized data */
mst_bss, /* Generally uninitialized data */
mst_abs, /* Generally absolute (nonrelocatable) */
@@ -1149,6 +1151,8 @@ extern struct minimal_symbol *lookup_min
extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR);
+extern int in_gnu_ifunc_stub (CORE_ADDR pc);
+
extern struct minimal_symbol
*lookup_minimal_symbol_by_pc_section (CORE_ADDR, struct obj_section *);
Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc-lib.c 2010-01-21 20:45:32.000000000 +0100
@@ -0,0 +1,54 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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/>. */
+
+#include <assert.h>
+
+typedef int (*final_t) (int arg);
+
+static int
+init_stub (int arg)
+{
+ return 0;
+}
+
+static int
+final (int arg)
+{
+ return arg + 1;
+}
+
+static volatile int gnu_ifunc_initialized;
+
+void
+gnu_ifunc_pre (void)
+{
+ assert (!gnu_ifunc_initialized);
+
+ gnu_ifunc_initialized = 1;
+}
+
+final_t gnu_ifuncX (void) asm ("gnu_ifunc");
+asm (".type gnu_ifunc, @gnu_indirect_function");
+
+final_t
+gnu_ifuncX (void)
+{
+ if (!gnu_ifunc_initialized)
+ return init_stub;
+ else
+ return final;
+}
Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.c 2010-01-21 20:45:32.000000000 +0100
@@ -0,0 +1,36 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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/>. */
+
+#include <assert.h>
+
+extern int gnu_ifunc (int arg);
+extern void gnu_ifunc_pre (void);
+
+int
+main (void)
+{
+ int i;
+
+ gnu_ifunc_pre ();
+
+ i = gnu_ifunc (1); /* break-at-call */
+ assert (i == 2);
+
+ gnu_ifunc (2); /* break-at-nextcall */
+
+ return 0; /* break-at-exit */
+}
Index: gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.1/gdb/testsuite/gdb.base/gnu-ifunc.exp 2010-01-21 20:45:32.000000000 +0100
@@ -0,0 +1,115 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if {[skip_shlib_tests]} {
+ return 0
+}
+
+set testfile "gnu-ifunc"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+set libfile "${testfile}-lib"
+set libsrc ${libfile}.c
+set lib_so ${objdir}/${subdir}/${libfile}.so
+
+set lib_nodebug_so_base ${libfile}-nodebug.so
+set lib_nodebug_so ${objdir}/${subdir}/${lib_nodebug_so_base}
+
+# {debug} provides DWARF symbol gnu_ifuncX confusing the ELF symbol
+# gnu_ifunc during address->symbol resolution for printing the symbol.
+# Still we need it here for "step"ping into the function.
+set lib_opts [list debug]
+set lib_nodebug_opts [list]
+set exec_opts [list debug shlib=$lib_so]
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_so $lib_opts] != ""
+ || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""} {
+ untested "Could not compile either $libsrc or $srcfile."
+ return -1
+}
+
+# Start with a fresh gdb.
+
+clean_restart $testfile
+gdb_load_shlibs ${lib_so}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 1;
+}
+
+# The "if" condition is artifical to test regression of a format patch.
+gdb_breakpoint "[gdb_get_line_number "break-at-nextcall"] if i && gnu_ifunc (i) != 42"
+
+gdb_breakpoint [gdb_get_line_number "break-at-call"]
+gdb_continue_to_breakpoint "break-at-call" ".*break-at-call.*"
+
+# Test GDB will automatically indirect the call.
+
+gdb_test "p gnu_ifunc (3)" " = 4"
+
+# Test GDB will skip the gnu_ifunc resolver on first call.
+
+gdb_test "step" "\r\nfinal .*"
+
+# Test GDB will not break before the final chosen implementation.
+
+# Also test a format patch regression:
+# Continuing.
+# Error in testing breakpoint condition:
+# Attempt to take address of value not located in memory.
+#
+# Breakpoint 2, main () at ./gdb.base/gnu-ifunc.c:33
+
+gdb_test "continue" "Continuing.\r\n\r\nBreakpoint .* (at|in) .*break-at-nextcall.*" \
+ "continue to break-at-nextcall"
+
+gdb_breakpoint "gnu_ifunc"
+
+gdb_continue_to_breakpoint "nextcall gnu_ifunc"
+
+gdb_test "frame" "#0 +(0x\[0-9a-f\]+ in +)?final \\(.*" "nextcall gnu_ifunc skipped"
+
+
+# Compare the two different addresses:
+
+gdb_test "p gnu_ifunc" " = {<text variable, no debug info>} 0x\[0-9a-f\]+ <final>" "p gnu_ifunc executing"
+gdb_test "info sym gnu_ifunc" "final in section .*" "info sym gnu_ifunc executing"
+
+set test "info addr gnu_ifunc"
+gdb_test_multiple $test $test {
+ -re "Symbol \"gnu_ifunc\" is at (0x\[0-9a-f\]+) in .*$gdb_prompt $" {
+ pass $test
+ }
+}
+gdb_test "info sym $expect_out(1,string)" "gnu_ifunc in section .*" "info sym <gnu_ifunc-address>"
+
+# <*gnu_ifunc> would be an incorrect resolution from DW_AT_MIPS_linkage_name.
+# We do not use {debug} build option for this purpose.
+
+if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_nodebug_so $lib_nodebug_opts] != ""} {
+ untested "Could not compile either $libsrc."
+ return -1
+}
+
+clean_restart $lib_nodebug_so_base
+
+gdb_test "p gnu_ifunc" " = {<text gnu-ifunc variable, no debug info>} 0x\[0-9a-f\]+ <gnu_ifunc>" "p gnu_ifunc not executing without debug"
+gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc not executing without debug"
Index: gdb-7.0.1/gdb/xtensa-linux-tdep.c
===================================================================
--- gdb-7.0.1.orig/gdb/xtensa-linux-tdep.c 2009-02-22 02:02:20.000000000 +0100
+++ gdb-7.0.1/gdb/xtensa-linux-tdep.c 2010-01-21 20:45:32.000000000 +0100
@@ -22,6 +22,7 @@
#include "solib-svr4.h"
#include "symtab.h"
+#include "linux-tdep.h"
/* OS specific initialization of gdbarch. */
@@ -30,6 +31,9 @@ xtensa_linux_init_abi (struct gdbarch_in
{
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ linux_convert_from_func_ptr_addr);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
--- gdb-7.0.1/gdb/configure.tgt-orig 2009-08-06 12:28:38.000000000 +0200
+++ gdb-7.0.1/gdb/configure.tgt 2010-01-21 21:28:38.000000000 +0100
@@ -374,7 +374,7 @@ powerpc-*-aix* | rs6000-*-*)
;;
powerpc-*-linux* | powerpc64-*-linux*)
# Target: PowerPC running Linux
- gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o \
+ gdb_target_obs="rs6000-tdep.o ppc-linux-tdep.o linux-tdep.o ppc-sysv-tdep.o \
solib.o solib-svr4.o solib-spu.o spu-multiarch.o \
corelow.o symfile-mem.o"
gdb_sim=../sim/ppc/libsim.a

View File

@ -1,17 +1,9 @@
[ Rediffed against gdb-7.0.1. ]
watchpoint-hw-hit-once.c is a part of:
http://sourceware.org/ml/gdb-patches/2009-11/msg00444.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00178.html
ec27fce19a16df73e763281ce3a6d0cdb718174e
--- a/gdb/config/i386/linux64.mh
+++ b/gdb/config/i386/linux64.mh
@@ -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 gcore.o linux-fork.o
proc-service.o linux-thread-db.o linux-fork.o
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux64.h
@ -58,47 +50,6 @@ ec27fce19a16df73e763281ce3a6d0cdb718174e
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
--- gdb-7.0.1-orig/gdb/config/ia64/linux.mh 2007-04-26 00:17:48.000000000 +0200
+++ gdb-7.0.1/gdb/config/ia64/linux.mh 2010-02-24 01:40:21.000000000 +0100
@@ -1,6 +1,6 @@
# Host: Intel IA-64 running GNU/Linux
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-regset.o ia64-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o linux-fork.o
--- /dev/null
+++ b/gdb/config/ia64/nm-linux.h
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux ia64.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef NM_LINUX_H
+#define NM_LINUX_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX_H */
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1257,8 +1257,10 @@ extern char *normal_pid_to_str (ptid_t ptid);
@ -155,40 +106,3 @@ ec27fce19a16df73e763281ce3a6d0cdb718174e
+gdb_test "" "main .* at .*" "start"
+
+gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c
@@ -0,0 +1,34 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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/>. */
+
+static int watchee;
+
+int
+main (void)
+{
+ volatile int dummy;
+
+ /* Stub lines are present as no breakpoints/watchpoint gets hit if current PC
+ already stays on the line PC while entering "step"/"continue". */
+
+ dummy = 0; /* Stub to catch WATCHEE access after runto_main. */
+ dummy = watchee;
+ dummy = 1; /* Stub to catch break-at-exit after WATCHEE has been hit. */
+ dummy = 2; /* break-at-exit */
+
+ return 0;
+}

View File

@ -1,108 +0,0 @@
http://sourceware.org/ml/archer/2010-q1/msg00047.html
Subject: [fortran-module] [commit] Fix a regression on setting breakpoint at
[ Backport for F-12. ]
f5c7672a52316155bc3367cbc2f0e7db22523634
https://bugzilla.redhat.com/show_bug.cgi?id=559291
gdb/
2010-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
David Moore <david.moore@intel.com>
* f-lang.c (f_lookup_symbol_nonlocal): Always fallback on
basic_lookup_symbol_nonlocal.
gdb/testsuite/
2010-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/module.exp (show language, setting breakpoint at module):
New.
* gdb.fortran/module.f90: New statement program module.
--- ./gdb/f-lang.c 2010-02-03 01:50:07.000000000 +0100
+++ ./gdb/f-lang.c 2010-02-03 01:49:06.000000000 +0100
@@ -308,33 +308,33 @@ f_lookup_symbol_nonlocal (const char *na
const struct block *block,
const domain_enum domain)
{
- struct fortran_using *use;
-
- if (!block)
- return NULL;
-
- for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
+ if (block)
{
- struct symbol *sym;
- struct type *type;
- struct symbol *retval;
-
- sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
-
- /* Module name lookup should not fail with correct debug info. */
- if (sym == NULL)
- continue;
-
- type = SYMBOL_TYPE (sym);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
- gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
-
- retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
- if (retval)
- return retval;
+ struct fortran_using *use;
+
+ for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
+ {
+ struct symbol *sym;
+ struct type *type;
+ struct symbol *retval;
+
+ sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
+
+ /* Module name lookup should not fail with correct debug info. */
+ if (sym == NULL)
+ continue;
+
+ type = SYMBOL_TYPE (sym);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
+ gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
+
+ retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
+ if (retval)
+ return retval;
+ }
}
- return NULL;
+ return basic_lookup_symbol_nonlocal (name, block, domain);
}
/* This is declared in c-lang.h but it is silly to import that file for what
--- ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:50:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:47:42.000000000 +0100
@@ -43,3 +43,13 @@ gdb_test "print var_b" " = 11"
gdb_test "print var_c" "No symbol \"var_c\" in current context\\."
gdb_test "print var_d" " = 12"
gdb_test "print var_i" " = 14" "print var_i value 14"
+
+# Breakpoint would work in language "c".
+gdb_test "show language" {The current source language is "(auto; currently )?fortran".}
+
+# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above
+# works. But DWARF DW_TAG_subprogram contains the name specified by
+# the "program" Fortran statement.
+if [gdb_breakpoint "module"] {
+ pass "setting breakpoint at module"
+}
--- ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:50:07.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:47:42.000000000 +0100
@@ -37,6 +37,8 @@ end module modmany
var_i = var_i ! i-is-2
end
+ program module
+
use modmany, only: var_b, var_d => var_c, var_i
call sub1

View File

@ -1,174 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-01/msg00661.html
Subject: [patch] Fix failed gdb_assert due to the PIE patchset
[ Backport for F-12/7.0. ]
Hi,
the PIE patchset brought in an occasionally failing gdb_assert (according to
Fedora ABRT bugreports).
solib-svr4.c:600: internal-error: scan_dyntag: Assertion `target_section < current_target_sections->sections_end' failed.
Now I understand it as generally current_target_sections are about target-side
data while symbols are the GDB side and there is only loose relation of those.
ABFD can be from multiple places acting for multiple purposes as parsed by
elf_lookup_lib_symbol:
exec_bfd:
It cannot be from exec_one - this BFD has no associated objfile to
pass to symfile_objfile. OK.
symfile_objfile:
It gets translated by elf_lookup_lib_symbol into exec_bfd which
represents the target data. OK.
so_list's objfile's separate_debug_objfile file:
gdb_assert-forbidden as input to elf_lookup_lib_symbol. OK.
so_list's objfile's main file:
update_solib_list must have called add_target_sections. OK.
objfile's separate_debug_objfile file:
gdb_assert-forbidden as input to elf_lookup_lib_symbol. OK.
objfile's main file (if it has no associated so_list):
Such ABFD from add_symbol_file_command has no add_target_sections
called. Still it can have current context BLOCK which crashes
scan_dyntag. BUG.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
The patch mostly reverts the PIE part there.
OK to check in?
Sorry,
Jan
gdb/
2010-01-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* solib-svr4.c (scan_dyntag): New variable dyn_addr. Replace gdb_assert
by a conditional setting DYN_ADDR. Use DYN_ADDR.
* config/djgpp/fnchange.lst: Add translations for
symbol-without-target_section.exp and symbol-without-target_section.c.
gdb/testsuite/
2010-01-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/symbol-without-target_section.exp,
gdb.base/symbol-without-target_section.c: New.
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -394,6 +394,8 @@
@V@/gdb/testsuite/gdb.base/solib-symbol-main.c @V@/gdb/testsuite/gdb.base/so-symmain.c
@V@/gdb/testsuite/gdb.base/solib-overlap-lib.c @V@/gdb/testsuite/gdb.base/so-ovrlib.c
@V@/gdb/testsuite/gdb.base/solib-overlap-main.c @V@/gdb/testsuite/gdb.base/so-ovrmain.c
+@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.exp @V@/gdb/testsuite/gdb.base/symnosec.exp
+@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.c @V@/gdb/testsuite/gdb.base/symnosec.c
@V@/gdb/testsuite/gdb.base/type-opaque-lib.c @V@/gdb/testsuite/gdb.base/ty-opqlib.c
@V@/gdb/testsuite/gdb.base/type-opaque-main.c @V@/gdb/testsuite/gdb.base/ty-opqmain.c
@V@/gdb/testsuite/gdb.base/watchpoint-hw.c @V@/gdb/testsuite/gdb.base/wp-hw.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -570,7 +570,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
{
int arch_size, step, sect_size;
long dyn_tag;
- CORE_ADDR dyn_ptr;
+ CORE_ADDR dyn_ptr, dyn_addr;
gdb_byte *bufend, *bufstart, *buf;
Elf32_External_Dyn *x_dynp_32;
Elf64_External_Dyn *x_dynp_64;
@@ -627,7 +627,17 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
target_section++)
if (sect == target_section->the_bfd_section)
break;
- gdb_assert (target_section < target_get_section_table (&exec_ops)->sections_end);
+ if (target_section < target_get_section_table (&exec_ops)->sections_end)
+ dyn_addr = target_section->addr;
+ else
+ {
+ /* ABFD may come from OBJFILE acting only as a symbol file without being
+ loaded into the target (see add_symbol_file_command). This case is
+ such fallback to the file VMA address without the possibility of
+ having the section relocated to its actual in-memory address. */
+
+ dyn_addr = bfd_section_vma (abfd, sect);
+ }
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
@@ -639,7 +649,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
CORE_ADDR ptr_addr;
ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
- ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8;
+ ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
*ptr = dyn_ptr;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.c
@@ -0,0 +1,18 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int symbol_without_target_section;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
@@ -0,0 +1,39 @@
+# 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/>.
+
+# Exploit formerly failed assertion in scan_dyntag when it got called for
+# objfile having ".dynamic" section but without having data loaded in target.
+# Such file is ${binmainfile} through add-symbol-file here. Set context first
+# by "list main" to have some local BLOCK set in lookup_symbol_global.
+
+set testfile symbol-without-target_section
+set srclibfile ${testfile}.c
+set binlibfile ${testfile}.x
+set srcmainfile start.c
+set binmainfile ${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srclibfile}" \
+ "${objdir}/${subdir}/${binlibfile}" object {debug}] != "" } {
+ untested ${testfile}.exp
+ return -1
+}
+if {[build_executable ${testfile}.exp ${binmainfile} ${srcmainfile} {debug}] == -1} {
+ return -1
+}
+clean_restart ${binlibfile}
+
+gdb_test "add-symbol-file ${objdir}/${subdir}/${binmainfile} 0" "" "add-symbol-file" \
+ "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
+gdb_test "list main"
+gdb_test "print symbol_without_target_section"

View File

@ -1,31 +0,0 @@
Fix was a part of merge of master:
e421d7b026e77f4dc127de49c01e80d533eb6825
--- ./gdb/symfile.c 2010-02-28 23:22:31.000000000 +0100
+++ ./gdb/symfile.c 2010-02-28 23:29:00.000000000 +0100
@@ -3448,6 +3448,7 @@ reread_symbols (void)
objfile->symtabs = NULL;
objfile->psymtabs = NULL;
objfile->psymtabs_addrmap = NULL;
+ objfile->quick_addrmap = NULL;
objfile->free_psymtabs = NULL;
objfile->cp_namespace_symtab = NULL;
objfile->msymbols = NULL;
@@ -3458,6 +3459,8 @@ reread_symbols (void)
memset (&objfile->msymbol_demangled_hash, 0,
sizeof (objfile->msymbol_demangled_hash));
+ objfile->flags &= ~OBJF_SYMTABS_READ;
+
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
/* obstack_init also initializes the obstack so it is
@@ -3502,8 +3505,6 @@ reread_symbols (void)
wrap_here ("");
}
- objfile->flags &= ~OBJF_SYMTABS_READ;
-
/* We're done reading the symbol file; finish off complaints. */
clear_complaints (&symfile_complaints, 0, 1);

View File

@ -0,0 +1,159 @@
http://sourceware.org/ml/gdb-patches/2010-02/msg00625.html
Subject: RFC: fix bug with std::terminate handler
I would appreciate comments on this patch.
This comes from an automatically-reported bug in the Red Hat bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=562975
call_function_by_hand installs a momentary breakpoint on std::terminate,
and then deletes it later. However, this can cause a double deletion of
the breakpoint. In the bug, the called function is dlopen, which causes
gdb to enter solib_add, which calls breakpoint_re_set, deleting the
momentary breakpoint.
This fix works by creating the momentary breakpoint with an internal
breakpoint number, and then trying to delete the breakpoint by number.
This bug does not always manifest in a crash. In fact, I couldn't make
it crash here, but I could observe the problem under valgrind.
Built and regtested on x86-64 (compile farm). I also manually verified
it using valgrind.
I think this patch is mildly ugly, due to the introduction of
set_momentary_breakpoint_at_pc_with_number. However, in the absence of
comments, I plan to check it in after a reasonable waiting period.
Tom
2010-02-25 Tom Tromey <tromey@redhat.com>
* infcall.c (do_delete_breakpoint_by_number): New function.
(call_function_by_hand): Refer to momentary breakpoint by number.
* breakpoint.h (set_momentary_breakpoint_at_pc_with_number):
Declare.
* breakpoint.c (set_momentary_breakpoint_at_pc_with_number): New
function.
Index: gdb-7.0.90.20100312/gdb/breakpoint.c
===================================================================
--- gdb-7.0.90.20100312.orig/gdb/breakpoint.c 2010-03-12 14:54:26.000000000 +0100
+++ gdb-7.0.90.20100312/gdb/breakpoint.c 2010-03-12 14:54:53.000000000 +0100
@@ -6115,6 +6115,20 @@ set_momentary_breakpoint_at_pc (struct g
return set_momentary_breakpoint (gdbarch, sal, null_frame_id, type);
}
+
+/* Like set_momentary_breakpoint_at_pc, but ensure that the new
+ breakpoint has a number. */
+
+struct breakpoint *
+set_momentary_breakpoint_at_pc_with_number (struct gdbarch *gdbarch,
+ CORE_ADDR pc,
+ enum bptype type)
+{
+ struct breakpoint *result = set_momentary_breakpoint_at_pc (gdbarch, pc,
+ type);
+ result->number = internal_breakpoint_number--;
+ return result;
+}
/* Tell the user we have just set a breakpoint B. */
Index: gdb-7.0.90.20100312/gdb/breakpoint.h
===================================================================
--- gdb-7.0.90.20100312.orig/gdb/breakpoint.h 2010-03-12 14:54:26.000000000 +0100
+++ gdb-7.0.90.20100312/gdb/breakpoint.h 2010-03-12 14:54:53.000000000 +0100
@@ -774,6 +774,9 @@ extern struct breakpoint *set_momentary_
extern struct breakpoint *set_momentary_breakpoint_at_pc
(struct gdbarch *, CORE_ADDR pc, enum bptype type);
+extern struct breakpoint *set_momentary_breakpoint_at_pc_with_number
+ (struct gdbarch *, CORE_ADDR pc, enum bptype type);
+
extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt);
extern void set_ignore_count (int, int, int);
Index: gdb-7.0.90.20100312/gdb/infcall.c
===================================================================
--- gdb-7.0.90.20100312.orig/gdb/infcall.c 2010-03-12 14:54:26.000000000 +0100
+++ gdb-7.0.90.20100312/gdb/infcall.c 2010-03-12 14:55:19.000000000 +0100
@@ -410,6 +410,18 @@ run_inferior_call (struct thread_info *c
return e;
}
+/* A cleanup function that deletes a breakpoint, if it still exists,
+ given the breakpoint's number. */
+
+static void
+do_delete_breakpoint_by_number (void *arg)
+{
+ int *num = arg;
+ struct breakpoint *bp = get_breakpoint (*num);
+ if (bp)
+ delete_breakpoint (bp);
+}
+
/* All this stuff with a dummy frame may seem unnecessarily complicated
(why not just save registers in GDB?). The purpose of pushing a dummy
frame which looks just like a real frame is so that if you call a
@@ -447,7 +459,8 @@ call_function_by_hand (struct value *fun
struct cleanup *args_cleanup;
struct frame_info *frame;
struct gdbarch *gdbarch;
- struct breakpoint *terminate_bp = NULL;
+ int terminate_bp_num = 0;
+ CORE_ADDR terminate_bp_addr = 0;
struct minimal_symbol *tm;
struct cleanup *terminate_bp_cleanup = NULL;
ptid_t call_thread_ptid;
@@ -765,8 +778,13 @@ call_function_by_hand (struct value *fun
struct minimal_symbol *tm = lookup_minimal_symbol ("std::terminate()",
NULL, NULL);
if (tm != NULL)
- terminate_bp = set_momentary_breakpoint_at_pc
+ {
+ struct breakpoint *bp;
+ bp = set_momentary_breakpoint_at_pc_with_number
(gdbarch, SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint);
+ terminate_bp_num = bp->number;
+ terminate_bp_addr = bp->loc->address;
+ }
}
/* Everything's ready, push all the info needed to restore the
@@ -780,8 +798,9 @@ call_function_by_hand (struct value *fun
discard_cleanups (inf_status_cleanup);
/* Register a clean-up for unwind_on_terminating_exception_breakpoint. */
- if (terminate_bp)
- terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp);
+ if (terminate_bp_num != 0)
+ terminate_bp_cleanup = make_cleanup (do_delete_breakpoint_by_number,
+ &terminate_bp_num);
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
If you're looking to implement asynchronous dummy-frames, then
@@ -947,9 +966,9 @@ When the function is done executing, GDB
in an inferior function call. Rewind, and warn the
user. */
- if (terminate_bp != NULL
+ if (terminate_bp_num != 0
&& (inferior_thread ()->stop_bpstat->breakpoint_at->address
- == terminate_bp->loc->address))
+ == terminate_bp_addr))
{
/* We must get back to the frame we were before the
dummy call. */
@@ -998,7 +1017,7 @@ When the function is done executing, GDB
/* If we get here and the std::terminate() breakpoint has been set,
it has to be cleaned manually. */
- if (terminate_bp)
+ if (terminate_bp_num != 0)
do_cleanups (terminate_bp_cleanup);
/* If we get here the called FUNCTION ran to completion,

View File

@ -0,0 +1,73 @@
http://sourceware.org/ml/gdb-patches/2010-04/msg00055.html
Subject: [patch] Fix dangling displays in separate debug
[ Backported. ]
Hi,
gdb.base/solib-display.exp using _separate_ debug info:
3: c_global = gdbtypes.c:1369: internal-error: check_typedef: Assertion `type' failed.
A problem internal to GDB has been detected,
This problem was fixed before by:
[patch 1/8] Types GC [unloading observer]
http://sourceware.org/ml/gdb-patches/2009-05/msg00544.html
Re: [patch 3/8] Types GC [display_uses_solib_p to exp_iterate]
http://sourceware.org/ml/gdb-patches/2009-07/msg00054.html
but as that patchset is still not in providing this temporary fixup instead.
One may only address that gdb.base/solib-display.exp was testing symbol
in-objfile while now it tests only symbol in-sepdebug-objfile and no longer
the in-objfile case. I find the in-sepdebug-objfile as a superset of
in-objfile test but I can rework it if anyones addresses this test change.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2010-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* printcmd.c (display_uses_solib_p): Check also
SEPARATE_DEBUG_OBJFILE.
gdb/testsuite/
2010-04-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/solib-display.exp (split solib): New.
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1845,7 +1845,10 @@ clear_dangling_display_expressions (stru
for (d = display_chain; d != NULL; d = d->next)
if (block_objfile (d->block) == objfile
- || (d->exp && exp_uses_objfile (d->exp, objfile)))
+ || (d->exp && exp_uses_objfile (d->exp, objfile))
+ || (objfile->separate_debug_objfile
+ && (block_objfile (d->block) == objfile->separate_debug_objfile
+ || (d->exp && exp_uses_objfile (d->exp, objfile->separate_debug_objfile)))))
{
xfree (d->exp);
d->exp = NULL;
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -53,6 +53,13 @@ if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
return -1
}
+set test "split solib"
+if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
+ fail $test
+} else {
+ pass $test
+}
+
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,751 @@
[ Backported. ]
commit cb928c67c90cfb5bbb0636d91855b95e51ad275d
Author: Daniel Jacobowitz <dan@debian.org>
Date: Mon Mar 1 17:19:21 2010 +0000
* gdbtypes.c (append_composite_type_field_raw): New.
(append_composite_type_field_aligned): Use the new function.
* gdbtypes.h (append_composite_type_field_raw): Declare.
* target-descriptions.c (struct tdesc_type_field): Add start and end.
(struct tdesc_type_flag): New type.
(struct tdesc_type): Add TDESC_TYPE_STRUCT and TDESC_TYPE_FLAGS to
kind. Add size to u.u. Add u.f for flags.
(tdesc_gdb_type): Handle TDESC_TYPE_STRUCT and TDESC_TYPE_FLAGS.
(tdesc_free_type): Likewise.
(tdesc_create_struct, tdesc_set_struct_size, tdesc_create_flags): New.
(tdesc_add_field): Handle TDESC_TYPE_STRUCT.
(tdesc_add_bitfield, tdesc_add_flag): New.
* target-descriptions.h (tdesc_create_struct, tdesc_set_struct_size)
(tdesc_create_flags, tdesc_add_bitfield, tdesc_add_flag): Declare.
* xml-tdesc.c (struct tdesc_parsing_data): Rename current_union to
current_type. Add current_type_size and current_type_is_flags.
(tdesc_start_union): Clear the new fields.
(tdesc_start_struct, tdesc_start_flags): New.
(tdesc_start_field): Handle struct fields, including bitfields.
(field_attributes): Make type optional. Add start and end.
(union_children): Rename to struct_union_children.
(union_attributes): Rename to struct_union_attributes. Add optional
size.
(flags_attributes): New.
(feature_children): Add struct and flags.
* features/gdb-target.dtd: Add flags and struct to features.
Make field type optional. Add field start and end.
doc/
* gdb.texinfo (Types): Describe <struct> and <flags>.
testsuite/
* gdb.xml/extra-regs.xml: Add struct1, struct2, and flags
types. Add structreg, bitfields, and flags registers.
* gdb.xml/tdesc-regs.exp: Test structreg and bitfields
registers.
--- gdb-7.1-p0/gdb/doc/gdb.texinfo 2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-03 21:04:13.000000000 +0200
@@ -33115,6 +33115,47 @@ each of which has a @var{name} and a @va
</union>
@end smallexample
+@cindex <struct>
+If a register's value is composed from several separate values, define
+it with a structure type. There are two forms of the @samp{<struct>}
+element; a @samp{<struct>} element must either contain only bitfields
+or contain no bitfields. If the structure contains only bitfields,
+its total size in bytes must be specified, each bitfield must have an
+explicit start and end, and bitfields are automatically assigned an
+integer type. The field's @var{start} should be less than or
+equal to its @var{end}, and zero represents the least significant bit.
+
+@smallexample
+<struct id="@var{id}" size="@var{size}">
+ <field name="@var{name}" start="@var{start}" end="@var{end}"/>
+ @dots{}
+</struct>
+@end smallexample
+
+If the structure contains no bitfields, then each field has an
+explicit type, and no implicit padding is added.
+
+@smallexample
+<struct id="@var{id}">
+ <field name="@var{name}" type="@var{type}"/>
+ @dots{}
+</struct>
+@end smallexample
+
+@cindex <flags>
+If a register's value is a series of single-bit flags, define it with
+a flags type. The @samp{<flags>} element has an explicit @var{size}
+and contains one or more @samp{<field>} elements. Each field has a
+@var{name}, a @var{start}, and an @var{end}. Only single-bit flags
+are supported.
+
+@smallexample
+<flags id="@var{id}" size="@var{size}">
+ <field name="@var{name}" start="@var{start}" end="@var{end}"/>
+ @dots{}
+</flags>
+@end smallexample
+
@subsection Registers
@cindex <reg>
--- gdb-7.1-p0/gdb/features/gdb-target.dtd 2010-01-01 08:31:48.000000000 +0100
+++ gdb-7.1/gdb/features/gdb-target.dtd 2010-04-03 21:04:13.000000000 +0200
@@ -19,7 +19,8 @@
<!ELEMENT compatible (#PCDATA)>
-<!ELEMENT feature ((vector | union)*, reg*)>
+<!ELEMENT feature
+ ((vector | flags | struct | union )*, reg*)>
<!ATTLIST feature
name ID #REQUIRED>
@@ -39,6 +40,16 @@
type CDATA #REQUIRED
count CDATA #REQUIRED>
+<!ELEMENT flags (field+)>
+<!ATTLIST flags
+ id CDATA #REQUIRED
+ size CDATA #REQUIRED>
+
+<!ELEMENT struct (field+)>
+<!ATTLIST struct
+ id CDATA #REQUIRED
+ size CDATA #IMPLIED>
+
<!ELEMENT union (field+)>
<!ATTLIST union
id CDATA #REQUIRED>
@@ -46,7 +57,9 @@
<!ELEMENT field EMPTY>
<!ATTLIST field
name CDATA #REQUIRED
- type CDATA #REQUIRED>
+ type CDATA #IMPLIED
+ start CDATA #IMPLIED
+ end CDATA #IMPLIED>
<!ENTITY % xinclude SYSTEM "xinclude.dtd">
%xinclude;
--- gdb-7.1-p0/gdb/gdbtypes.c 2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/gdbtypes.c 2010-04-03 21:04:13.000000000 +0200
@@ -3798,10 +3798,11 @@ arch_composite_type (struct gdbarch *gdb
}
/* Add new field with name NAME and type FIELD to composite type T.
- ALIGNMENT (if non-zero) specifies the minimum field alignment. */
-void
-append_composite_type_field_aligned (struct type *t, char *name,
- struct type *field, int alignment)
+ Do not set the field's position or adjust the type's length;
+ the caller should do so. Return the new field. */
+struct field *
+append_composite_type_field_raw (struct type *t, char *name,
+ struct type *field)
{
struct field *f;
TYPE_NFIELDS (t) = TYPE_NFIELDS (t) + 1;
@@ -3811,6 +3812,16 @@ append_composite_type_field_aligned (str
memset (f, 0, sizeof f[0]);
FIELD_TYPE (f[0]) = field;
FIELD_NAME (f[0]) = name;
+ return f;
+}
+
+/* Add new field with name NAME and type FIELD to composite type T.
+ ALIGNMENT (if non-zero) specifies the minimum field alignment. */
+void
+append_composite_type_field_aligned (struct type *t, char *name,
+ struct type *field, int alignment)
+{
+ struct field *f = append_composite_type_field_raw (t, name, field);
if (TYPE_CODE (t) == TYPE_CODE_UNION)
{
if (TYPE_LENGTH (t) < TYPE_LENGTH (field))
--- gdb-7.1-p0/gdb/gdbtypes.h 2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/gdbtypes.h 2010-04-03 21:04:13.000000000 +0200
@@ -1395,6 +1395,8 @@ extern void append_composite_type_field_
char *name,
struct type *field,
int alignment);
+struct field *append_composite_type_field_raw (struct type *t, char *name,
+ struct type *field);
/* Helper functions to construct a bit flags type. An initially empty
type is created using arch_flag_type(). Flags are then added using
--- gdb-7.1-p0/gdb/target-descriptions.c 2010-02-10 19:45:02.000000000 +0100
+++ gdb-7.1/gdb/target-descriptions.c 2010-04-03 21:04:13.000000000 +0200
@@ -90,9 +90,17 @@ typedef struct tdesc_type_field
{
char *name;
struct tdesc_type *type;
+ int start, end;
} tdesc_type_field;
DEF_VEC_O(tdesc_type_field);
+typedef struct tdesc_type_flag
+{
+ char *name;
+ int start;
+} tdesc_type_flag;
+DEF_VEC_O(tdesc_type_flag);
+
typedef struct tdesc_type
{
/* The name of this type. */
@@ -123,7 +131,9 @@ typedef struct tdesc_type
/* Types defined by a target feature. */
TDESC_TYPE_VECTOR,
- TDESC_TYPE_UNION
+ TDESC_TYPE_STRUCT,
+ TDESC_TYPE_UNION,
+ TDESC_TYPE_FLAGS
} kind;
/* Kind-specific data. */
@@ -136,11 +146,19 @@ typedef struct tdesc_type
int count;
} v;
- /* Union type. */
+ /* Struct or union type. */
struct
{
VEC(tdesc_type_field) *fields;
+ LONGEST size;
} u;
+
+ /* Flags type. */
+ struct
+ {
+ VEC(tdesc_type_flag) *flags;
+ LONGEST size;
+ } f;
} u;
} *tdesc_type_p;
DEF_VEC_P(tdesc_type_p);
@@ -652,6 +670,66 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
return type;
}
+ case TDESC_TYPE_STRUCT:
+ {
+ struct type *type, *field_type;
+ struct tdesc_type_field *f;
+ int ix;
+
+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
+ TYPE_NAME (type) = xstrdup (tdesc_type->name);
+ TYPE_TAG_NAME (type) = TYPE_NAME (type);
+
+ for (ix = 0;
+ VEC_iterate (tdesc_type_field, tdesc_type->u.u.fields, ix, f);
+ ix++)
+ {
+ if (f->type == NULL)
+ {
+ /* Bitfield. */
+ struct field *fld;
+ struct type *field_type;
+ int bitsize, total_size;
+
+ /* This invariant should be preserved while creating
+ types. */
+ gdb_assert (tdesc_type->u.u.size != 0);
+ if (tdesc_type->u.u.size > 4)
+ field_type = builtin_type (gdbarch)->builtin_uint64;
+ else
+ field_type = builtin_type (gdbarch)->builtin_uint32;
+
+ fld = append_composite_type_field_raw (type, xstrdup (f->name),
+ field_type);
+
+ /* For little-endian, BITPOS counts from the LSB of
+ the structure and marks the LSB of the field. For
+ big-endian, BITPOS counts from the MSB of the
+ structure and marks the MSB of the field. Either
+ way, it is the number of bits to the "left" of the
+ field. To calculate this in big-endian, we need
+ the total size of the structure. */
+ bitsize = f->end - f->start + 1;
+ total_size = tdesc_type->u.u.size * TARGET_CHAR_BIT;
+ if (gdbarch_bits_big_endian (gdbarch))
+ FIELD_BITPOS (fld[0]) = total_size - f->start - bitsize;
+ else
+ FIELD_BITPOS (fld[0]) = f->start;
+ FIELD_BITSIZE (fld[0]) = bitsize;
+ }
+ else
+ {
+ field_type = tdesc_gdb_type (gdbarch, f->type);
+ append_composite_type_field (type, xstrdup (f->name),
+ field_type);
+ }
+ }
+
+ if (tdesc_type->u.u.size != 0)
+ TYPE_LENGTH (type) = tdesc_type->u.u.size;
+ return type;
+ }
+
case TDESC_TYPE_UNION:
{
struct type *type, *field_type;
@@ -668,12 +746,30 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
field_type = tdesc_gdb_type (gdbarch, f->type);
append_composite_type_field (type, xstrdup (f->name), field_type);
- /* If any of the children of this union are vectors, flag the
+ /* If any of the children of a union are vectors, flag the
union as a vector also. This allows e.g. a union of two
vector types to show up automatically in "info vector". */
if (TYPE_VECTOR (field_type))
TYPE_VECTOR (type) = 1;
}
+ return type;
+ }
+
+ case TDESC_TYPE_FLAGS:
+ {
+ struct type *type, *field_type;
+ struct tdesc_type_flag *f;
+ int ix;
+
+ type = arch_flags_type (gdbarch, xstrdup (tdesc_type->name),
+ tdesc_type->u.f.size);
+ for (ix = 0;
+ VEC_iterate (tdesc_type_flag, tdesc_type->u.f.flags, ix, f);
+ ix++)
+ /* Note that contrary to the function name, this call will
+ just set the properties of an already-allocated
+ field. */
+ append_flags_type_flag (type, f->start, f->name);
return type;
}
@@ -1161,6 +1257,7 @@ tdesc_free_type (struct tdesc_type *type
switch (type->kind)
{
+ case TDESC_TYPE_STRUCT:
case TDESC_TYPE_UNION:
{
struct tdesc_type_field *f;
@@ -1175,6 +1272,20 @@ tdesc_free_type (struct tdesc_type *type
}
break;
+ case TDESC_TYPE_FLAGS:
+ {
+ struct tdesc_type_flag *f;
+ int ix;
+
+ for (ix = 0;
+ VEC_iterate (tdesc_type_flag, type->u.f.flags, ix, f);
+ ix++)
+ xfree (f->name);
+
+ VEC_free (tdesc_type_flag, type->u.f.flags);
+ }
+ break;
+
default:
break;
}
@@ -1199,6 +1310,29 @@ tdesc_create_vector (struct tdesc_featur
}
struct tdesc_type *
+tdesc_create_struct (struct tdesc_feature *feature, const char *name)
+{
+ struct tdesc_type *type = XZALLOC (struct tdesc_type);
+
+ type->name = xstrdup (name);
+ type->kind = TDESC_TYPE_STRUCT;
+
+ VEC_safe_push (tdesc_type_p, feature->types, type);
+ return type;
+}
+
+/* Set the total length of TYPE. Structs which contain bitfields may
+ omit the reserved bits, so the end of the last field may not
+ suffice. */
+
+void
+tdesc_set_struct_size (struct tdesc_type *type, LONGEST size)
+{
+ gdb_assert (type->kind == TDESC_TYPE_STRUCT);
+ type->u.u.size = size;
+}
+
+struct tdesc_type *
tdesc_create_union (struct tdesc_feature *feature, const char *name)
{
struct tdesc_type *type = XZALLOC (struct tdesc_type);
@@ -1210,13 +1344,32 @@ tdesc_create_union (struct tdesc_feature
return type;
}
+struct tdesc_type *
+tdesc_create_flags (struct tdesc_feature *feature, const char *name,
+ LONGEST size)
+{
+ struct tdesc_type *type = XZALLOC (struct tdesc_type);
+
+ type->name = xstrdup (name);
+ type->kind = TDESC_TYPE_FLAGS;
+ type->u.f.size = size;
+
+ VEC_safe_push (tdesc_type_p, feature->types, type);
+ return type;
+}
+
+/* Add a new field. Return a temporary pointer to the field, which
+ is only valid until the next call to tdesc_add_field (the vector
+ might be reallocated). */
+
void
tdesc_add_field (struct tdesc_type *type, const char *field_name,
struct tdesc_type *field_type)
{
struct tdesc_type_field f = { 0 };
- gdb_assert (type->kind == TDESC_TYPE_UNION);
+ gdb_assert (type->kind == TDESC_TYPE_UNION
+ || type->kind == TDESC_TYPE_STRUCT);
f.name = xstrdup (field_name);
f.type = field_type;
@@ -1224,6 +1377,37 @@ tdesc_add_field (struct tdesc_type *type
VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
}
+/* Add a new bitfield. */
+
+void
+tdesc_add_bitfield (struct tdesc_type *type, const char *field_name,
+ int start, int end)
+{
+ struct tdesc_type_field f = { 0 };
+
+ gdb_assert (type->kind == TDESC_TYPE_STRUCT);
+
+ f.name = xstrdup (field_name);
+ f.start = start;
+ f.end = end;
+
+ VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
+}
+
+void
+tdesc_add_flag (struct tdesc_type *type, int start,
+ const char *flag_name)
+{
+ struct tdesc_type_flag f = { 0 };
+
+ gdb_assert (type->kind == TDESC_TYPE_FLAGS);
+
+ f.name = xstrdup (flag_name);
+ f.start = start;
+
+ VEC_safe_push (tdesc_type_flag, type->u.f.flags, &f);
+}
+
static void
tdesc_free_feature (struct tdesc_feature *feature)
{
--- gdb-7.1-p0/gdb/target-descriptions.h 2010-02-10 19:45:03.000000000 +0100
+++ gdb-7.1/gdb/target-descriptions.h 2010-04-03 21:04:13.000000000 +0200
@@ -205,10 +205,20 @@ struct tdesc_type *tdesc_create_vector (
const char *name,
struct tdesc_type *field_type,
int count);
+struct tdesc_type *tdesc_create_struct (struct tdesc_feature *feature,
+ const char *name);
+void tdesc_set_struct_size (struct tdesc_type *type, LONGEST size);
struct tdesc_type *tdesc_create_union (struct tdesc_feature *feature,
const char *name);
+struct tdesc_type *tdesc_create_flags (struct tdesc_feature *feature,
+ const char *name,
+ LONGEST size);
void tdesc_add_field (struct tdesc_type *type, const char *field_name,
struct tdesc_type *field_type);
+void tdesc_add_bitfield (struct tdesc_type *type, const char *field_name,
+ int start, int end);
+void tdesc_add_flag (struct tdesc_type *type, int start,
+ const char *flag_name);
void tdesc_create_reg (struct tdesc_feature *feature, const char *name,
int regnum, int save_restore, const char *group,
int bitsize, const char *type);
--- gdb-7.1-p0/gdb/testsuite/gdb.xml/extra-regs.xml 2007-02-08 22:00:36.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.xml/extra-regs.xml 2010-04-03 21:04:13.000000000 +0200
@@ -8,9 +8,27 @@
<field name="v2" type="v2int16"/>
</union>
+ <struct id="struct1">
+ <field name="v4" type="v4int8"/>
+ <field name="v2" type="v2int16"/>
+ </struct>
+
+ <struct id="struct2" size="8">
+ <field name="f1" start="0" end="34"/>
+ <field name="f2" start="63" end="63"/>
+ </struct>
+
+ <flags id="flags" size="4">
+ <field name="X" start="0" end="0"/>
+ <field name="Y" start="2" end="2"/>
+ </flags>
+
<reg name="extrareg" bitsize="32"/>
<reg name="uintreg" bitsize="32" type="uint32"/>
<reg name="vecreg" bitsize="32" type="v4int8"/>
<reg name="unionreg" bitsize="32" type="vecint"/>
+ <reg name="structreg" bitsize="64" type="struct1"/>
+ <reg name="bitfields" bitsize="64" type="struct2"/>
+ <reg name="flags" bitsize="32" type="flags"/>
</feature>
</target>
--- gdb-7.1-p0/gdb/testsuite/gdb.xml/tdesc-regs.exp 2010-04-03 20:59:52.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.xml/tdesc-regs.exp 2010-04-03 21:04:13.000000000 +0200
@@ -141,6 +141,11 @@ gdb_test "ptype \$vecreg" "type = int8_t
gdb_test "ptype \$unionreg" \
"type = union {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
gdb_test "ptype \$unionreg.v4" "type = int8_t \\\[4\\\]"
+gdb_test "ptype \$structreg" \
+ "type = struct struct1 {\r\n *v4int8 v4;\r\n *v2int16 v2;\r\n}"
+gdb_test "ptype \$structreg.v4" "type = int8_t \\\[4\\\]"
+gdb_test "ptype \$bitfields" \
+ "type = struct struct2 {\r\n *uint64_t f1 : 35;\r\n *uint64_t f2 : 1;\r\n}"
load_description "core-only.xml" ""
# The extra register from the previous description should be gone.
--- gdb-7.1-p0/gdb/xml-tdesc.c 2010-01-01 08:31:46.000000000 +0100
+++ gdb-7.1/gdb/xml-tdesc.c 2010-04-03 21:04:13.000000000 +0200
@@ -85,8 +85,15 @@ struct tdesc_parsing_data
it does not have its own. This starts at zero. */
int next_regnum;
- /* The union we are currently parsing, or last parsed. */
- struct tdesc_type *current_union;
+ /* The struct or union we are currently parsing, or last parsed. */
+ struct tdesc_type *current_type;
+
+ /* The byte size of the current struct type, if specified. Zero
+ if not specified. */
+ int current_type_size;
+
+ /* Whether the current type is a flags type. */
+ int current_type_is_flags;
};
/* Handle the end of an <architecture> element and its value. */
@@ -229,11 +236,57 @@ tdesc_start_union (struct gdb_xml_parser
struct tdesc_parsing_data *data = user_data;
char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
- data->current_union = tdesc_create_union (data->current_feature, id);
+ data->current_type = tdesc_create_union (data->current_feature, id);
+ data->current_type_size = 0;
+ data->current_type_is_flags = 0;
+}
+
+/* Handle the start of a <struct> element. Initialize the type and
+ record it with the current feature. */
+
+static void
+tdesc_start_struct (struct gdb_xml_parser *parser,
+ const struct gdb_xml_element *element,
+ void *user_data, VEC(gdb_xml_value_s) *attributes)
+{
+ struct tdesc_parsing_data *data = user_data;
+ char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
+ struct tdesc_type *type;
+
+ type = tdesc_create_struct (data->current_feature, id);
+ data->current_type = type;
+ data->current_type_size = 0;
+ data->current_type_is_flags = 0;
+
+ if (VEC_length (gdb_xml_value_s, attributes) > 1)
+ {
+ int size = (int) * (ULONGEST *)
+ VEC_index (gdb_xml_value_s, attributes, 1)->value;
+ tdesc_set_struct_size (type, size);
+ data->current_type_size = size;
+ }
+}
+
+static void
+tdesc_start_flags (struct gdb_xml_parser *parser,
+ const struct gdb_xml_element *element,
+ void *user_data, VEC(gdb_xml_value_s) *attributes)
+{
+ struct tdesc_parsing_data *data = user_data;
+ char *id = VEC_index (gdb_xml_value_s, attributes, 0)->value;
+ int length = (int) * (ULONGEST *)
+ VEC_index (gdb_xml_value_s, attributes, 1)->value;
+ struct tdesc_type *type;
+
+ type = tdesc_create_flags (data->current_feature, id, length);
+
+ data->current_type = type;
+ data->current_type_size = 0;
+ data->current_type_is_flags = 1;
}
/* Handle the start of a <field> element. Attach the field to the
- current union. */
+ current struct or union. */
static void
tdesc_start_field (struct gdb_xml_parser *parser,
@@ -241,20 +294,84 @@ tdesc_start_field (struct gdb_xml_parser
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
struct tdesc_parsing_data *data = user_data;
+ int ix = 0, length;
struct gdb_xml_value *attrs = VEC_address (gdb_xml_value_s, attributes);
struct tdesc_type *field_type;
char *field_name, *field_type_id;
+ int start, end;
- field_name = attrs[0].value;
- field_type_id = attrs[1].value;
+ length = VEC_length (gdb_xml_value_s, attributes);
- field_type = tdesc_named_type (data->current_feature, field_type_id);
- if (field_type == NULL)
- gdb_xml_error (parser, _("Union field \"%s\" references undefined "
- "type \"%s\""),
- field_name, field_type_id);
+ field_name = attrs[ix++].value;
+
+ if (ix < length && strcmp (attrs[ix].name, "type") == 0)
+ field_type_id = attrs[ix++].value;
+ else
+ field_type_id = NULL;
+
+ if (ix < length && strcmp (attrs[ix].name, "start") == 0)
+ start = * (ULONGEST *) attrs[ix++].value;
+ else
+ start = -1;
+
+ if (ix < length && strcmp (attrs[ix].name, "end") == 0)
+ end = * (ULONGEST *) attrs[ix++].value;
+ else
+ end = -1;
+
+ if (field_type_id != NULL)
+ {
+ if (data->current_type_is_flags)
+ gdb_xml_error (parser, _("Cannot add typed field \"%s\" to flags"),
+ field_name);
+ if (data->current_type_size != 0)
+ gdb_xml_error (parser,
+ _("Explicitly sized type can not contain non-bitfield \"%s\""),
+ field_name);
+
+ field_type = tdesc_named_type (data->current_feature, field_type_id);
+ if (field_type == NULL)
+ gdb_xml_error (parser, _("Field \"%s\" references undefined "
+ "type \"%s\""),
+ field_name, field_type_id);
+
+ tdesc_add_field (data->current_type, field_name, field_type);
+ }
+ else if (start != -1 && end != -1)
+ {
+ struct tdesc_type *t = data->current_type;
+
+ if (data->current_type_is_flags)
+ tdesc_add_flag (t, start, field_name);
+ else
+ {
+ if (data->current_type_size == 0)
+ gdb_xml_error (parser,
+ _("Implicitly sized type can not contain bitfield \"%s\""),
+ field_name);
+
+ if (end >= 64)
+ gdb_xml_error (parser,
+ _("Bitfield \"%s\" goes past 64 bits (unsupported)"),
+ field_name);
+
+ /* Assume that the bit numbering in XML is "lsb-zero". Most
+ architectures other than PowerPC use this ordering. In
+ the future, we can add an XML tag to indicate "msb-zero"
+ numbering. */
+ if (start > end)
+ gdb_xml_error (parser, _("Bitfield \"%s\" has start after end"),
+ field_name);
- tdesc_add_field (data->current_union, field_name, field_type);
+ if (end >= data->current_type_size * TARGET_CHAR_BIT)
+ gdb_xml_error (parser, _("Bitfield \"%s\" does not fit in struct"));
+
+ tdesc_add_bitfield (t, field_name, start, end);
+ }
+ }
+ else
+ gdb_xml_error (parser, _("Field \"%s\" has neither type nor bit position"),
+ field_name);
}
/* Handle the start of a <vector> element. Initialize the type and
@@ -287,11 +404,13 @@ tdesc_start_vector (struct gdb_xml_parse
static const struct gdb_xml_attribute field_attributes[] = {
{ "name", GDB_XML_AF_NONE, NULL, NULL },
- { "type", GDB_XML_AF_NONE, NULL, NULL },
+ { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { "start", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { "end", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
};
-static const struct gdb_xml_element union_children[] = {
+static const struct gdb_xml_element struct_union_children[] = {
{ "field", field_attributes, NULL, GDB_XML_EF_REPEATABLE,
tdesc_start_field, NULL },
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
@@ -308,8 +427,15 @@ static const struct gdb_xml_attribute re
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
};
-static const struct gdb_xml_attribute union_attributes[] = {
+static const struct gdb_xml_attribute struct_union_attributes[] = {
{ "id", GDB_XML_AF_NONE, NULL, NULL },
+ { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL},
+ { NULL, GDB_XML_AF_NONE, NULL, NULL }
+};
+
+static const struct gdb_xml_attribute flags_attributes[] = {
+ { "id", GDB_XML_AF_NONE, NULL, NULL },
+ { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL},
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
};
@@ -329,9 +455,15 @@ static const struct gdb_xml_element feat
{ "reg", reg_attributes, NULL,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
tdesc_start_reg, NULL },
- { "union", union_attributes, union_children,
+ { "struct", struct_union_attributes, struct_union_children,
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
+ tdesc_start_struct, NULL },
+ { "union", struct_union_attributes, struct_union_children,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
tdesc_start_union, NULL },
+ { "flags", flags_attributes, struct_union_children,
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
+ tdesc_start_flags, NULL },
{ "vector", vector_attributes, NULL,
GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
tdesc_start_vector, NULL },

View File

@ -0,0 +1,457 @@
[ Backported. ]
commit 0257d639d42f896a359993ae8adb5792e280f65f
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Mar 1 17:26:02 2010 +0000
Remove TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
2010-03-01 H.J. Lu <hongjiu.lu@intel.com>
* target-descriptions.c (tdesc_type): Remove
TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR.
(tdesc_predefined_types): Likewise.
(tdesc_gdb_type): Likewise. Pass NULL to append_flags_type_flag
if flag name is empty.
(maint_print_c_tdesc_cmd): Handle TDESC_TYPE_FLAGS.
* features/i386/32bit-core.xml: Define i386_eflags.
* features/i386/64bit-core.xml: Likewise.
* features/i386/32bit-sse.xml: Define i386_mxcsr.
* features/i386/64bit-sse.xml: Likewise.
* features/i386/amd64-linux.c: Regenerated.
* features/i386/amd64.c: Likewise.
* features/i386/i386-linux.c: Likewise.
* features/i386/i386.c: Likewise.
--- gdb-7.1-p1/gdb/features/i386/32bit-core.xml 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/32bit-core.xml 2010-04-03 21:06:12.000000000 +0200
@@ -7,6 +7,26 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.i386.core">
+ <flags id="i386_eflags" size="4">
+ <field name="CF" start="0" end="0"/>
+ <field name="" start="1" end="1"/>
+ <field name="PF" start="2" end="2"/>
+ <field name="AF" start="4" end="4"/>
+ <field name="ZF" start="6" end="6"/>
+ <field name="SF" start="7" end="7"/>
+ <field name="TF" start="8" end="8"/>
+ <field name="IF" start="9" end="9"/>
+ <field name="DF" start="10" end="10"/>
+ <field name="OF" start="11" end="11"/>
+ <field name="NT" start="14" end="14"/>
+ <field name="RF" start="16" end="16"/>
+ <field name="VM" start="17" end="17"/>
+ <field name="AC" start="18" end="18"/>
+ <field name="VIF" start="19" end="19"/>
+ <field name="VIP" start="20" end="20"/>
+ <field name="ID" start="21" end="21"/>
+ </flags>
+
<reg name="eax" bitsize="32" type="int32"/>
<reg name="ecx" bitsize="32" type="int32"/>
<reg name="edx" bitsize="32" type="int32"/>
--- gdb-7.1-p1/gdb/features/i386/32bit-sse.xml 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/32bit-sse.xml 2010-04-03 21:06:12.000000000 +0200
@@ -22,6 +22,22 @@
<field name="v2_int64" type="v2i64"/>
<field name="uint128" type="uint128"/>
</union>
+ <flags id="i386_mxcsr" size="4">
+ <field name="IE" start="0" end="0"/>
+ <field name="DE" start="1" end="1"/>
+ <field name="ZE" start="2" end="2"/>
+ <field name="OE" start="3" end="3"/>
+ <field name="UE" start="4" end="4"/>
+ <field name="PE" start="5" end="5"/>
+ <field name="DAZ" start="6" end="6"/>
+ <field name="IM" start="7" end="7"/>
+ <field name="DM" start="8" end="8"/>
+ <field name="ZM" start="9" end="9"/>
+ <field name="OM" start="10" end="10"/>
+ <field name="UM" start="11" end="11"/>
+ <field name="PM" start="12" end="12"/>
+ <field name="FZ" start="15" end="15"/>
+ </flags>
<reg name="xmm0" bitsize="128" type="vec128" regnum="32"/>
<reg name="xmm1" bitsize="128" type="vec128"/>
--- gdb-7.1-p1/gdb/features/i386/64bit-core.xml 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/64bit-core.xml 2010-04-03 21:06:12.000000000 +0200
@@ -7,6 +7,26 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.i386.core">
+ <flags id="i386_eflags" size="4">
+ <field name="CF" start="0" end="0"/>
+ <field name="" start="1" end="1"/>
+ <field name="PF" start="2" end="2"/>
+ <field name="AF" start="4" end="4"/>
+ <field name="ZF" start="6" end="6"/>
+ <field name="SF" start="7" end="7"/>
+ <field name="TF" start="8" end="8"/>
+ <field name="IF" start="9" end="9"/>
+ <field name="DF" start="10" end="10"/>
+ <field name="OF" start="11" end="11"/>
+ <field name="NT" start="14" end="14"/>
+ <field name="RF" start="16" end="16"/>
+ <field name="VM" start="17" end="17"/>
+ <field name="AC" start="18" end="18"/>
+ <field name="VIF" start="19" end="19"/>
+ <field name="VIP" start="20" end="20"/>
+ <field name="ID" start="21" end="21"/>
+ </flags>
+
<reg name="rax" bitsize="64" type="int64"/>
<reg name="rbx" bitsize="64" type="int64"/>
<reg name="rcx" bitsize="64" type="int64"/>
--- gdb-7.1-p1/gdb/features/i386/64bit-sse.xml 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/64bit-sse.xml 2010-04-03 21:06:12.000000000 +0200
@@ -22,6 +22,22 @@
<field name="v2_int64" type="v2i64"/>
<field name="uint128" type="uint128"/>
</union>
+ <flags id="i386_mxcsr" size="4">
+ <field name="IE" start="0" end="0"/>
+ <field name="DE" start="1" end="1"/>
+ <field name="ZE" start="2" end="2"/>
+ <field name="OE" start="3" end="3"/>
+ <field name="UE" start="4" end="4"/>
+ <field name="PE" start="5" end="5"/>
+ <field name="DAZ" start="6" end="6"/>
+ <field name="IM" start="7" end="7"/>
+ <field name="DM" start="8" end="8"/>
+ <field name="ZM" start="9" end="9"/>
+ <field name="OM" start="10" end="10"/>
+ <field name="UM" start="11" end="11"/>
+ <field name="PM" start="12" end="12"/>
+ <field name="FZ" start="15" end="15"/>
+ </flags>
<reg name="xmm0" bitsize="128" type="vec128" regnum="40"/>
<reg name="xmm1" bitsize="128" type="vec128"/>
--- gdb-7.1-p1/gdb/features/i386/amd64-linux.c 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/amd64-linux.c 2010-04-03 21:06:12.000000000 +0200
@@ -17,6 +17,25 @@ initialize_tdesc_amd64_linux (void)
set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+ tdesc_add_flag (field_type, 0, "CF");
+ tdesc_add_flag (field_type, 1, "");
+ tdesc_add_flag (field_type, 2, "PF");
+ tdesc_add_flag (field_type, 4, "AF");
+ tdesc_add_flag (field_type, 6, "ZF");
+ tdesc_add_flag (field_type, 7, "SF");
+ tdesc_add_flag (field_type, 8, "TF");
+ tdesc_add_flag (field_type, 9, "IF");
+ tdesc_add_flag (field_type, 10, "DF");
+ tdesc_add_flag (field_type, 11, "OF");
+ tdesc_add_flag (field_type, 14, "NT");
+ tdesc_add_flag (field_type, 16, "RF");
+ tdesc_add_flag (field_type, 17, "VM");
+ tdesc_add_flag (field_type, 18, "AC");
+ tdesc_add_flag (field_type, 19, "VIF");
+ tdesc_add_flag (field_type, 20, "VIP");
+ tdesc_add_flag (field_type, 21, "ID");
+
tdesc_create_reg (feature, "rax", 0, 1, NULL, 64, "int64");
tdesc_create_reg (feature, "rbx", 1, 1, NULL, 64, "int64");
tdesc_create_reg (feature, "rcx", 2, 1, NULL, 64, "int64");
@@ -93,6 +112,22 @@ initialize_tdesc_amd64_linux (void)
field_type = tdesc_named_type (feature, "uint128");
tdesc_add_field (type, "uint128", field_type);
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+ tdesc_add_flag (field_type, 0, "IE");
+ tdesc_add_flag (field_type, 1, "DE");
+ tdesc_add_flag (field_type, 2, "ZE");
+ tdesc_add_flag (field_type, 3, "OE");
+ tdesc_add_flag (field_type, 4, "UE");
+ tdesc_add_flag (field_type, 5, "PE");
+ tdesc_add_flag (field_type, 6, "DAZ");
+ tdesc_add_flag (field_type, 7, "IM");
+ tdesc_add_flag (field_type, 8, "DM");
+ tdesc_add_flag (field_type, 9, "ZM");
+ tdesc_add_flag (field_type, 10, "OM");
+ tdesc_add_flag (field_type, 11, "UM");
+ tdesc_add_flag (field_type, 12, "PM");
+ tdesc_add_flag (field_type, 15, "FZ");
+
tdesc_create_reg (feature, "xmm0", 40, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm1", 41, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm2", 42, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/features/i386/amd64.c 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/amd64.c 2010-04-03 21:06:12.000000000 +0200
@@ -15,6 +15,25 @@ initialize_tdesc_amd64 (void)
set_tdesc_architecture (result, bfd_scan_arch ("i386:x86-64"));
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+ tdesc_add_flag (field_type, 0, "CF");
+ tdesc_add_flag (field_type, 1, "");
+ tdesc_add_flag (field_type, 2, "PF");
+ tdesc_add_flag (field_type, 4, "AF");
+ tdesc_add_flag (field_type, 6, "ZF");
+ tdesc_add_flag (field_type, 7, "SF");
+ tdesc_add_flag (field_type, 8, "TF");
+ tdesc_add_flag (field_type, 9, "IF");
+ tdesc_add_flag (field_type, 10, "DF");
+ tdesc_add_flag (field_type, 11, "OF");
+ tdesc_add_flag (field_type, 14, "NT");
+ tdesc_add_flag (field_type, 16, "RF");
+ tdesc_add_flag (field_type, 17, "VM");
+ tdesc_add_flag (field_type, 18, "AC");
+ tdesc_add_flag (field_type, 19, "VIF");
+ tdesc_add_flag (field_type, 20, "VIP");
+ tdesc_add_flag (field_type, 21, "ID");
+
tdesc_create_reg (feature, "rax", 0, 1, NULL, 64, "int64");
tdesc_create_reg (feature, "rbx", 1, 1, NULL, 64, "int64");
tdesc_create_reg (feature, "rcx", 2, 1, NULL, 64, "int64");
@@ -91,6 +110,22 @@ initialize_tdesc_amd64 (void)
field_type = tdesc_named_type (feature, "uint128");
tdesc_add_field (type, "uint128", field_type);
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+ tdesc_add_flag (field_type, 0, "IE");
+ tdesc_add_flag (field_type, 1, "DE");
+ tdesc_add_flag (field_type, 2, "ZE");
+ tdesc_add_flag (field_type, 3, "OE");
+ tdesc_add_flag (field_type, 4, "UE");
+ tdesc_add_flag (field_type, 5, "PE");
+ tdesc_add_flag (field_type, 6, "DAZ");
+ tdesc_add_flag (field_type, 7, "IM");
+ tdesc_add_flag (field_type, 8, "DM");
+ tdesc_add_flag (field_type, 9, "ZM");
+ tdesc_add_flag (field_type, 10, "OM");
+ tdesc_add_flag (field_type, 11, "UM");
+ tdesc_add_flag (field_type, 12, "PM");
+ tdesc_add_flag (field_type, 15, "FZ");
+
tdesc_create_reg (feature, "xmm0", 40, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm1", 41, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm2", 42, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/features/i386/i386-linux.c 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/i386-linux.c 2010-04-03 21:06:12.000000000 +0200
@@ -17,6 +17,25 @@ initialize_tdesc_i386_linux (void)
set_tdesc_osabi (result, osabi_from_tdesc_string ("GNU/Linux"));
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+ tdesc_add_flag (field_type, 0, "CF");
+ tdesc_add_flag (field_type, 1, "");
+ tdesc_add_flag (field_type, 2, "PF");
+ tdesc_add_flag (field_type, 4, "AF");
+ tdesc_add_flag (field_type, 6, "ZF");
+ tdesc_add_flag (field_type, 7, "SF");
+ tdesc_add_flag (field_type, 8, "TF");
+ tdesc_add_flag (field_type, 9, "IF");
+ tdesc_add_flag (field_type, 10, "DF");
+ tdesc_add_flag (field_type, 11, "OF");
+ tdesc_add_flag (field_type, 14, "NT");
+ tdesc_add_flag (field_type, 16, "RF");
+ tdesc_add_flag (field_type, 17, "VM");
+ tdesc_add_flag (field_type, 18, "AC");
+ tdesc_add_flag (field_type, 19, "VIF");
+ tdesc_add_flag (field_type, 20, "VIP");
+ tdesc_add_flag (field_type, 21, "ID");
+
tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
@@ -88,6 +107,22 @@ initialize_tdesc_i386_linux (void)
field_type = tdesc_named_type (feature, "uint128");
tdesc_add_field (type, "uint128", field_type);
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+ tdesc_add_flag (field_type, 0, "IE");
+ tdesc_add_flag (field_type, 1, "DE");
+ tdesc_add_flag (field_type, 2, "ZE");
+ tdesc_add_flag (field_type, 3, "OE");
+ tdesc_add_flag (field_type, 4, "UE");
+ tdesc_add_flag (field_type, 5, "PE");
+ tdesc_add_flag (field_type, 6, "DAZ");
+ tdesc_add_flag (field_type, 7, "IM");
+ tdesc_add_flag (field_type, 8, "DM");
+ tdesc_add_flag (field_type, 9, "ZM");
+ tdesc_add_flag (field_type, 10, "OM");
+ tdesc_add_flag (field_type, 11, "UM");
+ tdesc_add_flag (field_type, 12, "PM");
+ tdesc_add_flag (field_type, 15, "FZ");
+
tdesc_create_reg (feature, "xmm0", 32, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm1", 33, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm2", 34, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/features/i386/i386.c 2010-02-08 06:08:46.000000000 +0100
+++ gdb-7.1/gdb/features/i386/i386.c 2010-04-03 21:06:12.000000000 +0200
@@ -15,6 +15,25 @@ initialize_tdesc_i386 (void)
set_tdesc_architecture (result, bfd_scan_arch ("i386"));
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.core");
+ field_type = tdesc_create_flags (feature, "i386_eflags", 4);
+ tdesc_add_flag (field_type, 0, "CF");
+ tdesc_add_flag (field_type, 1, "");
+ tdesc_add_flag (field_type, 2, "PF");
+ tdesc_add_flag (field_type, 4, "AF");
+ tdesc_add_flag (field_type, 6, "ZF");
+ tdesc_add_flag (field_type, 7, "SF");
+ tdesc_add_flag (field_type, 8, "TF");
+ tdesc_add_flag (field_type, 9, "IF");
+ tdesc_add_flag (field_type, 10, "DF");
+ tdesc_add_flag (field_type, 11, "OF");
+ tdesc_add_flag (field_type, 14, "NT");
+ tdesc_add_flag (field_type, 16, "RF");
+ tdesc_add_flag (field_type, 17, "VM");
+ tdesc_add_flag (field_type, 18, "AC");
+ tdesc_add_flag (field_type, 19, "VIF");
+ tdesc_add_flag (field_type, 20, "VIP");
+ tdesc_add_flag (field_type, 21, "ID");
+
tdesc_create_reg (feature, "eax", 0, 1, NULL, 32, "int32");
tdesc_create_reg (feature, "ecx", 1, 1, NULL, 32, "int32");
tdesc_create_reg (feature, "edx", 2, 1, NULL, 32, "int32");
@@ -83,6 +102,22 @@ initialize_tdesc_i386 (void)
field_type = tdesc_named_type (feature, "uint128");
tdesc_add_field (type, "uint128", field_type);
+ field_type = tdesc_create_flags (feature, "i386_mxcsr", 4);
+ tdesc_add_flag (field_type, 0, "IE");
+ tdesc_add_flag (field_type, 1, "DE");
+ tdesc_add_flag (field_type, 2, "ZE");
+ tdesc_add_flag (field_type, 3, "OE");
+ tdesc_add_flag (field_type, 4, "UE");
+ tdesc_add_flag (field_type, 5, "PE");
+ tdesc_add_flag (field_type, 6, "DAZ");
+ tdesc_add_flag (field_type, 7, "IM");
+ tdesc_add_flag (field_type, 8, "DM");
+ tdesc_add_flag (field_type, 9, "ZM");
+ tdesc_add_flag (field_type, 10, "OM");
+ tdesc_add_flag (field_type, 11, "UM");
+ tdesc_add_flag (field_type, 12, "PM");
+ tdesc_add_flag (field_type, 15, "FZ");
+
tdesc_create_reg (feature, "xmm0", 32, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm1", 33, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "xmm2", 34, 1, NULL, 128, "vec128");
--- gdb-7.1-p1/gdb/target-descriptions.c 2010-04-03 21:04:13.000000000 +0200
+++ gdb-7.1/gdb/target-descriptions.c 2010-04-03 21:06:12.000000000 +0200
@@ -126,8 +126,6 @@ typedef struct tdesc_type
TDESC_TYPE_IEEE_DOUBLE,
TDESC_TYPE_ARM_FPA_EXT,
TDESC_TYPE_I387_EXT,
- TDESC_TYPE_I386_EFLAGS,
- TDESC_TYPE_I386_MXCSR,
/* Types defined by a target feature. */
TDESC_TYPE_VECTOR,
@@ -483,9 +481,7 @@ static struct tdesc_type tdesc_predefine
{ "ieee_single", TDESC_TYPE_IEEE_SINGLE },
{ "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
{ "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
- { "i387_ext", TDESC_TYPE_I387_EXT },
- { "i386_eflags", TDESC_TYPE_I386_EFLAGS },
- { "i386_mxcsr", TDESC_TYPE_I386_MXCSR }
+ { "i387_ext", TDESC_TYPE_I387_EXT }
};
/* Return the type associated with ID in the context of FEATURE, or
@@ -607,57 +603,6 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
return arch_float_type (gdbarch, -1, "builtin_type_i387_ext",
floatformats_i387_ext);
- case TDESC_TYPE_I386_EFLAGS:
- {
- struct type *type;
-
- type = arch_flags_type (gdbarch, "builtin_type_i386_eflags", 4);
- append_flags_type_flag (type, 0, "CF");
- append_flags_type_flag (type, 1, NULL);
- append_flags_type_flag (type, 2, "PF");
- append_flags_type_flag (type, 4, "AF");
- append_flags_type_flag (type, 6, "ZF");
- append_flags_type_flag (type, 7, "SF");
- append_flags_type_flag (type, 8, "TF");
- append_flags_type_flag (type, 9, "IF");
- append_flags_type_flag (type, 10, "DF");
- append_flags_type_flag (type, 11, "OF");
- append_flags_type_flag (type, 14, "NT");
- append_flags_type_flag (type, 16, "RF");
- append_flags_type_flag (type, 17, "VM");
- append_flags_type_flag (type, 18, "AC");
- append_flags_type_flag (type, 19, "VIF");
- append_flags_type_flag (type, 20, "VIP");
- append_flags_type_flag (type, 21, "ID");
-
- return type;
- }
- break;
-
- case TDESC_TYPE_I386_MXCSR:
- {
- struct type *type;
-
- type = arch_flags_type (gdbarch, "builtin_type_i386_mxcsr", 4);
- append_flags_type_flag (type, 0, "IE");
- append_flags_type_flag (type, 1, "DE");
- append_flags_type_flag (type, 2, "ZE");
- append_flags_type_flag (type, 3, "OE");
- append_flags_type_flag (type, 4, "UE");
- append_flags_type_flag (type, 5, "PE");
- append_flags_type_flag (type, 6, "DAZ");
- append_flags_type_flag (type, 7, "IM");
- append_flags_type_flag (type, 8, "DM");
- append_flags_type_flag (type, 9, "ZM");
- append_flags_type_flag (type, 10, "OM");
- append_flags_type_flag (type, 11, "UM");
- append_flags_type_flag (type, 12, "PM");
- append_flags_type_flag (type, 15, "FZ");
-
- return type;
- }
- break;
-
/* Types defined by a target feature. */
case TDESC_TYPE_VECTOR:
{
@@ -769,7 +714,8 @@ tdesc_gdb_type (struct gdbarch *gdbarch,
/* Note that contrary to the function name, this call will
just set the properties of an already-allocated
field. */
- append_flags_type_flag (type, f->start, f->name);
+ append_flags_type_flag (type, f->start,
+ *f->name ? f->name : NULL);
return type;
}
@@ -1602,6 +1548,7 @@ maint_print_c_tdesc_cmd (char *args, int
struct tdesc_reg *reg;
struct tdesc_type *type;
struct tdesc_type_field *f;
+ struct tdesc_type_flag *flag;
int ix, ix2, ix3;
/* Use the global target-supplied description, not the current
@@ -1715,6 +1662,18 @@ maint_print_c_tdesc_cmd (char *args, int
f->name);
}
break;
+ case TDESC_TYPE_FLAGS:
+ printf_unfiltered
+ (" field_type = tdesc_create_flags (feature, \"%s\", %d);\n",
+ type->name, (int) type->u.f.size);
+ for (ix3 = 0;
+ VEC_iterate (tdesc_type_flag, type->u.f.flags, ix3,
+ flag);
+ ix3++)
+ printf_unfiltered
+ (" tdesc_add_flag (field_type, %d, \"%s\");\n",
+ flag->start, flag->name);
+ break;
default:
error (_("C output is not supported type \"%s\"."), type->name);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
[ Backported. ]
commit 6448aace637843e8e7c021d7f8c5d5d5fdd71974
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Mar 3 20:19:48 2010 +0000
Mention improvement for X86 general purpose registers.
2010-03-03 H.J. Lu <hongjiu.lu@intel.com>
Eli Zaretskii <eliz@gnu.org>
* NEWS: Add X86 general purpose registers section.
--- gdb-7.1-p3/gdb/NEWS 2010-03-18 22:01:55.000000000 +0100
+++ gdb-7.1/gdb/NEWS 2010-04-03 21:07:46.000000000 +0200
@@ -438,6 +438,14 @@ GDB will now correctly handle all of:
now support hardware watchpoints, and will use them automatically
as appropriate.
+* X86 general purpose registers
+
+ GDB now supports reading/writing byte, word and double-word x86
+ general purpose registers directly. This means you can use, say,
+ $ah or $ax to refer, respectively, to the byte register AH and
+ 16-bit word register AX that are actually portions of the 32-bit
+ register EAX or 64-bit register RAX.
+
* Python scripting
GDB now has support for scripting using Python. Whether this is

View File

@ -0,0 +1,35 @@
[ Backported. ]
commit 49f8d1c24c639d891f58a3b9feda425833b702fb
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Mar 12 15:12:34 2010 +0000
Restore sp for x86.
2010-03-12 H.J. Lu <hongjiu.lu@intel.com>
* amd64-tdep.c (amd64_word_names): Replace "sp" with "".
* i386-tdep.c (i386_word_names): Likewise.
--- gdb-7.1-p4/gdb/amd64-tdep.c 2010-04-03 21:06:52.000000000 +0200
+++ gdb-7.1/gdb/amd64-tdep.c 2010-04-03 21:08:21.000000000 +0200
@@ -222,7 +222,7 @@ static const char *amd64_byte_names[] =
static const char *amd64_word_names[] =
{
- "ax", "bx", "cx", "dx", "si", "di", "bp", "sp",
+ "ax", "bx", "cx", "dx", "si", "di", "bp", "",
"r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
};
--- gdb-7.1-p4/gdb/i386-tdep.c 2010-04-03 21:06:52.000000000 +0200
+++ gdb-7.1/gdb/i386-tdep.c 2010-04-03 21:08:21.000000000 +0200
@@ -94,7 +94,7 @@ static const char *i386_byte_names[] =
static const char *i386_word_names[] =
{
"ax", "cx", "dx", "bx",
- "sp", "bp", "si", "di"
+ "", "bp", "si", "di"
};
/* MMX register? */

View File

@ -0,0 +1,183 @@
[ Backported. ]
commit d5ea7042210f5ad319ad19910bce13fd5717c6d6
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Mar 30 15:45:08 2010 +0000
Add xmlRegisters= to qSupported packet.
gdb/
2010-03-30 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention xmlRegisters= in qSupported packet.
* i386-tdep.c: Include "remote.h".
(_initialize_i386_tdep): Call register_remote_support_xml.
* remote.c (remote_support_xml): New.
(register_remote_support_xml): Likewise.
(remote_query_supported_append): Likewise.
(remote_query_supported): Support remote_support_xml.
* remote.h (register_remote_support_xml): New.
gdb/doc/
2010-03-30 H.J. Lu <hongjiu.lu@intel.com>
* gdb.texinfo (General Query Packets): Add xmlRegisters.
--- gdb-7.1-p5/gdb/NEWS 2010-04-03 21:07:46.000000000 +0200
+++ gdb-7.1/gdb/NEWS 2010-04-03 21:10:06.000000000 +0200
@@ -1,6 +1,11 @@
What has changed in GDB?
(Organized release by release)
+*** Changes since GDB 7.1
+
+* GDB now sends xmlRegisters= in qSupported packet to indicate that
+ it understands register description.
+
*** Changes in GDB 7.1
* C++ Improvements
--- gdb-7.1-p5/gdb/doc/gdb.texinfo 2010-04-03 21:04:13.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-03 21:09:29.000000000 +0200
@@ -30292,6 +30292,12 @@ extensions to the remote protocol. @val
extensions unless the stub also reports that it supports them by
including @samp{multiprocess+} in its @samp{qSupported} reply.
@xref{multiprocess extensions}, for details.
+
+@item xmlRegisters
+This feature indicates that @value{GDBN} supports the XML target
+description. If the stub sees @samp{xmlRegisters=} with target
+specific strings separated by a comma, it will report register
+description.
@end table
Stubs should ignore any unknown values for
--- gdb-7.1-p5/gdb/i386-tdep.c 2010-04-03 21:08:21.000000000 +0200
+++ gdb-7.1/gdb/i386-tdep.c 2010-04-03 21:09:29.000000000 +0200
@@ -44,6 +44,7 @@
#include "value.h"
#include "dis-asm.h"
#include "disasm.h"
+#include "remote.h"
#include "gdb_assert.h"
#include "gdb_string.h"
@@ -6000,4 +6001,7 @@ is \"default\"."),
/* Initialize the standard target descriptions. */
initialize_tdesc_i386 ();
+
+ /* Tell remote stub that we support XML target description. */
+ register_remote_support_xml ("i386");
}
--- gdb-7.1-p5/gdb/remote.c 2010-04-03 20:24:51.000000000 +0200
+++ gdb-7.1/gdb/remote.c 2010-04-03 21:09:29.000000000 +0200
@@ -3467,6 +3467,53 @@ static struct protocol_feature remote_pr
PACKET_bs },
};
+static char *remote_support_xml;
+
+/* Register string appended to "xmlRegisters=" in qSupported query. */
+
+void
+register_remote_support_xml (const char *xml ATTRIBUTE_UNUSED)
+{
+#if defined(HAVE_LIBEXPAT)
+ if (remote_support_xml == NULL)
+ remote_support_xml = concat ("xmlRegisters=", xml, NULL);
+ else
+ {
+ char *copy = xstrdup (remote_support_xml + 13);
+ char *p = strtok (copy, ",");
+
+ do
+ {
+ if (strcmp (p, xml) == 0)
+ {
+ /* already there */
+ xfree (copy);
+ return;
+ }
+ }
+ while ((p = strtok (NULL, ",")) != NULL);
+ xfree (copy);
+
+ p = concat (remote_support_xml, ",", xml, NULL);
+ xfree (remote_support_xml);
+ remote_support_xml = p;
+ }
+#endif
+}
+
+static char *
+remote_query_supported_append (char *msg, const char *append)
+{
+ if (msg)
+ {
+ char *p = concat (msg, ";", append, NULL);
+ xfree (msg);
+ return p;
+ }
+ else
+ return xstrdup (append);
+}
+
static void
remote_query_supported (void)
{
@@ -3485,24 +3532,27 @@ remote_query_supported (void)
rs->buf[0] = 0;
if (remote_protocol_packets[PACKET_qSupported].support != PACKET_DISABLE)
{
+ char *q = NULL;
const char *qsupported = gdbarch_qsupported (target_gdbarch);
+
+ if (rs->extended)
+ q = remote_query_supported_append (q, "multiprocess+");
+
if (qsupported)
+ q = remote_query_supported_append (q, qsupported);
+
+ if (remote_support_xml)
+ q = remote_query_supported_append (q, remote_support_xml);
+
+ if (q)
{
- char *q;
- if (rs->extended)
- q = concat ("qSupported:multiprocess+;", qsupported, NULL);
- else
- q = concat ("qSupported:", qsupported, NULL);
- putpkt (q);
+ char *p = concat ("qSupported:", q, NULL);
xfree (q);
+ putpkt (p);
+ xfree (p);
}
else
- {
- if (rs->extended)
- putpkt ("qSupported:multiprocess+");
- else
- putpkt ("qSupported");
- }
+ putpkt ("qSupported");
getpkt (&rs->buf, &rs->buf_size, 0);
--- gdb-7.1-p5/gdb/remote.h 2010-01-01 08:31:41.000000000 +0100
+++ gdb-7.1/gdb/remote.h 2010-04-03 21:09:29.000000000 +0200
@@ -66,6 +66,7 @@ extern void (*deprecated_target_wait_loo
void register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
const struct target_desc *tdesc);
+void register_remote_support_xml (const char *);
void remote_file_put (const char *local_file, const char *remote_file,
int from_tty);

View File

@ -0,0 +1,32 @@
[ Backported. ]
commit 684341392f3ca6703dc28dac548d3051811bff47
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Mar 30 18:37:03 2010 +0000
Add org.gnu.gdb.i386.avx.
2010-03-30 H.J. Lu <hongjiu.lu@intel.com>
* gdb.texinfo (i386 Features): Add org.gnu.gdb.i386.avx.
--- gdb-7.1-p6/gdb/doc/gdb.texinfo 2010-04-03 21:09:29.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-03 21:10:57.000000000 +0200
@@ -33380,6 +33380,17 @@ describe registers:
@samp{mxcsr}
@end itemize
+The @samp{org.gnu.gdb.i386.avx} feature is optional. It should
+describe the upper 128 bits of @sc{ymm} registers:
+
+@itemize @minus
+@item
+@samp{ymm0h} through @samp{ymm7h} for i386
+@item
+@samp{ymm0h} through @samp{ymm15h} for amd64
+@item
+@end itemize
+
The @samp{org.gnu.gdb.i386.linux} feature is optional. It should
describe a single register, @samp{orig_eax}.

View File

@ -0,0 +1,183 @@
[ Backported. ]
commit 5362e5e1dc4cfac24fbd58773aaa7a82c615b662
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Apr 1 20:02:07 2010 +0000
Support "ah", "bh", "ch", "dh" on amd64.
gdb/
2010-04-01 H.J. Lu <hongjiu.lu@intel.com>
* amd64-tdep.c (amd64_byte_names): Add "ah", "bh", "ch", "dh".
(AMD64_NUM_LOWER_BYTE_REGS): New.
(amd64_pseudo_register_read): Handle "ah", "bh", "ch", "dh".
(amd64_pseudo_register_write): Likewise.
(amd64_init_abi): Set num_byte_regs to 20.
gdb/testsuite/
2010-04-01 H.J. Lu <hongjiu.lu@intel.com>
* gdb.arch/amd64-byte.exp: Check "ah", "bh", "ch", "dh".
--- gdb-7.1-p7/gdb/amd64-tdep.c 2010-04-03 21:08:21.000000000 +0200
+++ gdb-7.1/gdb/amd64-tdep.c 2010-04-03 21:11:41.000000000 +0200
@@ -215,9 +215,13 @@ amd64_arch_reg_to_regnum (int reg)
static const char *amd64_byte_names[] =
{
"al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
- "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
+ "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l",
+ "ah", "bh", "ch", "dh"
};
+/* Number of lower byte registers. */
+#define AMD64_NUM_LOWER_BYTE_REGS 16
+
/* Register names for word pseudo-registers. */
static const char *amd64_word_names[] =
@@ -263,8 +267,18 @@ amd64_pseudo_register_read (struct gdbar
int gpnum = regnum - tdep->al_regnum;
/* Extract (always little endian). */
- regcache_raw_read (regcache, gpnum, raw_buf);
- memcpy (buf, raw_buf, 1);
+ if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
+ {
+ /* Special handling for AH, BH, CH, DH. */
+ regcache_raw_read (regcache,
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+ memcpy (buf, raw_buf + 1, 1);
+ }
+ else
+ {
+ regcache_raw_read (regcache, gpnum, raw_buf);
+ memcpy (buf, raw_buf, 1);
+ }
}
else if (i386_dword_regnum_p (gdbarch, regnum))
{
@@ -289,12 +303,26 @@ amd64_pseudo_register_write (struct gdba
{
int gpnum = regnum - tdep->al_regnum;
- /* Read ... */
- regcache_raw_read (regcache, gpnum, raw_buf);
- /* ... Modify ... (always little endian). */
- memcpy (raw_buf, buf, 1);
- /* ... Write. */
- regcache_raw_write (regcache, gpnum, raw_buf);
+ if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
+ {
+ /* Read ... AH, BH, CH, DH. */
+ regcache_raw_read (regcache,
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+ /* ... Modify ... (always little endian). */
+ memcpy (raw_buf + 1, buf, 1);
+ /* ... Write. */
+ regcache_raw_write (regcache,
+ gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+ }
+ else
+ {
+ /* Read ... */
+ regcache_raw_read (regcache, gpnum, raw_buf);
+ /* ... Modify ... (always little endian). */
+ memcpy (raw_buf, buf, 1);
+ /* ... Write. */
+ regcache_raw_write (regcache, gpnum, raw_buf);
+ }
}
else if (i386_dword_regnum_p (gdbarch, regnum))
{
@@ -2233,7 +2261,7 @@ amd64_init_abi (struct gdbarch_info info
tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS;
tdep->register_names = amd64_register_names;
- tdep->num_byte_regs = 16;
+ tdep->num_byte_regs = 20;
tdep->num_word_regs = 16;
tdep->num_dword_regs = 16;
/* Avoid wiring in the MMX registers for now. */
--- gdb-7.1-p7/gdb/testsuite/gdb.arch/amd64-byte.exp 2010-04-03 21:06:52.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-byte.exp 2010-04-03 21:11:41.000000000 +0200
@@ -52,7 +52,6 @@ if ![runto_main] then {
gdb_suppress_tests
}
-set nr_regs 14
set byte_regs(1) al
set byte_regs(2) bl
set byte_regs(3) cl
@@ -67,6 +66,10 @@ set byte_regs(11) r12l
set byte_regs(12) r13l
set byte_regs(13) r14l
set byte_regs(14) r15l
+set byte_regs(15) ah
+set byte_regs(16) bh
+set byte_regs(17) ch
+set byte_regs(18) dh
gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
"Breakpoint .* at .*${srcfile}.*" \
@@ -79,12 +82,19 @@ for { set r 1 } { $r <= 6 } { incr r }
"check contents of %$byte_regs($r)"
}
+for { set r 1 } { $r <= 4 } { incr r } {
+ set h [expr $r + 14]
+ gdb_test "print/x \$$byte_regs($h)" \
+ ".. = 0x[format %x $r]2" \
+ "check contents of %$byte_regs($h)"
+}
+
gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
"Breakpoint .* at .*${srcfile}.*" \
"set second breakpoint in main"
gdb_continue_to_breakpoint "continue to second breakpoint in main"
-for { set r 7 } { $r <= $nr_regs } { incr r } {
+for { set r 7 } { $r <= 14 } { incr r } {
gdb_test "print/x \$$byte_regs($r)" \
".. = 0x[format %x $r]1" \
"check contents of %$byte_regs($r)"
@@ -94,6 +104,11 @@ for { set r 1 } { $r <= 6 } { incr r }
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
}
+for { set r 1 } { $r <= 4 } { incr r } {
+ set h [expr $r + 14]
+ gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
+}
+
gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
"Breakpoint .* at .*${srcfile}.*" \
"set third breakpoint in main"
@@ -105,7 +120,14 @@ for { set r 1 } { $r <= 6 } { incr r }
"check contents of %$byte_regs($r)"
}
-for { set r 7 } { $r <= $nr_regs } { incr r } {
+for { set r 1 } { $r <= 4 } { incr r } {
+ set h [expr $r + 14]
+ gdb_test "print \$$byte_regs($h)" \
+ ".. = $h" \
+ "check contents of %$byte_regs($h)"
+}
+
+for { set r 7 } { $r <= 14 } { incr r } {
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
}
@@ -114,7 +136,7 @@ gdb_test "break [gdb_get_line_number "fo
"set forth breakpoint in main"
gdb_continue_to_breakpoint "continue to forth breakpoint in main"
-for { set r 7 } { $r <= $nr_regs } { incr r } {
+for { set r 7 } { $r <= 14 } { incr r } {
gdb_test "print \$$byte_regs($r)" \
".. = $r" \
"check contents of %$byte_regs($r)"

View File

@ -0,0 +1,16 @@
http://sourceware.org/ml/gdb-patches/2010-04/msg00056.html
linux-ppc-low.c:599: error: incompatible types when initializing type enum regset_type using type void (*)(struct regcache *, void *)
linux-ppc-low.c:599: warning: initialization from incompatible pointer type
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -594,7 +594,7 @@ struct regset_info target_regsets[] = {
PPC_PTRACE_GETREGS. */
{ PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, 0, SIZEOF_VSXREGS, EXTENDED_REGS,
ppc_fill_vsxregset, ppc_store_vsxregset },
- { PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, EXTENDED_REGS,
+ { PTRACE_GETVRREGS, PTRACE_SETVRREGS, 0, SIZEOF_VRREGS, EXTENDED_REGS,
ppc_fill_vrregset, ppc_store_vrregset },
{ PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 0, 32 * 4 + 8 + 4, EXTENDED_REGS,
ppc_fill_evrregset, ppc_store_evrregset },

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -33,6 +33,14 @@ if [test_compiler_info gcc*] {
lappend options additional_flags=-g3
}
+# 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"
+ }
+}
+
# Generate the intermediate object file. This is required by Darwin to
# have access to the .debug_macinfo section.
if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \

View File

@ -1,204 +0,0 @@
gdb/
2009-12-20 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix compatibility with G++-4.1.
* dwarf2read.c (partial_die_parent_scope): New variable PARENT_NAME.
Ignore parent namespaces with name "::".
(physname_prefix_1): Ignore namespaces with name "::".
gdb/testsuite/
2009-12-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-empty-namespace.exp, gdb.dwarf2/dw2-empty-namespace.S:
New.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2355,11 +2355,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
|| parent->tag == DW_TAG_interface_type
|| parent->tag == DW_TAG_union_type)
{
+ char *parent_name = parent->name;
+
+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
+ if (parent->tag == DW_TAG_namespace && parent_name != NULL
+ && strcmp (parent_name, "::") == 0)
+ parent_name = NULL;
+
if (grandparent_scope == NULL)
- parent->scope = parent->name;
+ parent->scope = parent_name;
else
parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope,
- parent->name, cu);
+ parent_name, cu);
}
else if (parent->tag == DW_TAG_enumeration_type)
/* Enumerators should not get the name of the enumeration as a prefix. */
@@ -9008,6 +9015,9 @@ physname_prefix_1 (struct ui_file *buf, struct die_info *die,
name = dwarf2_name (die, cu);
if (name == NULL)
name = "(anonymous namespace)";
+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
+ else if (strcmp (name, "::") == 0)
+ name = NULL;
break;
case DW_TAG_class_type:
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
@@ -0,0 +1,108 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2009 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::". */
+
+ .data
+var: .4byte 1
+
+ .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 4 /* DW_LANG_C_plus_plus (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 3 /* Abbrev: DW_TAG_namespace */
+ .ascii "::\0" /* DW_AT_name */
+
+ .uleb128 7 /* Abbrev: DW_TAG_variable (location) */
+ .ascii "var\0" /* DW_AT_name */
+ .byte 2f - 1f /* DW_AT_location */
+1: .byte 3 /* DW_OP_addr */
+ .4byte var /* <addr> */
+2: .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+
+ .byte 0 /* End of children of DW_TAG_namespace */
+
+ .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 */
+ .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 3 /* Abbrev code */
+ .uleb128 0x39 /* DW_TAG_namespace */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 7 /* Abbrev code (location) */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x2 /* DW_AT_location */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp
@@ -0,0 +1,43 @@
+# Copyright 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::".
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-empty-namespace"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
+ return -1
+}
+
+clean_restart $executable
+
+# `p var' below can work without identified DWARF DIE just based on its ELF symbol.
+# Catch it here as `type = <data variable, no debug info>'.
+gdb_test "ptype var" "type = int"
+
+gdb_test "p var" " = 1"

View File

@ -1,114 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-02/msg00713.html
Subject: Re: [patch] Fix false warning: section .gnu.liblist not found in ... [rediffed]
Hi,
only a technical rediff.
------------------------------------------------------------------------------
On Sat, 13 Feb 2010 23:49:29 +0100, Jan Kratochvil wrote:
Hi,
post-7.0 GDB started to print many false warnings on prelink-ed system:
$ ./gdb -nx -ex r echo
...
Reading symbols from /bin/echo...Reading symbols from /usr/lib/debug/bin/echo.debug...
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
done.
done.
Starting program: /bin/echo
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
These sections are from prelink and they are not present in the *.debug files.
It is formally a regression by:
commit 3bfec189bb0fa1a2a44f1645dd68a9572e7a841c
2010-01-07 Tristan Gingold <gingold@adacore.com>
* symfile.c (build_section_addr_info_from_objfile): New function.
(symbol_file_add_separate): Don't use offsets from objfile but
built an addr info.
But I think would be unavoidable even for the unification of PIC+PIE handling.
Found no usable section flag differences for .gnu.liblist vs. for example
.text so used just the section name for the exception.
.gnu.liblist/.gnu.conflict related dumps:
executable:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 6] .gnu.liblist GNU_LIBLIST 00000000004006b8 0006b8 000028 14 A 28 0 4
[ 7] .gnu.conflict RELA 00000000004006e0 0006e0 0001c8 18 A 5 0 8
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x005254 0x005254 R E 0x200000
Dynamic section at offset 0x52c8 contains 24 entries:
Tag Type Name/Value
0x000000006ffffef9 (GNU_LIBLIST) 0x4006b8
0x000000006ffffdf7 (GNU_LIBLISTSZ) 40 (bytes)
0x000000006ffffef8 (GNU_CONFLICT) 0x4006e0
0x000000006ffffdf6 (GNU_CONFLICTSZ) 456 (bytes)
library:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[74] .gnu.liblist GNU_LIBLIST 0000000000000000 249940 000014 14 75 0 4
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
2010-03-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (addr_info_make_relative): New variable sect_name, use it.
Do not warn on ".gnu.liblist" and ".gnu.conflict".
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -597,7 +597,8 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
- asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+ const char *sect_name = addrs->other[i].name;
+ asection *sect = bfd_get_section_by_name (abfd, sect_name);
if (sect)
{
@@ -614,8 +615,16 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
}
else
{
- warning (_("section %s not found in %s"), addrs->other[i].name,
- bfd_get_filename (abfd));
+ /* These two sections are intentionally loaded into memory from
+ the DYNAMIC segment and so they have both SEC_ALLOC and SEC_LOAD
+ set in the main executable (not in the library files). They
+ are not present in the separate debug info file, though. */
+
+ if (!(strcmp (sect_name, ".gnu.liblist") == 0
+ || strcmp (sect_name, ".gnu.conflict") == 0))
+ warning (_("section %s not found in %s"), sect_name,
+ bfd_get_filename (abfd));
+
addrs->other[i].addr = 0;
/* SECTINDEX is invalid if ADDR is zero. */

View File

@ -0,0 +1,501 @@
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -55,20 +55,6 @@ typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR;
/* Local functions */
extern void _initialize_f_language (void);
-#if 0
-static void clear_function_list (void);
-static long get_bf_for_fcn (long);
-static void clear_bf_list (void);
-static void patch_all_commons_by_name (char *, CORE_ADDR, int);
-static SAVED_F77_COMMON_PTR find_first_common_named (char *);
-static void add_common_entry (struct symbol *);
-static void add_common_block (char *, CORE_ADDR, int, char *);
-static SAVED_FUNCTION *allocate_saved_function_node (void);
-static SAVED_BF_PTR allocate_saved_bf_node (void);
-static COMMON_ENTRY_PTR allocate_common_entry_node (void);
-static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node (void);
-static void patch_common_entries (SAVED_F77_COMMON_PTR, CORE_ADDR, int);
-#endif
static void f_printchar (int c, struct type *type, struct ui_file * stream);
static void f_emit_char (int c, struct type *type,
@@ -419,185 +405,7 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
-#if 0
-static SAVED_BF_PTR
-allocate_saved_bf_node (void)
-{
- SAVED_BF_PTR new;
-
- new = (SAVED_BF_PTR) xmalloc (sizeof (SAVED_BF));
- return (new);
-}
-
-static SAVED_FUNCTION *
-allocate_saved_function_node (void)
-{
- SAVED_FUNCTION *new;
-
- new = (SAVED_FUNCTION *) xmalloc (sizeof (SAVED_FUNCTION));
- return (new);
-}
-
-static SAVED_F77_COMMON_PTR
-allocate_saved_f77_common_node (void)
-{
- SAVED_F77_COMMON_PTR new;
-
- new = (SAVED_F77_COMMON_PTR) xmalloc (sizeof (SAVED_F77_COMMON));
- return (new);
-}
-
-static COMMON_ENTRY_PTR
-allocate_common_entry_node (void)
-{
- COMMON_ENTRY_PTR new;
-
- new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY));
- return (new);
-}
-#endif
-
SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */
-SAVED_F77_COMMON_PTR tail_common_list = NULL; /* Ptr to last saved COMMON */
-SAVED_F77_COMMON_PTR current_common = NULL; /* Ptr to current COMMON */
-
-#if 0
-static SAVED_BF_PTR saved_bf_list = NULL; /* Ptr to (.bf,function)
- list */
-static SAVED_BF_PTR saved_bf_list_end = NULL; /* Ptr to above list's end */
-static SAVED_BF_PTR current_head_bf_list = NULL; /* Current head of above list
- */
-
-static SAVED_BF_PTR tmp_bf_ptr; /* Generic temporary for use
- in macros */
-
-/* The following function simply enters a given common block onto
- the global common block chain */
-
-static void
-add_common_block (char *name, CORE_ADDR offset, int secnum, char *func_stab)
-{
- SAVED_F77_COMMON_PTR tmp;
- char *c, *local_copy_func_stab;
-
- /* If the COMMON block we are trying to add has a blank
- name (i.e. "#BLNK_COM") then we set it to __BLANK
- because the darn "#" character makes GDB's input
- parser have fits. */
-
-
- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0
- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0)
- {
-
- xfree (name);
- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
- strcpy (name, BLANK_COMMON_NAME_LOCAL);
- }
-
- tmp = allocate_saved_f77_common_node ();
-
- local_copy_func_stab = xmalloc (strlen (func_stab) + 1);
- strcpy (local_copy_func_stab, func_stab);
-
- tmp->name = xmalloc (strlen (name) + 1);
-
- /* local_copy_func_stab is a stabstring, let us first extract the
- function name from the stab by NULLing out the ':' character. */
-
-
- c = NULL;
- c = strchr (local_copy_func_stab, ':');
-
- if (c)
- *c = '\0';
- else
- error (_("Malformed function STAB found in add_common_block()"));
-
-
- tmp->owning_function = xmalloc (strlen (local_copy_func_stab) + 1);
-
- strcpy (tmp->owning_function, local_copy_func_stab);
-
- strcpy (tmp->name, name);
- tmp->offset = offset;
- tmp->next = NULL;
- tmp->entries = NULL;
- tmp->secnum = secnum;
-
- current_common = tmp;
-
- if (head_common_list == NULL)
- {
- head_common_list = tail_common_list = tmp;
- }
- else
- {
- tail_common_list->next = tmp;
- tail_common_list = tmp;
- }
-}
-#endif
-
-/* The following function simply enters a given common entry onto
- the "current_common" block that has been saved away. */
-
-#if 0
-static void
-add_common_entry (struct symbol *entry_sym_ptr)
-{
- COMMON_ENTRY_PTR tmp;
-
-
-
- /* The order of this list is important, since
- we expect the entries to appear in decl.
- order when we later issue "info common" calls */
-
- tmp = allocate_common_entry_node ();
-
- tmp->next = NULL;
- tmp->symbol = entry_sym_ptr;
-
- if (current_common == NULL)
- error (_("Attempt to add COMMON entry with no block open!"));
- else
- {
- if (current_common->entries == NULL)
- {
- current_common->entries = tmp;
- current_common->end_of_entries = tmp;
- }
- else
- {
- current_common->end_of_entries->next = tmp;
- current_common->end_of_entries = tmp;
- }
- }
-}
-#endif
-
-/* This routine finds the first encountred COMMON block named "name" */
-
-#if 0
-static SAVED_F77_COMMON_PTR
-find_first_common_named (char *name)
-{
-
- SAVED_F77_COMMON_PTR tmp;
-
- tmp = head_common_list;
-
- while (tmp != NULL)
- {
- if (strcmp (tmp->name, name) == 0)
- return (tmp);
- else
- tmp = tmp->next;
- }
- return (NULL);
-}
-#endif
/* This routine finds the first encountred COMMON block named "name"
that belongs to function funcname */
@@ -620,193 +428,3 @@ find_common_for_function (char *name, char *funcname)
}
return (NULL);
}
-
-
-#if 0
-
-/* The following function is called to patch up the offsets
- for the statics contained in the COMMON block named
- "name." */
-
-static void
-patch_common_entries (SAVED_F77_COMMON_PTR blk, CORE_ADDR offset, int secnum)
-{
- COMMON_ENTRY_PTR entry;
-
- blk->offset = offset; /* Keep this around for future use. */
-
- entry = blk->entries;
-
- while (entry != NULL)
- {
- SYMBOL_VALUE (entry->symbol) += offset;
- SYMBOL_SECTION (entry->symbol) = secnum;
-
- entry = entry->next;
- }
- blk->secnum = secnum;
-}
-
-/* Patch all commons named "name" that need patching.Since COMMON
- blocks occur with relative infrequency, we simply do a linear scan on
- the name. Eventually, the best way to do this will be a
- hashed-lookup. Secnum is the section number for the .bss section
- (which is where common data lives). */
-
-static void
-patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum)
-{
-
- SAVED_F77_COMMON_PTR tmp;
-
- /* For blank common blocks, change the canonical reprsentation
- of a blank name */
-
- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0
- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0)
- {
- xfree (name);
- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
- strcpy (name, BLANK_COMMON_NAME_LOCAL);
- }
-
- tmp = head_common_list;
-
- while (tmp != NULL)
- {
- if (COMMON_NEEDS_PATCHING (tmp))
- if (strcmp (tmp->name, name) == 0)
- patch_common_entries (tmp, offset, secnum);
-
- tmp = tmp->next;
- }
-}
-#endif
-
-/* This macro adds the symbol-number for the start of the function
- (the symbol number of the .bf) referenced by symnum_fcn to a
- list. This list, in reality should be a FIFO queue but since
- #line pragmas sometimes cause line ranges to get messed up
- we simply create a linear list. This list can then be searched
- first by a queueing algorithm and upon failure fall back to
- a linear scan. */
-
-#if 0
-#define ADD_BF_SYMNUM(bf_sym,fcn_sym) \
- \
- if (saved_bf_list == NULL) \
-{ \
- tmp_bf_ptr = allocate_saved_bf_node(); \
- \
- tmp_bf_ptr->symnum_bf = (bf_sym); \
- tmp_bf_ptr->symnum_fcn = (fcn_sym); \
- tmp_bf_ptr->next = NULL; \
- \
- current_head_bf_list = saved_bf_list = tmp_bf_ptr; \
- saved_bf_list_end = tmp_bf_ptr; \
- } \
-else \
-{ \
- tmp_bf_ptr = allocate_saved_bf_node(); \
- \
- tmp_bf_ptr->symnum_bf = (bf_sym); \
- tmp_bf_ptr->symnum_fcn = (fcn_sym); \
- tmp_bf_ptr->next = NULL; \
- \
- saved_bf_list_end->next = tmp_bf_ptr; \
- saved_bf_list_end = tmp_bf_ptr; \
- }
-#endif
-
-/* This function frees the entire (.bf,function) list */
-
-#if 0
-static void
-clear_bf_list (void)
-{
-
- SAVED_BF_PTR tmp = saved_bf_list;
- SAVED_BF_PTR next = NULL;
-
- while (tmp != NULL)
- {
- next = tmp->next;
- xfree (tmp);
- tmp = next;
- }
- saved_bf_list = NULL;
-}
-#endif
-
-int global_remote_debug;
-
-#if 0
-
-static long
-get_bf_for_fcn (long the_function)
-{
- SAVED_BF_PTR tmp;
- int nprobes = 0;
-
- /* First use a simple queuing algorithm (i.e. look and see if the
- item at the head of the queue is the one you want) */
-
- if (saved_bf_list == NULL)
- internal_error (__FILE__, __LINE__,
- _("cannot get .bf node off empty list"));
-
- if (current_head_bf_list != NULL)
- if (current_head_bf_list->symnum_fcn == the_function)
- {
- if (global_remote_debug)
- fprintf_unfiltered (gdb_stderr, "*");
-
- tmp = current_head_bf_list;
- current_head_bf_list = current_head_bf_list->next;
- return (tmp->symnum_bf);
- }
-
- /* If the above did not work (probably because #line directives were
- used in the sourcefile and they messed up our internal tables) we now do
- the ugly linear scan */
-
- if (global_remote_debug)
- fprintf_unfiltered (gdb_stderr, "\ndefaulting to linear scan\n");
-
- nprobes = 0;
- tmp = saved_bf_list;
- while (tmp != NULL)
- {
- nprobes++;
- if (tmp->symnum_fcn == the_function)
- {
- if (global_remote_debug)
- fprintf_unfiltered (gdb_stderr, "Found in %d probes\n", nprobes);
- current_head_bf_list = tmp->next;
- return (tmp->symnum_bf);
- }
- tmp = tmp->next;
- }
-
- return (-1);
-}
-
-static SAVED_FUNCTION_PTR saved_function_list = NULL;
-static SAVED_FUNCTION_PTR saved_function_list_end = NULL;
-
-static void
-clear_function_list (void)
-{
- SAVED_FUNCTION_PTR tmp = saved_function_list;
- SAVED_FUNCTION_PTR next = NULL;
-
- while (tmp != NULL)
- {
- next = tmp->next;
- xfree (tmp);
- tmp = next;
- }
-
- saved_function_list = NULL;
-}
-#endif
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -71,14 +71,9 @@ typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR;
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 *);
-#define UNINITIALIZED_SECNUM -1
-#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM)
-
#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 */
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -35,10 +35,6 @@
#include "command.h"
#include "block.h"
-#if 0
-static int there_is_a_visible_common_named (char *);
-#endif
-
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
static void list_all_visible_commons (char *);
@@ -578,67 +574,6 @@ info_common_command (char *comname, int from_tty)
comname, funname);
}
-/* This function is used to determine whether there is a
- F77 common block visible at the current scope called 'comname'. */
-
-#if 0
-static int
-there_is_a_visible_common_named (char *comname)
-{
- SAVED_F77_COMMON_PTR the_common;
- struct frame_info *fi;
- char *funname = 0;
- struct symbol *func;
-
- if (comname == NULL)
- error (_("Cannot deal with NULL common name!"));
-
- fi = get_selected_frame (_("No frame selected"));
-
- /* The following is generally ripped off from stack.c's routine
- print_frame_info() */
-
- func = find_pc_function (fi->pc);
- if (func)
- {
- /* In certain pathological cases, the symtabs give the wrong
- function (when we are in the first function in a file which
- is compiled without debugging symbols, the previous function
- is compiled with debugging symbols, and the "foo.o" symbol
- that is supposed to tell us where the file with debugging symbols
- ends has been truncated by ar because it is longer than 15
- characters).
-
- So look in the minimal symbol tables as well, and if it comes
- up with a larger address for the function use that instead.
- I don't think this can ever cause any problems; there shouldn't
- be any minimal symbols in the middle of a function.
- FIXME: (Not necessarily true. What about text labels) */
-
- struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
-
- if (msymbol != NULL
- && (SYMBOL_VALUE_ADDRESS (msymbol)
- > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
- funname = SYMBOL_LINKAGE_NAME (msymbol);
- else
- funname = SYMBOL_LINKAGE_NAME (func);
- }
- else
- {
- struct minimal_symbol *msymbol =
- lookup_minimal_symbol_by_pc (fi->pc);
-
- if (msymbol != NULL)
- funname = SYMBOL_LINKAGE_NAME (msymbol);
- }
-
- the_common = find_common_for_function (comname, funname);
-
- return (the_common ? 1 : 0);
-}
-#endif
-
void
_initialize_f_valprint (void)
{

580
gdb-fortran-common.patch Normal file
View File

@ -0,0 +1,580 @@
Index: gdb-7.0.50.20100128/gdb/dwarf2read.c
===================================================================
--- gdb-7.0.50.20100128.orig/gdb/dwarf2read.c 2010-01-28 12:53:37.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/dwarf2read.c 2010-01-28 12:54:34.000000000 +0100
@@ -5818,12 +5818,14 @@ read_set_type (struct die_info *die, str
return set_die_type (die, set_type, cu);
}
-/* First cut: install each common block member as a global variable. */
+/* Create appropriate locally-scoped variables for all the DW_TAG_common_block
+ entries. Create also TYPE_CODE_STRUCT listing all such variables to be
+ available for `info common'. COMMON_BLOCK_DOMAIN is used to sepate the
+ common blocks name namespace from regular variable names. */
static void
read_common_block (struct die_info *die, struct dwarf2_cu *cu)
{
- struct die_info *child_die;
struct attribute *attr;
struct symbol *sym;
CORE_ADDR base = (CORE_ADDR) 0;
@@ -5848,10 +5850,40 @@ read_common_block (struct die_info *die,
}
if (die->child != NULL)
{
+ struct objfile *objfile = cu->objfile;
+ struct die_info *child_die;
+ struct type *type;
+ struct field *field;
+ char *name;
+ struct symbol *sym;
+
+ type = alloc_type (objfile);
+ TYPE_CODE (type) = TYPE_CODE_STRUCT;
+ /* Artificial type to be used only by `info common'. */
+ TYPE_NAME (type) = "<common>";
+
+ child_die = die->child;
+ while (child_die && child_die->tag)
+ {
+ TYPE_NFIELDS (type)++;
+ child_die = sibling_die (child_die);
+ }
+
+ TYPE_FIELDS (type) = obstack_alloc (&objfile->objfile_obstack,
+ sizeof (*TYPE_FIELDS (type))
+ * TYPE_NFIELDS (type));
+ memset (TYPE_FIELDS (type), 0, sizeof (*TYPE_FIELDS (type))
+ * TYPE_NFIELDS (type));
+
+ field = TYPE_FIELDS (type);
child_die = die->child;
while (child_die && child_die->tag)
{
+ /* Create the symbol in the DW_TAG_common_block block in the current
+ symbol scope. */
sym = new_symbol (child_die, NULL, cu);
+
+ /* Undocumented in DWARF3, when it can be present? */
attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
if (attr)
{
@@ -5869,8 +5901,25 @@ read_common_block (struct die_info *die,
SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
add_symbol_to_list (sym, &global_symbols);
}
+
+ if (SYMBOL_CLASS (sym) == LOC_STATIC)
+ SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym));
+ else
+ SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
+ FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
+ FIELD_NAME (*field) = SYMBOL_NATURAL_NAME (sym);
+ field++;
child_die = sibling_die (child_die);
}
+
+ /* TYPE_LENGTH (type) is left 0 - it is only a virtual structure even
+ with no consecutive address space. */
+
+ sym = new_symbol (die, type, cu);
+ /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
+ SYMBOL_VALUE_ADDRESS (sym) = base;
+
+ set_die_type (die, type, cu);
}
}
@@ -9061,6 +9110,13 @@ new_symbol (struct die_info *die, struct
{
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
+
+ /* Fortran explicitly imports any global symbols to the local
+ scope by DW_TAG_common_block. */
+ if (cu->language == language_fortran && die->parent
+ && die->parent->tag == DW_TAG_common_block)
+ attr2 = NULL;
+
if (attr2 && (DW_UNSND (attr2) != 0))
{
struct pending **list_to_add;
@@ -9245,6 +9301,11 @@ new_symbol (struct die_info *die, struct
SYMBOL_DOMAIN (sym) = MODULE_DOMAIN;
add_symbol_to_list (sym, &global_symbols);
break;
+ case DW_TAG_common_block:
+ SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN;
+ add_symbol_to_list (sym, cu->list_in_scope);
+ break;
default:
/* Not a tag we recognize. Hopefully we aren't processing
trash data, but since we must specifically ignore things
Index: gdb-7.0.50.20100128/gdb/f-lang.c
===================================================================
--- gdb-7.0.50.20100128.orig/gdb/f-lang.c 2010-01-28 12:53:38.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/f-lang.c 2010-01-28 12:53:46.000000000 +0100
@@ -446,27 +446,3 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
-
-SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */
-
-/* This routine finds the first encountred COMMON block named "name"
- that belongs to function funcname */
-
-SAVED_F77_COMMON_PTR
-find_common_for_function (char *name, char *funcname)
-{
-
- SAVED_F77_COMMON_PTR tmp;
-
- tmp = head_common_list;
-
- while (tmp != NULL)
- {
- if (strcmp (tmp->name, name) == 0
- && strcmp (tmp->owning_function, funcname) == 0)
- return (tmp);
- else
- tmp = tmp->next;
- }
- return (NULL);
-}
Index: gdb-7.0.50.20100128/gdb/f-lang.h
===================================================================
--- gdb-7.0.50.20100128.orig/gdb/f-lang.h 2010-01-28 12:53:38.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/f-lang.h 2010-01-28 12:53:46.000000000 +0100
@@ -51,36 +51,8 @@ enum f90_range_type
NONE_BOUND_DEFAULT /* "(low:high)" */
};
-struct common_entry
- {
- struct symbol *symbol; /* The symbol node corresponding
- to this component */
- struct common_entry *next; /* The next component */
- };
-
-struct saved_f77_common
- {
- char *name; /* Name of COMMON */
- char *owning_function; /* Name of parent function */
- int secnum; /* Section # of .bss */
- CORE_ADDR offset; /* Offset from .bss for
- this block */
- struct common_entry *entries; /* List of block's components */
- struct common_entry *end_of_entries; /* ptr. to end of components */
- struct saved_f77_common *next; /* Next saved COMMON block */
- };
-
-typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR;
-
-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 find_common_for_function (char *, char *);
-
#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 */
/* 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.0.50.20100128/gdb/f-valprint.c
===================================================================
--- gdb-7.0.50.20100128.orig/gdb/f-valprint.c 2010-01-28 12:53:38.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/f-valprint.c 2010-01-28 12:53:46.000000000 +0100
@@ -34,6 +34,8 @@
#include "gdbcore.h"
#include "command.h"
#include "block.h"
+#include "dictionary.h"
+#include "gdb_assert.h"
extern void _initialize_f_valprint (void);
static void info_common_command (char *, int);
@@ -476,22 +478,54 @@ f_val_print (struct type *type, const gd
return 0;
}
-static void
-list_all_visible_commons (char *funname)
+static int
+info_common_command_for_block (struct block *block, struct frame_info *frame,
+ const char *comname)
{
- SAVED_F77_COMMON_PTR tmp;
-
- tmp = head_common_list;
+ struct dict_iterator iter;
+ struct symbol *sym;
+ int values_printed = 0;
+ const char *name;
+ struct value_print_options opts;
+
+ get_user_print_options (&opts);
+
+ ALL_BLOCK_SYMBOLS (block, iter, sym)
+ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
+ {
+ struct type *type = SYMBOL_TYPE (sym);
+ int index;
+
+ gdb_assert (SYMBOL_CLASS (sym) == LOC_STATIC);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT);
+
+ if (comname && (!SYMBOL_LINKAGE_NAME (sym)
+ || strcmp (comname, SYMBOL_LINKAGE_NAME (sym)) != 0))
+ continue;
+
+ values_printed = 1;
+ if (SYMBOL_PRINT_NAME (sym))
+ printf_filtered (_("Contents of F77 COMMON block '%s':\n"),
+ SYMBOL_PRINT_NAME (sym));
+ else
+ printf_filtered (_("Contents of blank COMMON block:\n"));
+
+ for (index = 0; index < TYPE_NFIELDS (type); index++)
+ {
+ struct value *val;
+
+ gdb_assert (field_is_static (&TYPE_FIELD (type, index)));
+ val = value_static_field (type, index);
+
+ printf_filtered ("%s = ", TYPE_FIELD_NAME (type, index));
+ value_print (val, gdb_stdout, &opts);
+ putchar_filtered ('\n');
+ }
- printf_filtered (_("All COMMON blocks visible at this level:\n\n"));
+ putchar_filtered ('\n');
+ }
- while (tmp != NULL)
- {
- if (strcmp (tmp->owning_function, funname) == 0)
- printf_filtered ("%s\n", tmp->name);
-
- tmp = tmp->next;
- }
+ return values_printed;
}
/* This function is used to print out the values in a given COMMON
@@ -501,11 +535,9 @@ list_all_visible_commons (char *funname)
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;
- 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
@@ -517,74 +549,31 @@ info_common_command (char *comname, int
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
- func = find_pc_function (get_frame_pc (fi));
- if (func)
+ block = get_frame_block (fi, 0);
+ if (block == NULL)
{
- /* In certain pathological cases, the symtabs give the wrong
- function (when we are in the first function in a file which
- is compiled without debugging symbols, the previous function
- is compiled with debugging symbols, and the "foo.o" symbol
- that is supposed to tell us where the file with debugging symbols
- ends has been truncated by ar because it is longer than 15
- characters).
-
- So look in the minimal symbol tables as well, and if it comes
- up with a larger address for the function use that instead.
- I don't think this can ever cause any problems; there shouldn't
- be any minimal symbols in the middle of a function.
- FIXME: (Not necessarily true. What about text labels) */
-
- struct minimal_symbol *msymbol =
- lookup_minimal_symbol_by_pc (get_frame_pc (fi));
-
- if (msymbol != NULL
- && (SYMBOL_VALUE_ADDRESS (msymbol)
- > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
- funname = SYMBOL_LINKAGE_NAME (msymbol);
- else
- funname = SYMBOL_LINKAGE_NAME (func);
- }
- else
- {
- struct minimal_symbol *msymbol =
- lookup_minimal_symbol_by_pc (get_frame_pc (fi));
-
- if (msymbol != NULL)
- funname = SYMBOL_LINKAGE_NAME (msymbol);
- else /* Got no 'funname', code below will fail. */
- error (_("No function found for frame."));
+ printf_filtered (_("No symbol table info available.\n"));
+ return;
}
- /* If comname is NULL, we assume the user wishes to see the
- which COMMON blocks are visible here and then return */
-
- if (comname == 0)
+ while (block)
{
- list_all_visible_commons (funname);
- return;
+ if (info_common_command_for_block (block, fi, comname))
+ values_printed = 1;
+ /* After handling the function's top-level block, stop. Don't
+ continue to its superblock, the block of per-file symbols. */
+ if (BLOCK_FUNCTION (block))
+ break;
+ block = BLOCK_SUPERBLOCK (block);
}
- the_common = find_common_for_function (comname, funname);
-
- if (the_common)
+ if (!values_printed)
{
- if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0)
- printf_filtered (_("Contents of blank COMMON block:\n"));
+ if (comname)
+ printf_filtered (_("No common block '%s'.\n"), comname);
else
- printf_filtered (_("Contents of F77 COMMON block '%s':\n"), comname);
-
- printf_filtered ("\n");
- entry = the_common->entries;
-
- while (entry != NULL)
- {
- print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0);
- entry = entry->next;
- }
+ printf_filtered (_("No common blocks.\n"));
}
- else
- printf_filtered (_("Cannot locate the common block %s in function '%s'\n"),
- comname, funname);
}
void
Index: gdb-7.0.50.20100128/gdb/stack.c
===================================================================
--- gdb-7.0.50.20100128.orig/gdb/stack.c 2010-01-28 12:52:19.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/stack.c 2010-01-28 12:53:46.000000000 +0100
@@ -1474,6 +1474,8 @@ print_block_frame_locals (struct block *
case LOC_COMPUTED:
if (SYMBOL_IS_ARGUMENT (sym))
break;
+ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN)
+ break;
values_printed = 1;
print_variable_and_value (NULL, sym, frame, stream, 4 * num_tabs);
break;
Index: gdb-7.0.50.20100128/gdb/symtab.h
===================================================================
--- gdb-7.0.50.20100128.orig/gdb/symtab.h 2010-01-28 12:52:20.000000000 +0100
+++ gdb-7.0.50.20100128/gdb/symtab.h 2010-01-28 12:53:46.000000000 +0100
@@ -401,7 +401,10 @@ typedef enum domain_enum_tag
TYPES_DOMAIN,
/* Fortran module. Their naming must be separate. */
- MODULE_DOMAIN
+ MODULE_DOMAIN,
+
+ /* Fortran common blocks. Their naming must be separate from VAR_DOMAIN. */
+ COMMON_BLOCK_DOMAIN
}
domain_enum;
Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.fortran/common-block.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.fortran/common-block.exp 2010-01-28 12:53:46.000000000 +0100
@@ -0,0 +1,101 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 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.
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+set testfile "common-block"
+set srcfile ${testfile}.f90
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+ untested "Couldn't compile ${srcfile}"
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "stop-here-out"]
+gdb_continue_to_breakpoint "stop-here-out"
+
+# Common block naming with source name /foo/:
+# .symtab DW_TAG_common_block's DW_AT_name
+# Intel Fortran foo_ foo_
+# GNU Fortran foo_ foo
+#set suffix "_"
+set suffix ""
+
+set int4 {(integer\(kind=4\)|INTEGER\(4\))}
+set real4 {(real\(kind=4\)|REAL\(4\))}
+set real8 {(real\(kind=8\)|REAL\(8\))}
+
+gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context."
+gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context."
+gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context."
+gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
+gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
+gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context."
+
+gdb_test "info locals" "ix_x = 11\r\niy_y = 22\r\niz_z = 33\r\nix = 1\r\niy = 2\r\niz = 3" "info locals out"
+gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix_x = 11\r\niy_y = 22\r\niz_z = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix = 1\r\niy = 2\r\niz = 3" "info common out"
+
+gdb_test "ptype ix" "type = $int4" "ptype ix out"
+gdb_test "ptype iy" "type = $real4" "ptype iy out"
+gdb_test "ptype iz" "type = $real8" "ptype iz out"
+gdb_test "ptype ix_x" "type = $int4" "ptype ix_x out"
+gdb_test "ptype iy_y" "type = $real4" "ptype iy_y out"
+gdb_test "ptype iz_z" "type = $real8" "ptype iz_z out"
+
+gdb_test "p ix" " = 1 *" "p ix out"
+gdb_test "p iy" " = 2 *" "p iy out"
+gdb_test "p iz" " = 3 *" "p iz out"
+gdb_test "p ix_x" " = 11 *" "p ix_x out"
+gdb_test "p iy_y" " = 22 *" "p iy_y out"
+gdb_test "p iz_z" " = 33 *" "p iz_z out"
+
+gdb_breakpoint [gdb_get_line_number "stop-here-in"]
+gdb_continue_to_breakpoint "stop-here-in"
+
+gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context." "whatis foo$suffix in"
+gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context." "ptype foo$suffix in"
+gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context." "p foo$suffix in"
+gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "whatis fo_o$suffix in"
+gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "ptype fo_o$suffix in"
+gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "p fo_o$suffix in"
+
+gdb_test "info locals" "ix = 11\r\niy2 = 22\r\niz = 33\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3\r\niy = 5\r\niz_z = 55" "info locals in"
+gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix = 11\r\niy2 = 22\r\niz = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3" "info common in"
+
+gdb_test "ptype ix" "type = $int4" "ptype ix in"
+gdb_test "ptype iy2" "type = $real4" "ptype iy2 in"
+gdb_test "ptype iz" "type = $real8" "ptype iz in"
+gdb_test "ptype ix_x" "type = $int4" "ptype ix_x in"
+gdb_test "ptype iy_y" "type = $real4" "ptype iy_y in"
+gdb_test "ptype iz_z2" "type = $real8" "ptype iz_z2 in"
+
+gdb_test "p ix" " = 11 *" "p ix in"
+gdb_test "p iy2" " = 22 *" "p iy2 in"
+gdb_test "p iz" " = 33 *" "p iz in"
+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.0.50.20100128/gdb/testsuite/gdb.fortran/common-block.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.fortran/common-block.f90 2010-01-28 12:53:46.000000000 +0100
@@ -0,0 +1,67 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! Ihis file is the Fortran source file for dynamic.exp.
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+subroutine in
+
+ INTEGER*4 ix
+ REAL*4 iy2
+ REAL*8 iz
+
+ INTEGER*4 ix_x
+ REAL*4 iy_y
+ REAL*8 iz_z2
+
+ common /fo_o/ix,iy2,iz
+ common /foo/ix_x,iy_y,iz_z2
+
+ iy = 5
+ iz_z = 55
+
+ if (ix .ne. 11 .or. iy2 .ne. 22.0 .or. iz .ne. 33.0) call abort
+ if (ix_x .ne. 1 .or. iy_y .ne. 2.0 .or. iz_z2 .ne. 3.0) call abort
+
+ ix = 0 ! stop-here-in
+
+end subroutine in
+
+program common_test
+
+ INTEGER*4 ix
+ REAL*4 iy
+ REAL*8 iz
+
+ INTEGER*4 ix_x
+ REAL*4 iy_y
+ REAL*8 iz_z
+
+ common /foo/ix,iy,iz
+ common /fo_o/ix_x,iy_y,iz_z
+
+ ix = 1
+ iy = 2.0
+ iz = 3.0
+
+ ix_x = 11
+ iy_y = 22.0
+ iz_z = 33.0
+
+ call in ! stop-here-out
+
+end program common_test

153
gdb-fortran-logical8.patch Normal file
View File

@ -0,0 +1,153 @@
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -196,6 +196,7 @@ static int parse_number (char *, int, int, YYSTYPE *);
/* Special type cases, put in to allow the parser to distinguish different
legal basetypes. */
%token INT_KEYWORD INT_S2_KEYWORD LOGICAL_S1_KEYWORD LOGICAL_S2_KEYWORD
+%token LOGICAL_S8_KEYWORD
%token LOGICAL_KEYWORD REAL_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD
%token COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD COMPLEX_S32_KEYWORD
%token BOOL_AND BOOL_OR BOOL_NOT
@@ -606,6 +607,8 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
{ $$ = parse_f_type->builtin_integer_s2; }
| CHARACTER
{ $$ = parse_f_type->builtin_character; }
+ | LOGICAL_S8_KEYWORD
+ { $$ = parse_f_type->builtin_logical_s8;}
| LOGICAL_KEYWORD
{ $$ = parse_f_type->builtin_logical; }
| LOGICAL_S2_KEYWORD
@@ -858,6 +861,7 @@ static const struct token f77_keywords[] =
{ "integer_2", INT_S2_KEYWORD, BINOP_END },
{ "logical_1", LOGICAL_S1_KEYWORD, BINOP_END },
{ "logical_2", LOGICAL_S2_KEYWORD, BINOP_END },
+ { "logical_8", LOGICAL_S8_KEYWORD, BINOP_END },
{ "complex_8", COMPLEX_S8_KEYWORD, BINOP_END },
{ "integer", INT_KEYWORD, BINOP_END },
{ "logical", LOGICAL_KEYWORD, BINOP_END },
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -259,6 +245,7 @@ enum f_primitive_types {
f_primitive_type_logical,
f_primitive_type_logical_s1,
f_primitive_type_logical_s2,
+ f_primitive_type_logical_s8,
f_primitive_type_integer,
f_primitive_type_integer_s2,
f_primitive_type_real,
@@ -289,6 +276,8 @@ f_language_arch_info (struct gdbarch *gdbarch,
= builtin->builtin_logical_s1;
lai->primitive_type_vector [f_primitive_type_logical_s2]
= builtin->builtin_logical_s2;
+ lai->primitive_type_vector [f_primitive_type_logical_s8]
+ = builtin->builtin_logical_s8;
lai->primitive_type_vector [f_primitive_type_real]
= builtin->builtin_real;
lai->primitive_type_vector [f_primitive_type_real_s8]
@@ -372,6 +361,10 @@ build_fortran_types (struct gdbarch *gdbarch)
= arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1,
"logical*2");
+ builtin_f_type->builtin_logical_s8
+ = arch_boolean_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1,
+ "logical*8");
+
builtin_f_type->builtin_integer
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0,
"integer");
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -113,6 +80,7 @@ struct builtin_f_type
struct type *builtin_logical;
struct type *builtin_logical_s1;
struct type *builtin_logical_s2;
+ struct type *builtin_logical_s8;
struct type *builtin_real;
struct type *builtin_real_s8;
struct type *builtin_real_s16;
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/logical.exp
@@ -0,0 +1,44 @@
+# Copyright 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.
+
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+set testfile "logical"
+set srcfile ${testfile}.f90
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+ untested "Couldn't compile ${srcfile}"
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto MAIN__] then {
+ perror "couldn't run to breakpoint MAIN__"
+ continue
+}
+
+gdb_breakpoint [gdb_get_line_number "stop-here"]
+gdb_continue_to_breakpoint "stop-here"
+gdb_test "p l" " = \\.TRUE\\."
+gdb_test "p l1" " = \\.TRUE\\."
+gdb_test "p l2" " = \\.TRUE\\."
+gdb_test "p l4" " = \\.TRUE\\."
+gdb_test "p l8" " = \\.TRUE\\."
diff --git a/gdb/testsuite/gdb.fortran/logical.f90 b/gdb/testsuite/gdb.fortran/logical.f90
new file mode 100644
index 0000000..4229304
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/logical.f90
@@ -0,0 +1,33 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 2 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program; if not, write to the Free Software
+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+!
+! Ihis file is the Fortran source file for dynamic.exp.
+! Original file written by Jakub Jelinek <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+program test
+ logical :: l
+ logical (kind=1) :: l1
+ logical (kind=2) :: l2
+ logical (kind=4) :: l4
+ logical (kind=8) :: l8
+ l = .TRUE.
+ l1 = .TRUE.
+ l2 = .TRUE.
+ l4 = .TRUE.
+ l8 = .TRUE.
+ l = .FALSE. ! stop-here
+end

View File

@ -1,117 +0,0 @@
There was a regression by:
Re: [rfc, v3] Fix frame_id_inner comparison false positives
http://sourceware.org/ml/gdb-patches/2008-08/msg00578.html
http://sourceware.org/ml/gdb-cvs/2008-08/msg00182.html
916dde5d38b45a659514e47942ece70aec04cd78
the part:
* stack.c (return_command): Directly pop the selected frame.
Reproducible on:
hp-diablo-01.rhts.eng.bos.redhat.com
RHEL5.5-Server-20100216.nightly
kernel-2.6.18-187.el5.ia64
Not reproducible on:
hp-bl860c-03.rhts.eng.bos.redhat.com
RHEL-4.8
kernel-2.6.9-89.EL.ia64
To make ia64-tdep.c compilable +/- this stack.c check-in one must apply:
Re: [RFC] Remove addr, endaddr, offset from obj_section
http://sourceware.org/ml/gdb-patches/2008-09/msg00011.html
http://sourceware.org/ml/gdb-cvs/2008-09/msg00009.html
99072369ec3c8f94c9a596e5ce30bf1f1c4bf20e
It is reproducible by:
gdb.base/call-signal-resume.exp
although one must first remove the gdb_assert by:
gdb-infcall-sp-underflow.patch
Reproducer:
set confirm no
set breakpoint pending on
set height 0
set width 0
# testcase from: gdb-6.8-37.el5.src
file gdb.base/call-signals
break stop_one
run
call gen_signal ()
bt
frame 3
return
p/x $sp
break stop_two
info break
p/x $pc
p/x $sp
bt
set debug infrun 1
delete 1
continue
bt
p/x $pc
echo Bug is reproduced if sp is now 0:\n
p/x $sp
kill
quit
--- ./gdb/frame.c 2010-02-23 21:35:35.000000000 +0100
+++ ./gdb/frame.c 2010-02-23 21:46:34.000000000 +0100
@@ -517,7 +517,7 @@ frame_id_eq (struct frame_id l, struct f
a stack overflow strategy that cause the handler to be run on a
different stack. */
-static int
+int
frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
{
int inner;
--- ./gdb/frame.h 2009-09-13 18:28:28.000000000 +0200
+++ ./gdb/frame.h 2010-02-23 21:46:10.000000000 +0100
@@ -708,4 +708,7 @@ extern struct frame_info *create_new_fra
extern int frame_unwinder_is (struct frame_info *fi,
const struct frame_unwind *unwinder);
+extern int frame_id_inner (struct gdbarch *gdbarch, struct frame_id l,
+ struct frame_id r);
+
#endif /* !defined (FRAME_H) */
--- ./gdb/stack.c 2010-02-23 21:35:34.000000000 +0100
+++ ./gdb/stack.c 2010-02-23 21:44:39.000000000 +0100
@@ -1967,8 +1967,29 @@ If you continue, the return value that y
error (_("Not confirmed"));
}
- /* Discard the selected frame and all frames inner-to it. */
- frame_pop (get_selected_frame (NULL));
+ /* NOTE: cagney/2003-01-18: Is this silly? Rather than pop each
+ frame in turn, should this code just go straight to the relevant
+ frame and pop that? */
+
+ /* First discard all frames inner-to the selected frame (making the
+ selected frame current). */
+ {
+ struct frame_id selected_id = get_frame_id (get_selected_frame (NULL));
+ while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ())))
+ {
+ struct frame_info *frame = get_current_frame ();
+ if (frame_id_inner (get_frame_arch (frame), selected_id,
+ get_frame_id (frame)))
+ /* Caught in the safety net, oops! We've gone way past the
+ selected frame. */
+ error (_("Problem while popping stack frames (corrupt stack?)"));
+ frame_pop (get_current_frame ());
+ }
+ }
+
+ /* Second discard the selected frame (which is now also the current
+ frame). */
+ frame_pop (get_current_frame ());
/* Store RETURN_VALUE in the just-returned register set. */
if (return_value != NULL)

View File

@ -0,0 +1,151 @@
New testcase for:
https://bugzilla.redhat.com/show_bug.cgi?id=466222
(for the first / customer recommended fix)
and the upstream fix:
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
[rfc] Do not make up line information
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c
@@ -0,0 +1,21 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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/>. */
+
+void
+func (void)
+{
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineno-makeup.c
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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/>. */
+
+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
+ information (.debug_line) so we cannot use an external object file.
+
+ It must not be just a label as it would alias on the next function even for
+ correct GDB. Therefore some stub data must be placed there.
+
+ We need to provide a real stub function body as at least s390
+ (s390_analyze_prologue) would skip the whole body till reaching `main'. */
+
+extern void func (void);
+asm ("func: .incbin \"gdb.base/lineno-makeup-func.bin\"");
+
+int
+main (void)
+{
+ func ();
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
@@ -0,0 +1,78 @@
+# Copyright 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/>.
+
+set testfile "lineno-makeup"
+set srcfuncfile ${testfile}-func.c
+set srcfile ${testfile}.c
+set objfuncfile ${objdir}/${subdir}/${testfile}-func.o
+set binfuncfile ${objdir}/${subdir}/${testfile}-func.bin
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
+verbose -log "objcopy=$objcopy: $output"
+if { $objcopy != 0 } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+set binfuncfilesize [file size $binfuncfile]
+verbose -log "file size $binfuncfile = $binfuncfilesize"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set b_addr ""
+set test "break func"
+gdb_test_multiple $test $test {
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
+ set b_addr $expect_out(1,string)
+ pass $test
+ }
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" {
+ set b_addr $expect_out(1,string)
+ fail $test
+ }
+}
+verbose -log "b_addr=<$b_addr>"
+
+set p_addr ""
+set test "print func"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\]+ = {<text variable, no debug info>} (0x\[0-9a-f\]+) <func>\r\n$gdb_prompt $" {
+ set p_addr $expect_out(1,string)
+ pass $test
+ }
+}
+verbose -log "p_addr=<$p_addr>"
+
+set test "break address belongs to func"
+if {$b_addr == $p_addr} {
+ pass "$test (exact match)"
+} else {
+ set skip [expr $b_addr - $p_addr]
+ if {$skip > 0 && $skip < $binfuncfilesize} {
+ pass "$test (prologue skip by $skip bytes)"
+ } else {
+ fail $test
+ }
+}

View File

@ -41,6 +41,7 @@
#include <assert.h>
#include <pty.h>
#include <poll.h>
#include <sys/stat.h>
#define LENGTH(x) (sizeof (x) / sizeof (*(x)))
@ -87,6 +88,8 @@ static int read_out (int amaster)
/* Weird but at least after POLLHUP we get EIO instead of just EOF. */
if (buf_got == -1 && errno == EIO)
return 0;
if (buf_got == -1 && errno == EAGAIN)
return 0;
if (buf_got < 0)
{
perror ("read (amaster)");

View File

@ -0,0 +1,443 @@
http://sourceware.org/ml/gdb-patches/2010-03/msg01008.html
Subject: [patch 1/6]: PIE: Attach binary even after re-prelinked underneath
Hi,
there is a regression (against previous unreleased commits) by:
Re: RFC: Verify AT_ENTRY before using it
http://sourceware.org/ml/gdb-patches/2010-03/msg00395.html
for loading PIE executables which have changed on the disk since started.
There are in fact 3 different addresses one has to properly deal with.
This patch uses explicit "file" so it is not dependent on pending:
[patch] Attach to running but deleted executable
http://sourceware.org/ml/gdb-patches/2010-03/msg00950.html
The two copy-pasted blocks for elf32 and elf64 are "not nice" but this is the
current style in GDB.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
patch series together.
Thanks,
Jan
gdb/
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix attaching to PIEs prelinked on the disk since their start.
* solib-svr4.c (svr4_exec_displacement): New variable arch_size.
Verify it against bfd_get_arch_size. Try to match arbitrary
displacement for the phdrs comparison.
gdb/testsuite/
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/break-interp.exp: Run $binpie with new value "ATTACH", new
code for it. New variable relink_args.
(prelinkYES): Call prelinkNO.
(test_attach): Accept new parameter relink_args. Re-prelink the binary
in such case. Move the core code to ...
(test_attach_gdb): ... a new function. Send GDB command "file".
Extend expected "Attaching to " string.
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1750,13 +1750,183 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
really do not match. */
int phdrs_size, phdrs2_size, ok = 1;
gdb_byte *buf, *buf2;
+ int arch_size;
- buf = read_program_header (-1, &phdrs_size, NULL);
+ buf = read_program_header (-1, &phdrs_size, &arch_size);
buf2 = read_program_headers_from_bfd (exec_bfd, &phdrs2_size);
- if (buf != NULL && buf2 != NULL
- && (phdrs_size != phdrs2_size
- || memcmp (buf, buf2, phdrs_size) != 0))
- ok = 0;
+ if (buf != NULL && buf2 != NULL)
+ {
+ enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+
+ /* We are dealing with three different addresses. EXEC_BFD
+ represents current address in on-disk file. target memory content
+ may be different from EXEC_BFD as the file may have been prelinked
+ to a different address since the executable has been loaded.
+ Moreover the address of placement in target memory can be
+ different from what say the target memory program headers - this
+ is the goal of PIE.
+
+ Detected DISPLACEMENT covers both the offsets of PIE placement and
+ possible new prelink since start of the program. Here relocate
+ BUF and BUF2 just by the EXEC_BFD vs. target memory content offset
+ for the verification purpose. */
+
+ if (phdrs_size != phdrs2_size
+ || bfd_get_arch_size (exec_bfd) != arch_size)
+ ok = 0;
+ else if (arch_size == 32 && phdrs_size >= sizeof (Elf32_External_Phdr)
+ && phdrs_size % sizeof (Elf32_External_Phdr) == 0)
+ {
+ Elf_Internal_Ehdr *ehdr2 = elf_tdata (exec_bfd)->elf_header;
+ Elf_Internal_Phdr *phdr2 = elf_tdata (exec_bfd)->phdr;
+ CORE_ADDR displacement = 0;
+ int i;
+
+ /* DISPLACEMENT could be found easier by the difference of
+ ehdr2->e_entry but already read BUF does not contain ehdr. */
+
+ for (i = 0; i < ehdr2->e_phnum; i++)
+ if (phdr2[i].p_type == PT_LOAD)
+ {
+ Elf32_External_Phdr *phdrp;
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
+ CORE_ADDR vaddr, paddr;
+ CORE_ADDR displacement_vaddr = 0;
+ CORE_ADDR displacement_paddr = 0;
+
+ phdrp = &((Elf32_External_Phdr *) buf)[i];
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 4,
+ byte_order);
+ displacement_vaddr = vaddr - phdr2[i].p_vaddr;
+
+ paddr = extract_unsigned_integer (buf_paddr_p, 4,
+ byte_order);
+ displacement_paddr = paddr - phdr2[i].p_paddr;
+
+ if (displacement_vaddr == displacement_paddr)
+ displacement = displacement_vaddr;
+
+ break;
+ }
+
+ /* Now compare BUF and BUF2 with optional DISPLACEMENT. */
+
+ for (i = 0; i < phdrs_size / sizeof (Elf32_External_Phdr); i++)
+ {
+ Elf32_External_Phdr *phdrp;
+ Elf32_External_Phdr *phdr2p;
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
+ CORE_ADDR vaddr, paddr;
+
+ phdrp = &((Elf32_External_Phdr *) buf)[i];
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+ phdr2p = &((Elf32_External_Phdr *) buf2)[i];
+
+ /* PT_GNU_STACK addresses are left as zero not being
+ relocated by prelink, their displacing would create false
+ verification failure. Feel free to test the unrelocated
+ comparison for any segment type. */
+
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+ continue;
+
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 4, byte_order);
+ vaddr -= displacement;
+ store_unsigned_integer (buf_vaddr_p, 4, byte_order, vaddr);
+
+ paddr = extract_unsigned_integer (buf_paddr_p, 4, byte_order);
+ paddr -= displacement;
+ store_unsigned_integer (buf_paddr_p, 4, byte_order, paddr);
+
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+ continue;
+
+ ok = 0;
+ break;
+ }
+ }
+ else if (arch_size == 64 && phdrs_size >= sizeof (Elf64_External_Phdr)
+ && phdrs_size % sizeof (Elf64_External_Phdr) == 0)
+ {
+ Elf_Internal_Ehdr *ehdr2 = elf_tdata (exec_bfd)->elf_header;
+ Elf_Internal_Phdr *phdr2 = elf_tdata (exec_bfd)->phdr;
+ CORE_ADDR displacement = 0;
+ int i;
+
+ /* DISPLACEMENT could be found easier by the difference of
+ ehdr2->e_entry but already read BUF does not contain ehdr. */
+
+ for (i = 0; i < ehdr2->e_phnum; i++)
+ if (phdr2[i].p_type == PT_LOAD)
+ {
+ Elf64_External_Phdr *phdrp;
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
+ CORE_ADDR vaddr, paddr;
+ CORE_ADDR displacement_vaddr = 0;
+ CORE_ADDR displacement_paddr = 0;
+
+ phdrp = &((Elf64_External_Phdr *) buf)[i];
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 8,
+ byte_order);
+ displacement_vaddr = vaddr - phdr2[i].p_vaddr;
+
+ paddr = extract_unsigned_integer (buf_paddr_p, 8,
+ byte_order);
+ displacement_paddr = paddr - phdr2[i].p_paddr;
+
+ if (displacement_vaddr == displacement_paddr)
+ displacement = displacement_vaddr;
+
+ break;
+ }
+
+ /* Now compare BUF and BUF2 with optional DISPLACEMENT. */
+
+ for (i = 0; i < phdrs_size / sizeof (Elf64_External_Phdr); i++)
+ {
+ Elf64_External_Phdr *phdrp;
+ Elf64_External_Phdr *phdr2p;
+ gdb_byte *buf_vaddr_p, *buf_paddr_p;
+ CORE_ADDR vaddr, paddr;
+
+ phdrp = &((Elf64_External_Phdr *) buf)[i];
+ buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
+ buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
+ phdr2p = &((Elf64_External_Phdr *) buf2)[i];
+
+ /* PT_GNU_STACK addresses are left as zero not being
+ relocated by prelink, their displacing would create false
+ verification failure. Feel free to test the unrelocated
+ comparison for any segment type. */
+
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+ continue;
+
+ vaddr = extract_unsigned_integer (buf_vaddr_p, 8, byte_order);
+ vaddr -= displacement;
+ store_unsigned_integer (buf_vaddr_p, 8, byte_order, vaddr);
+
+ paddr = extract_unsigned_integer (buf_paddr_p, 8, byte_order);
+ paddr -= displacement;
+ store_unsigned_integer (buf_paddr_p, 8, byte_order, paddr);
+
+ if (memcmp (phdrp, phdr2p, sizeof (*phdrp)) == 0)
+ continue;
+
+ ok = 0;
+ break;
+ }
+ }
+ else
+ ok = 0;
+ }
xfree (buf);
xfree (buf2);
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -154,6 +154,12 @@ proc prelinkYES {arg {name ""}} {
if {$name == ""} {
set name [file tail $arg]
}
+
+ # Try to unprelink it first so that if it has been already prelinked before
+ # we get different address now and the result is not affected by the
+ # previous $arg state..
+ prelinkNO $arg "$name pre-unprelink"
+
set test "prelink $name"
set command "exec /usr/sbin/prelink -qNR --no-exec-shield $arg"
verbose -log "command is $command"
@@ -319,38 +325,12 @@ proc test_core {file displacement} {
set pf_prefix $old_ldprefix
}
-proc test_attach {file displacement} {
- global board_info gdb_prompt expect_out
-
- gdb_exit
-
- set test "sleep function started"
-
- set command "${file} sleep"
- set res [remote_spawn host $command];
- if { $res < 0 || $res == "" } {
- perror "Spawning $command failed."
- fail $test
- return
- }
- set pid [exp_pid -i $res]
- gdb_expect {
- -re "sleeping\r\n" {
- pass $test
- }
- eof {
- fail "$test (eof)"
- return
- }
- timeout {
- fail "$test (timeout)"
- return
- }
- }
+proc test_attach_gdb {file pid displacement prefix} {
+ global gdb_prompt expect_out
global pf_prefix
set old_ldprefix $pf_prefix
- lappend pf_prefix "attach:"
+ lappend pf_prefix "$prefix:"
gdb_exit
gdb_start
@@ -358,9 +338,13 @@ proc test_attach {file displacement} {
# Print the "PIE (Position Independent Executable) displacement" message.
gdb_test "set verbose on"
+ if {$file != ""} {
+ gdb_test "file $file" "Reading symbols from .*done\\." "file"
+ }
+
set test "attach"
gdb_test_multiple "attach $pid" $test {
- -re "Attaching to process $pid\r\n" {
+ -re "Attaching to (program: .*, )?process $pid\r\n" {
# Missing "$gdb_prompt $" is intentional.
pass $test
}
@@ -396,11 +380,56 @@ proc test_attach {file displacement} {
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
gdb_exit
- remote_exec host "kill -9 $pid"
-
set pf_prefix $old_ldprefix
}
+proc test_attach {file displacement {relink_args ""}} {
+ global board_info
+
+ gdb_exit
+
+ set test "sleep function started"
+
+ set command "${file} sleep"
+ set res [remote_spawn host $command];
+ if { $res < 0 || $res == "" } {
+ perror "Spawning $command failed."
+ fail $test
+ return
+ }
+ set pid [exp_pid -i $res]
+ gdb_expect {
+ -re "sleeping\r\n" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ return
+ }
+ timeout {
+ fail "$test (timeout)"
+ return
+ }
+ }
+
+ if {$relink_args == ""} {
+ test_attach_gdb "" $pid $displacement "attach"
+ } else {
+ # These could be rather passed as arguments.
+ global exec interp_saved interp
+
+ foreach relink {YES NO} {
+ if {[prelink$relink $relink_args [file tail $exec]]
+ && [copy $interp_saved $interp]} {
+ # /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
+ test_attach_gdb $exec $pid $displacement "attach-relink$relink"
+ }
+ }
+ }
+
+ remote_exec host "kill -9 $pid"
+}
+
proc test_ld {file ifmain trynosym displacement} {
global srcdir subdir gdb_prompt expect_out
@@ -609,7 +638,10 @@ foreach ldprelink {NO YES} {
set old_binprefix $pf_prefix
foreach binprelink {NO YES} {
foreach binsepdebug {NO IN SEP} {
- foreach binpie {NO YES} {
+ # "ATTACH" is like "YES" but it is modified during run.
+ # It cannot be used for problem reproducibility after the
+ # testcase ends.
+ foreach binpie {NO YES ATTACH} {
# This combination is not possible, non-PIE (fixed address)
# binary cannot be prelinked to any (other) address.
if {$binprelink == "YES" && $binpie == "NO"} {
@@ -628,7 +660,7 @@ foreach ldprelink {NO YES} {
if {$binsepdebug != "NO"} {
lappend opts {debug}
}
- if {$binpie == "YES"} {
+ if {$binpie != "NO"} {
lappend opts {additional_flags=-fPIE -pie}
}
if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
@@ -680,16 +712,45 @@ foreach ldprelink {NO YES} {
lappend dests $dest
}
- if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" [file tail $exec]]
+ if {$binpie == "NO"} {
+ set displacement "NONE"
+ } elseif {$binprelink == "NO"} {
+ set displacement "NONZERO"
+ } else {
+ set displacement "ZERO"
+ }
+
+ set relink_args "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]"
+ if {[prelink$binprelink $relink_args [file tail $exec]]
&& [copy $interp_saved $interp]} {
- if {$binpie == "NO"} {
- set displacement "NONE"
- } elseif {$binprelink == "NO"} {
- set displacement "NONZERO"
+ if {$binpie != "ATTACH"} {
+ test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
} else {
- set displacement "ZERO"
+ # If the file has been randomly prelinked it must
+ # be "NONZERO". We could see "ZERO" only if it was
+ # unprelinked na it is now running at the same
+ # address - which is 0 but executable can never run
+ # at address 0.
+
+ set displacement "NONZERO"
+ test_attach $exec $displacement $relink_args
+
+ # ATTACH executables + libraries get modified since
+ # they have been run. They cannot be used for
+ # problem reproducibility after the testcase ends.
+ set exec_debug [system_debug_get $exec]
+ if {$exec_debug != ""} {
+ # `file delete [glob "${exec_debug}*"]' does not work.
+ foreach f [glob "${exec_debug}*"] {
+ file delete $f
+ }
+ }
+ file delete -force $dir
+ # `file delete [glob "${exec}*"]' does not work.
+ foreach f [glob "${exec}*"] {
+ file delete $f
+ }
}
- test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
}
}
}

View File

@ -0,0 +1,87 @@
http://sourceware.org/ml/gdb-patches/2010-03/msg01000.html
Subject: [patch 2/6] PIE: Attach binary even after ld.so re-prelinked underneath
Hi,
when I have seen the PIE-binary-changed-sice-start tested also
ld.so-changed-since-start and it did not work.
There is questionable when to print and when to not to print non-fatal memory
read errors. Similar change I requested in
Re: [RFC/ia64] memory error when reading wrong core file
http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html
so that GDB prints at least as a warning
Cannot access memory at address ...
when some unexpected error happens.
Contrary to it there is not such warning present in the code below as in the
case of non-valgrind PIE with re-prelinked ld.so the memory read error happens
there. Some GDB code rework could probably avoid it.
Just for example all the memory read errors in read_program_header or even
- primarily - scan_dyntag are currently IMO-incorrectly silent and others.
Therefore posted the patch this way, making all these warnings printed and
possibly fixing code attempting incorrect reads along the way could be done by
a different patch.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
patch series together.
Thanks,
Jan
gdb/
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* auxv.c (ld_so_xfer_auxv): Do not error on failed read of data_address.
gdb/testsuite/
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/break-interp.exp (test_attach): Keep $interp changed. Move
its restore after the <$relink_args != ""> loop. new comment.
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -96,7 +96,16 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
pointer_address = SYMBOL_VALUE_ADDRESS (msym);
- data_address = read_memory_typed_address (pointer_address, ptr_type);
+ /* While it is an error I am not aware how to solve attaching to PIE under
+ valgrind --db-attach=yes different way when ld.so on-disk file has prelink
+ change in the meantime. Currently GDB will drop back to procfs_xfer_auxv
+ (so that at least non-valgrind PIE attachments with prelink change of
+ ld.so work). To make it working even with valgrind is PR 11440 requiring
+ a valgrind extension. */
+ if (target_read_memory (pointer_address, ptr_buf, ptr_size) != 0)
+ return -1;
+
+ data_address = extract_typed_address (ptr_buf, ptr_type);
/* Possibly still not initialized such as during an inferior startup. */
if (data_address == 0)
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -419,12 +419,16 @@ proc test_attach {file displacement {relink_args ""}} {
global exec interp_saved interp
foreach relink {YES NO} {
- if {[prelink$relink $relink_args [file tail $exec]]
- && [copy $interp_saved $interp]} {
+ # It would be more correct to also [copy $interp_saved $interp]
+ # here to really test just different prelink of $exec.
+ # But we would need a separate test for different prelink of ld.so
+ # where a bug occured. It is now all merged into this single test.
+ if [prelink$relink $relink_args [file tail $exec]] {
# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
test_attach_gdb $exec $pid $displacement "attach-relink$relink"
}
}
+ copy $interp_saved $interp
}
remote_exec host "kill -9 $pid"

View File

@ -0,0 +1,412 @@
http://sourceware.org/ml/gdb-patches/2010-03/msg01001.html
Subject: [patch 3/6] PIE: Fix occasional error attaching i686 binary
[ Testcase diff backported. ]
Hi,
this is the real bugreport which started this patch series.
gdb "Cannot access memory" on a running process
https://bugzilla.redhat.com/show_bug.cgi?id=576742
Offsets on i686 cause that while attaching to an unprelinked running PIE
scan_dyntag will incorrectly get a successful read in scan_dyntag from DT_DEBUG
it expects is from the mani executable but in fact it is from some ld.so or
libc.so (located low for --exec-shield). Another issue is that scan_dyntag
could verify more that the target memory matches the .dynamic section it is
reading from exec_bfd. It could also complain when the read failed (as always
failed so for for PIE attaches first, succeeded later so nobody has noticed
anything).
The successful read reads a bogus DT_DEBUG value and GDB errors on it later.
This is again a non-fatal error after the patch by Joel Brobecker above but it
was not so before and it is incorrect anyway.
The svr4_relocate_main_executable call in svr4_special_symbol_handling was
there before delayed that way for svr4_static_exec_displacement.
But svr4_static_exec_displacement has been removed in the meantime by:
Re: RFC: Verify AT_ENTRY before using it
http://sourceware.org/ml/gdb-patches/2010-03/msg00030.html
So it can be simplified + corrected now. Moreover GDB will now finally print
exactly "Using PIE (Position Independent Executable) displacement" exactly
once.
The reproducer depends on various offsets which may be distro dependent but it
was made so that it is hopefully reproducible everywhere. Reproduced + fixed
on Fedora 12 x86_64 and i686.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu for the whole
patch series together.
Thanks,
Jan
gdb/
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* auxv.c (memory_xfer_auxv): Update attach comment.
* solib-svr4.c (svr4_special_symbol_handling): Remove the call to
svr4_relocate_main_executable.
(svr4_solib_create_inferior_hook): Make the call to
svr4_relocate_main_executable unconditional.
gdb/testsuite/
2010-03-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/attach-pie-misread.exp, gdb.base/attach-pie-misread.c: New.
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -198,7 +198,8 @@ memory_xfer_auxv (struct target_ops *ops,
/* ld_so_xfer_auxv is the only function safe for virtual executables being
executed by valgrind's memcheck. As using ld_so_xfer_auxv is problematic
- during inferior startup GDB does call it only for attached processes. */
+ during inferior startup as ld.so symbol tables are not yet relocated GDB
+ calls ld_so_xfer_auxv only for attached processes. */
if (current_inferior ()->attach_flag != 0)
{
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1628,7 +1628,6 @@ enable_break (struct svr4_info *info, int from_tty)
static void
svr4_special_symbol_handling (void)
{
- svr4_relocate_main_executable ();
}
/* Read the ELF program headers from ABFD. Return the contents and
@@ -2065,8 +2064,7 @@ svr4_solib_create_inferior_hook (int from_tty)
info = get_svr4_info ();
/* Relocate the main executable if necessary. */
- if (current_inferior ()->attach_flag == 0)
- svr4_relocate_main_executable ();
+ svr4_relocate_main_executable ();
if (!svr4_have_link_map_offsets ())
return;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.c
@@ -0,0 +1,47 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <unistd.h>
+
+const char stub[] = {
+#ifdef GEN
+# include GEN
+#endif
+};
+
+int
+main (int argc, char **argv)
+{
+ /* Generator of GEN written in Python takes about 15s for x86_64's 4MB. */
+ if (argc == 2)
+ {
+ long count = strtol (argv[1], NULL, 0);
+
+ while (count-- > 0)
+ puts ("0x55,");
+
+ return 0;
+ }
+ if (argc != 1)
+ return 1;
+
+ puts ("sleeping");
+ fflush (stdout);
+
+ return sleep (60);
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/attach-pie-misread.exp
@@ -0,0 +1,209 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test only works on GNU/Linux.
+if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} {
+ continue
+}
+
+set test "attach-pie-misread"
+set srcfile ${test}.c
+set genfile ${objdir}/${subdir}/${test}-gen.h
+set executable ${test}
+set binfile ${objdir}/${subdir}/${executable}
+
+if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie"]] == -1} {
+ return -1
+}
+
+# Program Headers:
+# Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+# LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x134f5ec 0x134f5ec R E 0x200000
+# LOAD 0x134f5f0 0x000000000194f5f0 0x000000000194f5f0 0x1dbc60 0x214088 RW 0x200000
+# DYNAMIC 0x134f618 0x000000000194f618 0x000000000194f618 0x000200 0x000200 RW 0x8
+#
+proc read_phdr {binfile test} {
+ set readelf_program [transform readelf]
+ set command "exec $readelf_program -Wl $binfile"
+ verbose -log "command is $command"
+ set result [catch $command output]
+ verbose -log "result is $result"
+ verbose -log "output is $output"
+ if {$result != 0} {
+ fail $test
+ return
+ }
+ if ![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr] {
+ fail "$test (no Program Headers)"
+ return
+ }
+ if ![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr] {
+ fail "$test (no DYNAMIC found)"
+ return
+ }
+ verbose -log "dynamic_vaddr is $dynamic_vaddr"
+ set align_max -1
+ foreach {trash align} [regexp -line -all -inline {^ *LOAD .* (0x[0-9]+)$} $phdr] {
+ if {$align_max < $align} {
+ set align_max $align
+ }
+ }
+ verbose -log "align_max is $align_max"
+ if {$align_max == -1} {
+ fail "$test (no LOAD found)"
+ return
+ }
+ pass $test
+ return [list $dynamic_vaddr $align_max]
+}
+
+set phdr [read_phdr $binfile "readelf initial scan"]
+set dynamic_vaddr [lindex $phdr 0]
+set align_max [lindex $phdr 1]
+
+set stub_size [format 0x%x [expr "2 * $align_max - ($dynamic_vaddr & ($align_max - 1))"]]
+verbose -log "stub_size is $stub_size"
+
+# On x86_64 it is commonly about 4MB.
+if {$stub_size > 25000000} {
+ xfail "stub size $stub_size is too large"
+ return
+}
+
+set test "generate stub"
+set command "exec $binfile $stub_size >$genfile"
+verbose -log "command is $command"
+set result [catch $command output]
+verbose -log "result is $result"
+verbose -log "output is $output"
+if {$result == 0} {
+ pass $test
+} else {
+ fail $test
+}
+
+if {[build_executable ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -pie -DGEN=\"$genfile\""]] == -1} {
+ return -1
+}
+
+# x86_64 file has 25MB, no need to keep it.
+file delete -- $genfile
+
+set phdr [read_phdr $binfile "readelf rebuilt with stub_size"]
+set dynamic_vaddr_prelinkno [lindex $phdr 0]
+
+set command "exec /usr/sbin/prelink -q -N --no-exec-shield -R $binfile"
+verbose -log "command is $command"
+set result [catch $command output]
+verbose -log "result is $result"
+verbose -log "output is $output"
+
+set test "prelink -R"
+if {$result == 0 && $output == ""} {
+ pass $test
+} elseif {$result == 1 && [regexp {^(couldn't execute "/usr/sbin/prelink[^\r\n]*": no such file or directory\n?)*$} $output]} {
+ untested attach-pie-misread.exp
+ return -1
+} else {
+ fail $test
+}
+
+set phdr [read_phdr $binfile "readelf with prelink -R"]
+set dynamic_vaddr_prelinkyes [lindex $phdr 0]
+
+set first_offset [format 0x%x [expr $dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno]]
+verbose -log "first_offset is $first_offset"
+
+set test "first offset is non-zero"
+if {$first_offset == 0} {
+ fail "$test (-fPIE -pie in effect?)"
+} else {
+ pass $test
+}
+
+set test "start inferior"
+gdb_exit
+
+set res [remote_spawn host $binfile];
+if { $res < 0 || $res == "" } {
+ perror "Spawning $binfile failed."
+ fail $test
+ return
+}
+set pid [exp_pid -i $res]
+gdb_expect {
+ -re "sleeping\r\n" {
+ pass $test
+ }
+ eof {
+ fail "$test (eof)"
+ remote_exec host "kill -9 $pid"
+ return
+ }
+ timeout {
+ fail "$test (timeout)"
+ remote_exec host "kill -9 $pid"
+ return
+ }
+}
+
+# Due to alignments it was reproducible with 1 on x86_64 but 2 on i686.
+foreach align_mult {1 2} {
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "shift-by-$align_mult:"
+
+ # FIXME: We believe there is enough room under FIRST_OFFSET.
+ set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
+ verbose -log "shifted_offset is $shifted_offset"
+
+ set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offset $binfile"
+ verbose -log "command is $command"
+ set result [catch $command output]
+ verbose -log "result is $result"
+ verbose -log "output is $output"
+
+ set test "prelink -r"
+ if {$result == 0 && $output == ""} {
+ pass $test
+ } else {
+ fail $test
+ }
+
+ clean_restart $executable
+
+ set test "attach"
+ gdb_test_multiple "attach $pid" $test {
+ -re "Attaching to program: .*, process $pid\r\n" {
+ # Missing "$gdb_prompt $" is intentional.
+ pass $test
+ }
+ }
+
+ set test "error on Cannot access memory at address"
+ gdb_test_multiple "" $test {
+ -re "\r\nCannot access memory at address .*$gdb_prompt $" {
+ fail $test
+ }
+ -re "$gdb_prompt $" {
+ pass $test
+ }
+ }
+
+ gdb_test "detach" "Detaching from program: .*"
+
+ set pf_prefix $old_ldprefix
+}
+
+remote_exec host "kill -9 $pid"
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -248,9 +248,8 @@ proc reach {func command displacement} {
}
if {$displacement == $case} {
pass $test_displacement
- # Permit multiple such messages.
set displacement "FOUND-$displacement"
- } elseif {$displacement != "FOUND-$case"} {
+ } else {
fail $test_displacement
}
exp_continue
@@ -304,9 +303,8 @@ proc test_core {file displacement} {
}
if {$displacement == $case} {
pass $test_displacement
- # Permit multiple such messages.
set displacement "FOUND-$displacement"
- } elseif {$displacement != "FOUND-$case"} {
+ } else {
fail $test_displacement
}
exp_continue
@@ -362,9 +360,8 @@ proc test_attach_gdb {file pid displacement prefix} {
}
if {$displacement == $case} {
pass $test_displacement
- # Permit multiple such messages.
set displacement "FOUND-$displacement"
- } elseif {$displacement != "FOUND-$case"} {
+ } else {
fail $test_displacement
}
exp_continue
@@ -451,9 +448,7 @@
gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
if $ifmain {
- # Displacement message will be printed the second time on initializing
- # the linker from svr4_special_symbol_handling.
- reach "main" continue $displacement
+ reach "main" continue "NONE"
reach "libfunc" continue "NONE"
@@ -528,9 +517,8 @@ proc test_ld {file ifmain trynosym displacement} {
}
if {$displacement == $case} {
pass $test_displacement
- # Permit multiple such messages.
set displacement "FOUND-$displacement"
- } elseif {$displacement != "FOUND-$case"} {
+ } else {
fail $test_displacement
}
exp_continue

127
gdb-pie-rerun.patch Normal file
View File

@ -0,0 +1,127 @@
http://sourceware.org/ml/gdb-patches/2010-03/msg00868.html
Subject: [patch] PIE: Fix back re-run [Re: [patch] svr4_exec_displacement success indicator]
Hi,
currently:
$ echo 'main(){}'|gcc -o 1 -fPIE -pie -x c -; ./gdb -nx -ex 'set disable-randomization off' -ex 'b main' -ex r -ex c -ex r ./1
Breakpoint 1 at 0x6b0
Starting program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/1
Breakpoint 1, 0x00007fbf73e8c6b0 in main ()
Continuing.
Program exited with code 0140.
Starting program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/1
Error in re-setting breakpoint 1: Cannot access memory at address 0x7fbf73e8c6ac
It is since:
[patch] svr4_exec_displacement success indicator [Re: PIE question]
http://sourceware.org/ml/gdb-patches/2010-03/msg00336.html
On Mon, 08 Mar 2010 22:53:58 +0100, Jan Kratochvil wrote:
> Attached these changes:
>
> * svr4_exec_displacement calling convention should have success indicator.
>
> * Preserving now section_offsets if they are already set, inspired by
> init_objfile_sect_indices.
>
> I believe either of parts would be sufficient for this problem.
The first part has caused the regression for PIE on native x86* GNU/Linux host.
As I believe for Daniel J.'s seen regression of `qOffsets' the second already
checked-in part is sufficient - I would like to remove the first part.
OK to check it in?
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
(I do not think one needs to think about 7.1-branch as it is not a regression
against any FSF GDB release.)
Thanks,
Jan
gdb/
2010-03-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix re-run of PIE executable.
* solib-svr4.c (svr4_relocate_main_executable) <symfile_objfile>: Remove
the part of pre-set SYMFILE_OBJFILE->SECTION_OFFSETS.
gdb/testsuite/
2010-03-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix re-run of PIE executable.
* gdb.base/break-interp.exp (test_ld): Turn off "disable-randomization".
Remove $displacement_main to match the solib-svr4.c change. New "kill"
and re-"run" of the inferior.
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1791,17 +1791,10 @@ svr4_relocate_main_executable (void)
{
CORE_ADDR displacement;
- if (symfile_objfile)
- {
- int i;
-
- /* Remote target may have already set specific offsets by `qOffsets'
- which should be preferred. */
-
- for (i = 0; i < symfile_objfile->num_sections; i++)
- if (ANOFFSET (symfile_objfile->section_offsets, i) != 0)
- return;
- }
+ /* SYMFILE_OBJFILE->SECTION_OFFSETS may now contain displacement from the
+ previous run of the inferior. Re-set it according to the current value,
+ if we can find it out. But otherwise keep it as for remote target it may
+ have been pre-set by the `qOffsets' packet. */
if (! svr4_exec_displacement (&displacement))
return;
--- a/gdb/testsuite/gdb.base/break-interp.exp
+++ b/gdb/testsuite/gdb.base/break-interp.exp
@@ -416,25 +416,28 @@ proc test_ld {file ifmain trynosym displacement} {
# Print the "PIE (Position Independent Executable) displacement" message.
gdb_test "set verbose on"
+ # A bit better test coverage.
+ gdb_test "set disable-randomization off"
+
reach "dl_main" "run segv" $displacement
gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
if $ifmain {
# Displacement message will be printed the second time on initializing
- # the linker from svr4_special_symbol_handling. If any ANOFFSET has
- # been already set as non-zero the detection will no longer be run.
- if {$displacement == "NONZERO"} {
- set displacement_main "NONE"
- } else {
- set displacement_main $displacement
- }
- reach "main" continue $displacement_main
+ # the linker from svr4_special_symbol_handling.
+ reach "main" continue $displacement
reach "libfunc" continue "NONE"
gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt"
+ }
+ # Try re-run if the new PIE displacement takes effect.
+ gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
+ reach "dl_main" "run segv" $displacement
+
+ if $ifmain {
test_core $file $displacement
test_attach $file $displacement

View File

@ -1,21 +0,0 @@
pcc regression from:
http://sourceware.org/ml/gdb-patches/2008-12/msg00143.html
gdb/
2009-12-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (update_watchpoint): Set B->TYPE to bp_watchpoint before
calling hw_watchpoint_used_count.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1152,6 +1152,9 @@ update_watchpoint (struct breakpoint *b, int reparse)
{
int i, mem_cnt, other_type_used;
+ /* Do not count with B twice below. */
+ b->type = bp_watchpoint;
+
i = hw_watchpoint_used_count (bp_hardware_watchpoint,
&other_type_used);
mem_cnt = can_use_hardware_watchpoint (val_chain);

295
gdb-ppc-power7-test.patch Normal file
View File

@ -0,0 +1,295 @@
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp
@@ -0,0 +1,182 @@
+# Copyright 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 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.
+
+# Test PowerPC Power7 instructions disassembly.
+
+if {![istarget "powerpc*-*-*"]} then {
+ verbose "Skipping PowerPC Power7 instructions disassembly."
+ return
+}
+
+set testfile "powerpc-power7"
+set srcfile ${testfile}.s
+set objfile ${objdir}/${subdir}/${testfile}.o
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } {
+ untested "PowerPC Power7 instructions disassembly"
+ return -1
+}
+
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${objfile}
+
+
+# Disassemble the function.
+
+set test "disass func"
+gdb_test_multiple $test $test {
+ -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" {
+ set func $expect_out(1,string)
+ pass $test
+ }
+}
+
+proc instr_to_patt {offset instr} {
+ # 0x0000000000000018 <func+24>: stxvd2x vs43,r4,r5
+ return ".*\r\n\[ \t\]*[string map {0x 0x0*} $offset] <(func)?\\+?\[0-9\]*>:\[ \t\]*[string map [list { } "\[ \t\]+" . {\.}] $instr]\[ \t\]*\r\n.*"
+}
+
+# KFAIL strings would not exist if -Many would print the same as -Mpower7.
+# That means the power7 form should be the preferred one.
+# http://sourceware.org/ml/gdb-patches/2009-03/threads.html#00020
+
+proc func_check {offset instr {kfail ""}} {
+ global func
+
+ set test "Found $offset: $instr"
+ if [regexp -nocase -line [instr_to_patt $offset $instr] $func] {
+ pass $test
+ } elseif {$kfail != "" && [regexp -nocase -line [instr_to_patt $offset $kfail] $func]} {
+ kfail gdb/NNNN $test
+ } else {
+ fail $test
+ }
+}
+
+func_check 0x0 "lxvd2x vs3,r4,r5"
+# [PATCH] Remove support for POWER7 VSX load/store with update instructions
+# http://sourceware.org/ml/binutils/2009-09/msg00680.html
+# http://sourceware.org/ml/binutils-cvs/2009-09/msg00331.html
+# lxvd2ux vs3,r4,r5
+func_check 0x4 ".long 0x7c642ed8"
+func_check 0x8 "lxvd2x vs43,r4,r5"
+# lxvd2ux vs43,r4,r5
+func_check 0xc ".long 0x7d642ed9"
+func_check 0x10 "stxvd2x vs3,r4,r5"
+# stxvd2ux vs3,r4,r5
+func_check 0x14 ".long 0x7c642fd8"
+func_check 0x18 "stxvd2x vs43,r4,r5"
+# stxvd2ux vs43,r4,r5
+func_check 0x1c ".long 0x7d642fd9"
+func_check 0x20 "xxmrghd vs3,vs4,vs5"
+func_check 0x24 "xxmrghd vs43,vs44,vs45"
+func_check 0x28 "xxmrgld vs3,vs4,vs5"
+func_check 0x2c "xxmrgld vs43,vs44,vs45"
+func_check 0x30 "xxmrghd vs3,vs4,vs5"
+func_check 0x34 "xxmrghd vs43,vs44,vs45"
+func_check 0x38 "xxmrgld vs3,vs4,vs5"
+func_check 0x3c "xxmrgld vs43,vs44,vs45"
+func_check 0x40 "xxpermdi vs3,vs4,vs5,1"
+func_check 0x44 "xxpermdi vs43,vs44,vs45,1"
+func_check 0x48 "xxpermdi vs3,vs4,vs5,2"
+func_check 0x4c "xxpermdi vs43,vs44,vs45,2"
+func_check 0x50 "xvmovdp vs3,vs4"
+func_check 0x54 "xvmovdp vs43,vs44"
+func_check 0x58 "xvmovdp vs3,vs4"
+func_check 0x5c "xvmovdp vs43,vs44"
+func_check 0x60 "xvcpsgndp vs3,vs4,vs5"
+func_check 0x64 "xvcpsgndp vs43,vs44,vs45"
+func_check 0x68 "wait"
+func_check 0x6c "wait"
+func_check 0x70 "waitrsv"
+func_check 0x74 "waitrsv"
+func_check 0x78 "waitimpl"
+func_check 0x7c "waitimpl"
+func_check 0x80 "doze"
+func_check 0x84 "nap"
+func_check 0x88 "sleep"
+func_check 0x8c "rvwinkle"
+func_check 0x90 "prtyw r3,r4"
+func_check 0x94 "prtyd r13,r14"
+func_check 0x98 "mfcfar r10" "mfspr r10,28"
+func_check 0x9c "mtcfar r11" "mtspr 28,r11"
+func_check 0xa0 "cmpb r3,r4,r5"
+func_check 0xa4 "lwzcix r10,r11,r12"
+func_check 0xa8 "dadd f16,f17,f18"
+func_check 0xac "daddq f20,f22,f24"
+func_check 0xb0 "dss 3"
+func_check 0xb4 "dssall"
+func_check 0xb8 "dst r5,r4,1"
+func_check 0xbc "dstt r8,r7,0"
+func_check 0xc0 "dstst r5,r6,3"
+func_check 0xc4 "dststt r4,r5,2"
+func_check 0xc8 "divwe r10,r11,r12"
+func_check 0xcc "divwe. r11,r12,r13"
+func_check 0xd0 "divweo r12,r13,r14"
+func_check 0xd4 "divweo. r13,r14,r15"
+func_check 0xd8 "divweu r10,r11,r12"
+func_check 0xdc "divweu. r11,r12,r13"
+func_check 0xe0 "divweuo r12,r13,r14"
+func_check 0xe4 "divweuo. r13,r14,r15"
+func_check 0xe8 "bpermd r7,r17,r27"
+func_check 0xec "popcntw r10,r20"
+func_check 0xf0 "popcntd r10,r20"
+func_check 0xf4 "ldbrx r20,r21,r22"
+func_check 0xf8 "stdbrx r20,r21,r22"
+func_check 0xfc "lfiwzx f10,0,r10"
+func_check 0x100 "lfiwzx f10,r9,r10"
+func_check 0x104 "fcfids f4,f5"
+func_check 0x108 "fcfids. f4,f5"
+func_check 0x10c "fcfidus f4,f5"
+func_check 0x110 "fcfidus. f4,f5"
+func_check 0x114 "fctiwu f4,f5"
+func_check 0x118 "fctiwu. f4,f5"
+func_check 0x11c "fctiwuz f4,f5"
+func_check 0x120 "fctiwuz. f4,f5"
+func_check 0x124 "fctidu f4,f5"
+func_check 0x128 "fctidu. f4,f5"
+func_check 0x12c "fctiduz f4,f5"
+func_check 0x130 "fctiduz. f4,f5"
+func_check 0x134 "fcfidu f4,f5"
+func_check 0x138 "fcfidu. f4,f5"
+func_check 0x13c "ftdiv cr0,f10,f11"
+func_check 0x140 "ftdiv cr7,f10,f11"
+func_check 0x144 "ftsqrt cr0,f10"
+func_check 0x148 "ftsqrt cr7,f10"
+func_check 0x14c "dcbtt r8,r9" "dcbt 16,r8,r9"
+func_check 0x150 "dcbtstt r8,r9" "dcbtst 16,r8,r9"
+func_check 0x154 "dcffix f10,f12"
+func_check 0x158 "dcffix. f20,f22"
+func_check 0x15c "lbarx r10,r11,r12"
+func_check 0x160 "lbarx r10,r11,r12"
+func_check 0x164 "lbarx r10,r11,r12,1"
+func_check 0x168 "lharx r20,r21,r22"
+func_check 0x16c "lharx r20,r21,r22"
+func_check 0x170 "lharx r20,r21,r22,1"
+func_check 0x174 "stbcx. r10,r11,r12"
+func_check 0x178 "sthcx. r10,r11,r12"
+func_check 0x17c "fre f14,f15"
+func_check 0x180 "fre. f14,f15"
+func_check 0x184 "fres f14,f15"
+func_check 0x188 "fres. f14,f15"
+func_check 0x18c "frsqrte f14,f15"
+func_check 0x190 "frsqrte. f14,f15"
+func_check 0x194 "frsqrtes f14,f15"
+func_check 0x198 "frsqrtes. f14,f15"
+func_check 0x19c "isel r2,r3,r4,28"
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-power7.s
@@ -0,0 +1,107 @@
+ .text
+ .globl func
+func:
+ .long 0x7c642e98 /* 0: lxvd2x vs3,r4,r5 */
+ .long 0x7c642ed8 /* 4: lxvd2ux vs3,r4,r5 */
+ .long 0x7d642e99 /* 8: lxvd2x vs43,r4,r5 */
+ .long 0x7d642ed9 /* c: lxvd2ux vs43,r4,r5 */
+ .long 0x7c642f98 /* 10: stxvd2x vs3,r4,r5 */
+ .long 0x7c642fd8 /* 14: stxvd2ux vs3,r4,r5 */
+ .long 0x7d642f99 /* 18: stxvd2x vs43,r4,r5 */
+ .long 0x7d642fd9 /* 1c: stxvd2ux vs43,r4,r5 */
+ .long 0xf0642850 /* 20: xxmrghd vs3,vs4,vs5 */
+ .long 0xf16c6857 /* 24: xxmrghd vs43,vs44,vs45 */
+ .long 0xf0642b50 /* 28: xxmrgld vs3,vs4,vs5 */
+ .long 0xf16c6b57 /* 2c: xxmrgld vs43,vs44,vs45 */
+ .long 0xf0642850 /* 30: xxmrghd vs3,vs4,vs5 */
+ .long 0xf16c6857 /* 34: xxmrghd vs43,vs44,vs45 */
+ .long 0xf0642b50 /* 38: xxmrgld vs3,vs4,vs5 */
+ .long 0xf16c6b57 /* 3c: xxmrgld vs43,vs44,vs45 */
+ .long 0xf0642950 /* 40: xxpermdi vs3,vs4,vs5,1 */
+ .long 0xf16c6957 /* 44: xxpermdi vs43,vs44,vs45,1 */
+ .long 0xf0642a50 /* 48: xxpermdi vs3,vs4,vs5,2 */
+ .long 0xf16c6a57 /* 4c: xxpermdi vs43,vs44,vs45,2 */
+ .long 0xf0642780 /* 50: xvmovdp vs3,vs4 */
+ .long 0xf16c6787 /* 54: xvmovdp vs43,vs44 */
+ .long 0xf0642780 /* 58: xvmovdp vs3,vs4 */
+ .long 0xf16c6787 /* 5c: xvmovdp vs43,vs44 */
+ .long 0xf0642f80 /* 60: xvcpsgndp vs3,vs4,vs5 */
+ .long 0xf16c6f87 /* 64: xvcpsgndp vs43,vs44,vs45 */
+ .long 0x7c00007c /* 68: wait */
+ .long 0x7c00007c /* 6c: wait */
+ .long 0x7c20007c /* 70: waitrsv */
+ .long 0x7c20007c /* 74: waitrsv */
+ .long 0x7c40007c /* 78: waitimpl */
+ .long 0x7c40007c /* 7c: waitimpl */
+ .long 0x4c000324 /* 80: doze */
+ .long 0x4c000364 /* 84: nap */
+ .long 0x4c0003a4 /* 88: sleep */
+ .long 0x4c0003e4 /* 8c: rvwinkle */
+ .long 0x7c830134 /* 90: prtyw r3,r4 */
+ .long 0x7dcd0174 /* 94: prtyd r13,r14 */
+ .long 0x7d5c02a6 /* 98: mfcfar r10 */
+ .long 0x7d7c03a6 /* 9c: mtcfar r11 */
+ .long 0x7c832bf8 /* a0: cmpb r3,r4,r5 */
+ .long 0x7d4b662a /* a4: lwzcix r10,r11,r12 */
+ .long 0xee119004 /* a8: dadd f16,f17,f18 */
+ .long 0xfe96c004 /* ac: daddq f20,f22,f24 */
+ .long 0x7c60066c /* b0: dss 3 */
+ .long 0x7e00066c /* b4: dssall */
+ .long 0x7c2522ac /* b8: dst r5,r4,1 */
+ .long 0x7e083aac /* bc: dstt r8,r7,0 */
+ .long 0x7c6532ec /* c0: dstst r5,r6,3 */
+ .long 0x7e442aec /* c4: dststt r4,r5,2 */
+ .long 0x7d4b6356 /* c8: divwe r10,r11,r12 */
+ .long 0x7d6c6b57 /* cc: divwe. r11,r12,r13 */
+ .long 0x7d8d7756 /* d0: divweo r12,r13,r14 */
+ .long 0x7dae7f57 /* d4: divweo. r13,r14,r15 */
+ .long 0x7d4b6316 /* d8: divweu r10,r11,r12 */
+ .long 0x7d6c6b17 /* dc: divweu. r11,r12,r13 */
+ .long 0x7d8d7716 /* e0: divweuo r12,r13,r14 */
+ .long 0x7dae7f17 /* e4: divweuo. r13,r14,r15 */
+ .long 0x7e27d9f8 /* e8: bpermd r7,r17,r27 */
+ .long 0x7e8a02f4 /* ec: popcntw r10,r20 */
+ .long 0x7e8a03f4 /* f0: popcntd r10,r20 */
+ .long 0x7e95b428 /* f4: ldbrx r20,r21,r22 */
+ .long 0x7e95b528 /* f8: stdbrx r20,r21,r22 */
+ .long 0x7d4056ee /* fc: lfiwzx f10,0,r10 */
+ .long 0x7d4956ee /* 100: lfiwzx f10,r9,r10 */
+ .long 0xec802e9c /* 104: fcfids f4,f5 */
+ .long 0xec802e9d /* 108: fcfids. f4,f5 */
+ .long 0xec802f9c /* 10c: fcfidus f4,f5 */
+ .long 0xec802f9d /* 110: fcfidus. f4,f5 */
+ .long 0xfc80291c /* 114: fctiwu f4,f5 */
+ .long 0xfc80291d /* 118: fctiwu. f4,f5 */
+ .long 0xfc80291e /* 11c: fctiwuz f4,f5 */
+ .long 0xfc80291f /* 120: fctiwuz. f4,f5 */
+ .long 0xfc802f5c /* 124: fctidu f4,f5 */
+ .long 0xfc802f5d /* 128: fctidu. f4,f5 */
+ .long 0xfc802f5e /* 12c: fctiduz f4,f5 */
+ .long 0xfc802f5f /* 130: fctiduz. f4,f5 */
+ .long 0xfc802f9c /* 134: fcfidu f4,f5 */
+ .long 0xfc802f9d /* 138: fcfidu. f4,f5 */
+ .long 0xfc0a5900 /* 13c: ftdiv cr0,f10,f11 */
+ .long 0xff8a5900 /* 140: ftdiv cr7,f10,f11 */
+ .long 0xfc005140 /* 144: ftsqrt cr0,f10 */
+ .long 0xff805140 /* 148: ftsqrt cr7,f10 */
+ .long 0x7e084a2c /* 14c: dcbtt r8,r9 */
+ .long 0x7e0849ec /* 150: dcbtstt r8,r9 */
+ .long 0xed406644 /* 154: dcffix f10,f12 */
+ .long 0xee80b645 /* 158: dcffix. f20,f22 */
+ .long 0x7d4b6068 /* 15c: lbarx r10,r11,r12 */
+ .long 0x7d4b6068 /* 160: lbarx r10,r11,r12 */
+ .long 0x7d4b6069 /* 164: lbarx r10,r11,r12,1 */
+ .long 0x7e95b0e8 /* 168: lharx r20,r21,r22 */
+ .long 0x7e95b0e8 /* 16c: lharx r20,r21,r22 */
+ .long 0x7e95b0e9 /* 170: lharx r20,r21,r22,1 */
+ .long 0x7d4b656d /* 174: stbcx. r10,r11,r12 */
+ .long 0x7d4b65ad /* 178: sthcx. r10,r11,r12 */
+ .long 0xfdc07830 /* 17c: fre f14,f15 */
+ .long 0xfdc07831 /* 180: fre. f14,f15 */
+ .long 0xedc07830 /* 184: fres f14,f15 */
+ .long 0xedc07831 /* 188: fres. f14,f15 */
+ .long 0xfdc07834 /* 18c: frsqrte f14,f15 */
+ .long 0xfdc07835 /* 190: frsqrte. f14,f15 */
+ .long 0xedc07834 /* 194: frsqrtes f14,f15 */
+ .long 0xedc07835 /* 198: frsqrtes. f14,f15 */
+ .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */

View File

@ -1,14 +0,0 @@
--- gdb-7.0.1/gdb/python/py-type.c-orig 2010-01-14 00:00:29.000000000 +0100
+++ gdb-7.0.1/gdb/python/py-type.c 2010-01-14 00:14:26.000000000 +0100
@@ -177,7 +177,10 @@ convert_field (struct type *type, int fi
if (PyObject_SetAttrString (result, "artificial", arg) < 0)
goto failarg;
- arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
+ if (TYPE_CODE (type) == TYPE_CODE_CLASS)
+ arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
+ else
+ arg = Py_False;
Py_INCREF (arg);
if (PyObject_SetAttrString (result, "is_base_class", arg) < 0)
goto failarg;

View File

@ -1,312 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
Hi Chet,
FSF GDB currently ships bundled with readline-5.2 which works fine.
But using --with-system-readline and readline-6.0-patchlevel4 has
a regression:
readline-5.2: Run `gdb -nx -q' and type CTRL-C:
(gdb) Quit
(gdb) _
readline-6.0: Run `gdb -nx -q' and type CTRL-C:
(gdb) _
= nothing happens (it gets buffered and executed later)
(It does also FAIL on gdb.gdb/selftest.exp.)
It is because GDB waits in its own poll() mainloop and readline uses via
rl_callback_handler_install and rl_callback_handler_remove. This way the
readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
only stored to _rl_caught_signal but not executed.
Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
_rl_handle_signal is called then the signal is still stored to
_rl_caught_signal. In the _rl_interrupt_immediately case it should not be
stored when it was already processed.
rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
of its meaning it breaks the nest-counting of other routines which do
`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
creating problematic `_rl_interrupt_immediately == -1'.
`_rl_interrupt_immediately' is an internal variable, how it could be accessed
by a readline application? (OK, maybe it should not be used.)
Attaching a current GDB-side patch but it must access readline internal
variable _rl_caught_signal and it is generally just a workaround. Could you
please include support for signals in this asynchronous mode in readline-6.1?
I find it would be enough to make RL_CHECK_SIGNALS public?
GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
But this is not a patch intended to be accepted.
Thanks,
Jan
gdb/
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* config.in, configure: Regenerate.
* configure.ac (for readline_echoing_p): Move inside $LIBS change.
(for _rl_caught_signal): New.
* event-loop.c: Include readline/readline.h.
(gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
gdb/testsuite/
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.gdb/selftest.exp (backtrace through signal handler): Move before
SIGINT pass, drop the timeout case.
(send SIGINT signal to child process): Use gdb_test.
(backtrace through readline handler): New.
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -351,6 +351,9 @@
/* Define if Python interpreter is being linked in. */
#undef HAVE_PYTHON
+/* readline-6.0 workaround of blocked signals. */
+#undef HAVE_READLINE_CAUGHT_SIGNAL
+
/* Define to 1 if you have the `realpath' function. */
#undef HAVE_REALPATH
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -539,17 +539,25 @@ if test "$with_system_readline" = yes; then
# readline-6.0 started to use the name `_rl_echoing_p'.
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- AC_MSG_CHECKING([for readline_echoing_p])
save_LIBS=$LIBS
LIBS="$LIBS $READLINE"
+ AC_MSG_CHECKING([for readline_echoing_p])
AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
return readline_echoing_p;]]),
[READLINE_ECHOING_P=yes],
[READLINE_ECHOING_P=no
AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
[readline-6.0 started to use different name.])])
- LIBS="$save_LIBS"
AC_MSG_RESULT([$READLINE_ECHOING_P])
+ AC_MSG_CHECKING([for _rl_caught_signal])
+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
+ return _rl_caught_signal;]]),
+ [READLINE_CAUGHT_SIGNAL=yes
+ AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
+ [readline-6.0 workaround of blocked signals.])],
+ [READLINE_CAUGHT_SIGNAL=no])
+ AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
+ LIBS="$save_LIBS"
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -37,6 +37,7 @@
#include "exceptions.h"
#include "gdb_assert.h"
#include "gdb_select.h"
+#include "readline/readline.h"
/* Data point to pass to the event handler. */
typedef union event_data
@@ -411,6 +412,9 @@ gdb_do_one_event (void *data)
static int event_source_head = 0;
const int number_of_sources = 3;
int current = 0;
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
+ extern int volatile _rl_caught_signal;
+#endif
/* Any events already waiting in the queue? */
if (process_event ())
@@ -455,6 +459,16 @@ gdb_do_one_event (void *data)
if (gdb_wait_for_event (1) < 0)
return -1;
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
+ if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
+ && _rl_caught_signal)
+ {
+ /* Call RL_CHECK_SIGNALS this way. */
+ rl_callback_handler_remove ();
+ rl_callback_handler_install (NULL, input_handler);
+ }
+#endif
+
/* Handle any new events occurred while waiting. */
if (process_event ())
return 1;
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -464,31 +464,42 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
fail "$description (timeout)"
}
}
-
- set description "send SIGINT signal to child process"
- send_gdb "signal SIGINT\n"
- gdb_expect {
- -re "Continuing with signal SIGINT.*$gdb_prompt $" {
+
+ # get a stack trace with the poll function
+ #
+ # This fails on some linux systems for unknown reasons. On the
+ # systems where it fails, sometimes it works fine when run manually.
+ # The testsuite failures may not be limited to just aout systems.
+ setup_xfail "i*86-pc-linuxaout-gnu"
+ set description "backtrace through signal handler"
+ gdb_test_multiple "backtrace" $description {
+ -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
+ # On the alpha, we hit the infamous problem about gdb
+ # being unable to get the frame pointer (mentioned in
+ # gdb/README). As it is intermittent, there is no way to
+ # XFAIL it which will give us an XPASS if the problem goes
+ # away.
+ setup_xfail "alpha*-*-osf*"
fail "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
- # get a stack trace
+ gdb_test "signal SIGINT" "Continuing with signal SIGINT.*" \
+ "send SIGINT signal to child process"
+
+ # get a stack trace being redelivered by readline
#
# This fails on some linux systems for unknown reasons. On the
# systems where it fails, sometimes it works fine when run manually.
# The testsuite failures may not be limited to just aout systems.
+ # Optional system readline may not have symbols to be shown.
setup_xfail "i*86-pc-linuxaout-gnu"
- set description "backtrace through signal handler"
- send_gdb "backtrace\n"
- gdb_expect {
- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+ set description "backtrace through readline handler"
+ gdb_test_multiple "backtrace" $description {
+ -re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
@@ -500,9 +510,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
setup_xfail "alpha*-*-osf*"
fail "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
--- gdb-7.0/gdb/configure 2009-12-07 18:53:30.000000000 +0100
+++ gdb-7.0-x/gdb/configure 2009-12-07 18:53:14.000000000 +0100
@@ -9201,15 +9201,11 @@ if test "$with_system_readline" = yes; t
# readline-6.0 started to use the name `_rl_echoing_p'.
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- echo "$as_me:$LINENO: checking for readline_echoing_p" >&5
-echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6
save_LIBS=$LIBS
LIBS="$LIBS $READLINE"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
+$as_echo_n "checking for readline_echoing_p... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -9221,45 +9217,45 @@ extern int readline_echoing_p;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"; then :
READLINE_ECHOING_P=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ READLINE_ECHOING_P=no
-READLINE_ECHOING_P=no
+$as_echo "#define readline_echoing_p _rl_echoing_p" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
+$as_echo "$READLINE_ECHOING_P" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
+$as_echo_n "checking for _rl_caught_signal... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-cat >>confdefs.h <<\_ACEOF
-#define readline_echoing_p _rl_echoing_p
+int
+main ()
+{
+extern int volatile _rl_caught_signal;
+ return _rl_caught_signal;
+ ;
+ return 0;
+}
_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ READLINE_CAUGHT_SIGNAL=yes
+
+$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
+else
+ READLINE_CAUGHT_SIGNAL=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
+$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
LIBS="$save_LIBS"
- echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5
-echo "${ECHO_T}$READLINE_ECHOING_P" >&6
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'

View File

@ -1,123 +0,0 @@
gdb/
2009-07-31 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix compatibility of --with-system-readline and readline-6.0+.
* configure.ac <--with-system-readline> (for readline_echoing_p): New
test.
* config.in: Regenerate.
* configure: Regenerate.
Index: gdb-6.8.50.20090909/gdb/configure.ac
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:11:04.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:11:54.000000000 +0200
@@ -773,6 +773,21 @@ if test "$with_system_readline" = yes; t
READLINE=-lreadline
READLINE_DEPS=
READLINE_CFLAGS=
+
+ # readline-6.0 started to use the name `_rl_echoing_p'.
+ # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
+
+ AC_MSG_CHECKING([for readline_echoing_p])
+ save_LIBS=$LIBS
+ LIBS="$LIBS $READLINE"
+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
+ return readline_echoing_p;]]),
+ [READLINE_ECHOING_P=yes],
+ [READLINE_ECHOING_P=no
+ AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
+ [readline-6.0 started to use different name.])])
+ LIBS="$save_LIBS"
+ AC_MSG_RESULT([$READLINE_ECHOING_P])
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'
Index: gdb-6.8.50.20090909/gdb/config.in
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:11:33.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:12:00.000000000 +0200
@@ -815,6 +815,9 @@
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
+/* readline-6.0 started to use different name. */
+#undef readline_echoing_p
+
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported directly. */
Index: gdb-6.8.50.20090909/gdb/configure
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:11:07.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:11:54.000000000 +0200
@@ -9197,6 +9197,69 @@ if test "$with_system_readline" = yes; t
READLINE=-lreadline
READLINE_DEPS=
READLINE_CFLAGS=
+
+ # readline-6.0 started to use the name `_rl_echoing_p'.
+ # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
+
+ echo "$as_me:$LINENO: checking for readline_echoing_p" >&5
+echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6
+ save_LIBS=$LIBS
+ LIBS="$LIBS $READLINE"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+extern int readline_echoing_p;
+ return readline_echoing_p;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ READLINE_ECHOING_P=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+READLINE_ECHOING_P=no
+
+cat >>confdefs.h <<\_ACEOF
+#define readline_echoing_p _rl_echoing_p
+_ACEOF
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS="$save_LIBS"
+ echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5
+echo "${ECHO_T}$READLINE_ECHOING_P" >&6
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'

View File

@ -1,9 +1,20 @@
gdb/linux-nat.c:
- Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595).
--- gdb-6.8/gdb-orig/symfile.c 2008-08-21 00:06:50.000000000 +0200
+++ gdb-6.8/gdb/symfile.c 2008-08-21 22:31:00.000000000 +0200
@@ -1456,8 +1456,10 @@ find_separate_debug_file (struct objfile
Index: gdb-7.0.50.20100115/gdb/elfread.c
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/elfread.c 2010-01-15 22:19:28.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/elfread.c 2010-01-15 22:19:34.000000000 +0100
@@ -582,7 +582,7 @@ elf_symtab_read (struct objfile *objfile
#define BUILD_ID_VERBOSE_NONE 0
#define BUILD_ID_VERBOSE_FILENAMES 1
#define BUILD_ID_VERBOSE_BINARY_PARSE 2
-static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES;
+static int build_id_verbose = BUILD_ID_VERBOSE_NONE;
static void
show_build_id_verbose (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
@@ -1659,8 +1659,10 @@ find_separate_debug_file_by_buildid (str
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
{
@ -14,9 +25,11 @@ gdb/linux-nat.c:
xfree (build_id_name);
}
else if (build_id_name != NULL)
--- ./gdb/corelow.c 2010-01-01 16:04:34.000000000 +0100
+++ ./gdb/corelow.c 2010-01-01 16:06:26.000000000 +0100
@@ -277,7 +277,7 @@ add_to_thread_list (bfd *abfd, asection
Index: gdb-7.0.50.20100115/gdb/corelow.c
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/corelow.c 2010-01-15 22:19:27.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/corelow.c 2010-01-15 22:19:34.000000000 +0100
@@ -294,7 +294,7 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current */
}
@ -25,21 +38,12 @@ gdb/linux-nat.c:
static void
build_id_locate_exec (int from_tty)
--- ./gdb/symfile.c 2010-01-01 16:04:35.000000000 +0100
+++ ./gdb/symfile.c 2010-01-01 16:06:12.000000000 +0100
@@ -1249,7 +1249,7 @@ symbol_file_clear (int from_tty)
#define BUILD_ID_VERBOSE_NONE 0
#define BUILD_ID_VERBOSE_FILENAMES 1
#define BUILD_ID_VERBOSE_BINARY_PARSE 2
-static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES;
+static int build_id_verbose = BUILD_ID_VERBOSE_NONE;
static void
show_build_id_verbose (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
--- gdb-7.0-orig/gdb/linux-nat.c 2009-12-19 20:53:46.000000000 +0100
+++ gdb-7.0/gdb/linux-nat.c 2009-12-19 20:55:02.000000000 +0100
@@ -1604,8 +1604,22 @@ GPT: lwp %s had signal %s, but it is in
*status = lp->status;
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 22:19:27.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 22:19:55.000000000 +0100
@@ -1768,8 +1768,22 @@ GPT: lwp %s had signal %s, but it is in
target_signal_to_string (signo));
}
- if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)

View File

@ -1,8 +1,10 @@
Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as
the default gcc and gfortran binaries are from gcc-4.1.
--- gdb-7.0/gdb/testsuite/gdb.base/vla.exp-orig 2009-12-20 00:38:13.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/vla.exp 2009-12-20 00:54:19.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/vla.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/vla.exp 2010-01-15 22:14:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/vla.exp 2010-01-15 22:14:51.000000000 +0100
@@ -16,7 +16,25 @@
set testfile vla
set srcfile ${testfile}.c
@ -30,8 +32,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
untested "Couldn't compile test program"
return -1
}
--- gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp-orig 2009-12-20 00:38:13.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp 2009-12-20 01:11:47.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/break-interp.exp 2010-01-14 22:12:00.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp 2010-01-15 22:14:51.000000000 +0100
@@ -31,10 +31,30 @@ if [get_compiler_info ${binfile_lib}] {
return -1
}
@ -64,8 +68,8 @@ the default gcc and gfortran binaries are from gcc-4.1.
return -1
}
@@ -483,9 +503,33 @@ foreach ldprelink {NO YES} {
if {$binpie == "YES"} {
@@ -480,9 +500,33 @@ foreach ldprelink {NO YES} {
if {$binpie != "NO"} {
lappend opts {additional_flags=-fPIE -pie}
}
- if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
@ -100,8 +104,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
if {$binsepdebug == "SEP"} {
gdb_gnu_strip_debug $exec
# Just a sanity check. As gdb_gnu_strip_debug uses the
--- ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:21:00.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/common-block.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/common-block.exp 2010-01-15 22:14:17.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/common-block.exp 2010-01-15 22:14:51.000000000 +0100
@@ -20,7 +20,25 @@ set testfile "common-block"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
@ -129,8 +135,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:20:07.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dwarf-stride.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-01-15 22:14:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-01-15 22:14:51.000000000 +0100
@@ -27,7 +27,25 @@
set testfile dwarf-stride
set srcfile ${testfile}.f90
@ -158,8 +166,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
return -1
}
--- ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:17:21.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dynamic.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2010-01-15 22:14:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dynamic.exp 2010-01-15 22:14:51.000000000 +0100
@@ -25,7 +25,25 @@ set testfile "dynamic"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
@ -187,8 +197,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:22:37.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/library-module.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/library-module.exp 2010-01-15 22:14:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/library-module.exp 2010-01-15 22:14:51.000000000 +0100
@@ -25,16 +25,34 @@ if [get_compiler_info not-used] {
return -1
}
@ -228,8 +240,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:28:49.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/module.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/module.exp 2010-01-15 22:14:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/module.exp 2010-01-15 22:14:51.000000000 +0100
@@ -16,7 +16,25 @@
set testfile "module"
set srcfile ${testfile}.f90
@ -257,8 +271,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
return -1
}
--- ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:18:13.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/string.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/string.exp 2010-01-15 22:14:13.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/string.exp 2010-01-15 22:14:51.000000000 +0100
@@ -23,7 +23,25 @@ set testfile "string"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
@ -286,8 +302,10 @@ the default gcc and gfortran binaries are from gcc-4.1.
untested "Couldn't compile ${srcfile}"
return -1
}
--- gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp-orig 2009-12-20 09:47:04.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp 2009-12-20 09:50:06.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/omp-step.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2010-01-15 22:14:16.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/omp-step.exp 2010-01-15 22:14:51.000000000 +0100
@@ -15,7 +15,26 @@
set testfile "omp-step"
@ -316,13 +334,16 @@ the default gcc and gfortran binaries are from gcc-4.1.
return -1
}
--- ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-01-07 13:39:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-12-20 12:37:12.000000000 +0100
@@ -26,7 +26,25 @@ set testfile "derived-type"
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/derived-type.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-01 08:32:02.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-15 22:16:20.000000000 +0100
@@ -28,8 +28,26 @@ set testfile "derived-type"
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 f77}] != ""} {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
@ -334,7 +355,8 @@ the default gcc and gfortran binaries are from gcc-4.1.
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
@ -342,16 +364,19 @@ the default gcc and gfortran binaries are from gcc-4.1.
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/subarray.exp 2009-01-07 13:39:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/subarray.exp 2009-12-20 12:38:00.000000000 +0100
@@ -26,7 +26,25 @@ set testfile "subarray"
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/subarray.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-01 08:32:02.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-15 22:17:18.000000000 +0100
@@ -28,8 +28,26 @@ set testfile "subarray"
set srcfile ${testfile}.f
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 f77}] != ""} {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
@ -363,7 +388,8 @@ the default gcc and gfortran binaries are from gcc-4.1.
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
@ -371,11 +397,13 @@ the default gcc and gfortran binaries are from gcc-4.1.
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:22:18.000000000 +0100
+++ ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:39:53.000000000 +0100
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/tls-sepdebug.exp
===================================================================
--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-01-15 22:14:15.000000000 +0100
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-01-15 22:14:51.000000000 +0100
@@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi
# FIXME: gcc dependency (-Wl,-soname).

View File

@ -0,0 +1,41 @@
[RFC/ia64] memory error when reading wrong core file
http://sourceware.org/ml/gdb-patches/2010-01/msg00645.html
http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html
http://sourceware.org/ml/gdb-patches/2010-03/msg00298.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00065.html
c961a8da422283662e09ee498c0598d48fc9d70f
--- src/gdb/solib-svr4.c 2010/02/24 00:29:02 1.125
+++ src/gdb/solib-svr4.c 2010/03/08 07:45:49 1.126
@@ -868,9 +868,16 @@
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ CORE_ADDR addr = 0;
+ volatile struct gdb_exception ex;
- return read_memory_typed_address (info->debug_base + lmo->r_map_offset,
- ptr_type);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
+ ptr_type);
+ }
+ exception_print (gdb_stderr, ex);
+ return addr;
}
/* Find r_brk from the inferior's debug base. */
### src/gdb/ChangeLog 2010/03/08 01:49:30 1.11441
### src/gdb/ChangeLog 2010/03/08 07:45:49 1.11442
## -1,3 +1,10 @@
+2010-03-08 Joel Brobecker <brobecker@adacore.com>
+
+ Memory error when reading wrong core file.
+ * solib-svr4.c (solib_svr4_r_map): catch and print all exception
+ errors while reading the inferior memory, and return zero if
+ an exception was raised.
+
2010-03-07 Michael Snyder <msnyder@vmware.com>
* record.c (record_restore): Rename tmpu8 to rectype.

View File

@ -1,70 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-01/msg00142.html
Subject: [patch] Fix crash reading broken stabs
Hi,
seen this stabs from unknown variant of gcc-4.1.2:
1176586 LSYM 0 154 00000000 16682076 basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep:Tt(0,34)=s12!1,020,(0,35)=xs_Rep_base:;_S_max_size:/2(0,36)=k(0,30):_ZNSs4_Rep11_S_max_sizeE;_S_terminal:/2(0,22):_ZNSs4_Rep11_S_terminalE;_S_empty_rep_storage:/2(0,37)=ar(0,38)=r(0,38);0;037777777777;;0;3;(0,30):_ZNSs4_Rep20_S_empty_rep_storageE;_S_empty_rep::(0,39)=f(0,40)=&(0,34):_ZNSs4_Rep12_S_empty_repEv;2A?;_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);:_ZNKSs4_Rep12_M_is_leakedEv;2B.;_M_is_shared::(0,41):_ZNKSs4_Rep12_M_is_sharedEv;2B.;_M_set_leaked::(0,45)=#(0,34),(0,1),(0,33),(0,1);:_ZNSs4_Rep13_M_set_leakedEv;2A.;_M_set_sharable::(0,45):_ZNSs4_Rep15_M_set_sharableEv;2A.;_M_set_length_and_sharable::(0,46)=#(0,34),(0,1),(0,33),(0,25),(0,1);:_ZNSs4_Rep26_M_set_length_and_sharableEj;2A.;_M_refdata::(0,47)=#(0,34),(0,3),(0,33),(0,1);:_ZNSs4_Rep10_M_refdataEv;2A.;_M_grab::(0,48)=#(0,34),(0,3),(0,33),(0,5),(0,5),(0,1);:_ZNSs4_Rep7_M_grabERKSaIcES2_;2A.;_S_create::(0,49)=f(0,33):_ZNSs4_Rep9_S_createEjjRKSaIcE;2A?;_M_dispose::(0,50)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_disposeERKSaIcE;2A.;_M_destroy::(0,51)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_destroyERKSaIcE;2A.;_M_refcopy::(0,47):_ZNSs4_Rep10_M_refcopyEv;2A.;_M_clone::(0,52)=#(0,34),(0,3),(0,33),(0,5),(0,25),(0,1);:_ZNSs4_Rep8_M_cloneERKSaIcEj;2A.;;
There is a GDB crash at:
_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);
^^
+ [...] Some broken stabs
+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
+ have been present ";-16,(0,43)" reference instead. This way the
+ excessive ";" marker prematurely stops the parameters parsing. */
Still I was unable to reproduce producing such STABS output.
So this patch does not try to compensate the - presumably - buggy STABS output
and parses such record incorrectly. But it no longer crashes.
No regressions on {x86_64-m32,i686}-fedora12-linux-gnu
using --target_board unix/-gstabs+/-m32.
Thanks,
Jan
gdb/
2010-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* stabsread.c (read_args): Handle zero arguments.
gdb/testsuite/
2010-01-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.stabs/weird.def (args93): New.
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4111,7 +4111,17 @@ read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
}
(*pp)++; /* get past `end' (the ':' character) */
- if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
+ if (n == 0)
+ {
+ /* We should read at least the THIS parameter here. Some broken stabs
+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
+ have been present ";-16,(0,43)" reference instead. This way the
+ excessive ";" marker prematurely stops the parameters parsing. */
+
+ complaint (&symfile_complaints, _("Invalid (empty) method arguments"));
+ *varargsp = 0;
+ }
+ else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
*varargsp = 1;
else
{
--- a/gdb/testsuite/gdb.stabs/weird.def
+++ b/gdb/testsuite/gdb.stabs/weird.def
@@ -880,3 +880,6 @@ var3:
.stabs "sym92:\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
.stabs "type92:t92=\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
.stabs "attr92:G392=@\ !#$%&'()*+,-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~;1",N_GSYM,0,0, 0
+
+# See read_args "Invalid (empty) method arguments" error.
+.stabs "args93:G93=#(0,93),(0,93)=@s8;-16;,(0,93),(0,93);",N_GSYM,0,0,0

View File

@ -1,154 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00364.html
Subject: [patch] related_breakpoint stale ref crash fix
Hi,
getting occasional random:
PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint still triggers
PASS: gdb.threads/local-watch-wrong-thread.exp: let thread_function0 return
PASS: gdb.threads/local-watch-wrong-thread.exp: breakpoint on thread_function0's caller
-PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
+ERROR: Process no longer exists
+UNRESOLVED: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
It is even reproducible on HEAD using "input" file below and:
valgrind ../gdb -nx <input
(gdb) (gdb) Breakpoint 6 at 0x400685: file ./gdb.threads/local-watch-wrong-thread.c, line 47.
(gdb) ==31759== Invalid write of size 4
==31759== at 0x601A11: bpstat_check_breakpoint_conditions (breakpoint.c:3482)
==31759== by 0x601C70: bpstat_stop_status (breakpoint.c:3596)
==31759== by 0x65D228: handle_inferior_event (infrun.c:3589)
==31759== by 0x65A563: wait_for_inferior (infrun.c:2281)
==31759== by 0x659AA0: proceed (infrun.c:1883)
==31759== by 0x65300B: continue_1 (infcmd.c:668)
==31759== by 0x653282: continue_command (infcmd.c:760)
==31759== by 0x5C51D8: do_cfunc (cli-decode.c:67)
==31759== by 0x5C824F: cmd_func (cli-decode.c:1738)
==31759== by 0x48335A: execute_command (top.c:450)
==31759== by 0x67273E: command_handler (event-top.c:511)
==31759== by 0x672E53: command_line_handler (event-top.c:736)
==31759== Address 0xbbdc950 is 240 bytes inside a block of size 336 free'd
==31759== at 0x4A04D72: free (vg_replace_malloc.c:325)
==31759== by 0x486E4B: xfree (utils.c:1286)
==31759== by 0x60BC35: delete_breakpoint (breakpoint.c:8708)
==31759== by 0x60BDAF: delete_command (breakpoint.c:8765)
==31759== by 0x5C51D8: do_cfunc (cli-decode.c:67)
==31759== by 0x5C824F: cmd_func (cli-decode.c:1738)
==31759== by 0x48335A: execute_command (top.c:450)
==31759== by 0x67273E: command_handler (event-top.c:511)
==31759== by 0x672E53: command_line_handler (event-top.c:736)
==31759== by 0x672FCF: gdb_readline2 (event-top.c:817)
==31759== by 0x6725F7: stdin_event_handler (event-top.c:433)
==31759== by 0x670CDE: handle_file_event (event-loop.c:812)
==31759==
Watchpoint 4 deleted because the program has left the block in
which its expression is valid.
There is already automatic deletion of RELATED_BREAKPOINT in
map_breakpoint_numbers but "delete breakpoints" (for all the breakpoints)
calls delete_breakpoint from delete_command directly without calling
map_breakpoint_numbers and it does not delete the associated
bp_watchpoint_scope.
I find the attached patch is right for delete_breakpoint itself as such
function should not leave stale references in the leftover data structures.
How well could be other code cleaned up with this patch in place I have not
targeted by this patch.
The existing code expects accessibility of freed memory and discusses the
current stale references problem:
void
delete_breakpoint (struct breakpoint *bpt)
[...]
/* Has this bp already been deleted? This can happen because multiple
lists can hold pointers to bp's. bpstat lists are especial culprits.
One example of this happening is a watchpoint's scope bp. When the
scope bp triggers, we notice that the watchpoint is out of scope, and
delete it. We also delete its scope bp. But the scope bp is marked
"auto-deleting", and is already on a bpstat. That bpstat is then
checked for auto-deleting bp's, which are deleted.
A real solution to this problem might involve reference counts in bp's,
and/or giving them pointers back to their referencing bpstat's, and
teaching delete_breakpoint to only free a bp's storage when no more
references were extent. A cheaper bandaid was chosen. */
if (bpt->type == bp_none)
return;
[...]
bpt->type = bp_none;
xfree (bpt);
}
While fixing this part may be difficult I find the attached patch easy enough
fixing the IMO currently most common crash due to it.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
"input":
set height 0
set width 0
set confirm no
file ../testsuite/gdb.threads/local-watch-wrong-thread
set can-use-hw-watchpoints 1
break main
run
break local-watch-wrong-thread.c:36
continue
delete breakpoints
watch *myp
continue
delete breakpoints
echo MAKE watch\n
watch *myp if trigger != 0
echo MAKE break\n
break local-watch-wrong-thread.c:60
info break
continue
echo DELETE five\n
delete 5
set trigger=1
continue
set *myp=0
break local-watch-wrong-thread.c:47
continue
2009-12-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (delete_breakpoint <bpt->related_breakpoint != NULL>):
New.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8649,6 +8649,16 @@ delete_breakpoint (struct breakpoint *bpt)
if (bpt->type == bp_none)
return;
+ /* At least avoid this stale reference until the reference counting of
+ breakpoints gets resolved. */
+ if (bpt->related_breakpoint != NULL)
+ {
+ gdb_assert (bpt->related_breakpoint->related_breakpoint == bpt);
+ bpt->related_breakpoint->disposition = disp_del_at_next_stop;
+ bpt->related_breakpoint->related_breakpoint = NULL;
+ bpt->related_breakpoint = NULL;
+ }
+
observer_notify_breakpoint_deleted (bpt->number);
if (breakpoint_chain == bpt)

View File

@ -1,112 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-02/msg00477.html
Subject: Re: [patch] Fix crash on stale addrinfo->sectindex
On Fri, 19 Feb 2010 04:01:05 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> I think you ought to move this comment as well.
> It appears to just be hanging at the end of a block after the patch.
Yes; forgot.
> This is ok with that change. Thanks.
Checked-in.
On Fri, 19 Feb 2010 04:10:30 +0100, Tom Tromey wrote:
> Oh, by the way, I think this is reasonable for 7.1. It is
> straightforward and fixes a reported crash. If Joel agrees, please put
> it on the branch. Thanks.
OK for the branch?
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2010-02/msg00162.html
### src/gdb/ChangeLog 2010/02/19 00:35:53 1.11380
### src/gdb/ChangeLog 2010/02/19 06:19:44 1.11381
## -1,3 +1,10 @@
+2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * symfile.c (addr_info_make_relative): Extend comment. Move SECT to
+ a more inner block. Initialize ADDR by LOWER_OFFSET only if it was
+ found by bfd_get_section_by_name.
+ * symfile.h (struct section_addr_info) <sectindex>: New comment.
+
2010-02-19 Joel Brobecker <brobecker@adacore.com>
* NEWS: Add new "[...] since 7.1" section. Rename the "[...] since
--- src/gdb/symfile.c 2010/02/18 19:17:00 1.272
+++ src/gdb/symfile.c 2010/02/19 06:19:45 1.273
@@ -562,13 +562,13 @@
}
/* Relativize absolute addresses in ADDRS into offsets based on ABFD. Fill-in
- also SECTINDEXes there. */
+ also SECTINDEXes specific to ABFD there. This function can be used to
+ rebase ADDRS to start referencing different BFD than before. */
void
addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
{
asection *lower_sect;
- asection *sect;
CORE_ADDR lower_offset;
int i;
@@ -597,25 +597,29 @@
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
- if (addrs->other[i].addr != 0)
+ asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+
+ if (sect)
{
- sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
- if (sect)
+ /* This is the index used by BFD. */
+ addrs->other[i].sectindex = sect->index;
+
+ if (addrs->other[i].addr != 0)
{
addrs->other[i].addr -= bfd_section_vma (abfd, sect);
lower_offset = addrs->other[i].addr;
- /* This is the index used by BFD. */
- addrs->other[i].sectindex = sect->index;
}
else
- {
- warning (_("section %s not found in %s"), addrs->other[i].name,
- bfd_get_filename (abfd));
- addrs->other[i].addr = 0;
- }
+ addrs->other[i].addr = lower_offset;
}
else
- addrs->other[i].addr = lower_offset;
+ {
+ warning (_("section %s not found in %s"), addrs->other[i].name,
+ bfd_get_filename (abfd));
+ addrs->other[i].addr = 0;
+
+ /* SECTINDEX is invalid if ADDR is zero. */
+ }
}
}
--- src/gdb/symfile.h 2010/02/03 14:13:16 1.64
+++ src/gdb/symfile.h 2010/02/19 06:19:45 1.65
@@ -80,6 +80,8 @@
{
CORE_ADDR addr;
char *name;
+
+ /* SECTINDEX must be valid for associated BFD if ADDR is not zero. */
int sectindex;
} other[1];
};

View File

@ -1,17 +0,0 @@
commit 03729380c318738d19256b219bcc03d333dc54bf
Author: Daniel Jacobowitz <dan@debian.org>
Date: Mon Feb 1 17:51:18 2010 +0000
[...]
* gdb.base/interrupt.exp: Match unexpected gdb prompt.
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -167,6 +167,7 @@ if ![file exists $binfile] then {
# here.
gdb_expect {
-re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" }
+ -re "Undefined command.*$gdb_prompt " { fail "echo data" }
timeout { fail "echo data (timeout)" }
eof { fail "echo data (eof)" }
}

View File

@ -1,69 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00473.html
Subject: [patch] testsuite: false MI "unknown output after running" regression
Hi,
the attached patch will turn the results this way:
-KFAIL: gdb.mi/mi-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
+KFAIL: gdb.mi/mi-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
-XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (unknown output after running)
+XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (stopped at wrong place)
-KFAIL: gdb.mi/mi2-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
+KFAIL: gdb.mi/mi2-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
-XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (unknown output after running)
+XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (stopped at wrong place)
This is a fix of KFAIL-kind regression due to:
commit 26d086d741fb1bb0eee9d50e0bafa7c5e388023f
Re: [RFA] fix *stopped for CLI commands
http://sourceware.org/ml/gdb-patches/2009-02/msg00278.html
http://sourceware.org/ml/gdb-cvs/2009-02/msg00084.html
part:
gdb/testsuite/
2009-02-14 Vladimir Prus <vladimir@codesourcery.com>
* lib/mi-support.exp (mi_expect_stop): Adjust the order of fields.
(mi_expect_interrupt): Likewise.
* gdb.mi/mi-cli.exp: Check that "step" results in proper *stopped
response.
re-wdiff-ed for your convenience as:
verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re"
-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" {
-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}[-$any-]{+thread-id=\"$decimal\",stopped-threads=$any+}\r\n$prompt_re" {
FYI there is: set any "\[^\n\]*"
"stopped at wrong place" is the right kind of KFAIL/XFAIL (tested
gcc-4.1.2-46.el5_4.1.x86_64 and gcc-4.4.2-20.fc12.x86_64) as discussed
in PR gdb/2104.
In the last case there is missing comma (,) after the former patch above.
$after_stopped was IMO missing there even before. It is in use only by
gdb.mi/mi-simplerun.exp and gdb.mi/mi2-simplerun.exp. Also fixed below.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/testsuite/
2009-12-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* lib/mi-support.exp (mi_expect_stop <stopped at wrong place>): Insert
missing $after_stopped and comma (,) expectation.
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1038,7 +1038,7 @@ proc mi_expect_stop { reason func args file line extra test } {
pass "$test"
return $expect_out(2,string)
}
- -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
+ -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
verbose -log "got $expect_out(buffer)"
fail "$test (stopped at wrong place)"
return -1

44
gdb-unused-revert.patch Normal file
View File

@ -0,0 +1,44 @@
[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.

803
gdb-upstream.patch Normal file
View File

@ -0,0 +1,803 @@
http://sourceware.org/ml/gdb-cvs/2010-03/msg00104.html
5855954454f19a801f76bbf7baafd11a693c5d33
Imported to sync gdb.base/break-interp.exp for gdb-pie-rerun.patch.
### src/gdb/ChangeLog 2010/03/11 03:45:48 1.11469
### src/gdb/ChangeLog 2010/03/11 22:07:00 1.11470
## -1,3 +1,9 @@
+2010-03-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * solib-svr4.c (LM_ADDR_CHECK) <info_verbose>: Use printf_unfiltered
+ for the PIC displacement, print also the displacement value.
+ (svr4_exec_displacement): Print DISPLACEMENT if INFO_VERBOSE.
+
2010-03-10 Kevin Buettner <kevinb@redhat.com>
* remote-mips.c (close_ports, mips_initialize_cleanups)
--- src/gdb/solib-svr4.c 2010/03/10 20:55:44 1.129
+++ src/gdb/solib-svr4.c 2010/03/11 22:07:02 1.130
@@ -243,12 +243,10 @@
l_addr = l_dynaddr - dynaddr;
if (info_verbose)
- {
- warning (_(".dynamic section for \"%s\" "
- "is not at the expected address"), so->so_name);
- warning (_("difference appears to be caused by prelink, "
- "adjusting expectations"));
- }
+ printf_unfiltered (_("Using PIC (Position Independent Code) "
+ "prelink displacement %s for \"%s\".\n"),
+ paddress (target_gdbarch, l_addr),
+ so->so_name);
}
else
warning (_(".dynamic section for \"%s\" "
@@ -1767,6 +1765,18 @@
return 0;
}
+ if (info_verbose)
+ {
+ /* It can be printed repeatedly as there is no easy way to check
+ the executable symbols/file has been already relocated to
+ displacement. */
+
+ printf_unfiltered (_("Using PIE (Position Independent Executable) "
+ "displacement %s for \"%s\".\n"),
+ paddress (target_gdbarch, displacement),
+ bfd_get_filename (exec_bfd));
+ }
+
*displacementp = displacement;
return 1;
}
### src/gdb/testsuite/ChangeLog 2010/03/11 00:20:29 1.2168
### src/gdb/testsuite/ChangeLog 2010/03/11 22:07:02 1.2169
## -1,3 +1,20 @@
+2010-03-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.base/break-interp.exp: Create new displacement parameter value
+ for the test_ld calls.
+ (reach): New parameter displacement, verify its content. New push of
+ pf_prefix "reach-$func:". Import global expect_out.
+ (test_core): New parameter displacement, verify its content. New push
+ of pf_prefix "core:". New command "set verbose on". Import global
+ expect_out.
+ (test_attach): New parameter displacement, verify its content. New
+ push of pf_prefix "attach:". New command "set verbose on". Import
+ global expect_out.
+ (test_ld): New parameter displacement, pass it to the reach, test_core
+ and test_attach calls and verify its content in the "ld.so exit" test.
+ * gdb.base/prelink.exp: Remove gdb_exit and final return.
+ (prelink): Update expected text, use gdb_test.
+
2010-03-10 Doug Evans <dje@google.com>
* gdb.base/checkpoint.exp: Fix comment.
--- src/gdb/testsuite/gdb.base/break-interp.exp 2010/01/27 20:53:22 1.6
+++ src/gdb/testsuite/gdb.base/break-interp.exp 2010/03/11 22:07:03 1.7
@@ -221,30 +221,61 @@
}
# `runto' does not check we stopped really at the function we specified.
-proc reach {func command} {
- global gdb_prompt
+# DISPLACEMENT can be "NONE", "ZERO" or "NONZERO"
+proc reach {func command displacement} {
+ global gdb_prompt expect_out
+
+ global pf_prefix
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "reach-$func:"
if [gdb_breakpoint $func allow-pending] {
- set test "reach $func"
+ set test "reach"
+ set test_displacement "seen displacement message as $displacement"
gdb_test_multiple $command $test {
+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
+ # Missing "$gdb_prompt $" is intentional.
+ if {$expect_out(1,string) == "0x0"} {
+ set case "ZERO"
+ } else {
+ set case "NONZERO"
+ }
+ if {$displacement == $case} {
+ pass $test_displacement
+ # Permit multiple such messages.
+ set displacement "FOUND-$displacement"
+ } elseif {$displacement != "FOUND-$case"} {
+ fail $test_displacement
+ }
+ exp_continue
+ }
-re "Breakpoint \[0-9\]+, $func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
pass $test
}
- -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" {
+ -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" {
pass $test
}
}
+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ fail $test_displacement
+ }
}
+
+ set pf_prefix $old_ldprefix
}
-proc test_core {file} {
- global srcdir subdir gdb_prompt
+proc test_core {file displacement} {
+ global srcdir subdir gdb_prompt expect_out
set corefile [core_find $file {} "segv"]
if {$corefile == ""} {
return
}
+ global pf_prefix
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "core:"
+
gdb_exit
gdb_start
# Clear it to never find any separate debug infos in $debug_root.
@@ -252,14 +283,44 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $file
- # Do not check the binary filename as it may be truncated.
- gdb_test "core-file $corefile" "Core was generated by .*\r\n#0 .*" "core loaded"
+ # Print the "PIE (Position Independent Executable) displacement" message.
+ gdb_test "set verbose on"
+
+ set test "core loaded"
+ set test_displacement "seen displacement message"
+ gdb_test_multiple "core-file $corefile" $test {
+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
+ # Missing "$gdb_prompt $" is intentional.
+ if {$expect_out(1,string) == "0x0"} {
+ set case "ZERO"
+ } else {
+ set case "NONZERO"
+ }
+ if {$displacement == $case} {
+ pass $test_displacement
+ # Permit multiple such messages.
+ set displacement "FOUND-$displacement"
+ } elseif {$displacement != "FOUND-$case"} {
+ fail $test_displacement
+ }
+ exp_continue
+ }
+ -re "Core was generated by .*\r\n#0 .*$gdb_prompt $" {
+ # Do not check the binary filename as it may be truncated.
+ pass $test
+ }
+ }
+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ fail $test_displacement
+ }
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt"
+
+ set pf_prefix $old_ldprefix
}
-proc test_attach {file} {
- global board_info
+proc test_attach {file displacement} {
+ global board_info gdb_prompt expect_out
gdb_exit
@@ -287,17 +348,61 @@
}
}
+ global pf_prefix
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "attach:"
+
gdb_exit
gdb_start
- gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach"
+
+ # Print the "PIE (Position Independent Executable) displacement" message.
+ gdb_test "set verbose on"
+
+ set test "attach"
+ gdb_test_multiple "attach $pid" $test {
+ -re "Attaching to process $pid\r\n" {
+ # Missing "$gdb_prompt $" is intentional.
+ pass $test
+ }
+ }
+
+ set test "attach final prompt"
+ set test_displacement "seen displacement message"
+ gdb_test_multiple "" $test {
+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
+ # Missing "$gdb_prompt $" is intentional.
+ if {$expect_out(1,string) == "0x0"} {
+ set case "ZERO"
+ } else {
+ set case "NONZERO"
+ }
+ if {$displacement == $case} {
+ pass $test_displacement
+ # Permit multiple such messages.
+ set displacement "FOUND-$displacement"
+ } elseif {$displacement != "FOUND-$case"} {
+ fail $test_displacement
+ }
+ exp_continue
+ }
+ -re "$gdb_prompt $" {
+ pass $test
+ }
+ }
+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ fail $test_displacement
+ }
+
gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt"
gdb_exit
remote_exec host "kill -9 $pid"
+
+ set pf_prefix $old_ldprefix
}
-proc test_ld {file ifmain trynosym} {
- global srcdir subdir gdb_prompt
+proc test_ld {file ifmain trynosym displacement} {
+ global srcdir subdir gdb_prompt expect_out
# First test normal `file'-command loaded $FILE with symbols.
@@ -308,20 +413,31 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $file
- reach "dl_main" "run segv"
+ # Print the "PIE (Position Independent Executable) displacement" message.
+ gdb_test "set verbose on"
+
+ reach "dl_main" "run segv" $displacement
gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
if $ifmain {
- reach "main" continue
+ # Displacement message will be printed the second time on initializing
+ # the linker from svr4_special_symbol_handling. If any ANOFFSET has
+ # been already set as non-zero the detection will no longer be run.
+ if {$displacement == "NONZERO"} {
+ set displacement_main "NONE"
+ } else {
+ set displacement_main $displacement
+ }
+ reach "main" continue $displacement_main
- reach "libfunc" continue
+ reach "libfunc" continue "NONE"
gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt"
- test_core $file
+ test_core $file $displacement
- test_attach $file
+ test_attach $file $displacement
}
if !$trynosym {
@@ -341,18 +457,21 @@
gdb_test "set debug-file-directory"
gdb_reinitialize_dir $srcdir/$subdir
+ # Print the "PIE (Position Independent Executable) displacement" message.
+ gdb_test "set verbose on"
+
# Test no (error) message has been printed by `exec-file'.
set escapedfile [string_to_regexp $file]
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
if $ifmain {
- reach "dl_main" run
+ reach "dl_main" run $displacement
set test "info files"
set entrynohex ""
gdb_test_multiple $test $test {
-re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n.*$gdb_prompt $" {
- set entrynohex $expect_out(1,string)
+ set entrynohex $expect_out(1,string)
pass $test
}
}
@@ -363,7 +482,34 @@
} else {
# There is no symbol to break at ld.so. Moreover it can exit with an
# error code.
- gdb_test "run" "Program exited (normally|with code \[0-9\]+)\\." "ld.so exit"
+
+ set test "ld.so exit"
+ set test_displacement "seen displacement message"
+ gdb_test_multiple "run" $test {
+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " {
+ # Missing "$gdb_prompt $" is intentional.
+ if {$expect_out(1,string) == "0x0"} {
+ set case "ZERO"
+ } else {
+ set case "NONZERO"
+ }
+ if {$displacement == $case} {
+ pass $test_displacement
+ # Permit multiple such messages.
+ set displacement "FOUND-$displacement"
+ } elseif {$displacement != "FOUND-$case"} {
+ fail $test_displacement
+ }
+ exp_continue
+ }
+ -re "Program exited (normally|with code \[0-9\]+)\\.\r\n$gdb_prompt $" {
+ # Do not check the binary filename as it may be truncated.
+ pass $test
+ }
+ }
+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ fail $test_displacement
+ }
}
set pf_prefix $old_ldprefix
@@ -450,7 +596,12 @@
if ![prelink$ldprelink $interp] {
continue
}
- test_ld $interp 0 [expr {$ldsepdebug == "NO"}]
+ if {$ldprelink == "NO"} {
+ set displacement "NONZERO"
+ } else {
+ set displacement "ZERO"
+ }
+ test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
if ![copy $interp $interp_saved] {
continue
@@ -531,7 +682,14 @@
if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" [file tail $exec]]
&& [copy $interp_saved $interp]} {
- test_ld $exec 1 [expr {$binsepdebug == "NO"}]
+ if {$binpie == "NO"} {
+ set displacement "NONE"
+ } elseif {$binprelink == "NO"} {
+ set displacement "NONZERO"
+ } else {
+ set displacement "ZERO"
+ }
+ test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement
}
}
}
--- src/gdb/testsuite/gdb.base/prelink.exp 2010/02/13 12:02:29 1.11
+++ src/gdb/testsuite/gdb.base/prelink.exp 2010/03/11 22:07:03 1.12
@@ -112,15 +112,4 @@
# Print the "adjusting expectations" message.
gdb_test "set verbose on"
-set test "prelink"
-global gdb_prompt
-gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" {
- -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" {
- pass "$test"
- }
-}
-
-gdb_exit
-
-return 0
-
+gdb_test "core-file $objdir/$subdir/prelink.core" {Using PIC \(Position Independent Code\) prelink displacement.*} "prelink"
http://sourceware.org/ml/gdb-cvs/2010-03/msg00066.html
16558457783d71e2856ff2b9ceaa83199d2d9811
### src/gdb/ChangeLog 2010/03/08 07:45:49 1.11442
### src/gdb/ChangeLog 2010/03/08 08:32:49 1.11443
## -1,3 +1,8 @@
+2010-03-08 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * symfile.c (addr_info_make_relative): New variable sect_name, use it.
+ Do not warn on ".gnu.liblist" and ".gnu.conflict".
+
2010-03-08 Joel Brobecker <brobecker@adacore.com>
Memory error when reading wrong core file.
--- src/gdb/symfile.c 2010/03/05 19:32:44 1.275
+++ src/gdb/symfile.c 2010/03/08 08:32:49 1.276
@@ -592,7 +592,8 @@
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
- asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+ const char *sect_name = addrs->other[i].name;
+ asection *sect = bfd_get_section_by_name (abfd, sect_name);
if (sect)
{
@@ -609,8 +610,22 @@
}
else
{
- warning (_("section %s not found in %s"), addrs->other[i].name,
- bfd_get_filename (abfd));
+ /* This section does not exist in ABFD, which is normally
+ unexpected and we want to issue a warning.
+
+ However, the ELF prelinker does create a couple of sections
+ (".gnu.liblist" and ".gnu.conflict") which are marked in the main
+ executable as loadable (they are loaded in memory from the
+ DYNAMIC segment) and yet are not present in separate debug info
+ files. This is fine, and should not cause a warning. Shared
+ libraries contain just the section ".gnu.liblist" but it is not
+ marked as loadable there. */
+
+ if (!(strcmp (sect_name, ".gnu.liblist") == 0
+ || strcmp (sect_name, ".gnu.conflict") == 0))
+ warning (_("section %s not found in %s"), sect_name,
+ bfd_get_filename (abfd));
+
addrs->other[i].addr = 0;
/* SECTINDEX is invalid if ADDR is zero. */
http://sourceware.org/ml/gdb-cvs/2010-03/msg00138.html
http://sourceware.org/ml/gdb-patches/2010-03/msg00535.html
cc3e71651e2fd0168a2d3dd4efc2d3e15fd508dd
### src/gdb/ChangeLog 2010/03/15 03:48:46 1.11479
### src/gdb/ChangeLog 2010/03/15 09:31:30 1.11480
## -1,3 +1,8 @@
+2010-03-15 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * symfile.c (addr_info_make_relative): Ignore also missing ".dynbss"
+ and ".sdynbss". Update the comment.
+
2010-03-15 Jie Zhang <jie@codesourcery.com>
* MAINTAINERS: Update my email address.
--- src/gdb/symfile.c 2010/03/10 18:20:07 1.277
+++ src/gdb/symfile.c 2010/03/15 09:31:34 1.278
@@ -576,16 +576,19 @@
/* This section does not exist in ABFD, which is normally
unexpected and we want to issue a warning.
- However, the ELF prelinker does create a couple of sections
- (".gnu.liblist" and ".gnu.conflict") which are marked in the main
- executable as loadable (they are loaded in memory from the
- DYNAMIC segment) and yet are not present in separate debug info
- files. This is fine, and should not cause a warning. Shared
- libraries contain just the section ".gnu.liblist" but it is not
- marked as loadable there. */
+ However, the ELF prelinker does create a few sections which are
+ marked in the main executable as loadable (they are loaded in
+ memory from the DYNAMIC segment) and yet are not present in
+ separate debug info files. This is fine, and should not cause
+ a warning. Shared libraries contain just the section
+ ".gnu.liblist" but it is not marked as loadable there. There is
+ no other way to identify them than by their name as the sections
+ created by prelink have no special flags. */
if (!(strcmp (sect_name, ".gnu.liblist") == 0
- || strcmp (sect_name, ".gnu.conflict") == 0))
+ || strcmp (sect_name, ".gnu.conflict") == 0
+ || strcmp (sect_name, ".dynbss") == 0
+ || strcmp (sect_name, ".sdynbss") == 0))
warning (_("section %s not found in %s"), sect_name,
bfd_get_filename (abfd));
http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html
Subject: [patch] Fix separate-debug with non-unique section names (PR 11409)
A different version was checked-in but they are interchangeable:
http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00241.html
Hi,
gdb-7.1 is now broken for example for debugging /usr/bin/emacs due to:
http://sourceware.org/bugzilla/show_bug.cgi?id=11409
[22] .data PROGBITS 00000000007fe8a0 1fe8a0 215068 00 WA 0 0 32
[23] .data PROGBITS 0000000000a13920 413920 68c6e0 00 WA 0 0 32
It is in fact a regression against gdb-7.0 by me due to:
commit 71d0069a9f238a11f7f455bf6ad2adfc25683521
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Tue Jan 5 15:51:01 2010 +0000
gdb/
* symfile.c (syms_from_objfile): Remove the !MAINLINE conditional.
as while the code was broken even before the broken relocation was not applied
to mainline binary (before PIE+OSX patches went in).
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
OK to check-in also for gdb-7.1 (7.1.1)?
Thanks,
Jan
gdb/
2010-03-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (addr_info_make_relative): Move sect declaration to the
outer block. Initialize it to NULL. Prefer SECT->next more than
bfd_get_section_by_name.
gdb/testsuite/
2010-03-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/dup-sect.exp, gdb.base/dup-sect.S: New.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -529,6 +529,7 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
asection *lower_sect;
CORE_ADDR lower_offset;
int i;
+ asection *sect;
/* Find lowest loadable section to be used as starting point for
continguous sections. */
@@ -553,11 +554,23 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
(the loadable section directly below it in memory).
this_offset = lower_offset = lower_addr - lower_orig_addr */
+ sect = NULL;
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
const char *sect_name = addrs->other[i].name;
- asection *sect = bfd_get_section_by_name (abfd, sect_name);
+ /* Prefer the next section of that we have found last. The separate
+ debug info files have either the same section layout or just a few
+ sections are missing there. On the other hand the section name is not
+ unique and we could find an inappropraite section by its name. */
+
+ if (sect)
+ sect = sect->next;
+ if (sect && strcmp (sect_name, bfd_get_section_name (abfd, sect)) != 0)
+ sect = NULL;
+
+ if (sect == NULL)
+ sect = bfd_get_section_by_name (abfd, sect_name);
if (sect)
{
/* This is the index used by BFD. */
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dup-sect.S
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+ .section sect1, "a"
+var1: .byte 1
+
+ .section sect2, "a"
+var2: .byte 2
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dup-sect.exp
@@ -0,0 +1,79 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test inappropriate offseting of multiple sections with the same name.
+# When kept in object file (before final executable link) it still works.
+# When separate debug info file is not used it still works.
+# When the ELF symbol table is kept in the main binary it still works.
+# Used .S file as in .c file we would need __attriute__((section)) which is
+# a GCC extension.
+
+# This test can only be run on targets which support ELF and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile dup-sect
+set srcfile ${testfile}.S
+set srcmainfile start.c
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
+
+if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile}] {}] == -1} {
+ return -1
+}
+
+set test "rename section"
+set objcopy_program [transform objcopy]
+set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output]
+verbose "result is $result"
+verbose "output is $output"
+if {$result != 0} {
+ fail $test
+ return
+}
+pass $test
+
+set test "split"
+if {[gdb_gnu_strip_debug $binfile] != 0} {
+ fail $test
+} else {
+ pass $test
+}
+
+# gdb_gnu_strip_debug uses only --strip-debug and keeps the ELF symbol table
+# in $binfile.
+set test "strip"
+set strip_program [transform strip]
+set result [catch "exec $strip_program $binfile" output]
+verbose "result is $result"
+verbose "output is $output"
+if {$result != 0} {
+ fail $test
+ return
+}
+pass $test
+
+clean_restart $executable
+
+gdb_test "p/d *(const char *) &var1" " = 1" "var1 after strip"
+gdb_test "p/d *(const char *) &var2" " = 2" "var2 after strip"
[patch] Fix breakpoint at *_start
http://sourceware.org/ml/gdb-patches/2010-04/msg00059.html
http://sourceware.org/ml/gdb-cvs/2010-04/msg00029.html
### src/gdb/ChangeLog 2010/04/04 13:54:42 1.11568
### src/gdb/ChangeLog 2010/04/04 22:12:04 1.11569
## -1,5 +1,10 @@
2010-04-04 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * infcmd.c (run_command_1): Call proceed with regcache_read_pc address.
+ * config/djgpp/fnchange.lst: Add translation for break-entry.exp.
+
+2010-04-04 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* breakpoint.c (bpstat_find_step_resume_breakpoint): Remove.
* breakpoint.h (bpstat_find_step_resume_breakpoint): Remove.
--- src/gdb/infcmd.c 2010/03/25 20:48:53 1.263
+++ src/gdb/infcmd.c 2010/04/04 22:12:04 1.264
@@ -580,8 +580,9 @@
has done its thing; now we are setting up the running program. */
post_create_inferior (&current_target, 0);
- /* Start the target running. */
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
+ /* Start the target running. Do not use -1 continuation as it would skip
+ breakpoint right at the entry point. */
+ proceed (regcache_read_pc (get_current_regcache ()), TARGET_SIGNAL_0, 0);
/* Since there was no error, there's no need to finish the thread
states here. */
--- src/gdb/config/djgpp/fnchange.lst 2010/02/01 19:27:55 1.108
+++ src/gdb/config/djgpp/fnchange.lst 2010/04/04 22:12:07 1.109
@@ -371,6 +371,7 @@
@V@/gdb/testsuite/gdb.arch/powerpc-prologue.exp @V@/gdb/testsuite/gdb.arch/ppc-prologue.exp
@V@/gdb/testsuite/gdb.base/bitfields2.c @V@/gdb/testsuite/gdb.base/bitfiel2.c
@V@/gdb/testsuite/gdb.base/bitfields2.exp @V@/gdb/testsuite/gdb.base/bitfiel2.exp
+@V@/gdb/testsuite/gdb.base/break-entry.exp @V@/gdb/testsuite/gdb.base/brkentry.exp
@V@/gdb/testsuite/gdb.base/coremaker2.c @V@/gdb/testsuite/gdb.base/core2maker.c
@V@/gdb/testsuite/gdb.base/hashline1.exp @V@/gdb/testsuite/gdb.base/hash1line.exp
@V@/gdb/testsuite/gdb.base/hashline2.exp @V@/gdb/testsuite/gdb.base/hash2line.exp
### src/gdb/testsuite/ChangeLog 2010/04/02 05:13:07 1.2218
### src/gdb/testsuite/ChangeLog 2010/04/04 22:12:09 1.2219
## -1,3 +1,7 @@
+2010-04-04 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.base/break-entry.exp: New.
+
2010-04-02 Hui Zhu <teawater@gmail.com>
Michael Snyder <msnyder@vmware.com>
--- src/gdb/testsuite/gdb.base/break-entry.exp
+++ src/gdb/testsuite/gdb.base/break-entry.exp 2010-04-05 20:17:39.234684000 +0000
@@ -0,0 +1,43 @@
+# Copyright (C) 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test inferior can stop at its very first instruction, usually "_start".
+# Dynamic executables have first instruction in ld.so.
+
+set testfile break-entry
+if { [prepare_for_testing ${testfile}.exp ${testfile} start.c {additional_flags=-static}] } {
+ return -1
+}
+
+set test "info files"
+set entry ""
+gdb_test_multiple $test $test {
+ -re "\r\n\[\t \]*Entry point:\[\t \]*(0x\[0-9a-f\]+)\r\n.*$gdb_prompt $" {
+ set entry $expect_out(1,string)
+ pass $test
+ }
+}
+if {$entry == ""} {
+ untested ${testfile}.exp
+ return
+}
+
+if ![runto "*$entry"] {
+ return
+}
+gdb_test {p/x $pc} " = $entry"
+
+gdb_breakpoint "main"
+gdb_continue_to_breakpoint "main" "main.*"

View File

@ -0,0 +1,214 @@
FSF GDB variant is at:
http://sourceware.org/ml/gdb-patches/2010-03/msg00789.html
commit 56b45f494f647360f9d6ff84f12f59c08cbe05af
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date: Mon Mar 29 16:08:58 2010 -0400
Fix using_directive memory leak.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index ff2c9b1..35e4663 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -387,6 +387,7 @@ finish_block (struct symbol *symbol, struct pending **listhead,
}
block_set_using (block, using_directives, &objfile->objfile_obstack);
+ using_directives = NULL;
record_pending_block (objfile, block, opblock);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 6325ead..c6df91f 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -120,7 +120,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
anonymous namespace. So add symbols in it to the
namespace given by the previous component if there is
one, or to the global namespace if there isn't. */
- cp_add_using_directive (dest, src, NULL, "", 0);
+ cp_add_using_directive (dest, src, NULL, "", 0,
+ &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack);
}
/* The "+ 2" is for the "::". */
previous_component = next_component + 2;
@@ -132,11 +133,17 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
}
/* Add a using directive to using_list. If the using directive in question
- has already been added, don't add it twice. */
+ has already been added, don't add it twice.
+ Create a new struct using_direct which imports the namespace SRC into the
+ scope DEST. ALIAS is the name of the imported namespace in the current
+ scope. If ALIAS is NULL then the namespace is known by its original name.
+ The arguments are copied into newly allocated memory so they can be
+ temporaries. */
void
cp_add_using_directive (const char *dest, const char *src, const char *alias,
- const char *declaration, const int line_number)
+ const char *declaration, const int line_number,
+ struct obstack *obstack)
{
struct using_direct *current;
struct using_direct *new;
@@ -146,12 +153,26 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias,
for (current = using_directives; current != NULL; current = current->next)
{
if (strcmp (current->import_src, src) == 0
- && strcmp (current->import_dest, dest) == 0)
+ && strcmp (current->import_dest, dest) == 0
+ && ((alias == NULL && current->alias == NULL)
+ || (alias != NULL && current->alias != NULL
+ && strcmp (alias, current->alias) == 0)))
return;
}
- using_directives = cp_add_using (dest, src, alias, declaration,
- line_number, using_directives);
+ new = OBSTACK_ZALLOC (obstack, struct using_direct);
+
+ new->import_src = obsavestring (src, strlen (src), obstack);
+ new->import_dest = obsavestring (dest, strlen (dest), obstack);
+
+ if (alias != NULL)
+ new->alias = obsavestring (alias, strlen (alias), obstack);
+
+ new->declaration = obsavestring (declaration, strlen (declaration), obstack);
+ new->line_number = line_number;
+
+ new->next = using_directives;
+ using_directives = new;
}
@@ -203,42 +224,6 @@ cp_is_anonymous (const char *namespace)
!= NULL);
}
-/* Create a new struct using direct which imports the namespace SRC
- into the scope DEST. ALIAS is the name of the imported namespace
- in the current scope. If ALIAS is NULL then the
- namespace is known by its original name.
-
- Set its next member in the linked list to NEXT; allocate all memory
- using xmalloc. It copies the strings, so NAME can be a temporary
- string. */
-
-struct using_direct *
-cp_add_using (const char *dest,
- const char *src,
- const char *alias,
- const char *declaration,
- const int line_number,
- struct using_direct *next)
-{
- struct using_direct *retval;
-
- retval = xmalloc (sizeof (struct using_direct));
- retval->import_src = savestring (src, strlen (src));
- retval->import_dest = savestring (dest, strlen (dest));
-
- if (alias != NULL)
- retval->alias = savestring (alias, strlen (alias));
- else
- retval->alias = NULL;
-
- retval->declaration = savestring (declaration, strlen (declaration));
- retval->line_number = line_number;
- retval->next = next;
- retval->searched = 0;
-
- return retval;
-}
-
/* The C++-specific version of name lookup for static and global
names. This makes sure that names get looked for in all namespaces
that are in scope. NAME is the natural name of the symbol that
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 57aa5e5..41f17fe 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -101,14 +101,8 @@ extern void cp_add_using_directive (const char *dest,
const char *src,
const char *alias,
const char *declaration,
- const int line_number);
-
-extern struct using_direct *cp_add_using (const char *dest,
- const char *src,
- const char *alias,
- const char *declaration,
- const int line_number,
- struct using_direct *next);
+ const int line_number,
+ struct obstack *obstack);
extern void cp_initialize_namespace (void);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e3a780e..b73f444 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3563,12 +3563,12 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
}
}
- using_directives = cp_add_using (import_prefix,
- canonical_name,
- import_alias,
- imported_declaration,
- line_number,
- using_directives);
+ cp_add_using_directive (import_prefix,
+ canonical_name,
+ import_alias,
+ imported_declaration,
+ line_number,
+ &cu->objfile->objfile_obstack);
}
static void
@@ -5703,7 +5703,12 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
if (is_anonymous)
{
const char *previous_prefix = determine_prefix (die, cu);
- cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, "", dwarf2_read_decl_line(die, cu));
+ cp_add_using_directive (previous_prefix,
+ TYPE_NAME (type),
+ NULL,
+ "",
+ dwarf2_read_decl_line(die, cu),
+ &objfile->objfile_obstack);
}
}
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.cc b/gdb/testsuite/gdb.cp/gdb2384-base.cc
index 09ed04e..b58f30d 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.cc
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.cc
@@ -23,6 +23,8 @@ base::base (int _x)
{
}
+using namespace B;
+
int
base::meth ()
{
diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.h b/gdb/testsuite/gdb.cp/gdb2384-base.h
index b09701e..981943c 100644
--- a/gdb/testsuite/gdb.cp/gdb2384-base.h
+++ b/gdb/testsuite/gdb.cp/gdb2384-base.h
@@ -16,6 +16,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace B{
+ int x;
+}
+
class base
{
public:

View File

@ -1,231 +0,0 @@
http://sourceware.org/ml/gdb-patches/2009-12/msg00394.html
Subject: [patch] Fix watchpoint-at-epilogue 7.0 regression (s390x)
Hi,
attached testcase regressed 6.8->7.0 on some s390x systems.
At the moment PC is at epilogue (after frame pointer got destroyed and PC is
still in the calleed function) we must not try any unwinding as it can try to
unwind a garbage.
Correct way would be to implement epilogue unwinder (such as
amd64_epilogue_frame_unwind or i386_epilogue_frame_unwind ones) but it would
not be so easy on s390x as it would need full prologue-analyzer: After SP gets
restored there can be various instructions before the last jump - GDB needs to
interpret the jump to find the register value where it is going to jump to.
00000048279aa09c <round_and_return>:
[...]
48279aa1b8: eb 6f f0 d0 00 04 lmg %r6,%r15,208(%r15)
48279aa1be: 50 32 10 00 st %r3,0(%r2,%r1) # SP (%r15) is gone hone
48279aa1c2: b3 74 00 00 lzer %r0
48279aa1c6: 07 f4 br %r4 # %r4 is the target
[...]
Just an easy fix is to be more careful and do not try any unwinding if we find
PC is in the epilogue (previous instruction modifies SP=%r15).
It is even a performance optimization and I see no regression risk there.
The specific s390x error is:
#0 throw_error (error=MEMORY_ERROR, fmt=0x8042676a "Cannot access memory at address %s") at exceptions.c:415
#1 in memory_error (status=5, memaddr=0) at corefile.c:220
#2 in read_memory (memaddr=0, myaddr=0x3ffffc7f7f0 "", len=8) at corefile.c:238
#3 in read_memory_unsigned_integer (memaddr=0, len=8, byte_order=BFD_ENDIAN_BIG) at corefile.c:321
#4 in s390_backchain_frame_unwind_cache (this_frame=0x80608958, info=0x80608a08) at s390-tdep.c:1525
#5 in s390_frame_unwind_cache (this_frame=0x80608958, this_prologue_cache=0x80608970) at s390-tdep.c:1572
#6 in s390_frame_this_id (this_frame=0x80608958, this_prologue_cache=0x80608970, this_id=0x806089b8) at s390-tdep.c:1583
#7 in get_frame_id (fi=0x80608958) at frame.c:335
#8 in frame_find_by_id (id={stack_addr = 4398044824952, code_addr = 2147484952, special_addr = 0, stack_addr_p = 1, code_addr_p = 1, special_addr_p = 0, inline_depth = 0}) at frame.c:587
#9 in watchpoint_check (p=0x8095bbc0) at breakpoint.c:3203
#10 in catch_errors (func=0x801262c0 <watchpoint_check>, func_args=0x8095bbc0, errstring=0x80a26410 "Error evaluating expression for watchpoint 3\n", mask=6) at exceptions.c:510
#11 in bpstat_check_watchpoint (bs=0x8095bbc0) at breakpoint.c:3404
#12 in bpstat_stop_status (aspace=0x8061fcb0, bp_addr=2147485040, ptid={pid = 17372, lwp = 17372, tid = 0}) at breakpoint.c:3594
#13 in handle_inferior_event (ecs=0x3ffffc80520) at infrun.c:3588
I did not analyze why 6.8 did not error out, the GDB code is similar there.
No regressions on:
{x86_64,x86_64-m32,i686}-fedora12-linux-gnu (CVS HEAD GDB)
s390x-rhel48-linux-gnu (CVS HEAD GDB)
s390-rhel48-linux-gnu (CVS HEAD GDB)
s390x-rhel54-linux-gnu (Fedora 12 GDB)
s390-rhel54-linux-gnu (Fedora 12 GDB)
Thanks,
Jan
gdb/
2009-12-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (watchpoint_check): Check the call
gdbarch_in_function_epilogue_p before calling frame_find_by_id.
Extend the comment.
gdb/testsuite/
2009-12-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/watchpoint-cond-gone.exp, gdb.base/watchpoint-cond-gone.c,
gdb.base/watchpoint-cond-gone-stripped.c: New.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3200,6 +3200,17 @@ watchpoint_check (void *p)
struct gdbarch *frame_arch = get_frame_arch (frame);
CORE_ADDR frame_pc = get_frame_pc (frame);
+ /* in_function_epilogue_p() returns a non-zero value if we're still
+ in the function but the stack frame has already been invalidated.
+ Since we can't rely on the values of local variables after the
+ stack has been destroyed, we are treating the watchpoint in that
+ state as `not changed' without further checking. Don't mark
+ watchpoints as changed if the current frame is in an epilogue -
+ even if they are in some other frame, our view of the stack
+ is likely to be wrong and frame_find_by_id could error out. */
+ if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
+ return WP_VALUE_NOT_CHANGED;
+
fr = frame_find_by_id (b->watchpoint_frame);
within_current_scope = (fr != NULL);
@@ -3216,17 +3227,6 @@ watchpoint_check (void *p)
within_current_scope = 0;
}
- /* in_function_epilogue_p() returns a non-zero value if we're still
- in the function but the stack frame has already been invalidated.
- Since we can't rely on the values of local variables after the
- stack has been destroyed, we are treating the watchpoint in that
- state as `not changed' without further checking. Don't mark
- watchpoints as changed if the current frame is in an epilogue -
- even if they are in some other frame, our view of the stack
- is likely to be wrong. */
- if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
- return WP_VALUE_NOT_CHANGED;
-
if (within_current_scope)
/* If we end up stopping, the current frame will get selected
in normal_stop. So this call to select_frame won't affect
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c
@@ -0,0 +1,23 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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 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. */
+
+void
+jumper (void (*jumpto) (void))
+{
+ (*jumpto) ();
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.c
@@ -0,0 +1,37 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 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 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. */
+
+extern void jumper (void (*jumpto) (void));
+
+static void
+func (void)
+{
+ volatile int c;
+
+ c = 5;
+ c = 10; /* watchpoint-here */
+ c = 20;
+}
+
+int
+main (void)
+{
+ jumper (func);
+
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp
@@ -0,0 +1,51 @@
+# Copyright 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile "watchpoint-cond-gone"
+set srcfile ${testfile}.c
+set srcfilestripped ${testfile}-stripped.c
+set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
+set binfile ${objdir}/${subdir}/${testfile}
+
+# We need to generate a function without DWARF to crash older GDB.
+# Stepping into a dynamic function trampoline or stepping out of MAIN may work
+# but it is not a reliable FAIL case.
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != ""
+ || [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+clean_restart ${testfile}
+
+# Problem does not occur otherwise.
+gdb_test "set can-use-hw-watchpoints 0"
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_breakpoint [gdb_get_line_number "watchpoint-here"]
+gdb_continue_to_breakpoint "Place to set the watchpoint"
+
+# The condition `c == 30' is the subject being tested.
+gdb_test "watch c if c == 30" "" "Place the watchpoint"
+
+# We may stay either in the function itself or only at the first instruction of
+# its caller depending on the epilogue unwinder (or valid epilogue CFI) presence.
+gdb_test "finish" \
+ "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \
+ "Catch the no longer valid watchpoint"

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Apr 15 14:22:36 CEST 2010 - rguenther@novell.com
- Merge from gdb-7.1-12.fc13.src.rpm.
-------------------------------------------------------------------
Thu Mar 11 15:45:22 CET 2010 - rguenther@novell.com

221
gdb.spec
View File

@ -1,5 +1,5 @@
#
# spec file for package gdb (Version 7.0.1)
# spec file for package gdb (Version 7.1)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -23,14 +23,15 @@ Name: gdb
# Set version to contents of gdb/version.in.
# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
Version: 7.0.1
Version: 7.1
Release: 1
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
License: GPLv3+
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
Group: Development/Debuggers
# Do not provide URL for snapshots as the file lasts there only for 2 days.
# ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2
# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2
@ -64,7 +65,7 @@ Source2: gdb-orphanripper.c
Source3: gdb-gstack.man
# libstdc++ pretty printers from GCC SVN HEAD (4.5 experimental).
%define libstdcxxpython libstdc++-v3-python-r151798
%define libstdcxxpython libstdc++-v3-python-r155978
Source4: %{libstdcxxpython}.tar.bz2
# Work around out-of-date dejagnu that does not have KFAIL
@ -101,7 +102,6 @@ Patch118: gdb-6.3-gstack-20050411.patch
# VSYSCALL and PIE
Patch122: gdb-6.3-test-pie-20050107.patch
Patch124: gdb-archer-pie.patch
Patch389: gdb-archer-pie-addons.patch
Patch394: gdb-archer-pie-addons-keep-disabled.patch
@ -163,10 +163,6 @@ Patch170: gdb-6.3-bt-past-zero-20051201.patch
# Use bigger numbers than int.
Patch176: gdb-6.3-large-core-20051206.patch
# Hard-code executable names in gstack, such that it can run with a
# corrupted or missing PATH.
Patch177: gdb-6.3-gstack-without-path-20060414.patch
# Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
Patch188: gdb-6.5-bz203661-emit-relocs.patch
@ -204,8 +200,7 @@ Patch213: gdb-6.5-readline-long-line-crash-test.patch
# Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
Patch214: gdb-6.5-bz216711-clone-is-outermost.patch
# Try to reduce sideeffects of skipping ppc .so libs trampolines (BZ 218379).
Patch215: gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
Patch216: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
# Fix lockup on trampoline vs. its function lookup; unreproducible (BZ 218379).
@ -220,8 +215,8 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch
# Testcase for exec() from threaded program (BZ 202689).
Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
# Backported post gdb-7.0 fixups.
Patch232: gdb-7.0-upstream.patch
# Backported fixups post the source tarball.
Patch232: gdb-upstream.patch
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
@ -266,6 +261,7 @@ Patch271: gdb-6.5-bz243845-stale-testing-zombie-test.patch
# New locating of the matching binaries from the pure core file (build-id).
Patch274: gdb-6.6-buildid-locate.patch
Patch353: gdb-6.6-buildid-locate-rpm.patch
Patch415: gdb-6.6-buildid-locate-core-as-arg.patch
# Fix displaying of numeric char arrays as strings (BZ 224128).
Patch282: gdb-6.7-charsign-test.patch
@ -302,9 +298,6 @@ Patch309: gdb-6.3-mapping-zero-inode-test.patch
# Test a crash on `focus cmd', `focus prev' commands.
Patch311: gdb-6.3-focus-cmd-prev-test.patch
# Fix error on a sw watchpoint active at function epilogue (hit on s390x).
Patch314: gdb-watchpoint-cond-gone.patch
# Test various forms of threads tracking across exec() (BZ 442765).
Patch315: gdb-6.8-bz442765-threaded-exec-test.patch
@ -326,13 +319,6 @@ Patch324: gdb-6.8-glibc-headers-compat.patch
# Create a single binary `gdb' autodetecting --tui by its argv[0].
Patch326: gdb-6.8-tui-singlebinary.patch
# Support transparent debugging of inlined functions for an optimized code.
# Disable break-by-name on inlined functions due to a regression on parameters
# of inlined functions falsely <optimized out> (BZ 556975 Comment 8).
# Disable addon (finish) due to inline-cmds.exp: up from outer_inline2 assert.
Patch350: gdb-6.8-inlining-addon.patch
Patch328: gdb-6.8-inlining-by-name.patch
# Fix PRPSINFO in the core files dumped by gcore (BZ 254229).
Patch329: gdb-6.8-bz254229-gcore-prpsinfo.patch
@ -356,40 +342,18 @@ Patch348: gdb-6.8-bz466901-backtrace-full-prelinked.patch
# The merged branch `archer' of: http://sourceware.org/gdb/wiki/ProjectArcher
Patch349: gdb-archer.patch
Patch418: gdb-archer-excessive-files.patch
Patch420: gdb-archer-ada.patch
# Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187).
# - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE.
Patch352: gdb-6.8-bz457187-largefile.patch
Patch360: gdb-6.8-bz457187-largefile-test.patch
# Fix compatibility of --with-system-readline and readline-6.0+.
Patch375: gdb-readline-6.0.patch
# Fix python pretty printers lookup on x86_64.
Patch376: libstdc++-v3-python-common-prefix.patch
# New test for step-resume breakpoint placed in multiple threads at once.
Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch
# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
Patch382: gdb-core-open-vdso-warning.patch
# Support multiple directories for `set debug-file-directory' (BZ 528668).
Patch383: gdb-bz528668-symfile-sepcrc.patch
Patch384: gdb-bz528668-symfile-cleanup.patch
Patch385: gdb-bz528668-symfile-multi.patch
# Support GNU IFUNCs - indirect functions (BZ 539590).
Patch387: gdb-bz539590-gnu-ifunc.patch
# Fix bp conditionals [bp_location-accel] regression (BZ 538626).
Patch388: gdb-bz538626-bp_location-accel-bp-cond.patch
# Fix callback-mode readline-6.0 regression for CTRL-C.
Patch390: gdb-readline-6.0-signal.patch
# Fix syscall restarts for amd64->i386 biarch.
Patch391: gdb-x86_64-i386-syscall-restart.patch
@ -403,61 +367,75 @@ Patch393: gdb-rhel5-gcc44.patch
# Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595).
Patch335: gdb-rhel5-compat.patch
# Fix backward compatibility with G++ 4.1 namespaces "::".
Patch395: gdb-empty-namespace.patch
# Fix regression on re-setting the single ppc watchpoint slot.
Patch396: gdb-ppc-hw-watchpoint-twice.patch
# Fix regression by python on ia64 due to stale current frame.
Patch397: gdb-follow-child-stale-parent.patch
# testsuite: Fix false MI "unknown output after running" regression.
Patch398: gdb-testsuite-unknown-output.patch
# Workaround ccache making lineno non-zero for command-line definitions.
Patch403: gdb-ccache-workaround.patch
# Fix regression of gdb-7.0.1 not preserving typedef of a field.
Patch399: gdb-bitfield-check_typedef.patch
# Implement `info common' for Fortran.
Patch404: gdb-fortran-common-reduce.patch
Patch405: gdb-fortran-common.patch
# Fix related_breakpoint stale ref crash.
Patch400: gdb-stale-related_breakpoint.patch
# Fix Fortran logical-kind=8 (BZ 465310).
Patch406: gdb-fortran-logical8.patch
# Fix crash reading broken stabs (it377671).
Patch401: gdb-stabs-read_args.patch
# Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
Patch407: gdb-lineno-makeup-test.patch
# Fix crash while executing python code.
Patch402: gdb-python-cplus-crash.patch
# Test power7 ppc disassembly.
Patch408: gdb-ppc-power7-test.patch
# Fix failed gdb_assert due to the PIE patchset (BZ 559414).
Patch414: gdb-bz559414-pie-assert-fix.patch
# Fortran: Fix regression on setting breakpoint at toplevel symbols (BZ 559291).
Patch416: gdb-bz559291-fortran-module-toplevel.patch
# Revert: Add -Wunused-function to compile flags.
Patch412: gdb-unused-revert.patch
# Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866).
Patch417: gdb-bz541866-rwatch-before-run.patch
# testsuite: Fix long timeout on arches with failing gdb.base/interrupt.exp.
Patch419: gdb-test-interrupt.exp-timeout.patch
# Fix crash on stale addrinfo->sectindex (more sensitive due to the PIE patch).
Patch421: gdb-stale-sectindex.patch
# Remove false gdb_assert on $sp underflow.
Patch422: gdb-infcall-sp-underflow.patch
# Workaround ia64 inferior calls clearing SP.
Patch423: gdb-ia64-infcall-workaround.patch
# Fix double-free on std::terminate handler (Tom Tromey, BZ 562975).
Patch429: gdb-bz562975-std-terminate-double-free.patch
# [delayed-symfile] Backport fix of reread_symbols (Tom Tromey, BZ 562517).
Patch424: gdb-bz562517-archer-reread-quick_addrmap.patch
# PIE: Fix back re-reun.
Patch430: gdb-pie-rerun.patch
# Fix false warning: section .gnu.liblist not found in ...
Patch425: gdb-false-warning-gnu.liblist.patch
# Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742).
Patch432: gdb-solib-memory-error-nonfatal.patch
# testsuite: Fix unstable results of gdb.base/prelink.exp.
Patch433: gdb-6.7-testsuite-stable-results-prelink.patch
# [patch 1/6] PIE: Attach binary even after re-prelinked underneath
# [patch 2/6] PIE: Attach binary even after ld.so re-prelinked underneath
# [patch 3/6] PIE: Fix occasional error attaching i686 binary
Patch434: gdb-pie-1of6-reprelinked-bin.patch
Patch435: gdb-pie-2of6-reprelinked-ld.patch
Patch436: gdb-pie-3of6-relocate-once.patch
# [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla).
Patch437: gdb-using-directive-leak.patch
# Fix dangling displays in separate debuginfo (BZ 574483).
Patch438: gdb-bz574483-display-sepdebug.patch
# Support AVX registers (BZ 578250).
Patch439: gdb-bz578250-avx-01of10.patch
Patch440: gdb-bz578250-avx-02of10.patch
Patch441: gdb-bz578250-avx-03of10.patch
Patch442: gdb-bz578250-avx-04of10.patch
Patch443: gdb-bz578250-avx-05of10.patch
Patch444: gdb-bz578250-avx-06of10.patch
Patch445: gdb-bz578250-avx-07of10.patch
Patch446: gdb-bz578250-avx-08of10.patch
Patch447: gdb-bz578250-avx-09of10.patch
Patch448: gdb-bz578250-avx-10of10.patch
Patch449: gdb-bz578250-avx-10of10-ppc.patch
# Fix readline 5.1 warnings
Patch1000: readline-5.1-random.patch
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
Patch1007: fix-gdb-backtrace.diff
BuildRequires: bison flex gettext glibc-devel ncurses-devel texinfo zlib-devel
%if %{suse_version} < 1020
@ -479,8 +457,9 @@ BuildRequires: python-devel
# Ensure the devel libraries are installed for both multilib arches.
%define bits_local %{?_isa}
%define bits_other %{?_isa}
%if 0%{!?el5:1}
%ifarch s390x
%define bits_other (%{__isa_name}-31)
%define bits_other (%{__isa_name}-32)
%else #!s390x
%ifarch ppc
%define bits_other (%{__isa_name}-64)
@ -490,6 +469,7 @@ BuildRequires: python-devel
%endif #sparc64 ppc64 s390x x86_64
%endif #!ppc
%endif #!s390x
%endif #!el5
BuildRequires: dejagnu sharutils
# gcc-objc++ is not covered by the GDB testsuite.
@ -518,7 +498,7 @@ Java, and other languages, by executing them in a controlled fashion
and printing their data.
%package -n gdbserver
License: GPLv3+
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
Summary: A standalone server for GDB (the GNU source-level debugger)
Group: Development/Debuggers
@ -527,7 +507,8 @@ GDB, the GNU debugger, allows you to debug programs written in C, C++,
Java, and other languages, by executing them in a controlled fashion
and printing their data.
This package provides a program that allows you to run GDB on a different machine than the one which is running the program being debugged.
This package provides a program that allows you to run GDB on a different
machine than the one which is running the program being debugged.
%prep
@ -552,13 +533,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch232 -p1
%patch349 -p1
%patch418 -p1
%patch420 -p1
%patch383 -p1
%patch384 -p1
%patch385 -p1
%patch388 -p1
%patch124 -p1
%patch1 -p1
%patch3 -p1
@ -589,7 +564,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch169 -p1
%patch170 -p1
%patch176 -p1
%patch177 -p1
%patch188 -p1
%patch190 -p1
%patch194 -p1
@ -602,7 +576,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch211 -p1
%patch213 -p1
%patch214 -p1
%patch215 -p1
%patch216 -p1
%patch217 -p1
%patch225 -p1
@ -637,7 +610,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch304 -p1
%patch309 -p1
%patch311 -p1
%patch314 -p1
%patch315 -p1
%patch317 -p1
%patch318 -p1
@ -645,8 +617,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch322 -p1
%patch324 -p1
%patch326 -p1
###patch350 -p1
###patch328 -p1
%patch329 -p1
%patch330 -p1
%patch331 -p1
@ -654,51 +624,46 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch337 -p1
%patch343 -p1
%patch348 -p1
%patch352 -p1
%patch360 -p1
%patch375 -p1
%patch376 -p1
%patch381 -p1
%patch382 -p1
# Does not work on ia64
%ifnarch ia64
%patch387 -p1
%endif
%patch389 -p1
%patch390 -p1
%patch391 -p1
%patch392 -p1
%patch394 -p1
%patch395 -p1
%patch396 -p1
%patch397 -p1
%patch398 -p1
%patch399 -p1
%patch400 -p1
%patch401 -p1
%patch402 -p1
%patch414 -p1
%patch416 -p1
%patch403 -p1
%patch404 -p1
%patch405 -p1
%patch389 -p1
%patch394 -p1
%patch406 -p1
%patch407 -p1
%patch408 -p1
%patch412 -p1
%patch417 -p1
%patch419 -p1
%patch421 -p1
%patch422 -p1
%patch423 -p1
%patch424 -p1
%patch425 -p1
%if 0
# Always verify their applicability.
%patch393 -p1
%patch335 -p1
%if 0%{!?el5:1}
%patch393 -p1 -R
%patch335 -p1 -R
%endif
%endif
%patch429 -p1
%patch430 -p1
%patch432 -p1
%patch433 -p1
%patch434 -p1
%patch435 -p1
%patch436 -p1
%patch437 -p1
%patch438 -p1
%patch439 -p1
%patch440 -p1
%patch441 -p1
%patch442 -p1
%patch443 -p1
%patch444 -p1
%patch445 -p1
%patch446 -p1
%patch447 -p1
%patch448 -p1
%patch449 -p1
%patch1000
%patch1002 -p1
%patch1007
find -name "*.orig" | xargs rm -f
! find -name "*.rej" # Should not happen.
@ -975,7 +940,7 @@ fi
%files
%defattr(-,root,root)
%doc COPYING COPYING.LIB README NEWS
%doc COPYING3 COPYING COPYING.LIB README NEWS
%{_bindir}/gcore
%{_bindir}/gdb
%{_bindir}/gdbtui

View File

@ -1,18 +0,0 @@
On x86_64 host with:
pythondir: /usr/lib/python2.6/site-packages/gdb
libdir: /usr/lib64
prefix got set to "/usr/lib" but the code expects a trailing "/" (missing then
one "../" path component).
--- ./libstdc++-v3-python-r151798/hook.in-orig 2009-06-18 21:12:37.000000000 +0200
+++ ./libstdc++-v3-python-r151798/hook.in 2009-09-17 23:37:35.000000000 +0200
@@ -40,7 +40,7 @@ if gdb.current_objfile () is not None:
# In some bizarre configuration we might have found a match in the
# middle of a directory name.
if prefix[-1] != '/':
- prefix = os.path.dirname (prefix)
+ prefix = os.path.dirname (prefix) + '/'
# Strip off the prefix.
pythondir = pythondir[len (prefix):]

View File

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

View File

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