- Rebase to FSF GDB 7.1.90.20100721 (which is 7.2 pre-release).

This commit is contained in:
Jan Kratochvil 2010-07-21 21:30:20 +00:00
parent 1c901a1d76
commit dd46ae6cd0
108 changed files with 3132 additions and 47388 deletions

View File

@ -1,2 +1 @@
gdb-7.1.tar.bz2
libstdc++-v3-python-r155978.tar.bz2
gdb-7.1.90.20100721.tar.bz2

View File

@ -28,7 +28,7 @@
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/attach-see-vdso.exp 6 Jul 2007 14:14:44 -0000
@@ -0,0 +1,79 @@
@@ -0,0 +1,72 @@
+# Copyright 2007
+
+# This program is free software; you can redistribute it and/or modify
@ -47,13 +47,6 @@
+
+# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# This test only works on Linux
+if { ![istarget "*-*-linux-gnu*"] } {
+ return 0

View File

@ -15,11 +15,11 @@ testsuite/gdb.base:
Port to GDB-6.7.
Index: gdb-6.7/gdb/testsuite/gdb.base/setshow.exp
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/setshow.exp
===================================================================
--- gdb-6.7.orig/gdb/testsuite/gdb.base/setshow.exp 2007-08-23 20:14:17.000000000 +0200
+++ gdb-6.7/gdb/testsuite/gdb.base/setshow.exp 2007-10-15 21:34:52.000000000 +0200
@@ -106,6 +106,16 @@ if { ![target_info exists use_gdb_stub]
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/setshow.exp 2010-06-11 22:56:06.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/setshow.exp 2010-07-12 10:46:06.000000000 +0200
@@ -96,6 +96,16 @@ if { ![target_info exists use_gdb_stub]
delete_breakpoints
gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
}
@ -34,13 +34,13 @@ Index: gdb-6.7/gdb/testsuite/gdb.base/setshow.exp
+#test show backtrace past-zero-pc
+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is off." "show backtrace past-zero-pc (off)"
#test set check range on
gdb_test "set check range on" "" "set check range on"
gdb_test "set check range on" ".*" "set check range on"
#test show check range on
Index: gdb-6.7/gdb/frame.c
Index: gdb-7.1.90.20100711/gdb/frame.c
===================================================================
--- gdb-6.7.orig/gdb/frame.c 2007-10-12 22:35:58.000000000 +0200
+++ gdb-6.7/gdb/frame.c 2007-10-15 21:34:52.000000000 +0200
@@ -133,6 +133,16 @@ Whether backtraces should continue past
--- gdb-7.1.90.20100711.orig/gdb/frame.c 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/frame.c 2010-07-12 10:45:18.000000000 +0200
@@ -185,6 +185,16 @@ Whether backtraces should continue past
value);
}
@ -57,7 +57,7 @@ Index: gdb-6.7/gdb/frame.c
static int backtrace_past_entry;
static void
show_backtrace_past_entry (struct ui_file *file, int from_tty,
@@ -1483,9 +1493,7 @@ get_prev_frame (struct frame_info *this_
@@ -1784,9 +1794,7 @@ get_prev_frame (struct frame_info *this_
}
if (this_frame->level > 0
@ -68,7 +68,7 @@ Index: gdb-6.7/gdb/frame.c
&& get_frame_type (this_frame) == NORMAL_FRAME
&& get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
&& get_frame_pc (this_frame) == 0)
@@ -1850,6 +1858,17 @@ the rest of the stack trace."),
@@ -2271,6 +2279,17 @@ the rest of the stack trace."),
&set_backtrace_cmdlist,
&show_backtrace_cmdlist);

View File

@ -218,7 +218,7 @@ diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c gd
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
--- gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 1969-12-31 19:00:00.000000000 -0500
+++ gdb-6.3/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp 2007-08-02 14:21:29.000000000 -0400
@@ -0,0 +1,79 @@
@@ -0,0 +1,72 @@
+# Copyright 2006, 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -238,13 +238,6 @@ diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
+# jump of the PIE code.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "powerpc*-*-linux*"] then {
+ verbose "Skipping powerpc-linux prologue tests."
+ return

View File

@ -41,7 +41,7 @@ testsuite:
+
--- gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp.fix 2005-07-25 16:42:50.000000000 -0400
+++ gdb-6.3/gdb/testsuite/gdb.arch/ia64-sigtramp.exp 2005-07-25 16:42:01.000000000 -0400
@@ -0,0 +1,73 @@
@@ -0,0 +1,63 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -63,16 +63,6 @@ testsuite:
+
+# This file was written by Jeff Johnston (jjohnstn@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+if ![istarget "ia64-*-*"] then {
+ return
+}

View File

@ -16,7 +16,7 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.arch/ia64-sigill.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.arch/ia64-sigill.exp 2008-12-02 21:10:57.000000000 +0100
@@ -0,0 +1,59 @@
@@ -0,0 +1,49 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -38,16 +38,6 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.arch/ia64-sigill.exp
+
+# This file was written by Jeff Johnston (jjohnstn@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+if ![istarget "ia64-*-*"] then {
+ return
+}

View File

@ -38,7 +38,7 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.base/attach-32.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.base/attach-32.exp 2008-12-07 10:08:52.000000000 +0100
@@ -0,0 +1,252 @@
@@ -0,0 +1,245 @@
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -57,13 +57,6 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.base/attach-32.exp
+#
+# This test was based on attach.exp and modified for 32/64 bit Linux systems. */
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# On HP-UX 11.0, this test is causing a process running the program
+# "attach" to be left around spinning. Until we figure out why, I am
+# commenting out the test to avoid polluting tiamat (our 11.0 nightly

View File

@ -62,7 +62,7 @@ Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp 2009-08-12 06:58:28.000000000 +0200
@@ -0,0 +1,54 @@
@@ -0,0 +1,47 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
@ -84,13 +84,6 @@ Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp
+# Check that GDB can properly print an inherited member variable
+# (Bugzilla 146835)
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "b146835"
+set srcfile ${testfile}.cc
+set srcfile2 ${testfile}b.cc

View File

@ -25,10 +25,10 @@
Port to GDB-6.7.
Index: gdb-7.0.50.20100115/gdb/symfile-mem.c
Index: gdb-7.1.90.20100711/gdb/symfile-mem.c
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/symfile-mem.c 2010-01-01 08:31:42.000000000 +0100
+++ gdb-7.1.90.20100711/gdb/symfile-mem.c 2010-07-12 10:46:24.000000000 +0200
@@ -57,6 +57,14 @@
#include "elf/common.h"
@ -53,20 +53,20 @@ Index: gdb-7.0.50.20100115/gdb/symfile-mem.c
if (nbfd == NULL)
error (_("Failed to read a valid object file image from memory."));
Index: gdb-7.0.50.20100115/gdb/target.c
Index: gdb-7.1.90.20100711/gdb/target.c
===================================================================
--- 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 *
--- gdb-7.1.90.20100711.orig/gdb/target.c 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/target.c 2010-07-12 10:47:04.000000000 +0200
@@ -58,7 +58,7 @@ static int nosymbol (char *, CORE_ADDR *
static void tcomplain (void) ATTR_NORETURN;
static void tcomplain (void) ATTRIBUTE_NORETURN;
-static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
+static LONGEST nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
static int return_zero (void);
@@ -494,7 +494,7 @@ target_terminal_inferior (void)
@@ -513,7 +513,7 @@ target_terminal_inferior (void)
(*current_target.to_terminal_inferior) ();
}
@ -75,7 +75,7 @@ Index: gdb-7.0.50.20100115/gdb/target.c
nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct target_ops *t)
{
@@ -726,7 +726,7 @@ update_current_target (void)
@@ -718,7 +718,7 @@ update_current_target (void)
(void (*) (struct regcache *))
noprocess);
de_fault (deprecated_xfer_memory,
@ -84,7 +84,7 @@ Index: gdb-7.0.50.20100115/gdb/target.c
nomemory);
de_fault (to_files_info,
(void (*) (struct target_ops *))
@@ -1497,7 +1497,7 @@ target_xfer_partial (struct target_ops *
@@ -1526,7 +1526,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-7.0.50.20100115/gdb/target.c
{
/* Dispatch to the topmost target, not the flattened current_target.
Memory accesses check target->to_has_(all_)memory, and the
@@ -1513,7 +1513,7 @@ target_read_memory (CORE_ADDR memaddr, g
@@ -1542,7 +1542,7 @@ target_read_memory (CORE_ADDR memaddr, g
the target's stack. This may trigger different cache behavior. */
int
@ -102,7 +102,7 @@ Index: gdb-7.0.50.20100115/gdb/target.c
{
/* Dispatch to the topmost target, not the flattened current_target.
Memory accesses check target->to_has_(all_)memory, and the
@@ -1532,7 +1532,7 @@ target_read_stack (CORE_ADDR memaddr, gd
@@ -1561,7 +1561,7 @@ target_read_stack (CORE_ADDR memaddr, gd
Callers that can deal with partial writes should call target_write. */
int
@ -111,7 +111,7 @@ Index: gdb-7.0.50.20100115/gdb/target.c
{
/* Dispatch to the topmost target, not the flattened current_target.
Memory accesses check target->to_has_(all_)memory, and the
@@ -3098,8 +3098,8 @@ debug_to_prepare_to_store (struct regcac
@@ -3218,8 +3218,8 @@ debug_to_prepare_to_store (struct regcac
fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
}
@ -122,7 +122,7 @@ Index: gdb-7.0.50.20100115/gdb/target.c
int write, struct mem_attrib *attrib,
struct target_ops *target)
{
@@ -3109,8 +3109,8 @@ deprecated_debug_xfer_memory (CORE_ADDR
@@ -3229,8 +3229,8 @@ deprecated_debug_xfer_memory (CORE_ADDR
attrib, target);
fprintf_unfiltered (gdb_stdlog,
@ -133,11 +133,11 @@ Index: gdb-7.0.50.20100115/gdb/target.c
write ? "write" : "read", retval);
if (retval > 0)
Index: gdb-7.0.50.20100115/gdb/target.h
Index: gdb-7.1.90.20100711/gdb/target.h
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/target.h 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/target.h 2010-07-12 10:46:24.000000000 +0200
@@ -417,10 +417,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-7.0.50.20100115/gdb/target.h
void (*to_files_info) (struct target_ops *);
int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *);
@@ -786,12 +786,12 @@ extern void target_dcache_invalidate (vo
@@ -838,12 +838,12 @@ extern void target_dcache_invalidate (vo
extern int target_read_string (CORE_ADDR, char **, int, int *);
@ -168,11 +168,11 @@ Index: gdb-7.0.50.20100115/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-7.0.50.20100115/gdb/dcache.c
Index: gdb-7.1.90.20100711/gdb/dcache.c
===================================================================
--- 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)
--- gdb-7.1.90.20100711.orig/gdb/dcache.c 2010-05-14 19:53:15.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/dcache.c 2010-07-12 10:46:24.000000000 +0200
@@ -465,10 +465,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. */
@ -185,10 +185,10 @@ Index: gdb-7.0.50.20100115/gdb/dcache.c
{
int i;
int res;
Index: gdb-7.0.50.20100115/gdb/dcache.h
Index: gdb-7.1.90.20100711/gdb/dcache.h
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/dcache.h 2010-01-01 08:31:30.000000000 +0100
+++ gdb-7.1.90.20100711/gdb/dcache.h 2010-07-12 10:46:24.000000000 +0200
@@ -35,8 +35,8 @@ void dcache_free (DCACHE *);
/* Simple to call from <remote>_xfer_memory */
@ -200,11 +200,11 @@ Index: gdb-7.0.50.20100115/gdb/dcache.h
void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
int len);
Index: gdb-7.0.50.20100115/gdb/exec.c
Index: gdb-7.1.90.20100711/gdb/exec.c
===================================================================
--- 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)
--- gdb-7.1.90.20100711.orig/gdb/exec.c 2010-05-14 20:35:11.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/exec.c 2010-07-12 10:46:24.000000000 +0200
@@ -571,7 +571,7 @@ map_vmap (bfd *abfd, bfd *arch)
}
@ -213,11 +213,11 @@ Index: gdb-7.0.50.20100115/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-7.0.50.20100115/gdb/linux-nat.c
Index: gdb-7.1.90.20100711/gdb/linux-nat.c
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/linux-nat.c 2010-07-12 10:44:36.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/linux-nat.c 2010-07-12 10:46:24.000000000 +0200
@@ -5197,7 +5197,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-7.0.50.20100115/gdb/linux-nat.c
/* Re-read register stack area. */
xxfer = super_xfer_partial (ops, object, annex,
Index: gdb-7.0.50.20100115/gdb/remote.c
Index: gdb-7.1.90.20100711/gdb/remote.c
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/remote.c 2010-07-07 18:15:16.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/remote.c 2010-07-12 10:46:24.000000000 +0200
@@ -25,6 +25,7 @@
#include "gdb_string.h"
#include <ctype.h>
@ -238,7 +238,7 @@ Index: gdb-7.0.50.20100115/gdb/remote.c
#include "inferior.h"
#include "bfd.h"
#include "symfile.h"
@@ -6175,12 +6176,19 @@ handle_notification (char *buf, size_t l
@@ -6515,12 +6516,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-7.0.50.20100115/gdb/remote.c
set_general_thread (inferior_ptid);
@@ -6189,7 +6197,7 @@ remote_xfer_memory (CORE_ADDR mem_addr,
@@ -6529,7 +6537,7 @@ remote_xfer_memory (CORE_ADDR mem_addr,
else
res = remote_read_bytes (mem_addr, buffer, mem_len);
@ -269,11 +269,11 @@ Index: gdb-7.0.50.20100115/gdb/remote.c
}
/* Sends a packet with content determined by the printf format string
Index: gdb-7.0.50.20100115/gdb/remote-sim.c
Index: gdb-7.1.90.20100711/gdb/remote-sim.c
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/remote-sim.c 2010-05-16 23:11:14.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/remote-sim.c 2010-07-12 10:46:24.000000000 +0200
@@ -759,11 +759,14 @@ gdbsim_prepare_to_store (struct regcache
Returns the number of bytes transferred. */
@ -290,10 +290,10 @@ Index: gdb-7.0.50.20100115/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-7.0.50.20100115/gdb/exec.h
Index: gdb-7.1.90.20100711/gdb/exec.h
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/exec.h 2010-01-01 08:31:31.000000000 +0100
+++ gdb-7.1.90.20100711/gdb/exec.h 2010-07-12 10:46:24.000000000 +0200
@@ -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-7.0.90.20100306/gdb/doc/gdb.texinfo
Index: gdb-7.1.90.20100711/gdb/doc/gdb.texinfo
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/doc/gdb.texinfo 2010-07-01 19:40:04.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/doc/gdb.texinfo 2010-07-12 10:41:11.000000000 +0200
@@ -998,6 +998,12 @@ Read each symbol file's entire symbol ta
the default, which is to read it incrementally as it is needed.
This makes startup slower, but makes future operations faster.
@ -28,11 +28,11 @@ Index: gdb-7.0.90.20100306/gdb/doc/gdb.texinfo
@end table
@node Mode Options
Index: gdb-7.0.90.20100306/gdb/main.c
Index: gdb-7.1.90.20100711/gdb/main.c
===================================================================
--- 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)
--- gdb-7.1.90.20100711.orig/gdb/main.c 2010-07-12 10:17:26.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/main.c 2010-07-12 10:41:34.000000000 +0200
@@ -388,6 +388,7 @@ captured_main (void *data)
{"xdb", no_argument, &xdb_commands, 1},
{"dbx", no_argument, &dbx_commands, 1},
{"readnow", no_argument, &readnow_symbol_files, 1},
@ -40,19 +40,19 @@ Index: gdb-7.0.90.20100306/gdb/main.c
{"r", no_argument, &readnow_symbol_files, 1},
{"quiet", no_argument, &quiet, 1},
{"q", no_argument, &quiet, 1},
@@ -1033,6 +1034,7 @@ Options:\n\n\
fputs_unfiltered (_("\
@@ -980,6 +981,7 @@ Options:\n\n\
fputs_unfiltered (_(" file.\n\
--quiet Do not print version number on startup.\n\
--readnow Fully read symbol files on first access.\n\
+ --readnever Do not read symbol files.\n\
"), stream);
fputs_unfiltered (_("\
--se=FILE Use FILE as symbol file and executable file.\n\
Index: gdb-7.0.90.20100306/gdb/symfile.c
Index: gdb-7.1.90.20100711/gdb/symfile.c
===================================================================
--- 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 (
--- gdb-7.1.90.20100711.orig/gdb/symfile.c 2010-06-03 01:01:00.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/symfile.c 2010-07-12 10:41:11.000000000 +0200
@@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup (
/* Global variables owned by this file */
int readnow_symbol_files; /* Read full symbols immediately */
@ -60,33 +60,35 @@ Index: gdb-7.0.90.20100306/gdb/symfile.c
/* External variables and functions referenced. */
Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
Index: gdb-7.1.90.20100711/gdb/dwarf2read.c
===================================================================
--- 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"
--- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-12 10:43:53.000000000 +0200
@@ -51,6 +51,7 @@
#include "typeprint.h"
#include "jv-lang.h"
#include "psympriv.h"
+#include "top.h"
#include <fcntl.h>
#include "gdb_string.h"
@@ -1222,7 +1223,8 @@ dwarf2_has_info (struct objfile *objfile
@@ -1161,8 +1162,9 @@ dwarf2_has_info (struct objfile *objfile
bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
dwarf2_per_objfile->objfile = objfile;
}
- return (dwarf2_per_objfile->info.asection != NULL
+ return !readnever_symbol_files
+ && (dwarf2_per_objfile->info.asection != NULL
&& dwarf2_per_objfile->abbrev.asection != NULL);
- && dwarf2_per_objfile->abbrev.asection != NULL);
+ return (! readnever_symbol_files
+ && (dwarf2_per_objfile->info.asection != NULL
+ && dwarf2_per_objfile->abbrev.asection != NULL));
}
Index: gdb-7.0.90.20100306/gdb/top.h
/* When loading sections, we can either look for ".<name>", or for
Index: gdb-7.1.90.20100711/gdb/top.h
===================================================================
--- 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 *);
--- gdb-7.1.90.20100711.orig/gdb/top.h 2010-04-07 18:54:39.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/top.h 2010-07-12 10:41:11.000000000 +0200
@@ -61,6 +61,7 @@ extern void set_prompt (char *);
/* From random places. */
extern int readnow_symbol_files;

View File

@ -3,17 +3,17 @@
* gdb.gdb/selftest.exp: Add matching on specific Red Hat only version
string.
Index: gdb-6.8/gdb/testsuite/gdb.gdb/selftest.exp
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.gdb/selftest.exp
===================================================================
--- gdb-6.8.orig/gdb/testsuite/gdb.gdb/selftest.exp 2008-01-26 14:56:37.000000000 +0100
+++ gdb-6.8/gdb/testsuite/gdb.gdb/selftest.exp 2008-07-14 10:23:50.000000000 +0200
@@ -354,6 +354,9 @@ proc test_with_self { executable } {
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.gdb/selftest.exp 2010-06-26 08:44:47.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.gdb/selftest.exp 2010-07-12 09:59:42.000000000 +0200
@@ -342,6 +342,9 @@ proc test_with_self { executable } {
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version with cast"
}
+ -re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
+ pass "printed version Fedora or Red Hat Enterprise Linux only"
+ }
-re ".*$gdb_prompt $" { fail "printed version" }
timeout { fail "(timeout) printed version" }
}
do_steps_and_nexts

View File

@ -19,21 +19,30 @@ Proposed upstream but never committed upstream.
(source_command): Update documentation. Check permissions if
FROM_TTY is -1.
Index: gdb-7.0.50.20100121/gdb/cli/cli-cmds.c
Index: gdb-7.1.90.20100720/gdb/cli/cli-cmds.c
===================================================================
--- 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"
--- gdb-7.1.90.20100720.orig/gdb/cli/cli-cmds.c 2010-05-17 21:28:12.000000000 +0200
+++ gdb-7.1.90.20100720/gdb/cli/cli-cmds.c 2010-07-21 20:30:30.000000000 +0200
@@ -39,6 +39,7 @@
#include "source.h"
#include "disasm.h"
#include "tracepoint.h"
+#include "gdb_stat.h"
extern void disconnect_or_stop_tracing (int from_tty);
#include "ui-out.h"
@@ -488,6 +489,29 @@ find_and_open_script (int from_tty, char
file, O_RDONLY, &full_pathname);
make_cleanup (xfree, full_pathname);
@@ -487,7 +488,7 @@ Script filename extension recognition is
int
find_and_open_script (const char *script_file, int search_path,
- FILE **streamp, char **full_pathp)
+ FILE **streamp, char **full_pathp, int from_tty)
{
char *file;
int fd;
@@ -513,6 +514,32 @@ find_and_open_script (const char *script
return 0;
}
+#ifdef HAVE_GETUID
+ if (from_tty == -1)
@ -42,10 +51,12 @@ Index: gdb-7.0.50.20100121/gdb/cli/cli-cmds.c
+
+ if (fstat (fd, &statbuf) < 0)
+ {
+ int save_errno = errno;
+
+ close (fd);
+ /* Do not do_cleanups (old_cleanups) as FILE is allocated there.
+ perror_with_name calls error which should call the cleanups. */
+ perror_with_name (file);
+ do_cleanups (old_cleanups);
+ errno = save_errno;
+ return 0;
+ }
+ if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH))
+ {
@ -53,36 +64,37 @@ Index: gdb-7.0.50.20100121/gdb/cli/cli-cmds.c
+ warning (_("not using untrusted file \"%s\""), file);
+ close (fd);
+ do_cleanups (old_cleanups);
+ errno = EPERM;
+ return 0;
+ }
+ }
+#endif
+
/* 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
do_cleanups (old_cleanups);
if (fd == -1)
*streamp = fdopen (fd, FOPEN_RT);
@@ -572,13 +599,14 @@ source_script_with_search (const char *f
if (file == NULL || *file == 0)
error (_("source command requires file name of file to source."));
- if (!find_and_open_script (file, search_path, &stream, &full_path))
+ if (!find_and_open_script (file, search_path, &stream, &full_path,
+ from_tty))
{
/* The script wasn't found, or was otherwise inaccessible.
If the source command was invoked interactively, throw an error.
Otherwise (e.g. if it was invoked by a script), silently ignore
the error. */
- if (from_tty)
+ if (from_tty > 0)
perror_with_name (file);
else
{
@@ -554,6 +578,7 @@ source_script (char *file, int from_tty)
else
script_from_file (stream, file);
+ /* FILE gets freed by do_cleanups (old_cleanups). */
do_cleanups (old_cleanups);
}
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.exp
return;
Index: gdb-7.1.90.20100720/gdb/testsuite/gdb.base/gdbinit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.exp 2010-01-21 15:11:18.000000000 +0100
@@ -0,0 +1,98 @@
+++ gdb-7.1.90.20100720/gdb/testsuite/gdb.base/gdbinit.exp 2010-07-20 22:25:40.000000000 +0200
@@ -0,0 +1,91 @@
+# Copyright 2005
+# Free Software Foundation, Inc.
+
@ -105,13 +117,6 @@ Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.exp
+
+# This file was written by Jeff Johnston <jjohnstn@redhat.com>.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# are we on a target board
+if [is_remote target] {
+ return
@ -181,17 +186,17 @@ Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.exp
+}
+
+remote_exec build "rm .gdbinit"
Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.sample
Index: gdb-7.1.90.20100720/gdb/testsuite/gdb.base/gdbinit.sample
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.base/gdbinit.sample 2010-01-21 15:11:18.000000000 +0100
+++ gdb-7.1.90.20100720/gdb/testsuite/gdb.base/gdbinit.sample 2010-07-20 22:25:40.000000000 +0200
@@ -0,0 +1 @@
+echo "\nin gdbinit"
Index: gdb-7.0.50.20100121/gdb/main.c
Index: gdb-7.1.90.20100720/gdb/main.c
===================================================================
--- 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. (
--- gdb-7.1.90.20100720.orig/gdb/main.c 2010-06-26 08:44:47.000000000 +0200
+++ gdb-7.1.90.20100720/gdb/main.c 2010-07-21 20:09:03.000000000 +0200
@@ -794,7 +794,7 @@ Excess command line arguments ignored. (
debugging or what directory you are in. */
if (home_gdbinit && !inhibit_gdbinit)
@ -200,12 +205,39 @@ Index: gdb-7.0.50.20100121/gdb/main.c
/* Now perform all the actions indicated by the arguments. */
if (cdarg != NULL)
@@ -887,7 +887,7 @@ Can't attach to process and specify a co
@@ -868,7 +868,7 @@ Can't attach to process and specify a co
/* Read the .gdbinit file in the current directory, *if* it isn't
the same as the $HOME/.gdbinit file (it should exist, also). */
if (local_gdbinit && !inhibit_gdbinit)
- catch_command_errors (source_script, local_gdbinit, 0, RETURN_MASK_ALL);
+ catch_command_errors (source_script, local_gdbinit, -1, RETURN_MASK_ALL);
for (i = 0; i < ncmd; i++)
{
/* Now that all .gdbinit's have been read and all -d options have been
processed, we can read any scripts mentioned in SYMARG.
Index: gdb-7.1.90.20100720/gdb/python/py-auto-load.c
===================================================================
--- gdb-7.1.90.20100720.orig/gdb/python/py-auto-load.c 2010-05-17 23:23:25.000000000 +0200
+++ gdb-7.1.90.20100720/gdb/python/py-auto-load.c 2010-07-20 22:25:40.000000000 +0200
@@ -219,7 +219,7 @@ source_section_scripts (struct objfile *
}
opened = find_and_open_script (file, 1 /*search_path*/,
- &stream, &full_path);
+ &stream, &full_path, 1 /* from_tty */);
/* If the file is not found, we still record the file in the hash table,
we only want to print an error message once.
Index: gdb-7.1.90.20100720/gdb/cli/cli-cmds.h
===================================================================
--- gdb-7.1.90.20100720.orig/gdb/cli/cli-cmds.h 2010-05-03 01:52:14.000000000 +0200
+++ gdb-7.1.90.20100720/gdb/cli/cli-cmds.h 2010-07-20 22:25:40.000000000 +0200
@@ -126,7 +126,8 @@ extern void source_script (char *, int);
/* Exported to objfiles.c. */
extern int find_and_open_script (const char *file, int search_path,
- FILE **streamp, char **full_path);
+ FILE **streamp, char **full_path,
+ int from_tty);
/* Command tracing state. */

View File

@ -62,7 +62,7 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.exp 2008-12-08 22:22:14.000000000 +0100
@@ -0,0 +1,130 @@
@@ -0,0 +1,123 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
@ -83,13 +83,6 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.threads/step-thread-exit.exp
+
+# Check that GDB can step over a thread exit.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "step-thread-exit"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}

View File

@ -129,7 +129,7 @@ Index: gdb/testsuite/ChangeLog
+}
--- gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp.fix Fri Jan 21 17:07:02 2005
+++ gdb-6.3/gdb/testsuite/gdb.cp/constructortest.exp Fri Jan 21 17:05:29 2005
@@ -0,0 +1,137 @@
@@ -0,0 +1,130 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005, 2007 Free Software Foundation, Inc.
@ -150,13 +150,6 @@ Index: gdb/testsuite/ChangeLog
+
+# Check that GDB can break at multiple forms of constructors.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "constructortest"
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${testfile}

View File

@ -23,7 +23,7 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.exp 2008-12-07 10:13:01.000000000 +0100
@@ -0,0 +1,67 @@
@@ -0,0 +1,57 @@
+# Copyright 2005
+# Free Software Foundation, Inc.
+
@ -41,16 +41,6 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.base/move-dir.exp
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "move-dir"
+set srcfile ${testfile}.c
+set incfile ${testfile}.h

View File

@ -436,7 +436,7 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,433 @@
@@ -0,0 +1,423 @@
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -453,16 +453,6 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+if $tracelevel then {
+ strace $tracelevel
+ }
+
+set prms_id 0
+set bug_id 0
+
+# On HP-UX 11.0, this test is causing a process running the program
+# "attach" to be left around spinning. Until we figure out why, I am
+# commenting out the test to avoid polluting tiamat (our 11.0 nightly
@ -874,7 +864,7 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,977 @@
@@ -0,0 +1,966 @@
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2002, 2003, 2004
+# Free Software Foundation, Inc.
@ -900,17 +890,6 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp
+
+# Test the same stuff but with PIE executables
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile "break"
+set srcfile ${testfile}.c
+set srcfile1 ${testfile}1.c
@ -1856,7 +1835,7 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,243 @@
@@ -0,0 +1,233 @@
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
+
@ -1874,18 +1853,8 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# are we on a target board
+if ![isnative] then {
+ return

View File

@ -114,7 +114,7 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.5/gdb/testsuite/gdb.threads/watchthreads-threaded.exp 2006-07-12 01:54:29.000000000 -0300
@@ -0,0 +1,133 @@
@@ -0,0 +1,126 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
@ -135,13 +135,6 @@ Index: gdb-6.5/gdb/testsuite/gdb.threads/watchthreads2.exp
+
+# Check that GDB can support multiple watchpoints across threads.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# This test verifies that a watchpoint is detected in the proper thread
+# so the test is only meaningful on a system with hardware watchpoints.
+if [target_info exists gdb,no_hardware_watchpoints] {

View File

@ -171,7 +171,7 @@ Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2010-01-28 12:52:48.000000000 +0100
@@ -0,0 +1,67 @@
@@ -0,0 +1,60 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -187,13 +187,6 @@ Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp
+# 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 $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile dw2-errno
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}

View File

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

View File

@ -1,7 +1,7 @@
diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp
--- gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp 1969-12-31 19:00:00.000000000 -0500
+++ gdb-6.3/gdb/testsuite/gdb.base/tracefork-zombie.exp 2007-07-31 13:04:12.000000000 -0400
@@ -0,0 +1,82 @@
@@ -0,0 +1,75 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -18,13 +18,6 @@ diff -u -ruNp gdb-6.3-unpatched/gdb/testsuite/gdb.base/tracefork-zombie.exp gdb-
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# are we on a target board
+if [is_remote target] then {
+ return 0

View File

@ -10,11 +10,11 @@ for gdb/ChangeLog:
Port to GDB-6.7.
Index: gdb-6.7/gdb/dwarf2read.c
Index: gdb-7.1.90.20100711/gdb/dwarf2read.c
===================================================================
--- gdb-6.7.orig/gdb/dwarf2read.c 2007-10-15 00:08:30.000000000 +0200
+++ gdb-6.7/gdb/dwarf2read.c 2007-10-15 21:42:43.000000000 +0200
@@ -9070,8 +9070,7 @@ dwarf2_fundamental_type (struct objfile
--- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-12 10:43:53.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-12 10:49:32.000000000 +0200
@@ -11382,8 +11382,7 @@ read_signatured_type (struct objfile *ob
callers will only want a very basic result and this can become a
complaint.
@ -24,7 +24,7 @@ Index: gdb-6.7/gdb/dwarf2read.c
static CORE_ADDR
decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
@@ -9088,7 +9087,7 @@ decode_locdesc (struct dwarf_block *blk,
@@ -11399,7 +11398,7 @@ decode_locdesc (struct dwarf_block *blk,
i = 0;
stacki = 0;
@ -33,8 +33,8 @@ Index: gdb-6.7/gdb/dwarf2read.c
while (i < size)
{
@@ -9270,6 +9269,16 @@ decode_locdesc (struct dwarf_block *blk,
dwarf_stack_op_name (op));
@@ -11581,6 +11580,16 @@ decode_locdesc (struct dwarf_block *blk,
dwarf_stack_op_name (op, 1));
return (stack[stacki]);
}
+ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing

View File

@ -42,7 +42,7 @@ diff -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.5/gdb/testsuite/gdb.base/gcore
diff -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.5/gdb/testsuite/gdb.base/gcore-excessive-memory.exp gdb-6.5-unknown/gdb/testsuite/gdb.base/gcore-excessive-memory.exp
--- gdb-6.5/gdb/testsuite/gdb.base/gcore-excessive-memory.exp 1970-01-01 01:00:00.000000000 +0100
+++ gdb-6.5-unknown/gdb/testsuite/gdb.base/gcore-excessive-memory.exp 2008-01-08 11:47:32.000000000 +0100
@@ -0,0 +1,101 @@
@@ -0,0 +1,94 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -59,13 +59,6 @@ diff -u -X /home/jkratoch/.diffi.list -ruNp gdb-6.5/gdb/testsuite/gdb.base/gcore
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile gcore-excessive-memory
+set srcfile ${testfile}.c
+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh

View File

@ -1,847 +0,0 @@
2006-10-01 Jan Kratochvil <jan.kratochvil@redhat.com>
Fujitsu
* amd64-linux-nat.c: Support new linux_elfcore_write_prpsinfo,
linux_elfcore_write_prstatus, linux_elfcore_write_prfpreg.
(i386_linux_gregset32_reg_offset): New mapping for i386 on amd64.
* gcore.c (gcore_create_callback): Comment vdso Linux kernel bug.
* configure.ac: Check for <sys/user32.h>, <sys/procfs32.h>.
* configure, config.in: Regenerated.
* gdb_user32.h, gdb_procfs32.h: Define 32-bit core files even for
64-bit gdb, provide fallbacks for <sys/user32.h> and <sys/procfs32.h>.
* linux-nat.c: Virtualize `elfcore_*' by (*`linux_elfcore_*').
(linux_nat_do_thread_registers): Likewise.
(linux_nat_make_corefile_notes): Likewise.
* linux-nat.h: Likewise.
* Makefile.in: Dependencies updated.
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
Index: gdb-7.0.50.20100115/gdb/amd64-linux-nat.c
===================================================================
--- 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"
#include "i386-nat.h"
+#include "i387-tdep.h"
+#include "elf-bfd.h"
+#include "gdb_procfs32.h"
/* Mapping between the general-purpose registers in GNU/Linux x86-64
`struct user' format and GDB's register cache layout. */
@@ -85,6 +88,35 @@ static int amd64_linux_gregset64_reg_off
GNU/Linux i386 registers are all 32-bit, but since we're
little-endian we get away with that. */
+/* This info is not reusable from "i386-linux-nat.c" as gdb itself runs in
+ 64-bit mode and so ptrace(2) has 64-bit structure layout.
+ Just the corefile being generated has 32-bit layout so we need to do
+ a conversion specific to the i386-on-amd64 compatibility mode. */
+static int i386_linux_gregset32_reg_offset[] =
+{
+ 6 * 4, /* %eax */
+ 1 * 4, /* %ecx */
+ 2 * 4, /* %edx */
+ 0 * 4, /* %ebx */
+ 15 * 4, /* %esp */
+ 5 * 4, /* %ebp */
+ 3 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 12 * 4, /* %eip */
+ 14 * 4, /* %eflags */
+ 13 * 4, /* %cs */
+ 16 * 4, /* %ss */
+ 7 * 4, /* %ds */
+ 8 * 4, /* %es */
+ 9 * 4, /* %fs */
+ 10 * 4, /* %gs */
+ -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,
+ 11 * 4 /* "orig_eax" */
+};
+
/* From <sys/reg.h> on GNU/Linux i386. */
static int amd64_linux_gregset32_reg_offset[] =
{
@@ -103,6 +135,96 @@ static int amd64_linux_gregset32_reg_off
};
+/* This functions make ELF32 32-bit elfcore note sections
+ on amd64 environment. */
+
+static char *
+amd64_linux_elfcore_write_prpsinfo (bfd *abfd, char *buf, int *bufsiz,
+ const char *fname, const char *psargs)
+{
+ if (gdbarch_ptr_bit (target_gdbarch) == 32)
+ {
+ int note_type;
+ char *note_name = "CORE";
+ struct elf_prpsinfo32 data;
+ note_type = NT_PRPSINFO;
+
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ return elfcore_write_note (abfd, buf, bufsiz,
+ note_name, note_type, &data, sizeof (data));
+ }
+ else
+ return elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs);
+}
+
+static void
+amd64_linux_set_registers (const gdb_byte *gregs, gdb_byte *buf)
+{
+ int i;
+ /* Copy the i386 registers in the amd64 layout into i386 layout. */
+ for (i = 0; i < I386_NUM_GREGS; i++)
+ memcpy(buf + i386_linux_gregset32_reg_offset[i],
+ gregs + amd64_linux_gregset32_reg_offset[i], 4);
+ for (i = I386_CS_REGNUM; i <= I386_GS_REGNUM; i++)
+ memcpy(buf + i386_linux_gregset32_reg_offset[i],
+ gregs + amd64_linux_gregset32_reg_offset[i], 4);
+}
+
+static char *
+amd64_linux_elfcore_write_prstatus (bfd *abfd, char *buf, int *bufsiz,
+ long pid, int cursig, const void *gregs)
+{
+ if (gdbarch_ptr_bit (target_gdbarch) == 32)
+ {
+ char *note_name = "CORE";
+ struct elf_prstatus32 prstat;
+ memset (&prstat, 0, sizeof (prstat));
+ prstat.pr_pid = pid;
+ prstat.pr_cursig = cursig;
+ amd64_linux_set_registers (gregs, (gdb_byte *) &prstat.pr_reg);
+ return elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_PRSTATUS, &prstat, sizeof (prstat));
+ }
+ else
+ return elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs);
+}
+
+static char *
+amd64_elfcore_write_prxfpreg32 (bfd *abfd, char *buf, int *bufsiz,
+ struct regcache *regcache)
+{
+ char *note_name = "LINUX";
+ elf_fpxregset32_t fpxregs32;
+
+ i387_collect_fxsave (regcache, -1, &fpxregs32);
+ return elfcore_write_note(abfd, buf, bufsiz,
+ note_name, NT_PRXFPREG, &fpxregs32,
+ sizeof(fpxregs32));
+}
+
+static char *
+amd64_linux_elfcore_write_prfpreg (bfd *abfd, char *buf,
+ int *bufsiz, const void *fpregs, int size,
+ struct regcache *regcache)
+{
+ if (gdbarch_ptr_bit (target_gdbarch) == 32)
+ {
+ char *note_name = "CORE";
+ elf_fpregset32_t fpregs32;
+
+ i387_collect_fsave (regcache, -1, &fpregs32);
+ buf = elfcore_write_note(abfd, buf, bufsiz, note_name,
+ NT_FPREGSET, &fpregs32, sizeof(fpregs32));
+
+ return amd64_elfcore_write_prxfpreg32 (abfd, buf, bufsiz, regcache);
+ }
+ else
+ return elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size);
+}
+
+
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
@@ -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;
+ /* This functions make elfcore note sections. */
+ linux_elfcore_write_prpsinfo = amd64_linux_elfcore_write_prpsinfo;
+ linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus;
+ linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg;
+
/* Register the target. */
linux_nat_add_target (t);
linux_nat_set_new_thread (t, amd64_linux_new_thread);
Index: gdb-7.0.50.20100115/gdb/config.in
===================================================================
--- 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
+/* Define if struct elf_prstatus32 is available. */
+#undef HAVE_ELF_PRSTATUS32
+
/* Define to 1 if your system has the etext variable. */
#undef HAVE_ETEXT
@@ -490,6 +493,9 @@
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
+/* Define to 1 if you have the <sys/procfs32.h> header file. */
+#undef HAVE_SYS_PROCFS32_H
+
/* Define to 1 if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
@@ -517,6 +523,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
+/* Define to 1 if you have the <sys/user32.h> header file. */
+#undef HAVE_SYS_USER32_H
+
/* Define to 1 if you have the <sys/user.h> header file. */
#undef HAVE_SYS_USER_H
Index: gdb-7.0.50.20100115/gdb/configure
===================================================================
--- 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
+
+
+for ac_header in sys/user32.h sys/procfs32.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 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_objext'
+ { (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
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+echo "$as_me:$LINENO: checking for struct elf_prstatus32.pr_reg" >&5
+echo $ECHO_N "checking for struct elf_prstatus32.pr_reg... $ECHO_C" >&6
+if test "${ac_cv_member_struct_elf_prstatus32_pr_reg+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/procfs.h>
+
+int
+main ()
+{
+static struct elf_prstatus32 ac_aggr;
+if (ac_aggr.pr_reg)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 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_objext'
+ { (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
+ ac_cv_member_struct_elf_prstatus32_pr_reg=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/procfs.h>
+
+int
+main ()
+{
+static struct elf_prstatus32 ac_aggr;
+if (sizeof ac_aggr.pr_reg)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 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_objext'
+ { (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
+ ac_cv_member_struct_elf_prstatus32_pr_reg=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_elf_prstatus32_pr_reg=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_member_struct_elf_prstatus32_pr_reg" >&5
+echo "${ECHO_T}$ac_cv_member_struct_elf_prstatus32_pr_reg" >&6
+if test $ac_cv_member_struct_elf_prstatus32_pr_reg = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ELF_PRSTATUS32 1
+_ACEOF
+
+fi
+
# 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-7.0.50.20100115/gdb/configure.ac
===================================================================
--- 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
+AC_CHECK_HEADERS([sys/user32.h sys/procfs32.h])
+AC_CHECK_MEMBER([struct elf_prstatus32.pr_reg],
+ [AC_DEFINE(HAVE_ELF_PRSTATUS32, 1,
+ [Define if struct elf_prstatus32 is available. ])],
+ [], [#include <sys/procfs.h>])
# 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-7.0.50.20100115/gdb/gcore.c
===================================================================
--- 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;
+ /* Some Linux kernel versions around 2.6.17 have for i386 inferiors running
+ in compatibility mode on amd64 kernel their VSYSCALL page (at 0xffffe000)
+ protected as RWX==000 by default and gdb fails to read the library header
+ upon loading the core. This is a Linux kernel bug being fixed. */
+
/* 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-7.0.50.20100115/gdb/gdb_procfs32.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 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>
+#elif !defined HAVE_ELF_PRSTATUS32
+
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_PROCFS32_H
+#define _SYS_PROCFS32_H 1
+
+/* This is somewhat modelled after the file of the same name on SVR4
+ systems. It provides a definition of the core file format for ELF
+ used on Linux. It doesn't have anything to do with the /proc file
+ system, even though Linux has one.
+
+ Anyway, the whole purpose of this file is for GDB and GDB only.
+ Don't read too much into it. Don't use it for anything other than
+ GDB unless you know what you are doing. */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include "gdb_user32.h"
+
+/* We define here only the symbols differing from their 64-bit variant. */
+#include <sys/procfs.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register. */
+typedef unsigned int elf_greg32_t;
+
+/* And the whole bunch of them. We could have used `struct
+ user_regs_struct' directly in the typedef, but tradition says that
+ the register set is an array, which does have some peculiar
+ semantics, so leave it that way. */
+#define ELF_NGREG32 (sizeof (struct user_regs32_struct) / sizeof(elf_greg32_t))
+typedef elf_greg32_t elf_gregset32_t[ELF_NGREG32];
+
+/* Register set for the floating-point registers. */
+typedef struct user_fpregs32_struct elf_fpregset32_t;
+
+/* Register set for the extended floating-point registers. Includes
+ the Pentium III SSE registers in addition to the classic
+ floating-point stuff. */
+typedef struct user_fpxregs32_struct elf_fpxregset32_t;
+
+
+/* Definitions to generate Intel SVR4-like core files. These mostly
+ have the same names as the SVR4 types with "elf_" tacked on the
+ front to prevent clashes with Linux definitions, and the typedef
+ forms have been avoided. This is mostly like the SVR4 structure,
+ but more Linuxy, with things that Linux does not support and which
+ GDB doesn't really use excluded. */
+
+struct prstatus32_timeval
+ {
+ int tv_sec;
+ int tv_usec;
+ };
+
+struct elf_prstatus32
+ {
+ struct elf_siginfo pr_info; /* Info associated with signal. */
+ short int pr_cursig; /* Current signal. */
+ unsigned int pr_sigpend; /* Set of pending signals. */
+ unsigned int pr_sighold; /* Set of held signals. */
+ __pid_t pr_pid;
+ __pid_t pr_ppid;
+ __pid_t pr_pgrp;
+ __pid_t pr_sid;
+ struct prstatus32_timeval pr_utime; /* User time. */
+ struct prstatus32_timeval pr_stime; /* System time. */
+ struct prstatus32_timeval pr_cutime; /* Cumulative user time. */
+ struct prstatus32_timeval pr_cstime; /* Cumulative system time. */
+ elf_gregset32_t pr_reg; /* GP registers. */
+ int pr_fpvalid; /* True if math copro being used. */
+ };
+
+
+struct elf_prpsinfo32
+ {
+ char pr_state; /* Numeric process state. */
+ char pr_sname; /* Char for pr_state. */
+ char pr_zomb; /* Zombie. */
+ char pr_nice; /* Nice val. */
+ unsigned int pr_flag; /* Flags. */
+ unsigned short int pr_uid;
+ unsigned short int pr_gid;
+ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+ /* Lots missing */
+ char pr_fname[16]; /* Filename of executable. */
+ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
+ };
+
+
+/* The rest of this file provides the types for emulation of the
+ Solaris <proc_service.h> interfaces that should be implemented by
+ users of libthread_db. */
+
+/* Register sets. Linux has different names. */
+typedef elf_gregset_t prgregset32_t;
+typedef elf_fpregset_t prfpregset32_t;
+
+/* Process status and info. In the end we do provide typedefs for them. */
+typedef struct elf_prstatus32 prstatus32_t;
+typedef struct elf_prpsinfo32 prpsinfo32_t;
+
+__END_DECLS
+
+#endif /* _SYS_PROCFS32_H */
+
+#endif /* HAVE_SYS_PROCFS32_H */
Index: gdb-7.0.50.20100115/gdb/gdb_user32.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 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>
+#else
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+typedef int32_t gdb_int32_t;
+typedef uint32_t gdb_uint32_t;
+#else
+typedef signed int gdb_uint32_t;
+typedef unsigned int gdb_uint32_t;
+#endif
+
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_USER32_H
+#define _SYS_USER32_H 1
+
+/* These are the 32-bit x86 structures. */
+
+struct user_fpregs32_struct
+{
+ int32_t cwd;
+ int32_t swd;
+ int32_t twd;
+ int32_t fip;
+ int32_t fcs;
+ int32_t foo;
+ int32_t fos;
+ int32_t st_space [20];
+};
+
+struct user_fpxregs32_struct
+{
+ unsigned short int cwd;
+ unsigned short int swd;
+ unsigned short int twd;
+ unsigned short int fop;
+ int32_t fip;
+ int32_t fcs;
+ int32_t foo;
+ int32_t fos;
+ int32_t mxcsr;
+ int32_t reserved;
+ int32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
+ int32_t xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
+ int32_t padding[56];
+};
+
+struct user_regs32_struct
+{
+ int32_t ebx;
+ int32_t ecx;
+ int32_t edx;
+ int32_t esi;
+ int32_t edi;
+ int32_t ebp;
+ int32_t eax;
+ int32_t xds;
+ int32_t xes;
+ int32_t xfs;
+ int32_t xgs;
+ int32_t orig_eax;
+ int32_t eip;
+ int32_t xcs;
+ int32_t eflags;
+ int32_t esp;
+ int32_t xss;
+};
+
+struct user32
+{
+ struct user_regs32_struct regs;
+ int u_fpvalid;
+ struct user_fpregs32_struct i387;
+ uint32_t u_tsize;
+ uint32_t u_dsize;
+ uint32_t u_ssize;
+ uint32_t start_code;
+ uint32_t start_stack;
+ int32_t signal;
+ int reserved;
+ struct user_regs32_struct* u_ar0;
+ struct user_fpregs32_struct* u_fpstate;
+ uint32_t magic;
+ char u_comm [32];
+ int u_debugreg [8];
+};
+
+#endif /* _SYS_USER32_H */
+
+#endif /* HAVE_SYS_USER32_H */
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
===================================================================
--- 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);
+/* This functions make elfcore note sections.
+ They may get overriden by code adjusting data for multi-target builds. */
+char *(*linux_elfcore_write_prpsinfo)
+ (bfd *, char *, int *, const char *, const char *) = elfcore_write_prpsinfo;
+char *(*linux_elfcore_write_prstatus)
+ (bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus;
+static char *
+linux_elfcore_write_prfpreg_bfd (bfd *abfd, char *buf, int *bufsiz,
+ const void *fpregs, int size, struct regcache *regcache)
+{
+ return elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size);
+}
+char *(*linux_elfcore_write_prfpreg) (bfd *, char *, int *, const void *, int,
+ struct regcache *) = linux_elfcore_write_prfpreg_bfd;
+
static int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -4187,7 +4202,7 @@ linux_nat_do_thread_registers (bfd *obfd
else
fill_gregset (regcache, &gregs, -1);
- note_data = (char *) elfcore_write_prstatus (obfd,
+ note_data = (char *) linux_elfcore_write_prstatus (obfd,
note_data,
note_size,
lwp,
@@ -4237,10 +4252,10 @@ linux_nat_do_thread_registers (bfd *obfd
else
fill_fpregset (regcache, &fpregs, -1);
- note_data = (char *) elfcore_write_prfpreg (obfd,
+ note_data = (char *) linux_elfcore_write_prfpreg (obfd,
note_data,
note_size,
- &fpregs, sizeof (fpregs));
+ &fpregs, sizeof (fpregs), regcache);
}
return note_data;
@@ -4423,9 +4438,9 @@ linux_nat_make_corefile_notes (bfd *obfd
psargs_end - string_end);
}
}
- note_data = (char *) elfcore_write_prpsinfo (obfd,
- note_data,
- note_size, fname, psargs);
+ note_data = (char *) linux_elfcore_write_prpsinfo (obfd, note_data,
+ note_size, fname,
+ psargs);
}
/* Dump information for threads. */
Index: gdb-7.0.50.20100115/gdb/linux-nat.h
===================================================================
--- 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
/* 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. */
+extern char *(*linux_elfcore_write_prpsinfo)
+ (bfd *, char *, int *, const char *, const char *);
+extern char *(*linux_elfcore_write_prstatus)
+ (bfd *, char *, int *, long, int, const void *);
+extern char *(*linux_elfcore_write_prfpreg)
+ (bfd *, char *, int *, const void *, int, struct regcache *);

View File

@ -34,7 +34,7 @@ diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.c gdb-6.3/gdb/tests
diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp
--- gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:12:53.000000000 -0500
+++ gdb-6.3/gdb/testsuite/gdb.base/unwind-leak.exp 2007-12-19 15:11:35.000000000 -0500
@@ -0,0 +1,90 @@
@@ -0,0 +1,83 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -51,13 +51,6 @@ diff -u -rup gdb-6.3-orig/gdb/testsuite/gdb.base/unwind-leak.exp gdb-6.3/gdb/tes
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile unwind-leak
+set srcfile ${testfile}.c
+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh

View File

@ -3,7 +3,7 @@ Fix has been committed to:
--- /dev/null 2007-12-14 20:45:09.113039517 +0100
+++ gdb-6.5/gdb/testsuite/gdb.base/watchpoint-during-step.exp 2007-12-24 19:42:00.000000000 +0100
@@ -0,0 +1,51 @@
@@ -0,0 +1,44 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -20,13 +20,6 @@ Fix has been committed to:
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile watchpoint-during-step
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}

View File

@ -1,24 +0,0 @@
Dependency on: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
2006-09-01 Jan Kratochvil <jan.kratochvil@redhat.com>
* target.c (target_translate_tls_address): Fix for separate debuginfo.
diff -rup gdb-6.5.orig/gdb/target.c gdb-6.5/gdb/target.c
--- gdb-6.5.orig/gdb/target.c 2006-09-20 17:13:35.000000000 -0400
+++ gdb-6.5/gdb/target.c 2006-09-20 17:15:53.000000000 -0400
@@ -769,6 +769,12 @@ target_translate_tls_address (struct obj
ptid_t ptid = inferior_ptid;
volatile struct gdb_exception ex;
+ /* Resolve: Cannot find shared library
+ `/usr/lib/debug/lib/lib....so.debug' in dynamic linker's load
+ module list */
+ if (objfile->separate_debug_objfile_backlink != NULL)
+ objfile = objfile->separate_debug_objfile_backlink;
+
TRY_CATCH (ex, RETURN_MASK_ALL)
{
CORE_ADDR lm_addr;

View File

@ -58,8 +58,10 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
* exec.c (exec_file_attach): Print a more useful error message if the
user did "gdb core".
--- ./gdb/exceptions.h 2010-04-11 22:31:30.000000000 +0200
+++ ./gdb/exceptions.h 2010-04-11 22:31:47.000000000 +0200
Index: gdb-7.1.90.20100711/gdb/exceptions.h
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/exceptions.h 2010-05-03 01:52:14.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/exceptions.h 2010-07-13 22:56:29.000000000 +0200
@@ -78,6 +78,9 @@ enum errors {
/* Feature is not supported in this copy of GDB. */
UNSUPPORTED_ERROR,
@ -70,8 +72,10 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
/* 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
Index: gdb-7.1.90.20100711/gdb/exec.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/exec.c 2010-07-12 23:07:34.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/exec.c 2010-07-13 22:56:29.000000000 +0200
@@ -34,6 +34,7 @@
#include "arch-utils.h"
#include "gdbthread.h"
@ -80,7 +84,7 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
#include <fcntl.h>
#include "readline/readline.h"
@@ -256,12 +257,27 @@ exec_file_attach (char *filename, int fr
@@ -253,12 +254,27 @@ exec_file_attach (char *filename, int fr
if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
{
@ -111,8 +115,10 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
}
/* 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
Index: gdb-7.1.90.20100711/gdb/main.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/main.c 2010-07-12 23:07:34.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/main.c 2010-07-13 22:58:20.000000000 +0200
@@ -241,6 +241,36 @@ captured_command_loop (void *data)
return 1;
}
@ -150,7 +156,7 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
static int
captured_main (void *data)
{
@@ -703,6 +733,8 @@ extern int gdbtk_test (char *);
@@ -678,6 +708,8 @@ extern int gdbtk_test (char *);
{
symarg = argv[optind];
execarg = argv[optind];
@ -159,7 +165,7 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
optind++;
}
@@ -835,10 +867,25 @@ Excess command line arguments ignored. (
@@ -816,10 +848,25 @@ Excess command line arguments ignored. (
&& symarg != NULL
&& strcmp (execarg, symarg) == 0)
{
@ -178,13 +184,13 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
/* 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))
- if (catch_command_errors (exec_file_attach, execarg, !batch_flag, 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)
+ if (catch_command_errors (func, execarg, !batch_flag, RETURN_MASK_ALL)
+ && core_bfd == NULL)
catch_command_errors (symbol_file_add_main, symarg, !batch, RETURN_MASK_ALL);
catch_command_errors (symbol_file_add_main, symarg, !batch_flag, RETURN_MASK_ALL);
}
else

View File

@ -1,7 +1,7 @@
Index: gdb-7.0.50.20100115/gdb/event-top.c
Index: gdb-7.1.90.20100711/gdb/event-top.c
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/event-top.c 2010-06-26 08:44:47.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/event-top.c 2010-07-12 11:37:04.000000000 +0200
@@ -33,6 +33,7 @@
#include "cli/cli-script.h" /* for reset_command_nest_depth */
#include "main.h"
@ -28,11 +28,11 @@ Index: gdb-7.0.50.20100115/gdb/event-top.c
/* Each interpreter has its own rules on displaying the command
prompt. */
if (!current_interp_display_prompt_p ())
Index: gdb-7.0.50.20100115/gdb/elfread.c
Index: gdb-7.1.90.20100711/gdb/elfread.c
===================================================================
--- 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 @@
--- gdb-7.1.90.20100711.orig/gdb/elfread.c 2010-07-12 11:30:30.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/elfread.c 2010-07-12 11:37:04.000000000 +0200
@@ -42,6 +42,7 @@
#include "gdbcore.h"
#include "gdbcmd.h"
#include "observer.h"
@ -40,7 +40,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
extern void _initialize_elfread (void);
@@ -1119,8 +1120,353 @@ build_id_to_filename (struct build_id *b
@@ -1368,8 +1369,353 @@ build_id_to_filename (struct build_id *b
return retval;
}
@ -395,7 +395,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
avoidance. */
struct missing_filepair
@@ -1174,11 +1520,17 @@ missing_filepair_change (void)
@@ -1423,11 +1769,17 @@ missing_filepair_change (void)
/* All their memory came just from missing_filepair_OBSTACK. */
missing_filepair_hash = NULL;
}
@ -413,7 +413,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
missing_filepair_change ();
}
@@ -1245,14 +1597,34 @@ debug_print_missing (const char *binary,
@@ -1494,14 +1846,34 @@ debug_print_missing (const char *binary,
*slot = missing_filepair;
@ -455,11 +455,11 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
}
static char *
Index: gdb-7.0.50.20100115/gdb/symfile.h
Index: gdb-7.1.90.20100711/gdb/symfile.h
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/symfile.h 2010-07-12 11:06:18.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/symfile.h 2010-07-12 11:37:04.000000000 +0200
@@ -568,6 +568,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);
@ -467,11 +467,11 @@ Index: gdb-7.0.50.20100115/gdb/symfile.h
/* From dwarf2read.c */
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp
Index: gdb-7.1.90.20100711/gdb/testsuite/lib/gdb.exp
===================================================================
--- 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 { } {
--- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/gdb.exp 2010-07-12 11:05:57.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/lib/gdb.exp 2010-07-12 11:37:04.000000000 +0200
@@ -1353,7 +1353,7 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -480,10 +480,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp
send_gdb "set build-id-verbose 0\n"
gdb_expect 10 {
-re "$gdb_prompt $" {
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.1.90.20100711/gdb/testsuite/lib/mi-support.exp
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/mi-support.exp 2010-07-12 11:05:57.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/lib/mi-support.exp 2010-07-12 11:37:04.000000000 +0200
@@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } {
}
}
@ -493,10 +493,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp
send_gdb "190-gdb-set build-id-verbose 0\n"
gdb_expect 10 {
-re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
Index: gdb-7.0.50.20100115/gdb/tui/tui-interp.c
Index: gdb-7.1.90.20100711/gdb/tui/tui-interp.c
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/tui/tui-interp.c 2010-05-18 00:21:43.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/tui/tui-interp.c 2010-07-12 11:37:04.000000000 +0200
@@ -30,6 +30,7 @@
#include "tui/tui.h"
#include "tui/tui-io.h"
@ -505,7 +505,7 @@ Index: gdb-7.0.50.20100115/gdb/tui/tui-interp.c
/* Set to 1 when the TUI mode must be activated when we first start
gdb. */
@@ -128,6 +129,8 @@ tui_command_loop (void *data)
@@ -146,6 +147,8 @@ tui_command_loop (void *data)
char *a_prompt;
char *gdb_prompt = get_prompt ();
@ -514,10 +514,10 @@ Index: gdb-7.0.50.20100115/gdb/tui/tui-interp.c
/* Tell readline what the prompt to display is and what function
it will need to call after a whole line is read. This also
displays the first prompt. */
Index: gdb-7.0.50.20100115/gdb/aclocal.m4
Index: gdb-7.1.90.20100711/gdb/aclocal.m4
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/aclocal.m4 2010-05-23 02:56:59.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/aclocal.m4 2010-07-12 11:37:04.000000000 +0200
@@ -19,6 +19,162 @@ You have another version of autoconf. I
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
@ -681,11 +681,11 @@ Index: gdb-7.0.50.20100115/gdb/aclocal.m4
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
Index: gdb-7.0.50.20100115/gdb/config.in
Index: gdb-7.1.90.20100711/gdb/config.in
===================================================================
--- 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 @@
--- gdb-7.1.90.20100711.orig/gdb/config.in 2010-07-06 21:03:11.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/config.in 2010-07-12 11:38:30.000000000 +0200
@@ -46,6 +46,9 @@
/* Define to BFD's default target vector. */
#undef DEFAULT_BFD_VEC
@ -695,9 +695,9 @@ Index: gdb-7.0.50.20100115/gdb/config.in
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
@@ -221,6 +224,9 @@
/* Define if Python 2.6 is being used. */
#undef HAVE_LIBPYTHON2_6
@@ -232,6 +235,9 @@
/* Define if Python 2.7 is being used. */
#undef HAVE_LIBPYTHON2_7
+/* Define if librpm library is being used. */
+#undef HAVE_LIBRPM
@ -705,29 +705,29 @@ Index: gdb-7.0.50.20100115/gdb/config.in
/* Define if libunwind library is being used. */
#undef HAVE_LIBUNWIND
Index: gdb-7.0.50.20100115/gdb/configure
Index: gdb-7.1.90.20100711/gdb/configure
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/configure 2010-07-07 19:36:39.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/configure 2010-07-12 11:38:15.000000000 +0200
@@ -679,6 +679,9 @@ REPORT_BUGS_TO
PKGVERSION
TARGET_OBS
subdirs
+RPM_LIBS
+RPM_CFLAGS
+PKG_CONFIG
pythondir
GDB_DATADIR_PATH
GDB_DATADIR
@@ -888,6 +891,7 @@ with_separate_debug_dir
DEBUGDIR
am__fastdepCC_FALSE
@@ -945,6 +948,7 @@ enable_dependency_tracking
with_separate_debug_dir
with_gdb_datadir
with_relocated_sources
with_pythondir
+with_rpm
enable_targets
enable_64_bit_bfd
enable_gdbcli
@@ -928,6 +932,9 @@ LDFLAGS
@@ -985,6 +989,9 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
@ -737,16 +737,16 @@ Index: gdb-7.0.50.20100115/gdb/configure
YACC
YFLAGS
XMKMF'
@@ -1593,6 +1600,8 @@ Optional Packages:
@@ -1646,6 +1653,8 @@ Optional Packages:
[DATADIR/gdb]
--with-pythondir install Python data files in this path
[DATADIR/gdb/python]
--with-relocated-sources=PATH
automatically relocate this path for source files
+ --with-rpm query rpm database for missing debuginfos (yes/no,
+ def. auto=librpm.so)
--with-libunwind use libunwind frame unwinding support
--with-curses use the curses library instead of the termcap
library
@@ -1627,6 +1636,9 @@ Some influential environment variables:
@@ -1681,6 +1690,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
@ -756,7 +756,7 @@ Index: gdb-7.0.50.20100115/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.
@@ -6760,6 +6772,486 @@ else
@@ -7878,6 +7890,486 @@ _ACEOF
fi
@ -1242,290 +1242,14 @@ Index: gdb-7.0.50.20100115/gdb/configure
+
@@ -10043,265 +10535,25 @@ $as_echo "#define STDC_HEADERS 1" >>conf
fi
-
-
for ac_header in sys/user32.h sys/procfs32.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 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_objext'
- { (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
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+ if test "x$as_val" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
-echo "$as_me:$LINENO: checking for struct elf_prstatus32.pr_reg" >&5
-echo $ECHO_N "checking for struct elf_prstatus32.pr_reg... $ECHO_C" >&6
-if test "${ac_cv_member_struct_elf_prstatus32_pr_reg+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/procfs.h>
-
-int
-main ()
-{
-static struct elf_prstatus32 ac_aggr;
-if (ac_aggr.pr_reg)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 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_objext'
- { (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
- ac_cv_member_struct_elf_prstatus32_pr_reg=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <sys/procfs.h>
-
-int
-main ()
-{
-static struct elf_prstatus32 ac_aggr;
-if (sizeof ac_aggr.pr_reg)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 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_objext'
- { (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
- ac_cv_member_struct_elf_prstatus32_pr_reg=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_member_struct_elf_prstatus32_pr_reg=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_member_struct_elf_prstatus32_pr_reg" >&5
-echo "${ECHO_T}$ac_cv_member_struct_elf_prstatus32_pr_reg" >&6
-if test $ac_cv_member_struct_elf_prstatus32_pr_reg = yes; then
+ac_fn_c_check_member "$LINENO" "struct elf_prstatus32" "pr_reg" "ac_cv_member_struct_elf_prstatus32_pr_reg" "#include <sys/procfs.h>
+"
+if test "x$ac_cv_member_struct_elf_prstatus32_pr_reg" = x""yes; then :
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ELF_PRSTATUS32 1
-_ACEOF
+$as_echo "#define HAVE_ELF_PRSTATUS32 1" >>confdefs.h
fi
Index: gdb-7.0.50.20100115/gdb/configure.ac
subdirs="$subdirs doc testsuite"
Index: gdb-7.1.90.20100711/gdb/configure.ac
===================================================================
--- 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)
--- gdb-7.1.90.20100711.orig/gdb/configure.ac 2010-07-07 19:36:39.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/configure.ac 2010-07-12 11:38:02.000000000 +0200
@@ -108,6 +108,199 @@ AS_HELP_STRING([--with-relocated-sources
[Relocated directory for source files. ])
])
+# Integration with rpm library to support missing debuginfo suggestions.
+# --without-rpm: Disable any rpm support.
@ -1720,13 +1444,13 @@ Index: gdb-7.0.50.20100115/gdb/configure.ac
+ fi
+fi
+
AC_CONFIG_SUBDIRS(doc testsuite)
Index: gdb-7.0.50.20100115/gdb/acinclude.m4
# Check whether to support alternative target configurations
Index: gdb-7.1.90.20100711/gdb/acinclude.m4
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/acinclude.m4 2010-07-12 11:37:04.000000000 +0200
@@ -1,3 +1,5 @@
+# serial 1
+

View File

@ -1,19 +1,18 @@
Index: gdb-7.0.50.20100115/gdb/corelow.c
Index: gdb-7.1.90.20100711/gdb/corelow.c
===================================================================
--- 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"
--- gdb-7.1.90.20100711.orig/gdb/corelow.c 2010-05-14 01:53:32.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/corelow.c 2010-07-12 11:07:33.000000000 +0200
@@ -47,6 +47,9 @@
#include "filenames.h"
#include "progspace.h"
#include "objfiles.h"
+#include "auxv.h"
+#include "elf/common.h"
+#include "objfiles.h"
+#include "gdbcmd.h"
#ifndef O_LARGEFILE
@@ -290,6 +294,52 @@ add_to_thread_list (bfd *abfd, asection
@@ -289,6 +292,52 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current */
}
@ -66,7 +65,7 @@ Index: gdb-7.0.50.20100115/gdb/corelow.c
/* This routine opens and sets up the core file bfd. */
static void
@@ -387,6 +437,12 @@ core_open (char *filename, int from_tty)
@@ -386,6 +435,12 @@ core_open (char *filename, int from_tty)
push_target (&core_ops);
discard_cleanups (old_chain);
@ -79,7 +78,7 @@ Index: gdb-7.0.50.20100115/gdb/corelow.c
/* Do this before acknowledging the inferior, so if
post_create_inferior throws (can happen easilly if you're loading
a core file with the wrong exec), we aren't left with threads
@@ -925,4 +981,11 @@ _initialize_corelow (void)
@@ -924,4 +979,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target (&core_ops);
@ -91,11 +90,11 @@ Index: gdb-7.0.50.20100115/gdb/corelow.c
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
Index: gdb-7.0.50.20100115/gdb/doc/gdb.texinfo
Index: gdb-7.1.90.20100711/gdb/doc/gdb.texinfo
===================================================================
--- 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.
--- gdb-7.1.90.20100711.orig/gdb/doc/gdb.texinfo 2010-07-12 10:59:30.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/doc/gdb.texinfo 2010-07-12 11:05:57.000000000 +0200
@@ -14980,6 +14980,27 @@ information files.
@end table
@ -123,11 +122,11 @@ Index: gdb-7.0.50.20100115/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.50.20100115/gdb/solib-svr4.c
Index: gdb-7.1.90.20100711/gdb/solib-svr4.c
===================================================================
--- 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)
--- gdb-7.1.90.20100711.orig/gdb/solib-svr4.c 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/solib-svr4.c 2010-07-12 11:05:57.000000000 +0200
@@ -1181,9 +1181,49 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
@ -180,14 +179,14 @@ Index: gdb-7.0.50.20100115/gdb/solib-svr4.c
}
xfree (buffer);
Index: gdb-7.0.50.20100115/gdb/elfread.c
Index: gdb-7.1.90.20100711/gdb/elfread.c
===================================================================
--- 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"
--- gdb-7.1.90.20100711.orig/gdb/elfread.c 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/elfread.c 2010-07-12 11:30:30.000000000 +0200
@@ -38,6 +38,10 @@
#include "demangle.h"
#include "psympriv.h"
#include "gdbtypes.h"
+#include "libbfd.h"
+#include "gdbcore.h"
+#include "gdbcmd.h"
@ -195,10 +194,10 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
extern void _initialize_elfread (void);
@@ -567,6 +571,20 @@ elf_symtab_read (struct objfile *objfile
}
}
@@ -818,16 +822,65 @@ resolve_gnu_ifunc (const char *function_
return 0;
}
+/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
+ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */
+
@ -213,10 +212,10 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
+ fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"),
+ value);
+}
+
struct build_id
{
@@ -574,10 +592,44 @@ struct build_id
size_t size;
gdb_byte data[1];
};
@ -263,7 +262,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
{
struct build_id *retval;
@@ -593,6 +645,348 @@ build_id_bfd_get (bfd *abfd)
@@ -843,6 +896,348 @@ build_id_bfd_get (bfd *abfd)
return retval;
}
@ -612,7 +611,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
@@ -607,7 +1001,7 @@ build_id_verify (const char *filename, s
@@ -857,7 +1252,7 @@ build_id_verify (const char *filename, s
if (abfd == NULL)
return 0;
@ -621,7 +620,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -626,14 +1020,16 @@ build_id_verify (const char *filename, s
@@ -874,14 +1269,16 @@ build_id_verify (const char *filename, s
return retval;
}
@ -642,7 +641,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
@@ -664,7 +1060,10 @@ build_id_to_debug_filename (struct build
@@ -912,7 +1309,10 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
@ -654,7 +653,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
/* lrealpath() is expensive even for the usually non-existent files. */
if (access (link, F_OK) == 0)
@@ -677,17 +1076,188 @@ build_id_to_debug_filename (struct build
@@ -925,26 +1325,201 @@ build_id_to_debug_filename (struct build
}
if (retval != NULL)
@ -699,9 +698,9 @@ Index: gdb-7.0.50.20100115/gdb/elfread.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. */
@ -724,9 +723,9 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
+
+ retval = obstack_alloc (&missing_filepair_obstack, size);
+ memset (retval, 0, size);
+ return retval;
+}
+
return retval;
}
+static hashval_t
+missing_filepair_hash_func (const struct missing_filepair *elem)
+{
@ -843,10 +842,6 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
+find_separate_debug_file_by_buildid (struct objfile *objfile,
+ char **build_id_filename_return)
{
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;
- build_id = build_id_bfd_get (objfile->obfd);
@ -864,7 +859,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
xfree (build_id);
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
@@ -714,7 +1288,7 @@ find_separate_debug_file_by_buildid (str
@@ -954,7 +1529,7 @@ find_separate_debug_file_by_buildid (str
xfree (build_id_name);
}
else if (build_id_name != NULL)
@ -873,9 +868,9 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
}
return NULL;
}
@@ -887,9 +1461,10 @@ elf_symfile_read (struct objfile *objfil
@@ -1131,9 +1706,10 @@ elf_symfile_read (struct objfile *objfil
`.gnu_debuglink' may no longer be present with `.note.gnu.build-id'. */
else
if (!objfile_has_partial_symbols (objfile))
{
- char *debugfile;
+ char *debugfile, *build_id_filename;
@ -886,7 +881,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
if (debugfile == NULL)
debugfile = find_separate_debug_file_by_debuglink (objfile);
@@ -900,6 +1475,12 @@ elf_symfile_read (struct objfile *objfil
@@ -1145,6 +1721,12 @@ elf_symfile_read (struct objfile *objfil
symbol_file_add_separate (abfd, symfile_flags, objfile);
xfree (debugfile);
}
@ -899,7 +894,7 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
}
}
@@ -1072,4 +1653,16 @@ void
@@ -1304,4 +1886,16 @@ void
_initialize_elfread (void)
{
add_symtab_fns (&elf_sym_fns);
@ -916,13 +911,13 @@ Index: gdb-7.0.50.20100115/gdb/elfread.c
+
+ observer_attach_executable_changed (debug_print_executable_changed);
}
Index: gdb-7.0.50.20100115/gdb/symfile.h
Index: gdb-7.1.90.20100711/gdb/symfile.h
===================================================================
--- 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);
--- gdb-7.1.90.20100711.orig/gdb/symfile.h 2010-05-08 06:58:45.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/symfile.h 2010-07-12 11:06:18.000000000 +0200
@@ -562,6 +562,13 @@ void free_symfile_segment_data (struct s
extern struct cleanup *increment_reading_symtab (void);
+/* build-id support. */
+struct build_id;
@ -934,11 +929,11 @@ Index: gdb-7.0.50.20100115/gdb/symfile.h
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp
Index: gdb-7.1.90.20100711/gdb/testsuite/lib/gdb.exp
===================================================================
--- 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 { } {
--- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/gdb.exp 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/lib/gdb.exp 2010-07-12 11:05:57.000000000 +0200
@@ -1353,6 +1353,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
@ -955,10 +950,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp
return 0;
}
Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp
Index: gdb-7.1.90.20100711/gdb/testsuite/lib/mi-support.exp
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/mi-support.exp 2010-03-15 04:43:13.000000000 +0100
+++ gdb-7.1.90.20100711/gdb/testsuite/lib/mi-support.exp 2010-07-12 11:05:57.000000000 +0200
@@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
}
}
@ -976,13 +971,13 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp
detect_async
Index: gdb-7.0.50.20100115/gdb/objfiles.h
Index: gdb-7.1.90.20100711/gdb/objfiles.h
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/objfiles.h 2010-04-14 19:26:11.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/objfiles.h 2010-07-12 11:07:08.000000000 +0200
@@ -426,6 +426,10 @@ struct objfile
#define OBJF_MAIN (1 << 7)
#define OBJF_USERLOADED (1 << 3) /* User loaded */
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
+

View File

@ -1,27 +0,0 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225783
--- gdb-6.8/gdb/testsuite/gdb.base/prelink.exp.orig 2008-07-12 08:56:43.000000000 +0200
+++ gdb-6.8/gdb/testsuite/gdb.base/prelink.exp 2008-07-12 08:59:59.000000000 +0200
@@ -55,7 +55,7 @@ if { [gdb_compile "${srcdir}/${subdir}/$
# single new unprelinked library address without wasting the first one/two
# memory areas. We do not care of the efficiency of loading such resulting
# exec-shield unfriendly prelinked library.
-if {[catch "system \"prelink -qNR --no-exec-shield ${libfile}\""] != 0} {
+if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${libfile}\""] != 0} {
# Maybe we don't have prelink.
return -1
}
@@ -96,11 +96,11 @@ if { $found == 0 } {
return 0
}
-if {[catch "system \"prelink -uN ${libfile}\""] != 0} {
+if {[catch "system \"/usr/sbin/prelink -uN ${libfile}\""] != 0} {
untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?"
return 0
}
-catch "system \"prelink -qNR --no-exec-shield ${libfile}\""
+catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${libfile}\""
# Start with a fresh gdb

View File

@ -68,7 +68,7 @@
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/gcorebg.exp 25 Feb 2007 12:21:20 -0000
@@ -0,0 +1,120 @@
@@ -0,0 +1,113 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -93,13 +93,6 @@
+# It also tests a regression with `gdb_gcore.sh' being run without its
+# accessible terminal.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if ![info exists GCORE] {
+ set GCORE "${srcdir}/../gdb_gcore.sh"
+}

View File

@ -82,7 +82,7 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp 2010-01-15 03:22:52.000000000 +0100
@@ -0,0 +1,43 @@
@@ -0,0 +1,36 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -99,13 +99,6 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile fork-detach
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}

View File

@ -1,216 +0,0 @@
Test GCORE on 32bit inferiors on 64bit platforms.
UNSUPPORTED results are valid for `-m64' on 32bit targets.
Index: gdb-7.0.50.20100203/gdb/testsuite/gdb.base/gcore.exp
===================================================================
--- 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}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested gcore.exp
- return -1
+# `-static-libgcc' to avoid dependency on `libgcc.{i386,ppc}'.
+foreach additional_flags {{} {-m32 -static-libgcc} {-m64 -static-libgcc}} {
+
+set prefix "arch{$additional_flags}:"
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=$additional_flags]] != "" } {
+ unsupported "${prefix} gcore.exp"
+ continue
}
# Start with a fresh gdb.
@@ -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.
- unsupported "gdb does not support gcore on this target"
- return -1;
+ unsupported "${prefix} gdb does not support gcore on this target"
+ continue
}
-re "Save a core file .*$gdb_prompt $" {
- pass "help gcore"
+ pass "${prefix} help gcore"
}
-re ".*$gdb_prompt $" {
- fail "help gcore"
+ fail "${prefix} help gcore"
}
timeout {
- fail "help gcore (timeout)"
+ fail "${prefix} help gcore (timeout)"
}
}
if { ! [ runto_main ] } then {
- untested gcore.exp
- return -1
+ untested "${prefix} gcore.exp"
+ continue
}
proc capture_command_output { command prefix } {
@@ -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)
}
@@ -103,22 +108,22 @@ set escapedfilename [string_to_regexp ${
set core_supported 0
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
- "save a corefile" \
+ "${prefix} save a corefile" \
{
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
- pass "save a corefile"
+ pass "${prefix} save a corefile"
global core_supported
set core_supported 1
}
-re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
- unsupported "save a corefile"
+ unsupported "${prefix} save a corefile"
global core_supported
set core_supported 0
}
}
if {!$core_supported} {
- return -1
+ continue
}
# Now restart gdb and load the corefile.
@@ -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 $" {
- fail "re-load generated corefile (bad file format)"
+ fail "${prefix} re-load generated corefile (bad file format)"
# No use proceeding from here.
- return;
+ continue
}
-re ".*: No such file or directory.*$gdb_prompt $" {
- fail "re-load generated corefile (file not found)"
+ fail "${prefix} re-load generated corefile (file not found)"
# No use proceeding from here.
- return;
+ continue
}
-re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
- fail "re-load generated corefile (incomplete note section)"
+ fail "${prefix} re-load generated corefile (incomplete note section)"
}
-re "Core was generated by .*$gdb_prompt $" {
- pass "re-load generated corefile"
+ pass "${prefix} re-load generated corefile"
}
-re ".*$gdb_prompt $" {
- fail "re-load generated corefile"
+ fail "${prefix} re-load generated corefile"
}
timeout {
- fail "re-load generated corefile (timeout)"
+ fail "${prefix} re-load generated corefile (timeout)"
}
}
send_gdb "where\n"
-gdb_expect_list "where in corefile" ".*$gdb_prompt $" {
+gdb_expect_list "${prefix} where in corefile" ".*$gdb_prompt $" {
".*\[\r\n\]+#0 .* terminal_func \\(\\) at "
".*\[\r\n\]+#1 .* array_func \\(\\) at "
".*\[\r\n\]+#2 .* factorial_func \\(value=1\\) at "
@@ -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 {
- pass "corefile restored general registers"
+ pass "${prefix} corefile restored general registers"
} else {
- fail "corefile restored general registers"
+ fail "${prefix} corefile restored general registers"
}
set post_corefile_allregs [capture_command_output "info all-reg" ""]
if ![string compare $pre_corefile_allregs $post_corefile_allregs] then {
- pass "corefile restored all registers"
+ pass "${prefix} corefile restored all registers"
} else {
- fail "corefile restored all registers"
+ fail "${prefix} corefile restored all registers"
}
set post_corefile_extern_array \
[capture_command_output "print extern_array" "$print_prefix"]
if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] {
- pass "corefile restored extern array"
+ pass "${prefix} corefile restored extern array"
} else {
- fail "corefile restored extern array"
+ fail "${prefix} corefile restored extern array"
}
set post_corefile_static_array \
[capture_command_output "print static_array" "$print_prefix"]
if ![string compare $pre_corefile_static_array $post_corefile_static_array] {
- pass "corefile restored static array"
+ pass "${prefix} corefile restored static array"
} else {
- fail "corefile restored static array"
+ fail "${prefix} corefile restored static array"
}
set post_corefile_uninit_array \
[capture_command_output "print un_initialized_array" "$print_prefix"]
if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] {
- pass "corefile restored un-initialized array"
+ pass "${prefix} corefile restored un-initialized array"
} else {
- fail "corefile restored un-initialized array"
+ fail "${prefix} corefile restored un-initialized array"
}
set post_corefile_heap_string \
[capture_command_output "print heap_string" "$print_prefix"]
if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] {
- pass "corefile restored heap array"
+ pass "${prefix} corefile restored heap array"
} else {
- fail "corefile restored heap array"
+ fail "${prefix} corefile restored heap array"
}
set post_corefile_local_array \
[capture_command_output "print array_func::local_array" "$print_prefix"]
if ![string compare $pre_corefile_local_array $post_corefile_local_array] {
- pass "corefile restored stack array"
+ pass "${prefix} corefile restored stack array"
} else {
- fail "corefile restored stack array"
+ fail "${prefix} corefile restored stack array"
}
set post_corefile_backtrace [capture_command_output "backtrace" ""]
if ![string compare $pre_corefile_backtrace $post_corefile_backtrace] {
- pass "corefile restored backtrace"
+ pass "${prefix} corefile restored backtrace"
} else {
- fail "corefile restored backtrace"
+ fail "${prefix} corefile restored backtrace"
+}
+
+# $additional_flags:
}

View File

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

View File

@ -21,11 +21,11 @@
Port to GDB-6.8pre.
Index: gdb-7.0.50.20100115/gdb/inferior.h
Index: gdb-7.1.90.20100711/gdb/inferior.h
===================================================================
--- 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);
--- gdb-7.1.90.20100711.orig/gdb/inferior.h 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/inferior.h 2010-07-12 10:04:25.000000000 +0200
@@ -198,7 +198,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-7.0.50.20100115/gdb/inferior.h
/* From misc files */
Index: gdb-7.0.50.20100115/gdb/infrun.c
Index: gdb-7.1.90.20100711/gdb/infrun.c
===================================================================
--- 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);
--- gdb-7.1.90.20100711.orig/gdb/infrun.c 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/infrun.c 2010-07-12 10:05:26.000000000 +0200
@@ -76,7 +76,7 @@ static int follow_fork (void);
static void set_schedlock_func (char *args, int from_tty,
struct cmd_list_element *c);
@ -55,7 +55,7 @@ Index: gdb-7.0.50.20100115/gdb/infrun.c
static int currently_stepping_or_nexting_callback (struct thread_info *tp,
void *data);
@@ -1363,7 +1363,7 @@ maybe_software_singlestep (struct gdbarc
@@ -1549,7 +1549,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-7.0.50.20100115/gdb/infrun.c
{
int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
@@ -1376,10 +1376,12 @@ resume (int step, enum target_signal sig
@@ -1562,10 +1562,12 @@ resume (int step, enum target_signal sig
QUIT;
if (debug_infrun)
@ -79,9 +79,9 @@ Index: gdb-7.0.50.20100115/gdb/infrun.c
+ : "RESUME_STEP_NEEDED")),
+ sig, tp->trap_expected);
/* Some targets (e.g. Solaris x86) have a kernel bug when stepping
over an instruction that causes a page fault without triggering
@@ -1501,9 +1503,10 @@ a command like `return' or `jump' to con
/* Normally, by the time we reach `resume', the breakpoints are either
removed or inserted, as appropriate. The exception is if we're sitting
@@ -1678,9 +1680,10 @@ a command like `return' or `jump' to con
individually. */
resume_ptid = inferior_ptid;
}
@ -94,7 +94,7 @@ Index: gdb-7.0.50.20100115/gdb/infrun.c
{
/* User-settable 'scheduler' mode requires solo thread resume. */
resume_ptid = inferior_ptid;
@@ -1709,7 +1712,7 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -1889,7 +1892,7 @@ proceed (CORE_ADDR addr, enum target_sig
struct thread_info *tp;
CORE_ADDR pc;
struct address_space *aspace;
@ -103,7 +103,7 @@ Index: gdb-7.0.50.20100115/gdb/infrun.c
/* If we're stopped at a fork/vfork, follow the branch set by the
"set follow-fork-mode" command; otherwise, we'll just proceed
@@ -1744,13 +1747,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -1924,13 +1927,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-7.0.50.20100115/gdb/infrun.c
}
else
{
@@ -1781,13 +1784,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -1971,13 +1974,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-7.0.50.20100115/gdb/infrun.c
{
tp->trap_expected = 1;
/* If displaced stepping is enabled, we can step over the
@@ -1873,8 +1876,13 @@ proceed (CORE_ADDR addr, enum target_sig
@@ -2064,8 +2067,13 @@ proceed (CORE_ADDR addr, enum target_sig
/* Reset to normal state. */
init_infwait_state ();
@ -150,7 +150,7 @@ Index: gdb-7.0.50.20100115/gdb/infrun.c
/* Wait for it to stop (if not standalone)
and in any case decode why it stopped, and act accordingly. */
@@ -4655,13 +4663,18 @@ infrun: not switching back to stepped th
@@ -4903,13 +4911,18 @@ infrun: not switching back to stepped th
/* Is thread TP in the middle of single-stepping? */
@ -174,11 +174,11 @@ Index: gdb-7.0.50.20100115/gdb/infrun.c
}
/* Returns true if any thread *but* the one passed in "data" is in the
Index: gdb-7.0.50.20100115/gdb/linux-nat.c
Index: gdb-7.1.90.20100711/gdb/linux-nat.c
===================================================================
--- 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 *
--- gdb-7.1.90.20100711.orig/gdb/linux-nat.c 2010-07-12 10:00:56.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/linux-nat.c 2010-07-12 10:04:25.000000000 +0200
@@ -2827,7 +2827,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-7.0.50.20100115/gdb/linux-nat.c
return 1;
else
return 0;
Index: gdb-7.0.50.20100115/gdb/linux-nat.h
Index: gdb-7.1.90.20100711/gdb/linux-nat.h
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/linux-nat.h 2010-06-11 14:10:12.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/linux-nat.h 2010-07-12 10:04:25.000000000 +0200
@@ -55,8 +55,8 @@ struct lwp_info
/* If non-zero, a pending wait status. */
int status;

View File

@ -1,10 +1,11 @@
--- gdb-6.6/gdb/testsuite/gdb.threads/staticthreads.exp-orig 2005-04-30 21:56:47.000000000 +0200
+++ gdb-6.6/gdb/testsuite/gdb.threads/staticthreads.exp 2008-01-11 14:30:15.000000000 +0100
@@ -44,9 +44,21 @@ gdb_load ${binfile}
gdb_test "set print sevenbit-strings" ""
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.threads/staticthreads.exp 2010-06-02 23:53:28.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/staticthreads.exp 2010-07-12 11:43:26.000000000 +0200
@@ -44,6 +44,18 @@ gdb_test_no_output "set print sevenbit-s
# See if the static multi-threaded program runs.
+runto_main
runto_main
+
+# See if we get excessive LWP there (patched glibc with unpatched GDB):
+# * 2 Thread 135661664 (LWP 3856) main () at threadloop.c:41
@ -17,9 +18,6 @@
+ }
+}
+
# See if the static multi-threaded program runs.
-runto_main
gdb_test "break sem_post"
set test "Continue to main's call of sem_post"
gdb_test_multiple "continue" "$test" {

View File

@ -641,7 +641,7 @@ http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html
+ .section .note.GNU-stack,"",@progbits
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/i386-interface.exp 22 Dec 2007 19:07:28 -0000
@@ -0,0 +1,66 @@
@@ -0,0 +1,59 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -665,13 +665,6 @@ http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html
+# Test basis recognization of DW_TAG_interface_type.
+# GCC java_classify_record() produces it if returns RECORD_IS_INTERFACE.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} then {
+ verbose "Skipping i386 Java DW_TAG_interface_type test."
+ return

View File

@ -52,7 +52,7 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128
+char_u u_typed[]="A";
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/charsign.exp 26 Jan 2007 10:32:00 -0000
@@ -0,0 +1,70 @@
@@ -0,0 +1,63 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -69,13 +69,6 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile charsign
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}

View File

@ -39,7 +39,7 @@ http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.exp 3 Nov 2007 22:22:28 -0000
@@ -0,0 +1,61 @@
@@ -0,0 +1,54 @@
+# Copyright 2006 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
@ -58,16 +58,9 @@ http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html
+#
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+# Test displaying call clobbered registers in optimized binaries for ppc.
+# GDB should not show incorrect values.
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "powerpc*-*"] then {
+ verbose "Skipping powerpc* call clobbered registers testing."
+ return

View File

@ -1,68 +0,0 @@
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

@ -20,8 +20,10 @@ random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore
gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp:
frames-invalid can happen asynchronously.
--- ./gdb/testsuite/gdb.base/fileio.c 13 Jun 2006 08:55:22 -0000 1.10
+++ ./gdb/testsuite/gdb.base/fileio.c 8 Dec 2007 16:04:10 -0000
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/fileio.c 2009-10-01 17:39:13.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.c 2010-07-12 11:41:43.000000000 +0200
@@ -58,6 +58,8 @@ system (const char * string);
1) Invalid string/command. - returns 127. */
static const char *strerrno (int err);
@ -69,9 +71,11 @@ frames-invalid can happen asynchronously.
/* Don't change the order of the calls. They partly depend on each other */
test_open ();
test_write ();
--- ./gdb/testsuite/gdb.base/fileio.exp 23 Aug 2007 18:14:16 -0000 1.12
+++ ./gdb/testsuite/gdb.base/fileio.exp 8 Dec 2007 16:04:10 -0000
@@ -46,8 +46,8 @@ if [get_compiler_info ${binfile}] {
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/fileio.exp 2010-06-09 00:58:03.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/fileio.exp 2010-07-12 11:42:07.000000000 +0200
@@ -42,8 +42,8 @@ if [get_compiler_info ${binfile}] {
return -1;
}
@ -82,16 +86,16 @@ frames-invalid can happen asynchronously.
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
@@ -88,7 +88,7 @@ gdb_test continue \
"Opening nonexistant file returns ENOENT"
@@ -85,7 +85,7 @@ gdb_test continue \
gdb_test "continue" ".*" ""
send_gdb "continue\n" ; gdb_expect -re "$gdb_prompt $"
-catch "system \"chmod -f -w nowrt.fileio.test\""
+catch "system \"chmod -f -w fileio.dir/nowrt.fileio.test\""
gdb_test continue \
"Continuing\\..*open 5:.*EACCES$stop_msg" \
@@ -252,8 +252,8 @@ gdb_test continue \
@@ -250,8 +250,8 @@ gdb_test continue \
send_gdb "quit\n"
send_gdb "y\n"

View File

@ -1,146 +1,118 @@
Index: gdb-7.1/bfd/elf-bfd.h
Index: gdb-7.1.90.20100711/bfd/elf-bfd.h
===================================================================
--- gdb-7.1.orig/bfd/elf-bfd.h 2010-02-09 13:14:42.000000000 +0100
+++ gdb-7.1/bfd/elf-bfd.h 2010-05-16 20:22:38.000000000 +0200
@@ -2160,7 +2160,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
--- gdb-7.1.90.20100711.orig/bfd/elf-bfd.h 2010-06-27 06:07:51.000000000 +0200
+++ gdb-7.1.90.20100711/bfd/elf-bfd.h 2010-07-12 23:00:04.000000000 +0200
@@ -2171,8 +2171,9 @@ extern Elf_Internal_Phdr * _bfd_elf_find
/* Exported interface for writing elf corefile notes. */
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
+#include <sys/procfs.h>
extern char *elfcore_write_prpsinfo
- (bfd *, char *, int *, const char *, const char *);
+ (bfd *, char *, int *, void *, const char *, const char *);
+ (bfd *, char *, int *, const prpsinfo_t *);
extern char *elfcore_write_prstatus
(bfd *, char *, int *, long, int, const void *);
extern char * elfcore_write_pstatus
Index: gdb-7.1/bfd/elf.c
Index: gdb-7.1.90.20100711/bfd/elf.c
===================================================================
--- gdb-7.1.orig/bfd/elf.c 2010-02-18 01:09:06.000000000 +0100
+++ gdb-7.1/bfd/elf.c 2010-05-16 20:25:15.000000000 +0200
@@ -8545,6 +8545,7 @@ char *
--- gdb-7.1.90.20100711.orig/bfd/elf.c 2010-05-18 05:31:05.000000000 +0200
+++ gdb-7.1.90.20100711/bfd/elf.c 2010-07-12 22:51:17.000000000 +0200
@@ -8582,13 +8582,12 @@ elfcore_write_note (bfd *abfd,
return buf;
}
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
+#if defined (HAVE_PRPSINFO_T)
char *
elfcore_write_prpsinfo (bfd *abfd,
char *buf,
int *bufsiz,
+ void *info,
const char *fname,
const char *psargs)
- const char *fname,
- const char *psargs)
+ const prpsinfo_t *input)
{
@@ -8571,26 +8572,40 @@ elfcore_write_prpsinfo (bfd *abfd,
int note_type = NT_PRPSINFO;
#endif
const char *note_name = "CORE";
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
@@ -8596,48 +8595,55 @@ elfcore_write_prpsinfo (bfd *abfd,
if (bed->elf_backend_write_core_note != NULL)
{
char *ret;
+ char fname[sizeof (input->pr_fname) + 1];
+ char psargs[sizeof (input->pr_psargs) + 1];
+
+ strncpy (fname, input->pr_fname, sizeof (input->pr_fname));
+ fname[sizeof (input->pr_fname)] = 0;
+ strncpy (psargs, input->pr_psargs, sizeof (input->pr_psargs));
+ psargs[sizeof (input->pr_psargs)] = 0;
+
ret = (*bed->elf_backend_write_core_note) (abfd, buf, bufsiz,
NT_PRPSINFO, fname, psargs);
if (ret != NULL)
return ret;
}
- memset (&data, 0, sizeof (data));
-#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
+#if defined (HAVE_PRPSINFO32_T)
if (bed->s->elfclass == ELFCLASS32)
{
-#if defined (HAVE_PSINFO32_T)
- psinfo32_t data;
- int note_type = NT_PSINFO;
-#else
prpsinfo32_t data;
int note_type = NT_PRPSINFO;
-#endif
memset (&data, 0, sizeof (data));
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ if (info)
+ memcpy (&data, info, sizeof (data));
+ else
+ {
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ }
+
+ data.pr_state = input->pr_state;
+ data.pr_sname = input->pr_sname;
+ data.pr_zomb = input->pr_zomb;
+ data.pr_nice = input->pr_nice;
+ data.pr_flag = input->pr_flag;
+ data.pr_uid = input->pr_uid;
+ data.pr_gid = input->pr_gid;
+ data.pr_pid = input->pr_pid;
+ data.pr_ppid = input->pr_ppid;
+ data.pr_pgrp = input->pr_pgrp;
+ data.pr_sid = input->pr_sid;
+ BFD_ASSERT (sizeof (data.pr_fname) == sizeof (input->pr_fname));
+ memcpy (data.pr_fname, input->pr_fname, sizeof (data.pr_fname));
+ BFD_ASSERT (sizeof (data.pr_psargs) == sizeof (input->pr_psargs));
+ memcpy (data.pr_psargs, input->pr_psargs, sizeof (data.pr_psargs));
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
}
else
#endif
{
+/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue. */
#if defined (HAVE_PSINFO_T)
psinfo_t data;
+/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue. */
int note_type = NT_PSINFO;
#else
prpsinfo_t data;
-#if defined (HAVE_PSINFO_T)
- psinfo_t data;
- int note_type = NT_PSINFO;
-#else
- prpsinfo_t data;
int note_type = NT_PRPSINFO;
#endif
-#endif
- memset (&data, 0, sizeof (data));
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ if (info)
+ memcpy (&data, info, sizeof (data));
+ else
+ {
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ }
+
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
- note_name, note_type, &data, sizeof (data));
+ note_name, note_type, input, sizeof (*input));
}
Index: gdb-7.1/gdb/amd64-linux-nat.c
===================================================================
--- gdb-7.1.orig/gdb/amd64-linux-nat.c 2010-05-16 20:22:38.000000000 +0200
+++ gdb-7.1/gdb/amd64-linux-nat.c 2010-05-16 20:22:38.000000000 +0200
@@ -140,6 +140,7 @@ static int amd64_linux_gregset32_reg_off
static char *
amd64_linux_elfcore_write_prpsinfo (bfd *abfd, char *buf, int *bufsiz,
+ void *info,
const char *fname, const char *psargs)
{
if (gdbarch_ptr_bit (target_gdbarch) == 32)
@@ -149,14 +150,20 @@ amd64_linux_elfcore_write_prpsinfo (bfd
struct elf_prpsinfo32 data;
note_type = NT_PRPSINFO;
- memset (&data, 0, sizeof (data));
- strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
- strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ if (info)
+ memcpy (&data, info, sizeof (data));
+ else
+ {
+ memset (&data, 0, sizeof (data));
+ strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
+ strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
+ }
+
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
}
else
- return elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs);
+ return elfcore_write_prpsinfo (abfd, buf, bufsiz, info, fname, psargs);
}
-#endif /* PSINFO_T or PRPSINFO_T */
+#endif /* PRPSINFO_T */
static void
Index: gdb-7.1/gdb/fbsd-nat.c
#if defined (HAVE_PRSTATUS_T)
char *
Index: gdb-7.1.90.20100711/gdb/linux-nat.c
===================================================================
--- gdb-7.1.orig/gdb/fbsd-nat.c 2010-01-01 08:31:31.000000000 +0100
+++ gdb-7.1/gdb/fbsd-nat.c 2010-05-16 20:22:38.000000000 +0200
@@ -211,6 +211,7 @@ fbsd_make_corefile_notes (bfd *obfd, int
psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL);
note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
+ NULL,
fname, psargs);
}
Index: gdb-7.1/gdb/linux-nat.c
===================================================================
--- gdb-7.1.orig/gdb/linux-nat.c 2010-05-16 20:22:38.000000000 +0200
+++ gdb-7.1/gdb/linux-nat.c 2010-05-16 20:22:38.000000000 +0200
@@ -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
@@ -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)
- (bfd *, char *, int *, const char *, const char *) = elfcore_write_prpsinfo;
+ (bfd *, char *, int *, void *, const char *, const char *) = elfcore_write_prpsinfo;
char *(*linux_elfcore_write_prstatus)
(bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus;
static char *
@@ -4507,6 +4508,159 @@ linux_spu_make_corefile_notes (bfd *obfd
--- gdb-7.1.90.20100711.orig/gdb/linux-nat.c 2010-07-12 23:05:22.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/linux-nat.c 2010-07-12 22:57:34.000000000 +0200
@@ -4466,6 +4466,131 @@ linux_spu_make_corefile_notes (bfd *obfd
return args.note_data;
}
@ -153,7 +125,7 @@ Index: gdb-7.1/gdb/linux-nat.c
+ binfmt_elf.c. Unknown values are filled with zeroes. The structure is
+ malloced. */
+
+static void*
+static const prpsinfo_t *
+fill_prpsinfo (void)
+{
+ struct stat sb;
@ -173,6 +145,7 @@ Index: gdb-7.1/gdb/linux-nat.c
+ obsolete there to <linux/sched.h> TASK_* constants. */
+ const char state_string[] = "RSDTZW";
+ int state_num;
+ static prpsinfo_t retval;
+
+ /* Get /proc/$PID/stat. */
+ pid = ptid_get_pid (inferior_ptid);
@ -249,108 +222,63 @@ Index: gdb-7.1/gdb/linux-nat.c
+ state_num = 0;
+ }
+
+#if ULONG_MAX > 0xffffffffU
+ /* We skip this code on 32-bit gdb. */
+ if (gdbarch_ptr_bit (target_gdbarch) == 64)
+ {
+ struct elf_prpsinfo *info = xzalloc (sizeof (*info));
+ memset (&retval, 0, sizeof (retval));
+ retval.pr_state = state_num;
+ retval.pr_sname = proc_state[0];
+ retval.pr_zomb = (proc_state[0] == 'Z');
+ retval.pr_nice = proc_nice;
+ retval.pr_flag = flags;
+ retval.pr_uid = sb.st_uid;
+ retval.pr_gid = sb.st_gid;
+ retval.pr_pid = pid;
+ retval.pr_ppid = proc_ppid;
+ retval.pr_pgrp = proc_pgid;
+ retval.pr_sid = proc_sid;
+ strncpy (retval.pr_fname, proc_comm, sizeof (retval.pr_fname));
+ strncpy (retval.pr_psargs, proc_cmdline, sizeof (retval.pr_psargs));
+
+ info->pr_state = state_num;
+ info->pr_sname = proc_state[0];
+ info->pr_zomb = (proc_state[0] == 'Z');
+ info->pr_nice = proc_nice;
+ info->pr_flag = flags;
+ info->pr_uid = sb.st_uid;
+ info->pr_gid = sb.st_gid;
+ info->pr_pid = pid;
+ info->pr_ppid = proc_ppid;
+ info->pr_pgrp = proc_pgid;
+ info->pr_sid = proc_sid;
+ strncpy (info->pr_fname, proc_comm, sizeof (info->pr_fname));
+ strncpy (info->pr_psargs, proc_cmdline, sizeof (info->pr_psargs));
+
+ return info;
+ }
+#endif
+ if (gdbarch_ptr_bit (target_gdbarch) == 32)
+ {
+ struct elf_prpsinfo32 *info = xzalloc (sizeof (*info));
+
+ info->pr_state = state_num;
+ info->pr_sname = proc_state[0];
+ info->pr_zomb = (proc_state[0] == 'Z');
+ info->pr_nice = proc_nice;
+ info->pr_flag = flags;
+ info->pr_uid = sb.st_uid;
+ info->pr_gid = sb.st_gid;
+ info->pr_pid = pid;
+ info->pr_ppid = proc_ppid;
+ info->pr_pgrp = proc_pgid;
+ info->pr_sid = proc_sid;
+ strncpy (info->pr_fname, proc_comm, sizeof (info->pr_fname));
+ strncpy (info->pr_psargs, proc_cmdline, sizeof (info->pr_psargs));
+
+ return info;
+ }
+
+ return NULL;
+ return &retval;
+}
+#endif
+
/* Fills the "to_make_corefile_note" target vector. Builds the note
section for a corefile, and returns it in a malloc buffer. */
@@ -4527,8 +4681,14 @@ linux_nat_make_corefile_notes (bfd *obfd
@@ -4484,26 +4609,11 @@ linux_nat_make_corefile_notes (bfd *obfd
if (get_exec_file (0))
{
+#if defined (HAVE_PRPSINFO_T)
+ void *data = fill_prpsinfo ();
+#define DATAPTR data
+#else
+#define DATAPTR NULL
strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
strncpy (psargs, get_exec_file (0), sizeof (psargs));
+#endif
if (get_inferior_args ())
{
char *string_end;
@@ -4544,9 +4704,15 @@ linux_nat_make_corefile_notes (bfd *obfd
psargs_end - string_end);
}
}
- note_data = (char *) linux_elfcore_write_prpsinfo (obfd, note_data,
- note_size, fname,
+ note_data = (char *) linux_elfcore_write_prpsinfo (obfd,
+ note_data, note_size,
+ DATAPTR,
+ fname,
psargs);
+#if defined (HAVE_PRPSINFO_T)
+ xfree (DATAPTR);
+#endif
+#undef DATAPTR
- strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
- strncpy (psargs, get_exec_file (0), sizeof (psargs));
- if (get_inferior_args ())
- {
- char *string_end;
- char *psargs_end = psargs + sizeof (psargs);
-
- /* linux_elfcore_write_prpsinfo () handles zero unterminated
- strings fine. */
- string_end = memchr (psargs, 0, sizeof (psargs));
- if (string_end != NULL)
- {
- *string_end++ = ' ';
- strncpy (string_end, get_inferior_args (),
- psargs_end - string_end);
- }
- }
+ const prpsinfo_t *data = fill_prpsinfo ();
+
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
- note_size, fname, psargs);
+ note_size, data);
}
/* Dump information for threads. */
Index: gdb-7.1/gdb/linux-nat.h
Index: gdb-7.1.90.20100711/gdb/procfs.c
===================================================================
--- gdb-7.1.orig/gdb/linux-nat.h 2010-05-16 20:22:37.000000000 +0200
+++ gdb-7.1/gdb/linux-nat.h 2010-05-16 20:22:38.000000000 +0200
@@ -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)
- (bfd *, char *, int *, const char *, const char *);
+ (bfd *, char *, int *, void *, const char *, const char *);
extern char *(*linux_elfcore_write_prstatus)
(bfd *, char *, int *, long, int, const void *);
extern char *(*linux_elfcore_write_prfpreg)
Index: gdb-7.1/gdb/procfs.c
===================================================================
--- gdb-7.1.orig/gdb/procfs.c 2010-02-15 18:35:49.000000000 +0100
+++ gdb-7.1/gdb/procfs.c 2010-05-16 20:22:38.000000000 +0200
@@ -6184,6 +6184,7 @@ procfs_make_note_section (bfd *obfd, int
--- gdb-7.1.90.20100711.orig/gdb/procfs.c 2010-07-07 18:15:16.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/procfs.c 2010-07-12 23:05:23.000000000 +0200
@@ -5770,6 +5770,7 @@ procfs_make_note_section (bfd *obfd, int
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
note_size,

View File

@ -1,20 +1,5 @@
Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
Index: gdb-6.8.50.20090909/gdb/dwarf2loc.c
===================================================================
--- gdb-6.8.50.20090909.orig/gdb/dwarf2loc.c 2009-09-09 20:08:03.000000000 +0200
+++ gdb-6.8.50.20090909/gdb/dwarf2loc.c 2009-09-09 20:10:35.000000000 +0200
@@ -56,7 +56,9 @@ find_location_expression (struct dwarf2_
CORE_ADDR low, high;
gdb_byte *loc_ptr, *buf_end;
int length;
- struct objfile *objfile = dwarf2_per_cu_objfile (baton->per_cu);
+ struct objfile *objfile1 = dwarf2_per_cu_objfile (baton->per_cu);
+ struct objfile *objfile = objfile1->separate_debug_objfile
+ ? objfile1->separate_debug_objfile : objfile1;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int addr_size = dwarf2_per_cu_addr_size (baton->per_cu);
Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000

View File

@ -1,236 +0,0 @@
2008-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (fetch_watchpoint_value): New comment on unreachable
values.
(watch_command_1): New variable VAL_CHAIN. Refuse constant watchpoints.
* gdbtypes.h (TYPE_CODE_FUNC): New comment regarding pointers to it.
2008-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Set Watchpoints): Document constant value watchpoints.
2008-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/watchpoint.exp: Call TEST_CONSTANT_WATCHPOINT.
(test_constant_watchpoint): New function.
(test_inaccessible_watchpoint): Cleanup (delete) the watchpoint.
Test also a double-indirection watchpoint.
gdb.base/watchpoint.c (global_ptr_ptr): New variable.
(func4): New testing code for GLOBAL_PTR_PTR.
Index: gdb-7.0.50.20100115/gdb/breakpoint.c
===================================================================
--- 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
- chain. */
+ chain.
+
+ Inferior unreachable values return:
+ Inferior `int *intp = NULL;' with `watch *intp':
+ *VALP is NULL, *RESULTP contains lazy LVAL_MEMORY address 0, *VAL_CHAIN
+ contains the *RESULTP element and also INTP as LVAL_MEMORY.
+ Inferior `int **intpp = NULL;' with `watch **intpp':
+ *VALP is NULL, *RESULTP is NULL, *VAL_CHAIN contains lazy LVAL_MEMORY
+ address 0 and also INTPP as LVAL_MEMORY. */
static void
fetch_watchpoint_value (struct expression *exp, struct value **valp,
@@ -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;
+ struct value *val, *mark, *val_chain;
struct frame_info *frame;
char *exp_start = NULL;
char *exp_end = NULL;
@@ -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);
+
+ /* VALUE_MARK gets us the same value as FETCH_WATCHPOINT_VALUE's VAL_CHAIN
+ parameter. Just this way we do not have to VALUE_FREE the chained VALUEs
+ ourselves. */
+ for (val_chain = value_mark ();
+ val_chain != mark;
+ val_chain = value_next (val_chain))
+ if ((VALUE_LVAL (val_chain) == lval_memory
+ && TYPE_CODE (value_type (val_chain)) != TYPE_CODE_FUNC)
+ || VALUE_LVAL (val_chain) == lval_register)
+ break;
+ if (val_chain == mark)
+ {
+ int len;
+
+ len = exp_end - exp_start;
+ while (len > 0 && isspace (exp_start[len - 1]))
+ len--;
+ error (_("Cannot watch constant value %.*s."), len, exp_start);
+ }
+ /* Break the values chain only after its check above. */
if (val != NULL)
release_value (val);
Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
===================================================================
--- 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 */
- TYPE_CODE_FUNC, /* Function type */
+
+ /* Function type. It is not a pointer to a function. Function reference
+ by its name (such as `printf') has this type. C automatically converts
+ this function type to a pointer to function for any operation except
+ `sizeof (function_type)' or `&function_type' (unary &).
+ `sizeof (function_type)' is undefined in C. But GCC provides extension
+ (info '(gcc)Pointer Arith') defining its size as 1 byte. DWARF does not
+ define its size but GDB defines the size the GCC compatible way - GDB
+ function MAKE_FUNCTION_TYPE. The address itself is not modifiable.
+ As the function type has size 1 but its real value has `sizeof
+ (CORE_ADDR)' we cannot use NOT_LVAL category because the address would
+ not fit in the VALUE_CONTENTS_RAW container of its VALUE. We use
+ LVAL_MEMORY (and its VALUE_ADDRESS field) for it but we must be careful
+ it is not lvalue, it is the only non-modifiable LVAL_MEMORY. */
+ TYPE_CODE_FUNC,
+
TYPE_CODE_INT, /* Integer type */
/* Floating type. This is *NOT* a complex type. Beware, there are parts
Index: gdb-7.0.50.20100115/gdb/doc/gdb.texinfo
===================================================================
--- 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
+If you watch for a change in a numerically entered address you need to
+dereference it as the address itself is just a constant number which will never
+change. @value{GDBN} refuses to create a watchpoint that watches
+a never-changing value:
+
+@smallexample
+(@value{GDBP}) watch 0x600850
+Cannot watch constant value 0x600850.
+(@value{GDBP}) watch *(int *) 0x600850
+Watchpoint 1: *(int *) 6293584
+@end smallexample
+
@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-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.c
===================================================================
--- 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;
char *global_ptr;
+char **global_ptr_ptr;
void marker1 ()
{
@@ -119,6 +120,10 @@ func4 ()
buf[0] = 3;
global_ptr = buf;
buf[0] = 7;
+ buf[1] = 5;
+ global_ptr_ptr = &global_ptr;
+ buf[0] = 9;
+ global_ptr++;
}
int main ()
Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.exp
===================================================================
--- 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 {} {
}
}
}
-
+
+proc test_constant_watchpoint {} {
+ global gdb_prompt
+
+ gdb_test "watch 5" "Cannot watch constant value 5." "number is constant"
+ gdb_test "watch marker1" "Cannot watch constant value marker1." \
+ "marker1 is constant"
+ gdb_test "watch count + 6" ".*atchpoint \[0-9\]+: count \\+ 6"
+ gdb_test "set \$expr_breakpoint_number = \$bpnum" ""
+ gdb_test "delete \$expr_breakpoint_number" ""
+ gdb_test "watch 7 + count" ".*atchpoint \[0-9\]+: 7 \\+ count"
+ gdb_test "set \$expr_breakpoint_number = \$bpnum" ""
+ gdb_test "delete \$expr_breakpoint_number" ""
+}
+
proc test_inaccessible_watchpoint {} {
global gdb_prompt
@@ -662,7 +676,8 @@ proc test_inaccessible_watchpoint {} {
}
gdb_test "watch *global_ptr" ".*atchpoint \[0-9\]+: \\*global_ptr"
- gdb_test "next" ".*global_ptr = buf.*"
+ gdb_test "set \$global_ptr_breakpoint_number = \$bpnum" ""
+ gdb_test "next" ".*global_ptr = buf.*" "global_ptr next"
gdb_test_multiple "next" "next over ptr init" {
-re ".*atchpoint \[0-9\]+: \\*global_ptr\r\n\r\nOld value = .*\r\nNew value = 3 .*\r\n.*$gdb_prompt $" {
# We can not test for <unknown> here because NULL may be readable.
@@ -675,6 +690,28 @@ proc test_inaccessible_watchpoint {} {
pass "next over buffer set"
}
}
+ gdb_test "delete \$global_ptr_breakpoint_number" ""
+ gdb_test "watch **global_ptr_ptr" ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr"
+ gdb_test "set \$global_ptr_ptr_breakpoint_number = \$bpnum" ""
+ gdb_test "next" ".*global_ptr_ptr = &global_ptr.*" "gloabl_ptr_ptr next"
+ gdb_test_multiple "next" "next over global_ptr_ptr init" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = .*\r\nNew value = 7 .*\r\n.*$gdb_prompt $" {
+ # We can not test for <unknown> here because NULL may be readable.
+ # This test does rely on *NULL != 7.
+ pass "next over global_ptr_ptr init"
+ }
+ }
+ gdb_test_multiple "next" "next over global_ptr_ptr buffer set" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = 7 .*\r\nNew value = 9 .*\r\n.*$gdb_prompt $" {
+ pass "next over global_ptr_ptr buffer set"
+ }
+ }
+ gdb_test_multiple "next" "next over global_ptr_ptr pointer advance" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = 9 .*\r\nNew value = 5 .*\r\n.*$gdb_prompt $" {
+ pass "next over global_ptr_ptr pointer advance"
+ }
+ }
+ gdb_test "delete \$global_ptr_ptr_breakpoint_number" ""
}
}
@@ -851,6 +888,17 @@ if [initialize] then {
test_watchpoint_and_breakpoint
test_watchpoint_in_big_blob
+
+ # See above.
+ if [istarget "mips-idt-*"] then {
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+ initialize
+ }
+
+ test_constant_watchpoint
}
# Restore old timeout

View File

@ -1,8 +1,8 @@
Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
Index: gdb-7.1.90.20100711/gdb/dwarf2read.c
===================================================================
--- 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
--- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-12 23:07:35.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:13:02.000000000 +0200
@@ -2251,6 +2251,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-7.0.50.20100115/gdb/dwarf2read.c
case DW_TAG_typedef:
case DW_TAG_union_type:
if (!pdi->is_declaration)
@@ -2719,6 +2720,7 @@ add_partial_symbol (struct partial_die_i
@@ -2452,6 +2453,7 @@ add_partial_symbol (struct partial_die_i
}
break;
case DW_TAG_variable:
@ -18,7 +18,15 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
if (pdi->is_external)
{
/* Global Variable.
@@ -4770,7 +4772,8 @@ dwarf2_add_field (struct field_info *fip
@@ -3289,6 +3291,7 @@ die_needs_namespace (struct die_info *di
return 1;
case DW_TAG_variable:
+ case DW_TAG_constant:
/* We only need to prefix "globally" visible variables. These include
any variable marked with DW_AT_external or any variable that
lives in a namespace. [Variables in anonymous namespaces
@@ -4638,7 +4641,8 @@ dwarf2_add_field (struct field_info *fip
fip->non_public_fields = 1;
}
}
@ -28,7 +36,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
{
/* C++ static member. */
@@ -5339,7 +5342,8 @@ read_structure_type (struct die_info *di
@@ -5250,7 +5254,8 @@ read_structure_type (struct die_info *di
while (child_die && child_die->tag)
{
if (child_die->tag == DW_TAG_member
@ -38,7 +46,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
{
/* NOTE: carlton/2002-11-05: A C++ static data member
should be a DW_TAG_member that is a declaration, but
@@ -5459,6 +5463,7 @@ process_structure_scope (struct die_info
@@ -5396,6 +5401,7 @@ process_structure_scope (struct die_info
{
if (child_die->tag == DW_TAG_member
|| child_die->tag == DW_TAG_variable
@ -46,7 +54,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
|| child_die->tag == DW_TAG_inheritance)
{
/* Do nothing. */
@@ -7134,6 +7139,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
@@ -7109,6 +7115,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
&& abbrev->tag != DW_TAG_subprogram
&& abbrev->tag != DW_TAG_lexical_block
&& abbrev->tag != DW_TAG_variable
@ -54,7 +62,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
&& abbrev->tag != DW_TAG_namespace
&& abbrev->tag != DW_TAG_module
&& abbrev->tag != DW_TAG_member)
@@ -7242,6 +7248,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
@@ -7217,6 +7224,7 @@ load_partial_dies (bfd *abfd, gdb_byte *
if (load_all
|| abbrev->tag == DW_TAG_subprogram
|| abbrev->tag == DW_TAG_variable
@ -62,7 +70,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
|| abbrev->tag == DW_TAG_namespace
|| part_die->is_declaration)
{
@@ -9016,6 +9023,11 @@ new_symbol (struct die_info *die, struct
@@ -9059,6 +9067,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;
@ -72,5 +80,5 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
+ SYMBOL_TYPE (sym), NULL);
+ /* PASSTHRU */
case DW_TAG_variable:
case DW_TAG_member:
/* Compilation with minimal debug info may result in variables
with missing type entries. Change the misleading `void' type

View File

@ -1,25 +1,6 @@
Archer-upstreamed:
http://sourceware.org/ml/archer/2010-q2/msg00031.html
--- ./gdb/breakpoint.c 2010-05-29 01:12:32.000000000 +0200
+++ ./gdb/breakpoint.c 2010-05-29 01:22:21.000000000 +0200
@@ -1679,14 +1679,11 @@ create_exception_master_breakpoint (void
debug_hook = lookup_minimal_symbol_text ("_Unwind_DebugHook", objfile);
if (debug_hook != NULL)
{
- CORE_ADDR pc;
struct breakpoint *b;
- pc = find_function_start_pc (get_objfile_arch (objfile),
- SYMBOL_VALUE_ADDRESS (debug_hook),
- SYMBOL_OBJ_SECTION (debug_hook));
b = create_internal_breakpoint (get_objfile_arch (objfile),
- pc, bp_exception_master);
+ SYMBOL_VALUE_ADDRESS (debug_hook),
+ bp_exception_master);
b->addr_string = xstrdup ("_Unwind_DebugHook");
b->enable_state = bp_disabled;
}
--- ./gdb/testsuite/gdb.cp/cxxexec.cc 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.cp/cxxexec.cc 2010-05-29 01:18:56.000000000 +0200
@@ -0,0 +1,25 @@

View File

@ -1,8 +1,8 @@
Index: gdb-7.0.50.20100115/gdb/breakpoint.c
Index: gdb-7.1.90.20100711/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
--- gdb-7.1.90.20100711.orig/gdb/breakpoint.c 2010-07-12 23:07:33.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/breakpoint.c 2010-07-13 00:38:04.000000000 +0200
@@ -10159,6 +10159,50 @@ update_breakpoint_locations (struct brea
update_global_location_list (1);
}
@ -49,26 +49,27 @@ Index: gdb-7.0.50.20100115/gdb/breakpoint.c
+ qsort (bp_location, bp_location_count, sizeof (*bp_location),
+ 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.
Index: gdb-7.0.50.20100115/gdb/breakpoint.h
Unused in this case. */
Index: gdb-7.1.90.20100711/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);
--- gdb-7.1.90.20100711.orig/gdb/breakpoint.h 2010-07-12 23:07:33.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/breakpoint.h 2010-07-13 00:37:34.000000000 +0200
@@ -1088,4 +1088,7 @@ extern void check_tracepoint_command (ch
extern void start_rbreak_breakpoints (void);
extern void end_rbreak_breakpoints (void);
+extern void breakpoints_relocate (struct objfile *objfile,
+ struct section_offsets *delta);
+
#endif /* !defined (BREAKPOINT_H) */
Index: gdb-7.0.50.20100115/gdb/objfiles.c
Index: gdb-7.1.90.20100711/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
--- gdb-7.1.90.20100711.orig/gdb/objfiles.c 2010-05-16 02:46:46.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/objfiles.c 2010-07-13 00:37:19.000000000 +0200
@@ -834,6 +834,11 @@ objfile_relocate1 (struct objfile *objfi
obj_section_addr (s));
}

View File

@ -1,8 +1,8 @@
Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
Index: gdb-7.1.90.20100711/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,
--- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-13 00:26:25.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:34:00.000000000 +0200
@@ -5737,7 +5737,12 @@ read_common_block (struct die_info *die,
{
struct attribute *attr;
struct symbol *sym;
@ -16,7 +16,7 @@ Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr)
@@ -5919,6 +5924,7 @@ read_common_block (struct die_info *die,
@@ -5746,6 +5751,7 @@ read_common_block (struct die_info *die,
if (attr_form_is_block (attr))
{
base = decode_locdesc (DW_BLOCK (attr), cu);
@ -24,7 +24,7 @@ Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
}
else if (attr_form_is_section_offset (attr))
{
@@ -5980,12 +5986,15 @@ read_common_block (struct die_info *die,
@@ -5807,12 +5813,15 @@ read_common_block (struct die_info *die,
else
dwarf2_complex_location_expr_complaint ();
@ -42,7 +42,7 @@ Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
else
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
@@ -5999,7 +6008,7 @@ read_common_block (struct die_info *die,
@@ -5826,7 +5835,7 @@ read_common_block (struct die_info *die,
sym = new_symbol (die, type, cu);
/* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
@ -51,11 +51,11 @@ Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
set_die_type (die, type, cu);
}
Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
Index: gdb-7.1.90.20100711/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
--- gdb-7.1.90.20100711.orig/gdb/gdbtypes.h 2010-07-12 23:07:34.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/gdbtypes.h 2010-07-13 00:34:00.000000000 +0200
@@ -395,6 +395,7 @@ enum type_instance_flag_value
enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /* bitpos */
@ -63,7 +63,7 @@ Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
FIELD_LOC_KIND_PHYSNAME /* physname */
};
@@ -591,6 +592,7 @@ struct main_type
@@ -577,6 +578,7 @@ struct main_type
is the location (in the target) of the static field.
Otherwise, physname is the mangled label of the static field. */
@ -71,7 +71,7 @@ Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
CORE_ADDR physaddr;
char *physname;
}
@@ -1091,6 +1093,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1073,6 +1075,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)
@ -79,7 +79,7 @@ Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
@@ -1098,6 +1101,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1080,6 +1083,7 @@ extern void allocate_gnat_aux_type (stru
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
@ -87,7 +87,7 @@ Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -1110,6 +1114,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1092,6 +1096,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))
@ -95,11 +95,11 @@ Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
Index: gdb-7.0.90.20100306/gdb/jv-lang.c
Index: gdb-7.1.90.20100711/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
--- gdb-7.1.90.20100711.orig/gdb/jv-lang.c 2010-05-17 19:18:39.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/jv-lang.c 2010-07-13 00:34:00.000000000 +0200
@@ -409,7 +409,8 @@ java_link_class_type (struct gdbarch *gd
fields = NULL;
nfields--; /* First set up dummy "class" field. */
@ -109,7 +109,7 @@ Index: gdb-7.0.90.20100306/gdb/jv-lang.c
TYPE_FIELD_NAME (type, nfields) = "class";
TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
SET_TYPE_FIELD_PRIVATE (type, nfields);
@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gd
@@ -457,7 +458,8 @@ java_link_class_type (struct gdbarch *gd
SET_TYPE_FIELD_PROTECTED (type, i);
}
if (accflags & 0x0008) /* ACC_STATIC */
@ -119,27 +119,27 @@ Index: gdb-7.0.90.20100306/gdb/jv-lang.c
else
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
Index: gdb-7.0.90.20100306/gdb/value.c
Index: gdb-7.1.90.20100711/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)
--- gdb-7.1.90.20100711.orig/gdb/value.c 2010-07-12 23:07:33.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/value.c 2010-07-13 00:35:21.000000000 +0200
@@ -1943,7 +1943,8 @@ value_static_field (struct type *type, i
{
retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
}
else
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
break;
case FIELD_LOC_KIND_PHYSNAME:
{
@@ -1927,7 +1928,8 @@ value_static_field (struct type *type, i
@@ -1977,7 +1978,8 @@ value_static_field (struct type *type, i
}
if (retval && VALUE_LVAL (retval) == lval_memory)
SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
- value_address (retval));
+ value_address (retval)
+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
break;
}
return retval;
}
default:

View File

@ -1,105 +0,0 @@
commit a683bac73af74a757591672d89d720169c0b5ec9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Thu May 13 18:08:30 2010 +0200
Support DW_AT_upper_bound is referencing an optimized-out variable.
https://bugzilla.redhat.com/show_bug.cgi?id=591879
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -383,6 +383,9 @@ dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton,
size_t size;
struct value *val;
+ if (!dllbaton)
+ return 0;
+
data = find_location_expression (dllbaton, &size,
get_frame_address_in_block (frame));
if (data == NULL)
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -11693,6 +11693,11 @@ dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
{
struct dwarf2_loclist_baton *baton;
+ /* DW_AT_location of the referenced DIE may be missing if the referenced
+ variable has been optimized out. */
+ if (!attr)
+ return NULL;
+
if (!(attr_form_is_section_offset (attr)
/* ".debug_loc" may not exist at all, or the offset may be outside
the section. If so, fall through to the complaint in the
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
@@ -51,6 +51,17 @@ vardata:
.4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */
.byte 0 /* End of children of die */
+ /* DW_AT_upper_bound is referencing an optimized-out variable. */
+.Larrayb_type:
+ .uleb128 2 /* Abbrev: DW_TAG_array_type */
+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */
+
+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */
+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
+ .byte 0 /* DW_AT_lower_bound */
+ .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */
+ .byte 0 /* End of children of die */
+
.Luint_type:
.uleb128 4 /* Abbrev: DW_TAG_base_type */
.4byte .Luint_str /* DW_AT_name */
@@ -69,9 +80,24 @@ vardata:
.4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
.4byte .Llen_loclist-.Lloclist /* DW_AT_location */
+ /* optimized-out variable for b_string. */
+.Llenb_var:
+ .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */
+ .byte 1 /* DW_AT_artificial */
+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */
+
.uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
.string "a_string" /* DW_AT_name */
- .4byte .Larray_type-.Lcu1_begin/* DW_AT_type */
+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */
+ .byte 2f - 1f /* DW_AT_location */
+1: .byte 3 /* DW_OP_addr */
+ .4byte vardata /* <addr> */
+2:
+
+ /* DW_AT_upper_bound is referencing an optimized-out variable. */
+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
+ .string "b_string" /* DW_AT_name */
+ .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */
.byte 2f - 1f /* DW_AT_location */
1: .byte 3 /* DW_OP_addr */
.4byte vardata /* <addr> */
@@ -164,6 +190,16 @@ vardata:
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
+ .uleb128 7 /* Abbrev code */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0x0 /* no_children */
+ .uleb128 0x34 /* DW_AT_artificial */
+ .uleb128 0x0c /* DW_FORM_flag */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
.byte 0x0 /* Terminator */
/* String table */
--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
@@ -46,3 +46,6 @@ if ![runto "*main"] {
gdb_test "p a_string" { = "seen"}
gdb_test "ptype a_string" {type = char \[4\]}
+
+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
+gdb_test "ptype b_string" {type = char \[\]}

View File

@ -1,21 +0,0 @@
commit ec5a7769d5c05542d12fc21afa25f32360db7de4
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Wed May 12 22:00:46 2010 +0200
Fix mb_reserve:
https://bugzilla.redhat.com/show_bug.cgi?id=590635
diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp
index 7203a48..24a608f 100644
--- a/gdb/testsuite/gdb.base/vla-overflow.exp
+++ b/gdb/testsuite/gdb.base/vla-overflow.exp
@@ -66,7 +66,8 @@ proc memory_v_pages_get {} {
set pages_found [memory_v_pages_get]
-set mb_reserve 10
+# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
+set mb_reserve 40
verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
set kb_found [expr $pages_found * $pagesize / 1024]
set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,20 @@
--- a/gdb/config/i386/linux64.mh
+++ b/gdb/config/i386/linux64.mh
Index: gdb-7.1.90.20100711/gdb/config/i386/linux64.mh
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/config/i386/linux64.mh 2010-05-28 20:50:31.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/config/i386/linux64.mh 2010-07-13 19:02:54.000000000 +0200
@@ -2,7 +2,7 @@
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o linux-fork.o
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux64.h
NAT_CDEPS = $(srcdir)/proc-service.list
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
--- a/gdb/config/i386/nm-linux.h
+++ b/gdb/config/i386/nm-linux.h
@@ -29,4 +29,7 @@
#define FILL_FPXREGSET
#endif
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
#endif /* nm-linux.h */
--- /dev/null
+++ b/gdb/config/i386/nm-linux64.h
Index: gdb-7.1.90.20100711/gdb/config/i386/nm-linux64.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1.90.20100711/gdb/config/i386/nm-linux64.h 2010-07-13 19:02:28.000000000 +0200
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux amd64.
+
@ -50,9 +44,11 @@
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1257,8 +1257,10 @@ extern char *normal_pid_to_str (ptid_t ptid);
Index: gdb-7.1.90.20100711/gdb/target.h
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/target.h 2010-07-12 23:07:34.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/target.h 2010-07-13 19:02:28.000000000 +0200
@@ -1298,8 +1298,10 @@ extern char *normal_pid_to_str (ptid_t p
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
@ -63,8 +59,10 @@
#define target_region_ok_for_hw_watchpoint(addr, len) \
(*current_target.to_region_ok_for_hw_watchpoint) (addr, len)
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2010-07-13 19:02:28.000000000 +0200
@@ -0,0 +1,40 @@
+# Copyright 2009, 2010 Free Software Foundation, Inc.
+

View File

@ -1,427 +0,0 @@
commit e5ea8d026015c2a0c7774788b425914857de1ffb
Author: pmuldoon <pmuldoon>
Date: Wed Apr 14 12:02:42 2010 +0000
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
PR python/11381
* python/py-prettyprint.c (pretty_print_one_value): Test for
Py_None.
(print_string_repr): Test for Py_None. Set flags accordingly.
Return value depending on return type.
(print_children): Take a value indicating whether data was printed
before this function was called. Alter output accordingly.
(apply_val_pretty_printer): Capture return value from
print_string_repr and pass to print_children.
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-prettyprint.py (NoStringContainerPrinter): New printer.
* gdb.python/py-prettyprint.c: Add justchildren struct, typedefs.
* gdb.python/py-prettyprint.exp: New test for to_string returning None.
* gdb.python/py-mi.exp: New test for to_string returning None.
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Pretty Printing): Document behaviour when to_string
returns None.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,16 @@
+2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
+
+ PR python/11381
+
+ * python/py-prettyprint.c (pretty_print_one_value): Test for
+ Py_None.
+ (print_string_repr): Test for Py_None. Set flags accordingly.
+ Return value depending on return type.
+ (print_children): Take a value indicating whether data was printed
+ before this function was called. Alter output accordingly.
+ (apply_val_pretty_printer): Capture return value from
+ print_string_repr and pass to print_children.
+
2010-04-13 Mark Kettenis <kettenis@gnu.org>
PR corefiles/11481
### a/gdb/doc/ChangeLog
### b/gdb/doc/ChangeLog
## -1,3 +1,8 @@
+2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
+
+ * gdb.texinfo (Pretty Printing): Document behaviour when to_string
+ returns None.
+
2010-04-09 Stan Shebs <stan@codesourcery.com>
* gdb.texinfo (gdb/mi Tracepoint Commands) <-trace-status>:
Index: gdb-7.1/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.1.orig/gdb/doc/gdb.texinfo 2010-06-30 03:22:07.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-06-30 03:22:20.000000000 +0200
@@ -20344,6 +20344,9 @@ the resulting value. Again, this may re
pretty-printer. Python scalars (integers, floats, and booleans) and
strings are convertible to @code{gdb.Value}; other types are not.
+Finally, if this method returns @code{None} then no further operations
+are peformed in this method and nothing is printed.
+
If the result is not one of these types, an exception is raised.
@end defop
Index: gdb-7.1/gdb/python/py-prettyprint.c
===================================================================
--- gdb-7.1.orig/gdb/python/py-prettyprint.c 2010-06-30 03:22:02.000000000 +0200
+++ gdb-7.1/gdb/python/py-prettyprint.c 2010-06-30 03:23:38.000000000 +0200
@@ -125,9 +125,12 @@ find_pretty_printer (PyObject *value)
/* Pretty-print a single value, via the printer object PRINTER.
If the function returns a string, a PyObject containing the string
- is returned. Otherwise, if the function returns a value,
- *OUT_VALUE is set to the value, and NULL is returned. On error,
- *OUT_VALUE is set to NULL, and NULL is returned. */
+ is returned. If the function returns Py_NONE that means the pretty
+ printer returned the Python None as a value. Otherwise, if the
+ function returns a value, *OUT_VALUE is set to the value, and NULL
+ is returned. On error, *OUT_VALUE is set to NULL, and NULL is
+ returned. */
+
static PyObject *
pretty_print_one_value (PyObject *printer, struct value **out_value)
{
@@ -140,7 +143,8 @@ pretty_print_one_value (PyObject *printe
result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
if (result)
{
- if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result))
+ if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result)
+ && result != Py_None)
{
*out_value = convert_value_from_python (result);
if (PyErr_Occurred ())
@@ -184,8 +188,11 @@ gdbpy_get_display_hint (PyObject *printe
}
/* Helper for apply_val_pretty_printer which calls to_string and
- formats the result. */
-static void
+ formats the result. If the value returnd is Py_None, nothing is
+ printed and the function returns a 1; in all other cases data is
+ printed as given by the pretty printer and the function returns 0.
+*/
+static int
print_string_repr (PyObject *printer, const char *hint,
struct ui_file *stream, int recurse,
const struct value_print_options *options,
@@ -194,52 +201,58 @@ print_string_repr (PyObject *printer, co
{
struct value *replacement = NULL;
PyObject *py_str = NULL;
+ int is_py_none = 0;
py_str = pretty_print_one_value (printer, &replacement);
if (py_str)
{
- gdb_byte *output = NULL;
- long length;
- struct type *type;
- char *encoding = NULL;
- PyObject *string = NULL;
- int is_lazy;
-
- is_lazy = gdbpy_is_lazy_string (py_str);
- if (is_lazy)
- output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
+ if (py_str == Py_None)
+ is_py_none = 1;
else
{
- string = python_string_to_target_python_string (py_str);
- if (string)
+ gdb_byte *output = NULL;
+ long length;
+ struct type *type;
+ char *encoding = NULL;
+ PyObject *string = NULL;
+ int is_lazy;
+
+ is_lazy = gdbpy_is_lazy_string (py_str);
+ if (is_lazy)
+ output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
+ else
{
- output = PyString_AsString (string);
- length = PyString_Size (string);
- type = builtin_type (gdbarch)->builtin_char;
+ string = python_string_to_target_python_string (py_str);
+ if (string)
+ {
+ output = PyString_AsString (string);
+ length = PyString_Size (string);
+ type = builtin_type (gdbarch)->builtin_char;
+ }
+ else
+ gdbpy_print_stack ();
+
+ }
+
+ if (output)
+ {
+ if (is_lazy || (hint && !strcmp (hint, "string")))
+ LA_PRINT_STRING (stream, type, output, length, encoding,
+ 0, options);
+ else
+ fputs_filtered (output, stream);
}
else
gdbpy_print_stack ();
- }
-
- if (output)
- {
- if (is_lazy || (hint && !strcmp (hint, "string")))
- LA_PRINT_STRING (stream, type, output, length, encoding,
- 0, options);
+ if (string)
+ Py_DECREF (string);
else
- fputs_filtered (output, stream);
- }
- else
- gdbpy_print_stack ();
-
- if (string)
- Py_DECREF (string);
- else
- xfree (output);
+ xfree (output);
- xfree (encoding);
- Py_DECREF (py_str);
+ xfree (encoding);
+ Py_DECREF (py_str);
+ }
}
else if (replacement)
{
@@ -250,6 +263,8 @@ print_string_repr (PyObject *printer, co
}
else
gdbpy_print_stack ();
+
+ return is_py_none;
}
static void
@@ -328,12 +343,14 @@ push_dummy_python_frame ()
}
/* Helper for apply_val_pretty_printer that formats children of the
- printer, if any exist. */
+ printer, if any exist. If is_py_none is true, then nothing has
+ been printed by to_string, and format output accordingly. */
static void
print_children (PyObject *printer, const char *hint,
struct ui_file *stream, int recurse,
const struct value_print_options *options,
- const struct language_defn *language)
+ const struct language_defn *language,
+ int is_py_none)
{
int is_map, is_array, done_flag, pretty;
unsigned int i;
@@ -413,7 +430,13 @@ print_children (PyObject *printer, const
2. Arrays. Always print a ",".
3. Other. Always print a ",". */
if (i == 0)
- fputs_filtered (" = {", stream);
+ {
+ if (is_py_none)
+ fputs_filtered ("{", stream);
+ else
+ fputs_filtered (" = {", stream);
+ }
+
else if (! is_map || i % 2 == 0)
fputs_filtered (pretty ? "," : ", ", stream);
@@ -537,7 +560,7 @@ apply_val_pretty_printer (struct type *t
char *hint = NULL;
struct cleanup *cleanups;
int result = 0;
-
+ int is_py_none = 0;
cleanups = ensure_python_env (gdbarch, language);
/* Instantiate the printer. */
@@ -562,9 +585,11 @@ apply_val_pretty_printer (struct type *t
make_cleanup (free_current_contents, &hint);
/* Print the section */
- print_string_repr (printer, hint, stream, recurse, options, language,
- gdbarch);
- print_children (printer, hint, stream, recurse, options, language);
+ is_py_none = print_string_repr (printer, hint, stream, recurse,
+ options, language, gdbarch);
+ print_children (printer, hint, stream, recurse, options, language,
+ is_py_none);
+
result = 1;
Index: gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-mi.exp 2010-01-14 09:03:37.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp 2010-06-30 03:22:20.000000000 +0200
@@ -61,6 +61,16 @@ mi_list_varobj_children container {
mi_delete_varobj container "delete varobj"
+mi_create_dynamic_varobj nscont nstype \
+ "create nscont varobj, no pretty-printing"
+
+mi_list_varobj_children nscont {
+ { nscont.len len 0 int }
+ { nscont.elements elements 1 "int ." }
+} "examine nscont children=0, no pretty-printing"
+
+mi_delete_varobj nscont "delete varobj"
+
mi_gdb_test "-enable-pretty-printing" ""
mi_create_varobj_checked string string_1 \
@@ -239,4 +249,29 @@ mi_continue_to_line \
mi_varobj_update_with_type_change container int 0 "update after type change"
+
+mi_continue_to_line \
+ [gdb_get_line_number {break to inspect struct and union} ${testfile}.c] \
+ "step to outer breakpoint"
+
+mi_create_dynamic_varobj nscont nstype \
+ "create nstype varobj"
+
+mi_list_varobj_children nscont {
+ { {nscont.\[0\]} {\[0\]} 0 int }
+ { {nscont.\[1\]} {\[1\]} 0 int }
+} "list children after setting update range"
+
+mi_gdb_test "-var-set-visualizer nscont None" \
+ "\\^done" \
+ "clear visualizer"
+
+mi_gdb_test "-var-update nscont" \
+ "\\^done,changelist=\\\[\\\]" \
+ "varobj update after clearing"
+
+mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \
+ "\\^done" \
+ "choose default visualizer"
+
remote_file host delete ${remote_python_file}
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.c 2010-01-14 09:03:37.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c 2010-06-30 03:22:20.000000000 +0200
@@ -119,6 +119,15 @@ typedef struct string_repr
/* This lets us avoid malloc. */
int array[100];
+int narray[10];
+
+struct justchildren
+{
+ int len;
+ int *elements;
+};
+
+typedef struct justchildren nostring_type;
struct container
{
@@ -196,7 +205,9 @@ main ()
const struct string_repr cstring = { { "const string" } };
/* Clearing by being `static' could invoke an other GDB C++ bug. */
struct nullstr nullstr;
-
+ nostring_type nstype;
+ nstype.elements = narray;
+ nstype.len = 0;
init_ss(&ss, 1, 2);
init_ss(ssa+0, 3, 4);
@@ -249,5 +260,9 @@ main ()
do_nothing ();
#endif
+ nstype.elements[0] = 7;
+ nstype.elements[1] = 42;
+ nstype.len = 2;
+
return 0; /* break to inspect struct and union */
}
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.exp 2010-06-30 03:22:02.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp 2010-06-30 03:24:14.000000000 +0200
@@ -115,6 +115,7 @@ proc run_lang_tests {lang} {
gdb_test "print nullstr" "RuntimeError: Error reading string from inferior.*"
+ gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
gdb_test "continue" "Program exited normally\."
remote_file host delete ${remote_python_file}
Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.py 2010-01-14 09:03:37.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py 2010-06-30 03:22:20.000000000 +0200
@@ -53,6 +53,33 @@ class ContainerPrinter:
def children(self):
return self._iterator(self.val['elements'], self.val['len'])
+# Test a printer where to_string is None
+class NoStringContainerPrinter:
+ class _iterator:
+ def __init__ (self, pointer, len):
+ self.start = pointer
+ self.pointer = pointer
+ self.end = pointer + len
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ if self.pointer == self.end:
+ raise StopIteration
+ result = self.pointer
+ self.pointer = self.pointer + 1
+ return ('[%d]' % int (result - self.start), result.dereference())
+
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return None
+
+ def children(self):
+ return self._iterator(self.val['elements'], self.val['len'])
+
class pp_s:
def __init__(self, val):
self.val = val
@@ -190,8 +217,10 @@ def register_pretty_printers ():
# both the C and C++ cases.
pretty_printers_dict[re.compile ('^struct string_repr$')] = string_print
pretty_printers_dict[re.compile ('^struct container$')] = ContainerPrinter
+ pretty_printers_dict[re.compile ('^struct justchildren$')] = NoStringContainerPrinter
pretty_printers_dict[re.compile ('^string_repr$')] = string_print
pretty_printers_dict[re.compile ('^container$')] = ContainerPrinter
+ pretty_printers_dict[re.compile ('^justchildren$')] = NoStringContainerPrinter
pretty_printers_dict[re.compile ('^struct ns$')] = pp_ns
pretty_printers_dict[re.compile ('^ns$')] = pp_ns

View File

@ -1,159 +0,0 @@
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

@ -1,40 +0,0 @@
RFA: update `print' docs
http://sourceware.org/ml/gdb-patches/2010-03/msg00236.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00048.html
### src/gdb/doc/ChangeLog 2010/03/01 17:19:22 1.1017
### src/gdb/doc/ChangeLog 2010/03/05 20:01:21 1.1018
## -1,3 +1,8 @@
+2010-03-05 Tom Tromey <tromey@redhat.com>
+
+ * gdb.texinfo (Data): Link to pretty-printing.
+ (Output Formats): Likewise. Correct text.
+
2010-03-01 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.texinfo (Types): Describe <struct> and <flags>.
--- src/gdb/doc/gdb.texinfo 2010/03/01 17:19:22 1.676
+++ src/gdb/doc/gdb.texinfo 2010/03/05 20:01:21 1.677
@@ -6661,7 +6661,8 @@
command (abbreviated @code{p}), or its synonym @code{inspect}. It
evaluates and prints the value of an expression of the language your
program is written in (@pxref{Languages, ,Using @value{GDBN} with
-Different Languages}).
+Different Languages}). It may also print the expression using a
+Python-based pretty-printer (@pxref{Pretty Printing}).
@table @code
@item print @var{expr}
@@ -7159,8 +7160,10 @@
@item r
@cindex raw printing
Print using the @samp{raw} formatting. By default, @value{GDBN} will
-use a type-specific pretty-printer. The @samp{r} format bypasses any
-pretty-printer which might exist for the value's type.
+use a Python-based pretty-printer, if one is available (@pxref{Pretty
+Printing}). This typically results in a higher-level display of the
+value's contents. The @samp{r} format bypasses any Python
+pretty-printer which might exist.
@end table
For example, to print the program counter in hex (@pxref{Registers}), type

View File

@ -1,182 +0,0 @@
Re: [patch] doc-python: Pretty Printing split user / developer
http://sourceware.org/ml/gdb-patches/2010-04/msg00757.html
http://sourceware.org/ml/gdb-cvs/2010-04/msg00221.html
[ Backported for Fedora. ]
### src/gdb/doc/ChangeLog 2010/04/22 04:09:25 1.1053
### src/gdb/doc/ChangeLog 2010/04/22 16:32:43 1.1054
## -1,3 +1,14 @@
+2010-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.texinfo (Data): New @menu reference to Pretty Printing.
+ (Python API): Change the reference to Pretty Printing API.
+ (Pretty Printing): Move the user part under the Data node. Reformat
+ the sample output to 72 columns. Create a new reference to Pretty
+ Printing API. Rename the API part ...
+ (Pretty Printing API): To a new node name.
+ (Selecting Pretty-Printers, Progspaces In Python, Objfiles In Python)
+ (GDB/MI Variable Objects): Change references to Pretty Printing API.
+
2010-04-21 Stan Shebs <stan@codesourcery.com>
* gdb.texinfo (Tracepoint Actions): Mention synonymy of actions
--- gdb-7.1/gdb/doc/gdb.texinfo.orig 2010-04-22 19:08:30.000000000 +0200
+++ gdb-7.1/gdb/doc/gdb.texinfo 2010-04-22 19:10:41.000000000 +0200
@@ -6727,6 +6727,7 @@ Table}.
* Memory:: Examining memory
* Auto Display:: Automatic display
* Print Settings:: Print settings
+* Pretty Printing:: Python pretty printing
* Value History:: Value history
* Convenience Vars:: Convenience variables
* Registers:: Registers
@@ -7897,6 +7898,42 @@ Do not pretty print C@t{++} virtual func
Show whether C@t{++} virtual function tables are pretty printed, or not.
@end table
+@node Pretty Printing
+@section Pretty Printing
+
+@value{GDBN} provides a mechanism to allow pretty-printing of values using
+Python code. It greatly simplifies the display of complex objects. This
+mechanism works for both MI and the CLI.
+
+For example, here is how a C@t{++} @code{std::string} looks without a
+pretty-printer:
+
+@smallexample
+(@value{GDBP}) print s
+$1 = @{
+ static npos = 4294967295,
+ _M_dataplus = @{
+ <std::allocator<char>> = @{
+ <__gnu_cxx::new_allocator<char>> = @{
+ <No data fields>@}, <No data fields>
+ @},
+ members of std::basic_string<char, std::char_traits<char>,
+ std::allocator<char> >::_Alloc_hider:
+ _M_p = 0x804a014 "abcd"
+ @}
+@}
+@end smallexample
+
+With a pretty-printer for @code{std::string} only the contents are printed:
+
+@smallexample
+(@value{GDBP}) print s
+$2 = "abcd"
+@end smallexample
+
+For implementing pretty printers for new types you should read the Python API
+details (@pxref{Pretty Printing API}).
+
@node Value History
@section Value History
@@ -19608,8 +19645,8 @@ situation, a Python @code{KeyboardInterr
* Exception Handling::
* Auto-loading:: Automatically loading Python code.
* Values From Inferior:: Python representation of values.
-* Types In Python:: Python representation of types.
-* Pretty Printing:: Pretty-printing values.
+* Types In Python:: Python representation of types.
+* Pretty Printing API:: Pretty-printing values.
* Selecting Pretty-Printers:: How GDB chooses a pretty-printer.
* Inferiors In Python:: Python representation of inferiors (processes)
* Threads In Python:: Accessing inferior threads from Python.
@@ -20241,37 +20278,10 @@ A function internal to @value{GDBN}. Th
convenience functions.
@end table
-@node Pretty Printing
-@subsubsection Pretty Printing
-
-@value{GDBN} provides a mechanism to allow pretty-printing of values
-using Python code. The pretty-printer API allows application-specific
-code to greatly simplify the display of complex objects. This
-mechanism works for both MI and the CLI.
-
-For example, here is how a C@t{++} @code{std::string} looks without a
-pretty-printer:
+@node Pretty Printing API
+@subsubsection Pretty Printing API
-@smallexample
-(@value{GDBP}) print s
-$1 = @{
- static npos = 4294967295,
- _M_dataplus = @{
- <std::allocator<char>> = @{
- <__gnu_cxx::new_allocator<char>> = @{<No data fields>@}, <No data fields>@},
- members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
- _M_p = 0x804a014 "abcd"
- @}
-@}
-@end smallexample
-
-After a pretty-printer for @code{std::string} has been installed, only
-the contents are printed:
-
-@smallexample
-(@value{GDBP}) print s
-$2 = "abcd"
-@end smallexample
+An example output is provided (@pxref{Pretty Printing}).
A pretty-printer is just an object that holds a value and implements a
specific interface, defined here.
@@ -20359,7 +20369,7 @@ attribute.
A function on one of these lists is passed a single @code{gdb.Value}
argument and should return a pretty-printer object conforming to the
-interface definition above (@pxref{Pretty Printing}). If a function
+interface definition above (@pxref{Pretty Printing API}). If a function
cannot create a pretty-printer for the value, it should return
@code{None}.
@@ -20436,7 +20446,7 @@ printers with a specific objfile, @value
printers for the specific version of the library used by each
inferior.
-To continue the @code{std::string} example (@pxref{Pretty Printing}),
+To continue the @code{std::string} example (@pxref{Pretty Printing API}),
this code might appear in @code{gdb.libstdcxx.v6}:
@smallexample
@@ -21048,7 +21058,7 @@ The @code{pretty_printers} attribute is
used to look up pretty-printers. A @code{Value} is passed to each
function in order; if the function returns @code{None}, then the
search continues. Otherwise, the return value should be an object
-which is used to format the value. @xref{Pretty Printing}, for more
+which is used to format the value. @xref{Pretty Printing API}, for more
information.
@end defivar
@@ -24875,7 +24885,7 @@ then this attribute will not be present.
@item displayhint
A dynamic varobj can supply a display hint to the front end. The
value comes directly from the Python pretty-printer object's
-@code{display_hint} method. @xref{Pretty Printing}.
+@code{display_hint} method. @xref{Pretty Printing API}.
@end table
Typical output will look like this:
@@ -25047,7 +25057,7 @@ The result may have its own attributes:
@item displayhint
A dynamic varobj can supply a display hint to the front end. The
value comes directly from the Python pretty-printer object's
-@code{display_hint} method. @xref{Pretty Printing}.
+@code{display_hint} method. @xref{Pretty Printing API}.
@item has_more
This is an integer attribute which is nonzero if there are children
@@ -25411,7 +25421,7 @@ single argument. @value{GDBN} will call
the varobj @var{name} as an argument (this is done so that the same
Python pretty-printing code can be used for both the CLI and MI).
When called, this object must return an object which conforms to the
-pretty-printing interface (@pxref{Pretty Printing}).
+pretty-printing interface (@pxref{Pretty Printing API}).
The pre-defined function @code{gdb.default_visualizer} may be used to
select a visualizer by following the built-in process

View File

@ -1,73 +0,0 @@
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

View File

@ -9,9 +9,11 @@ Neither its obstack-leak.patch nor
http://sourceware.org/ml/gdb-patches/2010-05/msg00271.html
is needed as the linked list is used instead.
--- ./gdb/dwarf2read.c 2010-05-13 18:26:22.000000000 +0200
+++ ./gdb/dwarf2read.c 2010-05-13 18:45:04.000000000 +0200
@@ -251,6 +251,28 @@ struct comp_unit_head
Index: gdb-7.1.90.20100711/gdb/dwarf2read.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-13 00:34:00.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 22:25:18.000000000 +0200
@@ -216,6 +216,28 @@ struct comp_unit_head
unsigned int first_die_offset;
};
@ -40,7 +42,7 @@ is needed as the linked list is used instead.
/* Internal state when decoding a particular compilation unit. */
struct dwarf2_cu
{
@@ -329,6 +351,10 @@ struct dwarf2_cu
@@ -294,6 +316,10 @@ struct dwarf2_cu
/* Header data from the line table, during full symbol processing. */
struct line_header *line_header;
@ -51,7 +53,7 @@ is needed as the linked list is used instead.
/* Mark used when releasing cached dies. */
unsigned int mark : 1;
@@ -1208,6 +1234,9 @@ static void destroy_section (struct dwar
@@ -1142,6 +1168,9 @@ static struct type *get_die_type (struct
static struct dwarf2_locexpr_baton *dwarf2_attr_to_locexpr_baton
(struct attribute *attr, struct dwarf2_cu *cu);
@ -61,7 +63,7 @@ is needed as the linked list is used instead.
/* Try to locate the sections we need for DWARF 2 debugging
information and return true if we have enough to do something. */
@@ -3435,6 +3464,58 @@ load_full_comp_unit (struct dwarf2_per_c
@@ -3137,6 +3166,58 @@ load_full_comp_unit (struct dwarf2_per_c
discard_cleanups (free_cu_cleanup);
}
@ -120,8 +122,8 @@ is needed as the linked list is used instead.
/* Generate full symbol information for PST and CU, whose DIEs have
already been loaded into memory. */
@@ -3447,7 +3528,7 @@ process_full_comp_unit (struct dwarf2_pe
bfd *abfd = objfile->obfd;
@@ -3148,7 +3229,7 @@ process_full_comp_unit (struct dwarf2_pe
struct objfile *objfile = pst->objfile;
CORE_ADDR lowpc, highpc;
struct symtab *symtab;
- struct cleanup *back_to;
@ -129,7 +131,7 @@ is needed as the linked list is used instead.
CORE_ADDR baseaddr;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -3457,11 +3538,22 @@ process_full_comp_unit (struct dwarf2_pe
@@ -3158,11 +3239,22 @@ process_full_comp_unit (struct dwarf2_pe
cu->list_in_scope = &file_symbols;
@ -152,7 +154,7 @@ is needed as the linked list is used instead.
/* Some compilers don't define a DW_AT_high_pc attribute for the
compilation unit. If the DW_AT_high_pc is missing, synthesize
it, by scanning the DIE's below the compilation unit. */
@@ -5093,7 +5185,6 @@ dwarf2_add_member_fn (struct field_info
@@ -4854,7 +4946,6 @@ dwarf2_add_member_fn (struct field_info
int i;
struct fn_field *fnp;
char *fieldname;
@ -160,7 +162,7 @@ is needed as the linked list is used instead.
struct nextfnfield *new_fnfield;
struct type *this_type;
@@ -5105,9 +5196,6 @@ dwarf2_add_member_fn (struct field_info
@@ -4866,9 +4957,6 @@ dwarf2_add_member_fn (struct field_info
if (fieldname == NULL)
return;
@ -170,7 +172,7 @@ is needed as the linked list is used instead.
/* Look up member function name in fieldlist. */
for (i = 0; i < fip->nfnfields; i++)
{
@@ -5133,7 +5221,7 @@ dwarf2_add_member_fn (struct field_info
@@ -4894,7 +4982,7 @@ dwarf2_add_member_fn (struct field_info
flp->name = fieldname;
flp->length = 0;
flp->head = NULL;
@ -179,7 +181,7 @@ is needed as the linked list is used instead.
}
/* Create a new member function field and chain it to the field list
@@ -5147,9 +5235,19 @@ dwarf2_add_member_fn (struct field_info
@@ -4908,9 +4996,19 @@ dwarf2_add_member_fn (struct field_info
/* Fill in the member function field info. */
fnp = &new_fnfield->fnfield;
@ -202,7 +204,7 @@ is needed as the linked list is used instead.
fnp->type = alloc_type (objfile);
this_type = read_type_die (die, cu);
if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC)
@@ -5175,7 +5273,7 @@ dwarf2_add_member_fn (struct field_info
@@ -4936,7 +5034,7 @@ dwarf2_add_member_fn (struct field_info
}
else
complaint (&symfile_complaints, _("member function type missing for '%s'"),
@ -211,7 +213,7 @@ is needed as the linked list is used instead.
/* Get fcontext from DW_AT_containing_type if present. */
if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
@@ -7500,7 +7598,9 @@ load_partial_dies (bfd *abfd, gdb_byte *
@@ -7315,7 +7413,9 @@ load_partial_dies (bfd *abfd, gdb_byte *
|| last_die->tag == DW_TAG_interface_type
|| last_die->tag == DW_TAG_structure_type
|| last_die->tag == DW_TAG_union_type))
@ -222,8 +224,10 @@ is needed as the linked list is used instead.
&& (last_die->tag == DW_TAG_subprogram
|| last_die->tag == DW_TAG_lexical_block))))
{
--- ./gdb/testsuite/gdb.dwarf2/pr11465.S 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.dwarf2/pr11465.S 2010-05-13 18:39:00.000000000 +0200
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.dwarf2/pr11465.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.dwarf2/pr11465.S 2010-07-13 22:24:48.000000000 +0200
@@ -0,0 +1,355 @@
+/* Copyright 2010 Free Software Foundation, Inc.
+
@ -580,8 +584,10 @@ is needed as the linked list is used instead.
+.LASF4:
+ .string "GNU C++ 4.4.2"
+ .ident "GCC: (GNU) 4.4.2"
--- ./gdb/testsuite/gdb.dwarf2/pr11465.exp 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.dwarf2/pr11465.exp 2010-05-13 18:39:00.000000000 +0200
Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.dwarf2/pr11465.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.dwarf2/pr11465.exp 2010-07-13 22:24:48.000000000 +0200
@@ -0,0 +1,39 @@
+# Copyright 2010 Free Software Foundation, Inc.
+

View File

@ -1,187 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-03/msg01039.html
Subject: [patch] Fix crash on NULL function's TYPE_FIELD_TYPE
Hi,
seen one possibility of a crash.
#0 c_print_type (type=0x0, ...)
#1 in c_type_print_args (type=0xfceb890,
(The real reason of a reported GDB crash was different, though.)
Thanks,
Jan
gdb/
2010-03-30 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix crash on reading wrong function declaration DWARF.
* dwarf2read.c (read_subroutine_type): New variable void_type.
Pre-fill all TYPE_FIELD_TYPEs. Move nparams and iparams initialization
more close to their use.
gdb/testsuite/
2010-03-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-bad-parameter-type.exp,
gdb.dwarf2/dw2-bad-parameter-type.S: New.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5938,13 +5938,14 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
if (die->child != NULL)
{
+ struct type *void_type = objfile_type (cu->objfile)->builtin_void;
struct die_info *child_die;
- int nparams = 0;
- int iparams = 0;
+ int nparams, iparams;
/* Count the number of parameters.
FIXME: GDB currently ignores vararg functions, but knows about
vararg member functions. */
+ nparams = 0;
child_die = die->child;
while (child_die && child_die->tag)
{
@@ -5960,6 +5961,12 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
TYPE_FIELDS (ftype) = (struct field *)
TYPE_ZALLOC (ftype, nparams * sizeof (struct field));
+ /* TYPE_FIELD_TYPE must never be NULL. Pre-fill the array to ensure it
+ even if we error out during the parameters reading below. */
+ for (iparams = 0; iparams < nparams; iparams++)
+ TYPE_FIELD_TYPE (ftype, iparams) = void_type;
+
+ iparams = 0;
child_die = die->child;
while (child_die && child_die->tag)
{
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S
@@ -0,0 +1,73 @@
+/* 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 .debug_info
+debug_start:
+ .long debug_end - 1f /* Length of Compilation Unit Info */
+1:
+ .2byte 0x3 /* DWARF version number */
+ .long .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 0x4 /* Pointer Size (in bytes) */
+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */
+ .ascii "GNU C 4.4.3\0" /* DW_AT_producer */
+ .byte 0x1 /* DW_AT_language */
+ .ascii "1.c\0" /* DW_AT_name */
+ .uleb128 0x4 /* (DIE (0x3c) DW_TAG_subprogram) */
+ .ascii "f\0" /* DW_AT_name */
+/* Value 0 would require has_section_at_zero != 0 (which is true, though). */
+ .long 1 /* DW_AT_low_pc */
+ .long 2 /* DW_AT_high_pc */
+ .byte 0x1 /* DW_AT_prototyped */
+ .uleb128 0x5 /* (DIE (0x42) DW_TAG_formal_parameter) */
+/* Invalid value. */
+ .long 0x0 /* DW_AT_type */
+ .byte 0x0 /* end of children of DIE 0x3c */
+ .byte 0x0 /* end of children of DIE 0xb */
+debug_end:
+
+ .section .debug_abbrev
+.Ldebug_abbrev0:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x4 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x27 /* (DW_AT_prototyped) */
+ .uleb128 0xc /* (DW_FORM_flag) */
+ .byte 0x0
+ .byte 0x0
+ .uleb128 0x5 /* (abbrev code) */
+ .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
+ .byte 0x0 /* DW_children_no */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0x0
+ .byte 0x0
+ .byte 0x0
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
@@ -0,0 +1,44 @@
+# 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 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-bad-parameter-type"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+set binfile ${objdir}/${subdir}/${executable}
+
+# First try referencing DW_AT_frame_base which is not defined.
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
+ return -1
+}
+
+clean_restart $executable
+
+# The first access (as we do not use -readnow) prints some:
+# Dwarf Error: Cannot find DIE at 0x0 referenced from DIE at 0x29 [in module ...]
+gdb_test "ptype f"
+
+gdb_test "ptype f"
+gdb_test "p 5" " = 5" "is alive"

File diff suppressed because it is too large Load Diff

View File

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

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

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

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

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

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

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

@ -1,16 +0,0 @@
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

@ -1,59 +0,0 @@
06e357f534abcf8912e4fd597daae8f1387d631c
Fix compatibility with: FYI: fix BINOP_SUBSCRIPT with pieced arrays
http://sourceware.org/ml/gdb-patches/2010-05/msg00281.html
2010-05-30 Jan Kratochvil <jan.kratochvil@redhat.com>
* valarith.c (binop_user_defined_p): Return 0 on ARG1 or ARG2 being
TYPE_DYNAMIC.
* value.c (coerce_ref): Use object_address_get_data resolution for
TYPE_DYNAMIC ARG.
[ Backported. ]
Index: gdb-7.1/gdb/valarith.c
===================================================================
--- gdb-7.1.orig/gdb/valarith.c 2010-05-30 18:54:28.000000000 +0200
+++ gdb-7.1/gdb/valarith.c 2010-05-30 18:54:43.000000000 +0200
@@ -309,6 +309,10 @@ int
binop_user_defined_p (enum exp_opcode op,
struct value *arg1, struct value *arg2)
{
+ /* FIXME: We should support user defined ops for dynamic types. */
+ if (TYPE_DYNAMIC (value_type (arg1)) || TYPE_DYNAMIC (value_type (arg2)))
+ return 0;
+
return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2));
}
Index: gdb-7.1/gdb/value.c
===================================================================
--- gdb-7.1.orig/gdb/value.c 2010-05-30 18:54:36.000000000 +0200
+++ gdb-7.1/gdb/value.c 2010-05-30 18:55:52.000000000 +0200
@@ -2400,7 +2400,24 @@ value_from_decfloat (struct type *type,
struct value *
coerce_ref (struct value *arg)
{
- struct type *value_type_arg_tmp = check_typedef (value_type (arg));
+ struct type *value_type_arg_tmp;
+
+ if (TYPE_DYNAMIC (value_type (arg)))
+ {
+ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
+ CORE_ADDR address;
+
+ value_type_arg_tmp = value_type (arg);
+ address = value_raw_address (arg);
+ if (! object_address_get_data (value_type_arg_tmp, &address))
+ error (_("Attempt to coerce non-valid value."));
+ CHECK_TYPEDEF (value_type_arg_tmp);
+ arg = value_at_lazy (value_type_arg_tmp, address);
+ do_cleanups (cleanups);
+ }
+ else
+ value_type_arg_tmp = check_typedef (value_type (arg));
+
if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
unpack_pointer (value_type (arg),

View File

@ -1,80 +0,0 @@
commit 96c23bfd2863bcca7388653a7bc4c9f8a64a03be
Author: Ulrich Weigand <uweigand@de.ibm.com>
Date: Fri Feb 26 12:48:17 2010 +0000
* dwarf2loc.c (struct piece_closure): Remove ARCH member,
add ADDR_SIZE member.
(allocate_piece_closure): Update.
(copy_pieced_value_closure): Likewise.
(dwarf2_evaluate_loc_desc): Likewise.
(read_pieced_value): Use DWARF address size instead of
GDB's gdbarch_addr_bit as size of values on the DWARF stack.
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 1c4d057..20ede3e 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -232,8 +232,8 @@ struct piece_closure
/* The number of pieces used to describe this variable. */
int n_pieces;
- /* The architecture, used only for DWARF_VALUE_STACK. */
- struct gdbarch *arch;
+ /* The target address size, used only for DWARF_VALUE_STACK. */
+ int addr_size;
/* The pieces themselves. */
struct dwarf_expr_piece *pieces;
@@ -244,12 +244,12 @@ struct piece_closure
static struct piece_closure *
allocate_piece_closure (int n_pieces, struct dwarf_expr_piece *pieces,
- struct gdbarch *arch)
+ int addr_size)
{
struct piece_closure *c = XZALLOC (struct piece_closure);
c->n_pieces = n_pieces;
- c->arch = arch;
+ c->addr_size = addr_size;
c->pieces = XCALLOC (n_pieces, struct dwarf_expr_piece);
memcpy (c->pieces, pieces, n_pieces * sizeof (struct dwarf_expr_piece));
@@ -298,13 +298,12 @@ read_pieced_value (struct value *v)
case DWARF_VALUE_STACK:
{
- size_t n;
- int addr_size = gdbarch_addr_bit (c->arch) / 8;
- n = p->size;
- if (n > addr_size)
- n = addr_size;
+ struct gdbarch *gdbarch = get_type_arch (value_type (v));
+ size_t n = p->size;
+ if (n > c->addr_size)
+ n = c->addr_size;
store_unsigned_integer (contents + offset, n,
- gdbarch_byte_order (c->arch),
+ gdbarch_byte_order (gdbarch),
p->v.expr.value);
}
break;
@@ -377,7 +376,7 @@ copy_pieced_value_closure (struct value *v)
{
struct piece_closure *c = (struct piece_closure *) value_computed_closure (v);
- return allocate_piece_closure (c->n_pieces, c->pieces, c->arch);
+ return allocate_piece_closure (c->n_pieces, c->pieces, c->addr_size);
}
static void
@@ -439,7 +438,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
struct piece_closure *c;
struct frame_id frame_id = get_frame_id (frame);
- c = allocate_piece_closure (ctx->num_pieces, ctx->pieces, ctx->gdbarch);
+ c = allocate_piece_closure (ctx->num_pieces, ctx->pieces,
+ ctx->addr_size);
retval = allocate_computed_value (type, &pieced_value_funcs, c);
VALUE_FRAME_ID (retval) = frame_id;
}

View File

@ -1,68 +0,0 @@
commit 60d15ff6d78921d080aee681e60372abe6627570
Author: mgretton <mgretton>
Date: Tue May 4 09:54:17 2010 +0000
* gdb/dwarf2loc.c (read_pieced_value, write_pieced_value,
dwarf2_evaluate_loc_desc): Handle not being able to access DWARF
registers gracefully.
Index: gdb-7.1/gdb/dwarf2loc.c
===================================================================
--- gdb-7.1.orig/gdb/dwarf2loc.c 2010-05-25 21:35:10.000000000 +0200
+++ gdb-7.1/gdb/dwarf2loc.c 2010-05-25 21:37:32.000000000 +0200
@@ -458,8 +458,16 @@ read_pieced_value (struct value *v)
/* Big-endian, and we want less than full size. */
reg_offset = register_size (arch, gdb_regnum) - p->size;
- get_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
- contents + offset);
+ if (gdb_regnum != -1)
+ {
+ get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ p->size, contents + offset);
+ }
+ else
+ {
+ error (_("Unable to access DWARF register number %s"),
+ paddress (arch, p->v.expr.value));
+ }
}
break;
@@ -531,8 +539,16 @@ write_pieced_value (struct value *to, st
/* Big-endian, and we want less than full size. */
reg_offset = register_size (arch, gdb_regnum) - p->size;
- put_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
- contents + offset);
+ if (gdb_regnum != -1)
+ {
+ put_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ p->size, contents + offset);
+ }
+ else
+ {
+ error (_("Unable to write to DWARF register number %s"),
+ paddress (arch, p->v.expr.value));
+ }
}
break;
case DWARF_VALUE_MEMORY:
@@ -611,7 +627,16 @@ dwarf2_evaluate_loc_desc (struct type *t
struct gdbarch *arch = get_frame_arch (frame);
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
- retval = value_from_register (type, gdb_regnum, frame);
+ if (gdb_regnum != -1)
+ {
+ retval = value_from_register (type,
+ gdb_regnum, frame);
+ }
+ else
+ {
+ error (_("Unable to access DWARF register number %s"),
+ paddress (arch, dwarf_regnum));
+ }
}
break;

View File

@ -1,99 +0,0 @@
commit dacd66a53b559be9c26d2c523f168f1ef0261f4d
Author: Michael Snyder <msnyder@specifix.com>
Date: Fri May 14 17:53:11 2010 +0000
2010-05-14 Michael Snyder <msnyder@vmware.com>
* dbxread.c: White space.
* dcache.c: White space.
* disasm.c: White space.
* doublest.c: White space.
* dsrec.c: White space.
* dummy-frame.c: White space.
* dwarf2expr.c: White space.
* dwarf2-frame.c: White space.
* dwarf2loc.c: White space.
* dwarf2read.c: White space.
--- gdb-7.1/gdb/dwarf2loc.c.orig 2010-05-25 23:06:46.000000000 +0200
+++ gdb-7.1/gdb/dwarf2loc.c 2010-05-25 23:06:46.000000000 +0200
@@ -236,6 +236,7 @@ static CORE_ADDR
dwarf_expr_frame_cfa (void *baton)
{
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
+
return dwarf2_frame_cfa (debaton->frame);
}
@@ -444,6 +445,7 @@ read_pieced_value (struct value *v)
for (i = 0; i < c->n_pieces; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
+
switch (p->location)
{
case DWARF_VALUE_REGISTER:
@@ -482,6 +484,7 @@ read_pieced_value (struct value *v)
{
struct gdbarch *gdbarch = get_type_arch (value_type (v));
size_t n = p->size;
+
if (n > c->addr_size)
n = c->addr_size;
store_unsigned_integer (contents + offset, n,
@@ -493,6 +496,7 @@ read_pieced_value (struct value *v)
case DWARF_VALUE_LITERAL:
{
size_t n = p->size;
+
if (n > p->v.literal.length)
n = p->v.literal.length;
memcpy (contents + offset, p->v.literal.data, n);
@@ -525,6 +529,7 @@ write_pieced_value (struct value *to, st
for (i = 0; i < c->n_pieces; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
+
switch (p->location)
{
case DWARF_VALUE_REGISTER:
@@ -712,6 +717,7 @@ static CORE_ADDR
needs_frame_read_reg (void *baton, int regnum)
{
struct needs_frame_baton *nf_baton = baton;
+
nf_baton->needs_frame = 1;
return 1;
}
@@ -742,6 +748,7 @@ static CORE_ADDR
needs_frame_frame_cfa (void *baton)
{
struct needs_frame_baton *nf_baton = baton;
+
nf_baton->needs_frame = 1;
return 1;
}
@@ -751,6 +758,7 @@ static CORE_ADDR
needs_frame_tls_address (void *baton, CORE_ADDR offset)
{
struct needs_frame_baton *nf_baton = baton;
+
nf_baton->needs_frame = 1;
return 1;
}
@@ -907,6 +915,7 @@ locexpr_read_variable (struct symbol *sy
{
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
struct value *val;
+
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
dlbaton->size, dlbaton->per_cu);
@@ -918,6 +927,7 @@ static int
locexpr_read_needs_frame (struct symbol *symbol)
{
struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+
return dwarf2_loc_desc_needs_frame (dlbaton->data, dlbaton->size,
dlbaton->per_cu);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2010-05/msg00188.html
http://sourceware.org/ml/gdb-cvs/2010-05/msg00189.html
### src/gdb/ChangeLog 2010/05/21 20:45:18 1.11830
### src/gdb/ChangeLog 2010/05/21 20:56:48 1.11831
## -1,3 +1,8 @@
+2010-05-21 Tom Tromey <tromey@redhat.com>
+
+ * eval.c (evaluate_subexp_standard) <BINOP_SUBSCRIPT>: Call
+ evaluate_subexp, not evaluate_subexp_with_coercion.
+
### src/gdb/testsuite/ChangeLog 2010/05/21 20:39:50 1.2273
### src/gdb/testsuite/ChangeLog 2010/05/21 20:56:49 1.2274
## -1,5 +1,10 @@
2010-05-21 Tom Tromey <tromey@redhat.com>
+ * gdb.dwarf2/pieces.exp (pieces_test_f2): New proc.
+ Call it.
+
--- src/gdb/eval.c 2010/05/14 18:35:11 1.134
+++ src/gdb/eval.c 2010/05/21 20:56:49 1.135
@@ -2059,8 +2059,8 @@
error (_("':' operator used in invalid context"));
case BINOP_SUBSCRIPT:
- arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
- arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+ arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
if (binop_user_defined_p (op, arg1, arg2))
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 20:39:50 1.1
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:00:27 1.2
@@ -54,4 +54,18 @@
gdb_test "print a.j" " = 14" "print a.j in pieces:f1"
}
+# Function f2 tests for a bug when indexing into an array created
+# using DW_OP_piece.
+proc pieces_test_f2 {} {
+ global csrcfile
+ set line [gdb_get_line_number "f2 breakpoint" $csrcfile]
+ gdb_test "break pieces.c:$line" "Breakpoint 3.*" \
+ "set f2 breakpoint for pieces"
+ gdb_continue_to_breakpoint "continue to f2 breakpoint for pieces"
+ gdb_test "print a" " = .4, 14." "print a in pieces:f2"
+ gdb_test "print a\[0\]" " = 4" "print a\[0\] in pieces:f2"
+ gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2"
+}
+
pieces_test_f1
+pieces_test_f2

File diff suppressed because it is too large Load Diff

View File

@ -1,820 +0,0 @@
http://sourceware.org/ml/gdb-cvs/2010-05/msg00191.html
### src/gdb/ChangeLog 2010/05/21 21:01:46 1.11832
### src/gdb/ChangeLog 2010/05/21 21:13:10 1.11833
## -1,5 +1,20 @@
2010-05-21 Tom Tromey <tromey@redhat.com>
+ * dwarf2loc.c (extract_bits_primitive): New function.
+ (extract_bits): Likewise.
+ (insert_bits): Likewise.
+ (copy_bitwise): Likewise.
+ (read_pieced_value): Do all operations in bits.
+ (write_pieced_value): Likewise.
+ * dwarf2expr.h (struct dwarf_expr_piece) <offset>: New field.
+ * dwarf2expr.c (add_piece): New arguments bit_piece, offset.
+ Always use xrealloc to resize piece array.
+ (execute_stack_op) <DW_OP_reg0>: Handle DW_OP_bit_piece.
+ <DW_OP_piece>: Update.
+ <DW_OP_bit_piece>: New case.
+
### src/gdb/testsuite/ChangeLog 2010/05/21 21:01:46 1.2275
### src/gdb/testsuite/ChangeLog 2010/05/21 21:13:13 1.2276
## -1,5 +1,12 @@
2010-05-21 Tom Tromey <tromey@redhat.com>
+ * gdb.dwarf2/pieces.exp (pieces_test_f3): New proc.
+ Call it.
+ * gdb.dwarf2/pieces.S: Update.
+ * gdb.dwarf2/pieces.c (struct B): Remove initial field.
+
--- src/gdb/dwarf2expr.c 2010/05/21 21:01:46 1.43
+++ src/gdb/dwarf2expr.c 2010/05/21 21:13:10 1.44
@@ -153,23 +153,21 @@
/* Add a new piece to CTX's piece list. */
static void
-add_piece (struct dwarf_expr_context *ctx, ULONGEST size)
+add_piece (struct dwarf_expr_context *ctx, ULONGEST size, ULONGEST offset)
{
struct dwarf_expr_piece *p;
ctx->num_pieces++;
- if (ctx->pieces)
- ctx->pieces = xrealloc (ctx->pieces,
- (ctx->num_pieces
- * sizeof (struct dwarf_expr_piece)));
- else
- ctx->pieces = xmalloc (ctx->num_pieces
- * sizeof (struct dwarf_expr_piece));
+ ctx->pieces = xrealloc (ctx->pieces,
+ (ctx->num_pieces
+ * sizeof (struct dwarf_expr_piece)));
p = &ctx->pieces[ctx->num_pieces - 1];
p->location = ctx->location;
p->size = size;
+ p->offset = offset;
+
if (p->location == DWARF_VALUE_LITERAL)
{
p->v.literal.data = ctx->data;
@@ -499,9 +497,11 @@
case DW_OP_reg31:
if (op_ptr != op_end
&& *op_ptr != DW_OP_piece
+ && *op_ptr != DW_OP_bit_piece
&& *op_ptr != DW_OP_GNU_uninit)
error (_("DWARF-2 expression error: DW_OP_reg operations must be "
- "used either alone or in conjuction with DW_OP_piece."));
+ "used either alone or in conjuction with DW_OP_piece "
+ "or DW_OP_bit_piece."));
result = op - DW_OP_reg0;
ctx->location = DWARF_VALUE_REGISTER;
@@ -872,7 +872,7 @@
/* Record the piece. */
op_ptr = read_uleb128 (op_ptr, op_end, &size);
- add_piece (ctx, size);
+ add_piece (ctx, 8 * size, 0);
/* Pop off the address/regnum, and reset the location
type. */
@@ -883,6 +883,24 @@
}
goto no_push;
+ case DW_OP_bit_piece:
+ {
+ ULONGEST size, offset;
+
+ /* Record the piece. */
+ op_ptr = read_uleb128 (op_ptr, op_end, &size);
+ op_ptr = read_uleb128 (op_ptr, op_end, &offset);
+ add_piece (ctx, size, offset);
+
+ /* Pop off the address/regnum, and reset the location
+ type. */
+ if (ctx->location != DWARF_VALUE_LITERAL
+ && ctx->location != DWARF_VALUE_OPTIMIZED_OUT)
+ dwarf_expr_pop (ctx);
+ ctx->location = DWARF_VALUE_MEMORY;
+ }
+ goto no_push;
+
case DW_OP_GNU_uninit:
if (op_ptr != op_end)
error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
--- src/gdb/dwarf2expr.h 2010/05/21 21:01:46 1.21
+++ src/gdb/dwarf2expr.h 2010/05/21 21:13:11 1.22
@@ -155,7 +155,7 @@
};
-/* A piece of an object, as recorded by DW_OP_piece. */
+/* A piece of an object, as recorded by DW_OP_piece or DW_OP_bit_piece. */
struct dwarf_expr_piece
{
enum dwarf_value_location location;
@@ -181,8 +181,10 @@
} literal;
} v;
- /* The length of the piece, in bytes. */
+ /* The length of the piece, in bits. */
ULONGEST size;
+ /* The piece offset, in bits. */
+ ULONGEST offset;
};
struct dwarf_expr_context *new_dwarf_expr_context (void);
--- src/gdb/dwarf2loc.c 2010/05/21 21:01:46 1.80
+++ src/gdb/dwarf2loc.c 2010/05/21 21:13:11 1.81
@@ -259,52 +259,245 @@
return c;
}
+/* The lowest-level function to extract bits from a byte buffer.
+ SOURCE is the buffer. It is updated if we read to the end of a
+ byte.
+ SOURCE_OFFSET_BITS is the offset of the first bit to read. It is
+ updated to reflect the number of bits actually read.
+ NBITS is the number of bits we want to read. It is updated to
+ reflect the number of bits actually read. This function may read
+ fewer bits.
+ BITS_BIG_ENDIAN is taken directly from gdbarch.
+ This function returns the extracted bits. */
+
+static unsigned int
+extract_bits_primitive (const gdb_byte **source,
+ unsigned int *source_offset_bits,
+ int *nbits, int bits_big_endian)
+{
+ unsigned int avail, mask, datum;
+
+ gdb_assert (*source_offset_bits < 8);
+
+ avail = 8 - *source_offset_bits;
+ if (avail > *nbits)
+ avail = *nbits;
+
+ mask = (1 << avail) - 1;
+ datum = **source;
+ if (bits_big_endian)
+ datum >>= 8 - (*source_offset_bits + *nbits);
+ else
+ datum >>= *source_offset_bits;
+ datum &= mask;
+
+ *nbits -= avail;
+ *source_offset_bits += avail;
+ if (*source_offset_bits >= 8)
+ {
+ *source_offset_bits -= 8;
+ ++*source;
+ }
+
+ return datum;
+}
+
+/* Extract some bits from a source buffer and move forward in the
+ buffer.
+
+ SOURCE is the source buffer. It is updated as bytes are read.
+ SOURCE_OFFSET_BITS is the offset into SOURCE. It is updated as
+ bits are read.
+ NBITS is the number of bits to read.
+ BITS_BIG_ENDIAN is taken directly from gdbarch.
+
+ This function returns the bits that were read. */
+
+static unsigned int
+extract_bits (const gdb_byte **source, unsigned int *source_offset_bits,
+ int nbits, int bits_big_endian)
+{
+ unsigned int datum;
+
+ gdb_assert (nbits > 0 && nbits <= 8);
+
+ datum = extract_bits_primitive (source, source_offset_bits, &nbits,
+ bits_big_endian);
+ if (nbits > 0)
+ {
+ unsigned int more;
+
+ more = extract_bits_primitive (source, source_offset_bits, &nbits,
+ bits_big_endian);
+ if (bits_big_endian)
+ datum <<= nbits;
+ else
+ more <<= nbits;
+ datum |= more;
+ }
+
+ return datum;
+}
+
+/* Write some bits into a buffer and move forward in the buffer.
+
+ DATUM is the bits to write. The low-order bits of DATUM are used.
+ DEST is the destination buffer. It is updated as bytes are
+ written.
+ DEST_OFFSET_BITS is the bit offset in DEST at which writing is
+ done.
+ NBITS is the number of valid bits in DATUM.
+ BITS_BIG_ENDIAN is taken directly from gdbarch. */
+
+static void
+insert_bits (unsigned int datum,
+ gdb_byte *dest, unsigned int dest_offset_bits,
+ int nbits, int bits_big_endian)
+{
+ unsigned int mask;
+
+ gdb_assert (dest_offset_bits >= 0 && dest_offset_bits + nbits <= 8);
+
+ mask = (1 << nbits) - 1;
+ if (bits_big_endian)
+ {
+ datum <<= 8 - (dest_offset_bits + nbits);
+ mask <<= 8 - (dest_offset_bits + nbits);
+ }
+ else
+ {
+ datum <<= dest_offset_bits;
+ mask <<= dest_offset_bits;
+ }
+
+ gdb_assert ((datum & ~mask) == 0);
+
+ *dest = (*dest & ~mask) | datum;
+}
+
+/* Copy bits from a source to a destination.
+
+ DEST is where the bits should be written.
+ DEST_OFFSET_BITS is the bit offset into DEST.
+ SOURCE is the source of bits.
+ SOURCE_OFFSET_BITS is the bit offset into SOURCE.
+ BIT_COUNT is the number of bits to copy.
+ BITS_BIG_ENDIAN is taken directly from gdbarch. */
+
+static void
+copy_bitwise (gdb_byte *dest, unsigned int dest_offset_bits,
+ const gdb_byte *source, unsigned int source_offset_bits,
+ unsigned int bit_count,
+ int bits_big_endian)
+{
+ unsigned int dest_avail;
+ int datum;
+
+ /* Reduce everything to byte-size pieces. */
+ dest += dest_offset_bits / 8;
+ dest_offset_bits %= 8;
+ source += source_offset_bits / 8;
+ source_offset_bits %= 8;
+
+ dest_avail = 8 - dest_offset_bits % 8;
+
+ /* See if we can fill the first destination byte. */
+ if (dest_avail < bit_count)
+ {
+ datum = extract_bits (&source, &source_offset_bits, dest_avail,
+ bits_big_endian);
+ insert_bits (datum, dest, dest_offset_bits, dest_avail, bits_big_endian);
+ ++dest;
+ dest_offset_bits = 0;
+ bit_count -= dest_avail;
+ }
+
+ /* Now, either DEST_OFFSET_BITS is byte-aligned, or we have fewer
+ than 8 bits remaining. */
+ gdb_assert (dest_offset_bits % 8 == 0 || bit_count < 8);
+ for (; bit_count >= 8; bit_count -= 8)
+ {
+ datum = extract_bits (&source, &source_offset_bits, 8, bits_big_endian);
+ *dest++ = (gdb_byte) datum;
+ }
+
+ /* Finally, we may have a few leftover bits. */
+ gdb_assert (bit_count <= 8 - dest_offset_bits % 8);
+ if (bit_count > 0)
+ {
+ datum = extract_bits (&source, &source_offset_bits, bit_count,
+ bits_big_endian);
+ insert_bits (datum, dest, dest_offset_bits, bit_count, bits_big_endian);
+ }
+}
+
static void
read_pieced_value (struct value *v)
{
int i;
long offset = 0;
- ULONGEST bytes_to_skip;
+ ULONGEST bits_to_skip;
gdb_byte *contents;
struct piece_closure *c = (struct piece_closure *) value_computed_closure (v);
struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (v));
size_t type_len;
+ size_t buffer_size = 0;
+ char *buffer = NULL;
+ struct cleanup *cleanup;
+ int bits_big_endian
+ = gdbarch_bits_big_endian (get_type_arch (value_type (v)));
if (value_type (v) != value_enclosing_type (v))
internal_error (__FILE__, __LINE__,
_("Should not be able to create a lazy value with "
"an enclosing type"));
+ cleanup = make_cleanup (free_current_contents, &buffer);
+
contents = value_contents_raw (v);
- bytes_to_skip = value_offset (v);
- type_len = TYPE_LENGTH (value_type (v));
+ bits_to_skip = 8 * value_offset (v);
+ type_len = 8 * TYPE_LENGTH (value_type (v));
+
for (i = 0; i < c->n_pieces && offset < type_len; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
- size_t this_size;
- long dest_offset, source_offset;
-
- if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
+ size_t this_size, this_size_bits;
+ long dest_offset_bits, source_offset_bits, source_offset;
+ gdb_byte *intermediate_buffer;
+
+ /* Compute size, source, and destination offsets for copying, in
+ bits. */
+ this_size_bits = p->size;
+ if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
{
- bytes_to_skip -= p->size;
+ bits_to_skip -= this_size_bits;
continue;
}
- this_size = p->size;
- if (this_size > type_len - offset)
- this_size = type_len - offset;
- if (bytes_to_skip > 0)
- {
- dest_offset = 0;
- source_offset = bytes_to_skip;
- this_size -= bytes_to_skip;
- bytes_to_skip = 0;
+ if (this_size_bits > type_len - offset)
+ this_size_bits = type_len - offset;
+ if (bits_to_skip > 0)
+ {
+ dest_offset_bits = 0;
+ source_offset_bits = bits_to_skip;
+ this_size_bits -= bits_to_skip;
+ bits_to_skip = 0;
}
else
{
- dest_offset = offset;
- source_offset = 0;
+ dest_offset_bits = offset;
+ source_offset_bits = 0;
+ }
+
+ this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
+ source_offset = source_offset_bits / 8;
+ if (buffer_size < this_size)
+ {
+ buffer_size = this_size;
+ buffer = xrealloc (buffer, buffer_size);
}
+ intermediate_buffer = buffer;
+ /* Copy from the source to DEST_BUFFER. */
switch (p->location)
{
case DWARF_VALUE_REGISTER:
@@ -316,13 +509,18 @@
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
&& this_size < register_size (arch, gdb_regnum))
- /* Big-endian, and we want less than full size. */
- reg_offset = register_size (arch, gdb_regnum) - this_size;
+ {
+ /* Big-endian, and we want less than full size. */
+ reg_offset = register_size (arch, gdb_regnum) - this_size;
+ /* We want the lower-order THIS_SIZE_BITS of the bytes
+ we extract from the register. */
+ source_offset_bits += 8 * this_size - this_size_bits;
+ }
if (gdb_regnum != -1)
{
get_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, contents + dest_offset);
+ this_size, buffer);
}
else
{
@@ -334,11 +532,9 @@
case DWARF_VALUE_MEMORY:
if (p->v.expr.in_stack_memory)
- read_stack (p->v.expr.value + source_offset,
- contents + dest_offset, this_size);
+ read_stack (p->v.expr.value + source_offset, buffer, this_size);
else
- read_memory (p->v.expr.value + source_offset,
- contents + dest_offset, this_size);
+ read_memory (p->v.expr.value + source_offset, buffer, this_size);
break;
case DWARF_VALUE_STACK:
@@ -355,7 +551,7 @@
/* Nothing. */
}
else if (source_offset == 0)
- store_unsigned_integer (contents + dest_offset, n,
+ store_unsigned_integer (buffer, n,
gdbarch_byte_order (gdbarch),
p->v.expr.value);
else
@@ -365,7 +561,7 @@
store_unsigned_integer (bytes, n + source_offset,
gdbarch_byte_order (gdbarch),
p->v.expr.value);
- memcpy (contents + dest_offset, bytes + source_offset, n);
+ memcpy (buffer, bytes + source_offset, n);
}
}
break;
@@ -379,8 +575,7 @@
? p->v.literal.length - source_offset
: 0);
if (n != 0)
- memcpy (contents + dest_offset,
- p->v.literal.data + source_offset, n);
+ intermediate_buffer = p->v.literal.data + source_offset;
}
break;
@@ -388,17 +583,25 @@
/* We just leave the bits empty for now. This is not ideal
but gdb currently does not have a nice way to represent
optimized-out pieces. */
- warning (_("bytes %ld-%ld in computed object were optimized out; "
+ warning (_("bits %ld-%ld in computed object were optimized out; "
"replacing with zeroes"),
offset,
- offset + (long) this_size);
+ offset + (long) this_size_bits);
break;
default:
internal_error (__FILE__, __LINE__, _("invalid location type"));
}
- offset += this_size;
+
+ if (p->location != DWARF_VALUE_OPTIMIZED_OUT)
+ copy_bitwise (contents, dest_offset_bits,
+ intermediate_buffer, source_offset_bits % 8,
+ this_size_bits, bits_big_endian);
+
+ offset += this_size_bits;
}
+
+ do_cleanups (cleanup);
}
static void
@@ -406,11 +609,16 @@
{
int i;
long offset = 0;
- ULONGEST bytes_to_skip;
+ ULONGEST bits_to_skip;
const gdb_byte *contents;
struct piece_closure *c = (struct piece_closure *) value_computed_closure (to);
struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (to));
size_t type_len;
+ size_t buffer_size = 0;
+ char *buffer = NULL;
+ struct cleanup *cleanup;
+ int bits_big_endian
+ = gdbarch_bits_big_endian (get_type_arch (value_type (to)));
if (frame == NULL)
{
@@ -418,34 +626,57 @@
return;
}
+ cleanup = make_cleanup (free_current_contents, &buffer);
+
contents = value_contents (from);
- bytes_to_skip = value_offset (to);
- type_len = TYPE_LENGTH (value_type (to));
+ bits_to_skip = 8 * value_offset (to);
+ type_len = 8 * TYPE_LENGTH (value_type (to));
for (i = 0; i < c->n_pieces && offset < type_len; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
- size_t this_size;
- long dest_offset, source_offset;
+ size_t this_size_bits, this_size;
+ long dest_offset_bits, source_offset_bits, dest_offset, source_offset;
+ int need_bitwise;
+ const gdb_byte *source_buffer;
- if (bytes_to_skip > 0 && bytes_to_skip >= p->size)
+ this_size_bits = p->size;
+ if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
{
- bytes_to_skip -= p->size;
+ bits_to_skip -= this_size_bits;
continue;
}
- this_size = p->size;
- if (this_size > type_len - offset)
- this_size = type_len - offset;
- if (bytes_to_skip > 0)
- {
- dest_offset = bytes_to_skip;
- source_offset = 0;
- this_size -= bytes_to_skip;
- bytes_to_skip = 0;
+ if (this_size_bits > type_len - offset)
+ this_size_bits = type_len - offset;
+ if (bits_to_skip > 0)
+ {
+ dest_offset_bits = bits_to_skip;
+ source_offset_bits = 0;
+ this_size_bits -= bits_to_skip;
+ bits_to_skip = 0;
+ }
+ else
+ {
+ dest_offset_bits = 0;
+ source_offset_bits = offset;
+ }
+
+ this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
+ source_offset = source_offset_bits / 8;
+ dest_offset = dest_offset_bits / 8;
+ if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0)
+ {
+ source_buffer = contents + source_offset;
+ need_bitwise = 0;
}
else
{
- dest_offset = 0;
- source_offset = offset;
+ if (buffer_size < this_size)
+ {
+ buffer_size = this_size;
+ buffer = xrealloc (buffer, buffer_size);
+ }
+ source_buffer = buffer;
+ need_bitwise = 1;
}
switch (p->location)
@@ -463,8 +694,18 @@
if (gdb_regnum != -1)
{
+ if (need_bitwise)
+ {
+ get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ this_size, buffer);
+ copy_bitwise (buffer, dest_offset_bits,
+ contents, source_offset_bits,
+ this_size_bits,
+ bits_big_endian);
+ }
+
put_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, contents + source_offset);
+ this_size, source_buffer);
}
else
{
@@ -474,15 +715,31 @@
}
break;
case DWARF_VALUE_MEMORY:
+ if (need_bitwise)
+ {
+ /* Only the first and last bytes can possibly have any
+ bits reused. */
+ read_memory (p->v.expr.value + dest_offset, buffer, 1);
+ read_memory (p->v.expr.value + dest_offset + this_size - 1,
+ buffer + this_size - 1, 1);
+ copy_bitwise (buffer, dest_offset_bits,
+ contents, source_offset_bits,
+ this_size_bits,
+ bits_big_endian);
+ }
+
write_memory (p->v.expr.value + dest_offset,
- contents + source_offset, this_size);
+ source_buffer, this_size);
break;
default:
set_value_optimized_out (to, 1);
- return;
+ goto done;
}
- offset += this_size;
+ offset += this_size_bits;
}
+
+ done:
+ do_cleanups (cleanup);
}
static void *
--- src/gdb/testsuite/gdb.dwarf2/pieces.S 2010/05/21 21:01:46 1.2
+++ src/gdb/testsuite/gdb.dwarf2/pieces.S 2010/05/21 21:13:13 1.3
@@ -989,23 +989,18 @@
.LLST6:
.long .LVL13-.Ltext0 # Location list begin address (*.LLST6)
.long .LVL14-.Ltext0 # Location list end address (*.LLST6)
- .value 0xa # Location expression size
- .byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
- .uleb128 0
+ .value 0x8 # Location expression size
.byte 0x34 # DW_OP_lit4
.byte 0x9f # DW_OP_stack_value
.byte 0x9d # DW_OP_bit_piece
.uleb128 0xc
.uleb128 0
- .byte 0x93 # DW_OP_piece
- .uleb128 0x2
- .long .LVL14-.Ltext0 # Location list begin address (*.LLST6)
- .long .LVL15-.Ltext0 # Location list end address (*.LLST6)
- .value 0x15 # Location expression size
.byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
+ .uleb128 0x14
.uleb128 0
+ .long .LVL14-.Ltext0 # Location list begin address (*.LLST6)
+ .long .LVL15-.Ltext0 # Location list end address (*.LLST6)
+ .value 0x11 # Location expression size
.byte 0x34 # DW_OP_lit4
.byte 0x9f # DW_OP_stack_value
.byte 0x9d # DW_OP_bit_piece
@@ -1021,15 +1016,11 @@
.byte 0x9d # DW_OP_bit_piece
.uleb128 0xc
.uleb128 0
- .byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
- .uleb128 0
+ .byte 0x93 # DW_OP_piece
+ .uleb128 0x1
.long .LVL15-.Ltext0 # Location list begin address (*.LLST6)
.long .LVL16-1-.Ltext0 # Location list end address (*.LLST6)
- .value 0x14 # Location expression size
- .byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
- .uleb128 0
+ .value 0x10 # Location expression size
.byte 0x52 # DW_OP_reg2
.byte 0x9d # DW_OP_bit_piece
.uleb128 0xc
@@ -1044,15 +1035,11 @@
.byte 0x9d # DW_OP_bit_piece
.uleb128 0xc
.uleb128 0
- .byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
- .uleb128 0
+ .byte 0x93 # DW_OP_piece
+ .uleb128 0x1
.long .LVL16-1-.Ltext0 # Location list begin address (*.LLST6)
.long .LVL17-.Ltext0 # Location list end address (*.LLST6)
- .value 0x14 # Location expression size
- .byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
- .uleb128 0
+ .value 0x10 # Location expression size
.byte 0x56 # DW_OP_reg6
.byte 0x9d # DW_OP_bit_piece
.uleb128 0xc
@@ -1067,14 +1054,14 @@
.byte 0x9d # DW_OP_bit_piece
.uleb128 0xc
.uleb128 0
- .byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
- .uleb128 0
+ .byte 0x93 # DW_OP_piece
+ .uleb128 0x1
.long .LVL17-.Ltext0 # Location list begin address (*.LLST6)
.long .LFE3-.Ltext0 # Location list end address (*.LLST6)
.value 0xf # Location expression size
- .byte 0x93 # DW_OP_piece
- .uleb128 0x2
+ .byte 0x9d # DW_OP_bit_piece
+ .uleb128 0xc
+ .uleb128 0
.byte 0x91 # DW_OP_fbreg
.sleb128 0
.byte 0x94 # DW_OP_deref_size
@@ -1085,9 +1072,8 @@
.byte 0x9d # DW_OP_bit_piece
.uleb128 0xc
.uleb128 0
- .byte 0x9d # DW_OP_bit_piece
- .uleb128 0x4
- .uleb128 0
+ .byte 0x93 # DW_OP_piece
+ .uleb128 0x1
.long 0 # Location list terminator begin (*.LLST6)
.long 0 # Location list terminator end (*.LLST6)
.LLST7:
@@ -1356,7 +1342,7 @@
.long 0x48 # DW_AT_type
.byte 0x4 # DW_AT_byte_size
.byte 0xc # DW_AT_bit_size
- .byte 0x10 # DW_AT_bit_offset
+ .byte 0x14 # DW_AT_bit_offset
.byte 0x2 # DW_AT_data_member_location
.byte 0x23 # DW_OP_plus_uconst
.uleb128 0
@@ -1367,7 +1353,7 @@
.long 0x48 # DW_AT_type
.byte 0x4 # DW_AT_byte_size
.byte 0xc # DW_AT_bit_size
- .byte 0x4 # DW_AT_bit_offset
+ .byte 0x8 # DW_AT_bit_offset
.byte 0x2 # DW_AT_data_member_location
.byte 0x23 # DW_OP_plus_uconst
.uleb128 0
--- src/gdb/testsuite/gdb.dwarf2/pieces.c 2010/05/21 21:01:46 1.2
+++ src/gdb/testsuite/gdb.dwarf2/pieces.c 2010/05/21 21:13:13 1.3
@@ -21,7 +21,7 @@
However, it is used to extract breakpoint line numbers. */
struct A { int i; int j; };
-struct B { int : 4; int i : 12; int j : 12; int : 4; };
+struct B { int i : 12; int j : 12; int : 4; };
struct C { int i; int j; int q; };
__attribute__((noinline)) void
@@ -89,7 +89,7 @@
f6 (int k)
{
int z = 23;
- struct C a = { k, k, z};
+ struct C a = { k, k, z };
asm ("" : "+r" (a.i));
a.j++;
bar (a.i);
--- src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:01:46 1.3
+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:13:13 1.4
@@ -67,15 +67,30 @@
gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2"
}
+# Function f3 tests DW_OP_bit_piece.
+proc pieces_test_f3 {} {
+ global csrcfile
+ set line [gdb_get_line_number "f3 breakpoint" $csrcfile]
+ gdb_test "break pieces.c:$line" "Breakpoint 4.*" \
+ "set f3 breakpoint for pieces"
+ gdb_continue_to_breakpoint "continue to f3 breakpoint for pieces"
+ gdb_test "print a.i" " = 4" "print a.i in pieces:f3"
+ gdb_test "print a.j" " = 14" "print a.j in pieces:f3"
+ # Right now gdb says "value optimized out" here, but that is wrong.
+ setup_kfail "no bug yet" *-*-*
+ gdb_test "print a.i = 7" " = 7" "set a.i in pieces:f3"
+ gdb_test "print a.i" " = 7" "print new a.i in pieces:f3"
+}
+
# Function f6 tests for an empty DW_OP_piece.
proc pieces_test_f6 {} {
global csrcfile
set line [gdb_get_line_number "f6 breakpoint" $csrcfile]
- gdb_test "break pieces.c:$line" "Breakpoint 4.*" \
+ gdb_test "break pieces.c:$line" "Breakpoint 5.*" \
"set f6 breakpoint for pieces"
gdb_continue_to_breakpoint "continue to f6 breakpoint for pieces"
gdb_test "print a" \
- "warning: bytes .* in computed object were.* = {i = 7, j = 8, q = 0}" \
+ "warning: bits .* in computed object were.* = {i = 7, j = 8, q = 0}" \
"print a with optimized out piece"
# Note: no warning for this case.
gdb_test_multiple "print a.i" \
@@ -91,4 +106,5 @@
pieces_test_f1
pieces_test_f2
+pieces_test_f3
pieces_test_f6

View File

@ -1,79 +0,0 @@
https://bugzilla.redhat.com/show_bug.cgi?id=586566
http://sourceware.org/ml/gdb-patches/2010-03/msg00746.html
http://sourceware.org/ml/gdb-patches/2010-05/msg00551.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00194.html
### src/gdb/ChangeLog 2010/03/19 22:00:16 1.11508
### src/gdb/ChangeLog 2010/03/20 05:17:10 1.11509
## -1,3 +1,9 @@
+2010-03-20 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * tui/tui-disasm.c (tui_get_begin_asm_address): Default to
+ get_current_arch.
+ * tui/tui-layout.c (extract_display_start_addr): Likewise.
+
2010-03-19 Stan Shebs <stan@codesourcery.com>
* ax-gdb.c (gen_fetch): Handle bool.
--- src/gdb/tui/tui-disasm.c 2010/01/01 07:32:07 1.33
+++ src/gdb/tui/tui-disasm.c 2010/03/20 05:17:10 1.34
@@ -21,6 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
#include "symtab.h"
#include "breakpoint.h"
#include "frame.h"
@@ -330,7 +331,7 @@
{
struct tui_gen_win_info *locator;
struct tui_locator_element *element;
- struct gdbarch *gdbarch = NULL;
+ struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR addr;
locator = tui_locator_win_info_ptr ();
--- src/gdb/tui/tui-layout.c 2010/01/01 07:32:07 1.36
+++ src/gdb/tui/tui-layout.c 2010/03/20 05:17:10 1.37
@@ -21,6 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "arch-utils.h"
#include "command.h"
#include "symtab.h"
#include "frame.h"
@@ -522,7 +523,7 @@
extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
{
enum tui_layout_type cur_layout = tui_current_layout ();
- struct gdbarch *gdbarch = NULL;
+ struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR addr;
CORE_ADDR pc;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
--- /dev/null 2010-05-24 04:43:32.632794021 +0200
+++ gdb-7.1/gdb/testsuite/gdb.base/tui-layout.exp 2010-05-24 20:13:30.000000000 +0200
@@ -0,0 +1,21 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile tui-layout
+if { [prepare_for_testing ${testfile}.exp ${testfile} start.c] } {
+ return -1
+}
+
+gdb_test "layout asm"

View File

@ -1,66 +0,0 @@
[patch] Fix ADL anonymous type crash
http://sourceware.org/ml/gdb-patches/2010-06/msg00004.html
http://sourceware.org/ml/gdb-cvs/2010-06/msg00012.html
[ Backported the testcase. ]
### src/gdb/ChangeLog 2010/06/02 06:24:00 1.11862
### src/gdb/ChangeLog 2010/06/02 15:31:29 1.11863
## -1,3 +1,8 @@
+2010-06-02 Sami Wagiaalla <swagiaal@redhat.com>
+
+ * cp-support.c (make_symbol_overload_list_adl_namespace): Handle
+ anonymous type case.
+
2010-06-02 Pierre Muller <muller@ics.u-strasbg.fr>
* dwarf2read.c (read_subrange_type): Handle missing base type
### src/gdb/testsuite/ChangeLog 2010/06/01 21:29:21 1.2298
### src/gdb/testsuite/ChangeLog 2010/06/02 15:31:30 1.2299
## -1,3 +1,8 @@
+2010-06-02 Sami Wagiaalla <swagiaal@redhat.com>
+
+ * gdb.cp/namespace-koenig.exp: Added new test case.
+ * gdb.cp/namespace-koenig.cc: Ditto.
+
2010-06-01 Michael Snyder <msnyder@vmware.com>
* gdb.base/arithmet.exp: Use gdb_test_no_output.
--- src/gdb/cp-support.c 2010/05/13 23:53:32 1.40
+++ src/gdb/cp-support.c 2010/06/02 15:31:30 1.41
@@ -752,6 +752,9 @@
type_name = TYPE_NAME (type);
+ if (type_name == NULL)
+ return;
+
prefix_len = cp_entire_prefix_len (type_name);
if (prefix_len != 0)
--- gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.cc.orig 2010-06-09 08:20:14.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.cc 2010-06-09 11:09:29.000000000 +0200
@@ -165,6 +165,13 @@ namespace M {
}
//------------
+static union {
+ int a;
+ char b;
+}p_union;
+
+//------------
+
int
main ()
{
--- gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.exp.orig 2010-06-09 08:20:14.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace-koenig.exp 2010-06-09 11:09:48.000000000 +0200
@@ -110,3 +111,7 @@ gdb_test "p o + 5.0f" "= 22"
gdb_test "p o + 5" "= 23"
gdb_test "p o++" "= 24"
+
+#test that lookup is not thwarted by anonymous types
+gdb_test "p foo (p_union)" \
+ "Cannot resolve function foo to any overloaded instance"

View File

@ -1,329 +0,0 @@
commit be1f57c90bdf86477b9bc69cc982171d6ad5df56
Author: Tom Tromey <tromey@redhat.com>
Date: Tue Apr 20 17:33:13 2010 +0000
* dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4.
(struct dwarf2_cie) <segment_size>: New field.
* dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4.
(skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset,
DW_FORM_exprloc.
(read_attribute_value): Handle DW_FORM_flag_present,
DW_FORM_sec_offset, DW_FORM_exprloc.
(dump_die_shallow): Likewise.
(attr_form_is_section_offset): Handle DW_FORM_sec_offset.
(dwarf2_const_value): Handle DW_FORM_exprloc.
(attr_form_is_block): Likewise.
(struct line_header) <maximum_ops_per_instruction>: New field.
(dwarf_decode_line_header): Set new field.
(dwarf_decode_lines): Handle new field.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,20 @@
+2010-04-20 Tom Tromey <tromey@redhat.com>
+
+ * dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4.
+ (struct dwarf2_cie) <segment_size>: New field.
+ * dwarf2read.c (partial_read_comp_unit_head): Accept DWARF 4.
+ (skip_one_die): Handle DW_FORM_flag_present, DW_FORM_sec_offset,
+ DW_FORM_exprloc.
+ (read_attribute_value): Handle DW_FORM_flag_present,
+ DW_FORM_sec_offset, DW_FORM_exprloc.
+ (dump_die_shallow): Likewise.
+ (attr_form_is_section_offset): Handle DW_FORM_sec_offset.
+ (dwarf2_const_value): Handle DW_FORM_exprloc.
+ (attr_form_is_block): Likewise.
+ (struct line_header) <maximum_ops_per_instruction>: New field.
+ (dwarf_decode_line_header): Set new field.
+ (dwarf_decode_lines): Handle new field.
+
2010-04-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* f-exp.y: Add new production to recognize the `logical*8' type.
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -85,6 +85,9 @@ struct dwarf2_cie
/* The version recorded in the CIE. */
unsigned char version;
+
+ /* The segment size. */
+ unsigned char segment_size;
};
struct dwarf2_cie_table
@@ -1714,7 +1717,7 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p,
/* Check version number. */
cie_version = read_1_byte (unit->abfd, buf);
- if (cie_version != 1 && cie_version != 3)
+ if (cie_version != 1 && cie_version != 3 && cie_version != 4)
return NULL;
cie->version = cie_version;
buf += 1;
@@ -1738,6 +1741,20 @@ decode_frame_entry_1 (struct comp_unit *unit, gdb_byte *start, int eh_frame_p,
augmentation += 2;
}
+ if (cie->version >= 4)
+ {
+ /* FIXME: check that this is the same as from the CU header. */
+ cie->addr_size = read_1_byte (unit->abfd, buf);
+ ++buf;
+ cie->segment_size = read_1_byte (unit->abfd, buf);
+ ++buf;
+ }
+ else
+ {
+ cie->addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
+ cie->segment_size = 0;
+ }
+
cie->code_alignment_factor =
read_unsigned_leb128 (unit->abfd, buf, &bytes_read);
buf += bytes_read;
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -396,6 +396,7 @@ struct line_header
unsigned short version;
unsigned int header_length;
unsigned char minimum_instruction_length;
+ unsigned char maximum_ops_per_instruction;
unsigned char default_is_stmt;
int line_base;
unsigned char line_range;
@@ -1488,10 +1489,10 @@ partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
info_ptr = read_comp_unit_head (header, info_ptr, abfd);
- if (header->version != 2 && header->version != 3)
+ if (header->version != 2 && header->version != 3 && header->version != 4)
error (_("Dwarf Error: wrong version in compilation unit header "
- "(is %d, should be %d) [in module %s]"), header->version,
- 2, bfd_get_filename (abfd));
+ "(is %d, should be 2, 3, or 4) [in module %s]"), header->version,
+ bfd_get_filename (abfd));
if (header->abbrev_offset >= dwarf2_per_objfile->abbrev.size)
error (_("Dwarf Error: bad offset (0x%lx) in compilation unit header "
@@ -2776,6 +2777,8 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr,
case DW_FORM_flag:
info_ptr += 1;
break;
+ case DW_FORM_flag_present:
+ break;
case DW_FORM_data2:
case DW_FORM_ref2:
info_ptr += 2;
@@ -2793,9 +2796,11 @@ skip_one_die (gdb_byte *buffer, gdb_byte *info_ptr,
read_string (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
break;
+ case DW_FORM_sec_offset:
case DW_FORM_strp:
info_ptr += cu->header.offset_size;
break;
+ case DW_FORM_exprloc:
case DW_FORM_block:
info_ptr += read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
@@ -7129,6 +7134,10 @@ read_attribute_value (struct attribute *attr, unsigned form,
DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
info_ptr += 8;
break;
+ case DW_FORM_sec_offset:
+ DW_UNSND (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read);
+ info_ptr += bytes_read;
+ break;
case DW_FORM_string:
DW_STRING (attr) = read_string (abfd, info_ptr, &bytes_read);
DW_STRING_IS_CANONICAL (attr) = 0;
@@ -7140,6 +7149,7 @@ read_attribute_value (struct attribute *attr, unsigned form,
DW_STRING_IS_CANONICAL (attr) = 0;
info_ptr += bytes_read;
break;
+ case DW_FORM_exprloc:
case DW_FORM_block:
blk = dwarf_alloc_block (cu);
blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
@@ -7164,6 +7174,9 @@ read_attribute_value (struct attribute *attr, unsigned form,
DW_UNSND (attr) = read_1_byte (abfd, info_ptr);
info_ptr += 1;
break;
+ case DW_FORM_flag_present:
+ DW_UNSND (attr) = 1;
+ break;
case DW_FORM_sdata:
DW_SND (attr) = read_signed_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
@@ -7680,7 +7693,7 @@ dwarf2_attr_no_follow (struct die_info *die, unsigned int name,
/* Return non-zero iff the attribute NAME is defined for the given DIE,
and holds a non-zero value. This function should only be used for
- DW_FORM_flag attributes. */
+ DW_FORM_flag or DW_FORM_flag_present attributes. */
static int
dwarf2_flag_true_p (struct die_info *die, unsigned name, struct dwarf2_cu *cu)
@@ -7862,6 +7875,21 @@ dwarf_decode_line_header (unsigned int offset, bfd *abfd,
line_ptr += offset_size;
lh->minimum_instruction_length = read_1_byte (abfd, line_ptr);
line_ptr += 1;
+ if (lh->version >= 4)
+ {
+ lh->maximum_ops_per_instruction = read_1_byte (abfd, line_ptr);
+ line_ptr += 1;
+ }
+ else
+ lh->maximum_ops_per_instruction = 1;
+
+ if (lh->maximum_ops_per_instruction == 0)
+ {
+ lh->maximum_ops_per_instruction = 1;
+ complaint (&symfile_complaints,
+ _("invalid maximum_ops_per_instruction in `.debug_line' section"));
+ }
+
lh->default_is_stmt = read_1_byte (abfd, line_ptr);
line_ptr += 1;
lh->line_base = read_1_signed_byte (abfd, line_ptr);
@@ -8010,6 +8038,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
int basic_block = 0;
int end_sequence = 0;
CORE_ADDR addr;
+ unsigned char op_index = 0;
if (!decode_for_pst_p && lh->num_file_names >= file)
{
@@ -8041,12 +8070,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
{
/* Special operand. */
adj_opcode = op_code - lh->opcode_base;
- address += (adj_opcode / lh->line_range)
- * lh->minimum_instruction_length;
+ address += (((op_index + (adj_opcode / lh->line_range))
+ / lh->maximum_ops_per_instruction)
+ * lh->minimum_instruction_length);
+ op_index = ((op_index + (adj_opcode / lh->line_range))
+ % lh->maximum_ops_per_instruction);
line += lh->line_base + (adj_opcode % lh->line_range);
if (lh->num_file_names < file || file == 0)
dwarf2_debug_line_missing_file_complaint ();
- else
+ /* For now we ignore lines not starting on an
+ instruction boundary. */
+ else if (op_index == 0)
{
lh->file_names[file - 1].included_p = 1;
if (!decode_for_pst_p && is_stmt)
@@ -8081,6 +8115,7 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
break;
case DW_LNE_set_address:
address = read_address (abfd, line_ptr, cu, &bytes_read);
+ op_index = 0;
line_ptr += bytes_read;
address += baseaddr;
break;
@@ -8146,9 +8181,17 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
basic_block = 0;
break;
case DW_LNS_advance_pc:
- address += lh->minimum_instruction_length
- * read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
+ {
+ CORE_ADDR adjust
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+
+ address += (((op_index + adjust)
+ / lh->maximum_ops_per_instruction)
+ * lh->minimum_instruction_length);
+ op_index = ((op_index + adjust)
+ % lh->maximum_ops_per_instruction);
+ line_ptr += bytes_read;
+ }
break;
case DW_LNS_advance_line:
line += read_signed_leb128 (abfd, line_ptr, &bytes_read);
@@ -8195,11 +8238,19 @@ dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
instruction length since special opcode 255 would have
scaled the the increment. */
case DW_LNS_const_add_pc:
- address += (lh->minimum_instruction_length
- * ((255 - lh->opcode_base) / lh->line_range));
+ {
+ CORE_ADDR adjust = (255 - lh->opcode_base) / lh->line_range;
+
+ address += (((op_index + adjust)
+ / lh->maximum_ops_per_instruction)
+ * lh->minimum_instruction_length);
+ op_index = ((op_index + adjust)
+ % lh->maximum_ops_per_instruction);
+ }
break;
case DW_LNS_fixed_advance_pc:
address += read_2_bytes (abfd, line_ptr);
+ op_index = 0;
line_ptr += 2;
break;
default:
@@ -8761,6 +8812,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
case DW_FORM_block2:
case DW_FORM_block4:
case DW_FORM_block:
+ case DW_FORM_exprloc:
blk = DW_BLOCK (attr);
if (TYPE_LENGTH (SYMBOL_TYPE (sym)) != blk->size)
dwarf2_const_value_length_mismatch_complaint (SYMBOL_PRINT_NAME (sym),
@@ -10308,6 +10360,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
case DW_FORM_block1:
fprintf_unfiltered (f, "block: size %d", DW_BLOCK (&die->attrs[i])->size);
break;
+ case DW_FORM_exprloc:
+ fprintf_unfiltered (f, "expression: size %u",
+ DW_BLOCK (&die->attrs[i])->size);
+ break;
case DW_FORM_ref1:
case DW_FORM_ref2:
case DW_FORM_ref4:
@@ -10323,6 +10379,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
fprintf_unfiltered (f, "constant: %s",
pulongest (DW_UNSND (&die->attrs[i])));
break;
+ case DW_FORM_sec_offset:
+ fprintf_unfiltered (f, "section offset: %s",
+ pulongest (DW_UNSND (&die->attrs[i])));
+ break;
case DW_FORM_sig8:
if (DW_SIGNATURED_TYPE (&die->attrs[i]) != NULL)
fprintf_unfiltered (f, "signatured type, offset: 0x%x",
@@ -10343,6 +10403,9 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
else
fprintf_unfiltered (f, "flag: FALSE");
break;
+ case DW_FORM_flag_present:
+ fprintf_unfiltered (f, "flag: TRUE");
+ break;
case DW_FORM_indirect:
/* the reader will have reduced the indirect form to
the "base form" so this form should not occur */
@@ -11520,7 +11583,8 @@ attr_form_is_block (struct attribute *attr)
attr->form == DW_FORM_block1
|| attr->form == DW_FORM_block2
|| attr->form == DW_FORM_block4
- || attr->form == DW_FORM_block);
+ || attr->form == DW_FORM_block
+ || attr->form == DW_FORM_exprloc);
}
/* Return non-zero if ATTR's value is a section offset --- classes
@@ -11535,7 +11599,8 @@ static int
attr_form_is_section_offset (struct attribute *attr)
{
return (attr->form == DW_FORM_data4
- || attr->form == DW_FORM_data8);
+ || attr->form == DW_FORM_data8
+ || attr->form == DW_FORM_sec_offset);
}

View File

@ -1,56 +0,0 @@
commit 669907bd6d54ae8e85b1278f0f16f8641ce6802d
Author: Tom Tromey <tromey@redhat.com>
Date: Tue Apr 20 21:19:07 2010 +0000
* dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name.
(read_partial_die): Likewise.
(dwarf_attr_name): Likewise.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,9 @@
+2010-04-20 Tom Tromey <tromey@redhat.com>
+
+ * dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name.
+ (read_partial_die): Likewise.
+ (dwarf_attr_name): Likewise.
+
2010-04-20 Chris Moller <cmoller@redhat.com>
PR 10867
--- gdb-7.1/gdb/dwarf2read.c.orig 2010-06-09 14:38:01.000000000 +0200
+++ gdb-7.1/gdb/dwarf2read.c 2010-06-09 14:49:53.000000000 +0200
@@ -7675,7 +7675,11 @@ read_partial_die (struct partial_die_inf
break;
}
break;
+ case DW_AT_linkage_name:
case DW_AT_MIPS_linkage_name:
+ /* Note that both forms of linkage name might appear. We
+ assume they will be the same, and we only store the last
+ one we see. */
if (cu->language == language_ada)
part_die->name = DW_STRING (&attr);
break;
@@ -10167,7 +10171,11 @@ dwarf2_name (struct die_info *die, struc
struct attribute *attr = NULL;
if (cu->language == language_ada)
- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+ {
+ attr = dwarf2_attr (die, DW_AT_linkage_name, cu);
+ if (attr == NULL)
+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+ }
if (!attr)
attr = dwarf2_attr (die, DW_AT_name, cu);
@@ -10555,6 +10563,8 @@ dwarf_attr_name (unsigned attr)
/* DWARF 4 values. */
case DW_AT_signature:
return "DW_AT_signature";
+ case DW_AT_linkage_name:
+ return "DW_AT_linkage_name";
/* SGI/MIPS extensions. */
#ifdef MIPS /* collides with DW_AT_HP_block_index */
case DW_AT_MIPS_fde:

View File

@ -1,274 +0,0 @@
commit f49f91e9c3eaba847f75f5c46e77e261a76d9a9b
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Jun 28 20:35:51 2010 +0000
gdb/
* cp-namespace.c (cp_lookup_nested_type): New variable
concatenated_name. Turn the current return condition into a reverse
one. Call also lookup_static_symbol_aux on the constructed qualified
name.
* symtab.c (lookup_symbol_aux): Move variable objfile and searching in
other files into a called ...
(lookup_static_symbol_aux): ... new function here.
* symtab.h (lookup_static_symbol_aux): New prototype.
* valops.c (value_maybe_namespace_elt): Call also
lookup_static_symbol_aux if we failed otherwise.
gdb/testsuite/
* gdb.cp/namespace.exp (whatis C::cOtherFileType)
(whatis ::C::cOtherFileType, whatis C::cOtherFileVar)
(whatis ::C::cOtherFileVar, print C::cOtherFileVar)
(print ::C::cOtherFileVar)
(whatis C::OtherFileClass::cOtherFileClassType)
(whatis ::C::OtherFileClass::cOtherFileClassType)
(print C::OtherFileClass::cOtherFileClassVar)
(print ::cOtherFileClassVar)
(print ::C::OtherFileClass::cOtherFileClassVar): New tests.
(ptype OtherFileClass, ptype ::C::OtherFileClass): Permit arbitrary
trailing content.
* gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType)
(C::OtherFileClass::cOtherFileClassVar)
(C::OtherFileClass::cOtherFileClassVar_use, C::cOtherFileType)
(C::cOtherFileVar, C::cOtherFileVar_use): New.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,18 @@
2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * cp-namespace.c (cp_lookup_nested_type): New variable
+ concatenated_name. Turn the current return condition into a reverse
+ one. Call also lookup_static_symbol_aux on the constructed qualified
+ name.
+ * symtab.c (lookup_symbol_aux): Move variable objfile and searching in
+ other files into a called ...
+ (lookup_static_symbol_aux): ... new function here.
+ * symtab.h (lookup_static_symbol_aux): New prototype.
+ * valops.c (value_maybe_namespace_elt): Call also
+ lookup_static_symbol_aux if we failed otherwise.
+
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Fix PR c++/11703 and PR gdb/1448.
* c-exp.y (yylex) <last_was_coloncolon && first_was_coloncolon>: Add
FIRST_ITER check.
Index: gdb-7.1/gdb/cp-namespace.c
===================================================================
--- gdb-7.1.orig/gdb/cp-namespace.c 2010-06-29 17:54:17.000000000 +0200
+++ gdb-7.1/gdb/cp-namespace.c 2010-06-29 17:59:32.000000000 +0200
@@ -585,10 +585,24 @@ cp_lookup_nested_type (struct type *pare
nested_name,
block,
VAR_DOMAIN);
- if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
- return NULL;
- else
+ char *concatenated_name;
+
+ if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+ return SYMBOL_TYPE (sym);
+
+ /* Now search all static file-level symbols. Not strictly correct,
+ but more useful than an error. We do not try to guess any imported
+ namespace as even the fully specified namespace seach is is already
+ not C++ compliant and more assumptions could make it too magic. */
+
+ concatenated_name = alloca (strlen (parent_name) + 2
+ + strlen (nested_name) + 1);
+ sprintf (concatenated_name, "%s::%s", parent_name, nested_name);
+ sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
+ if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
return SYMBOL_TYPE (sym);
+
+ return NULL;
}
default:
internal_error (__FILE__, __LINE__,
Index: gdb-7.1/gdb/symtab.h
===================================================================
--- gdb-7.1.orig/gdb/symtab.h 2010-06-29 17:54:16.000000000 +0200
+++ gdb-7.1/gdb/symtab.h 2010-06-29 18:00:37.000000000 +0200
@@ -1036,6 +1036,12 @@ extern struct partial_symbol *lookup_par
const char *, int,
domain_enum);
+/* Lookup a symbol only in the file static scope of all the objfiles. */
+
+struct symbol *lookup_static_symbol_aux (const char *name,
+ const domain_enum domain);
+
+
/* lookup a symbol by name, within a specified block */
extern struct symbol *lookup_block_symbol (const struct block *, const char *,
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 17:54:11.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 18:17:17.000000000 +0200
@@ -217,6 +217,70 @@ gdb_expect {
gdb_test "break BBB::Class::xyzq" \
"Breakpoint.*at $hex: file.*namespace.cc, line 68\\."
+# Tests accessing static elements in namespace of other file.
+
+gdb_test "whatis C::cOtherFileType" "type = short"
+gdb_test "whatis ::C::cOtherFileType" "type = short"
+gdb_test "whatis C::cOtherFileVar" "type = const C::cOtherFileType"
+gdb_test "whatis ::C::cOtherFileVar" "type = const C::cOtherFileType"
+gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319"
+gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319"
+
+if {[test_compiler_info {gcc-[0-3]-*}]
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
+ # The type in class is missing in older GCCs.
+ setup_xfail *-*-*
+}
+gdb_test "whatis C::OtherFileClass::cOtherFileClassType" "type = short"
+if {[test_compiler_info {gcc-[0-3]-*}]
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
+ # The type in class is missing in older GCCs.
+ setup_xfail *-*-*
+}
+gdb_test "whatis ::C::OtherFileClass::cOtherFileClassType" "type = short"
+
+set test "print C::OtherFileClass::cOtherFileClassVar"
+gdb_test_multiple $test $test {
+ -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "static field cOtherFileClassVar has been optimized out\r\n$gdb_prompt $" {
+ setup_kfail "c++/11702" "*-*-*"
+ fail $test
+ }
+}
+
+# FSF GCC <=4.4 creates unqualified DIE "cOtherFileClassVar" ignoring the
+# namespace the same way older GDB did.
+set test "print ::cOtherFileClassVar"
+set test2 "print ::C::OtherFileClass::cOtherFileClassVar"
+gdb_test_multiple $test $test {
+ -re "No symbol \"cOtherFileClassVar\" in current context\\.\r\n$gdb_prompt $" {
+ pass $test
+
+ gdb_test_multiple $test2 $test2 {
+ -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
+ pass $test2
+ }
+ -re "static field cOtherFileClassVar has been optimized out\r\n$gdb_prompt $" {
+ setup_kfail "c++/11702" "*-*-*"
+ fail $test2
+ }
+ }
+
+ }
+ -re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
+ if {[test_compiler_info {gcc-[0-3]-*}]
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
+ # Do not permit to XFAIL on recent GCCs.
+ setup_xfail *-*-*
+ }
+ fail $test
+
+ unresolved $test2
+ }
+}
+
# Test to see if the appropriate namespaces are in scope when trying
# to print out stuff from within a function defined within a
# namespace.
@@ -260,7 +324,7 @@ gdb_test "ptype C::NestedClass" "No symb
# Tests involving multiple files
gdb_test "print cOtherFile" "\\$\[0-9\].* = 316"
-gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n public:|struct C::OtherFileClass \{)\r\n int z;\r\n\}"
+gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n public:|struct C::OtherFileClass \{)\r\n int z;\r\n.*\}"
cp_test_ptype_class \
"ptype ::C::OtherFileClass" "" "class" "C::OtherFileClass" \
{
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace1.cc 2010-01-01 08:32:01.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc 2010-06-29 17:56:42.000000000 +0200
@@ -21,7 +21,15 @@ namespace C
class OtherFileClass {
public:
int z;
+
+ typedef short cOtherFileClassType;
+ static const cOtherFileClassType cOtherFileClassVar = 318;
+ cOtherFileClassType cOtherFileClassVar_use ();
};
+ OtherFileClass::cOtherFileClassType OtherFileClass::cOtherFileClassVar_use ()
+ {
+ return cOtherFileClassVar;
+ }
namespace {
int cXOtherFile = 29;
@@ -35,6 +43,13 @@ namespace C
static OtherFileClass *c = new OtherFileClass();
c->z = cOtherFile + cXOtherFile;
}
+
+ typedef short cOtherFileType;
+ static const cOtherFileType cOtherFileVar = 319;
+ cOtherFileType cOtherFileVar_use ()
+ {
+ return cOtherFileVar;
+ }
}
namespace {
Index: gdb-7.1/gdb/valops.c
===================================================================
--- gdb-7.1.orig/gdb/valops.c 2010-06-29 17:54:16.000000000 +0200
+++ gdb-7.1/gdb/valops.c 2010-06-29 18:15:00.000000000 +0200
@@ -3253,9 +3253,17 @@ value_maybe_namespace_elt (const struct
struct symbol *sym;
struct value *result;
- sym = cp_lookup_symbol_namespace(namespace_name, name,
- get_selected_block (0),
- VAR_DOMAIN);
+ sym = cp_lookup_symbol_namespace (namespace_name, name,
+ get_selected_block (0), VAR_DOMAIN);
+
+ if (sym == NULL)
+ {
+ char *concatenated_name = alloca (strlen (namespace_name) + 2
+ + strlen (name) + 1);
+
+ sprintf (concatenated_name, "%s::%s", namespace_name, name);
+ sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN);
+ }
if (sym == NULL)
return NULL;
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1122,10 +1121,21 @@ lookup_symbol_aux (const char *name, const struct block *block,
return sym;
/* Now search all static file-level symbols. Not strictly correct,
- but more useful than an error. Do the symtabs first, then check
- the psymtabs. If a psymtab indicates the existence of the
- desired name as a file-level static, then do psymtab-to-symtab
- conversion on the fly and return the found symbol. */
+ but more useful than an error. */
+
+ return lookup_static_symbol_aux (name, domain);
+}
+
+/* Search all static file-level symbols for NAME from DOMAIN. Do the symtabs
+ first, then check the psymtabs. If a psymtab indicates the existence of the
+ desired name as a file-level static, then do psymtab-to-symtab conversion on
+ the fly and return the found symbol. */
+
+struct symbol *
+lookup_static_symbol_aux (const char *name, const domain_enum domain)
+{
+ struct objfile *objfile;
+ struct symbol *sym;
sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
if (sym != NULL)

View File

@ -1,308 +0,0 @@
commit 758a1f7149cb7469c7e6bb30cb572715ee90a6e8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Jun 28 20:39:27 2010 +0000
gdb/
* c-typeprint.c (c_type_print_base): For no fields check include also
TYPE_TYPEDEF_FIELD_COUNT. Print new typedefs section.
* dwarf2read.c (struct typedef_field_list)
(struct field_info) <typedef_field_list, typedef_field_list_count>: New.
(dwarf2_add_typedef): New.
(read_structure_type): Call dwarf2_add_typedef for DW_TAG_typedef.
Copy also FI.TYPEDEF_FIELD_LIST.
* gdbtypes.h (struct typedef_field)
(struct cplus_struct_type) <typedef_field, typedef_field_count>
(TYPE_TYPEDEF_FIELD_ARRAY, TYPE_TYPEDEF_FIELD, TYPE_TYPEDEF_FIELD_NAME)
(TYPE_TYPEDEF_FIELD_TYPE, TYPE_TYPEDEF_FIELD_COUNT): New.
gdb/testsuite/
* gdb.cp/namespace.exp (ptype OtherFileClass typedefs)
(ptype ::C::OtherFileClass typedefs): New.
* gdb.cp/namespace1.cc (C::OtherFileClass::cOtherFileClassType2)
(C::OtherFileClass::cOtherFileClassVar2): New.
(C::OtherFileClass::cOtherFileClassVar_use): Use also
cOtherFileClassVar2.
(C::cOtherFileType2, C::cOtherFileVar2): New.
(C::cOtherFileVar_use): use also cOtherFileVar2.
* gdb.cp/userdef.exp (ptype &*c): Permit arbitrary trailing text.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,19 @@
2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * c-typeprint.c (c_type_print_base): For no fields check include also
+ TYPE_TYPEDEF_FIELD_COUNT. Print new typedefs section.
+ * dwarf2read.c (struct typedef_field_list)
+ (struct field_info) <typedef_field_list, typedef_field_list_count>: New.
+ (dwarf2_add_typedef): New.
+ (read_structure_type): Call dwarf2_add_typedef for DW_TAG_typedef.
+ Copy also FI.TYPEDEF_FIELD_LIST.
+ * gdbtypes.h (struct typedef_field)
+ (struct cplus_struct_type) <typedef_field, typedef_field_count>
+ (TYPE_TYPEDEF_FIELD_ARRAY, TYPE_TYPEDEF_FIELD, TYPE_TYPEDEF_FIELD_NAME)
+ (TYPE_TYPEDEF_FIELD_TYPE, TYPE_TYPEDEF_FIELD_COUNT): New.
+
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* cp-namespace.c (cp_lookup_nested_type): New variable
concatenated_name. Turn the current return condition into a reverse
one. Call also lookup_static_symbol_aux on the constructed qualified
Index: gdb-7.1/gdb/c-typeprint.c
===================================================================
--- gdb-7.1.orig/gdb/c-typeprint.c 2010-06-29 17:54:09.000000000 +0200
+++ gdb-7.1/gdb/c-typeprint.c 2010-06-29 18:17:48.000000000 +0200
@@ -774,7 +774,8 @@ c_type_print_base (struct type *type, st
cp_type_print_derivation_info (stream, type);
fprintf_filtered (stream, "{\n");
- if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
+ if (TYPE_NFIELDS (type) == 0 && TYPE_NFN_FIELDS (type) == 0
+ && TYPE_TYPEDEF_FIELD_COUNT (type) == 0)
{
if (TYPE_STUB (type))
fprintfi_filtered (level + 4, stream, _("<incomplete type>\n"));
@@ -1060,6 +1061,29 @@ c_type_print_base (struct type *type, st
}
}
+ /* Print typedefs defined in this class. */
+
+ if (TYPE_TYPEDEF_FIELD_COUNT (type) != 0)
+ {
+ if (TYPE_NFIELDS (type) != 0 || TYPE_NFN_FIELDS (type) != 0)
+ fprintf_filtered (stream, "\n");
+
+ for (i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); i++)
+ {
+ struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i);
+
+ /* Dereference the typedef declaration itself. */
+ gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF);
+ target = TYPE_TARGET_TYPE (target);
+
+ print_spaces_filtered (level + 4, stream);
+ fprintf_filtered (stream, "typedef ");
+ c_print_type (target, (char *) TYPE_TYPEDEF_FIELD_NAME (type, i),
+ stream, show - 1, level + 4);
+ fprintf_filtered (stream, ";\n");
+ }
+ }
+
fprintfi_filtered (level, stream, "}");
if (TYPE_LOCALTYPE_PTR (type) && show >= 0)
Index: gdb-7.1/gdb/dwarf2read.c
===================================================================
--- gdb-7.1.orig/gdb/dwarf2read.c 2010-06-29 17:54:28.000000000 +0200
+++ gdb-7.1/gdb/dwarf2read.c 2010-06-29 18:17:48.000000000 +0200
@@ -722,6 +722,16 @@ struct field_info
/* Number of entries in the fnfieldlists array. */
int nfnfields;
+
+ /* typedefs defined inside this class. TYPEDEF_FIELD_LIST contains head of
+ a NULL terminated list of TYPEDEF_FIELD_LIST_COUNT elements. */
+ struct typedef_field_list
+ {
+ struct typedef_field field;
+ struct typedef_field_list *next;
+ }
+ *typedef_field_list;
+ unsigned typedef_field_list_count;
};
/* One item on the queue of compilation units to read in full symbols
@@ -5075,6 +5085,39 @@ dwarf2_add_field (struct field_info *fip
}
}
+/* Add a typedef defined in the scope of the FIP's class. */
+
+static void
+dwarf2_add_typedef (struct field_info *fip, struct die_info *die,
+ struct dwarf2_cu *cu)
+{
+ struct objfile *objfile = cu->objfile;
+ struct gdbarch *gdbarch = get_objfile_arch (objfile);
+ struct typedef_field_list *new_field;
+ struct attribute *attr;
+ struct typedef_field *fp;
+ char *fieldname = "";
+
+ /* Allocate a new field list entry and link it in. */
+ new_field = xzalloc (sizeof (*new_field));
+ make_cleanup (xfree, new_field);
+
+ gdb_assert (die->tag == DW_TAG_typedef);
+
+ fp = &new_field->field;
+
+ /* Get name of field. */
+ fp->name = dwarf2_name (die, cu);
+ if (fp->name == NULL)
+ return;
+
+ fp->type = read_type_die (die, cu);
+
+ new_field->next = fip->typedef_field_list;
+ fip->typedef_field_list = new_field;
+ fip->typedef_field_list_count++;
+}
+
/* Create the vector of fields, and attach it to the type. */
static void
@@ -5600,6 +5643,8 @@ read_structure_type (struct die_info *di
/* C++ base class field. */
dwarf2_add_field (&fi, child_die, cu);
}
+ else if (child_die->tag == DW_TAG_typedef)
+ dwarf2_add_typedef (&fi, child_die, cu);
child_die = sibling_die (child_die);
}
@@ -5673,6 +5718,28 @@ read_structure_type (struct die_info *di
}
}
}
+
+ /* Copy fi.typedef_field_list linked list elements content into the
+ allocated array TYPE_TYPEDEF_FIELD_ARRAY (type). */
+ if (fi.typedef_field_list)
+ {
+ int i = fi.typedef_field_list_count;
+
+ TYPE_TYPEDEF_FIELD_ARRAY (type)
+ = TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
+ TYPE_TYPEDEF_FIELD_COUNT (type) = i;
+
+ /* Reverse the list order to keep the debug info elements order. */
+ while (--i >= 0)
+ {
+ struct typedef_field *dest, *src;
+
+ dest = &TYPE_TYPEDEF_FIELD (type, i);
+ src = &fi.typedef_field_list->field;
+ fi.typedef_field_list = fi.typedef_field_list->next;
+ *dest = *src;
+ }
+ }
}
quirk_gcc_member_function_pointer (type, cu->objfile);
Index: gdb-7.1/gdb/gdbtypes.h
===================================================================
--- gdb-7.1.orig/gdb/gdbtypes.h 2010-06-29 17:54:17.000000000 +0200
+++ gdb-7.1/gdb/gdbtypes.h 2010-06-29 18:18:29.000000000 +0200
@@ -948,6 +948,19 @@ struct cplus_struct_type
member functions or virtual base classes. Minus one if not
dynamic. Zero if not yet computed. */
int is_dynamic : 2;
+
+ /* typedefs defined inside this class. TYPEDEF_FIELD points to an array of
+ TYPEDEF_FIELD_COUNT elements. */
+ struct typedef_field
+ {
+ /* Unqualified name to be prefixed by owning class qualified name. */
+ const char *name;
+
+ /* Type this typedef named NAME represents. */
+ struct type *type;
+ }
+ *typedef_field;
+ unsigned typedef_field_count;
};
/* Struct used for ranking a function for overload resolution */
@@ -1182,6 +1195,17 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_LOCALTYPE_FILE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->file)
#define TYPE_LOCALTYPE_LINE(thistype) (TYPE_CPLUS_SPECIFIC(thistype)->localtype_ptr->line)
+#define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \
+ TYPE_CPLUS_SPECIFIC (thistype)->typedef_field
+#define TYPE_TYPEDEF_FIELD(thistype, n) \
+ TYPE_CPLUS_SPECIFIC (thistype)->typedef_field[n]
+#define TYPE_TYPEDEF_FIELD_NAME(thistype, n) \
+ TYPE_TYPEDEF_FIELD (thistype, n).name
+#define TYPE_TYPEDEF_FIELD_TYPE(thistype, n) \
+ TYPE_TYPEDEF_FIELD (thistype, n).type
+#define TYPE_TYPEDEF_FIELD_COUNT(thistype) \
+ TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
+
#define TYPE_IS_OPAQUE(thistype) (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) || \
(TYPE_CODE (thistype) == TYPE_CODE_UNION)) && \
(TYPE_NFIELDS (thistype) == 0) && \
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 18:17:17.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace.exp 2010-06-29 18:18:58.000000000 +0200
@@ -332,6 +332,21 @@ cp_test_ptype_class \
}
gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"."
+# Test class typedefs printing.
+set expect "type = class C::OtherFileClass \{\r\n.*\r\n *typedef short cOtherFileClassType;\r\n *typedef long cOtherFileClassType2;\r\n\}"
+if {[test_compiler_info {gcc-[0-3]-*}]
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
+ # The type in class is missing in older GCCs.
+ setup_xfail *-*-*
+}
+gdb_test "ptype OtherFileClass" $expect "ptype OtherFileClass typedefs"
+if {[test_compiler_info {gcc-[0-3]-*}]
+ || [test_compiler_info {gcc-4-[0-4]-*}]} {
+ # The type in class is missing in older GCCs.
+ setup_xfail *-*-*
+}
+gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs"
+
# Some anonymous namespace tests.
gdb_test "print cX" "\\$\[0-9\].* = 6"
Index: gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/namespace1.cc 2010-06-29 17:56:42.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/namespace1.cc 2010-06-29 18:17:48.000000000 +0200
@@ -23,12 +23,14 @@ namespace C
int z;
typedef short cOtherFileClassType;
+ typedef long cOtherFileClassType2;
static const cOtherFileClassType cOtherFileClassVar = 318;
+ static const cOtherFileClassType2 cOtherFileClassVar2 = 320;
cOtherFileClassType cOtherFileClassVar_use ();
};
OtherFileClass::cOtherFileClassType OtherFileClass::cOtherFileClassVar_use ()
{
- return cOtherFileClassVar;
+ return cOtherFileClassVar + cOtherFileClassVar2;
}
namespace {
@@ -45,10 +47,12 @@ namespace C
}
typedef short cOtherFileType;
+ typedef long cOtherFileType2;
static const cOtherFileType cOtherFileVar = 319;
+ static const cOtherFileType2 cOtherFileVar2 = 321;
cOtherFileType cOtherFileVar_use ()
{
- return cOtherFileVar;
+ return cOtherFileVar + cOtherFileVar2;
}
}
Index: gdb-7.1/gdb/testsuite/gdb.cp/userdef.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/userdef.exp 2010-06-29 17:54:11.000000000 +0200
+++ gdb-7.1/gdb/testsuite/gdb.cp/userdef.exp 2010-06-29 18:17:48.000000000 +0200
@@ -154,7 +154,7 @@ gdb_test "break A2::'operator +'" ".*Bre
gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}"
gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}"
gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex"
-gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\]+} &\\*"
+gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \]+int z;\[\r\n\].*} &\\*"
gdb_test "print operator== (mem1, mem2)" " = false"
gdb_test "print operator== (mem1, mem1)" " = true"

View File

@ -1,38 +0,0 @@
commit 477c1359b217cdc052a7c9f83cae9c894396894c
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Jun 28 22:03:31 2010 +0000
gdb/
* dwarf2read.c (read_structure_type) <fi.typedef_field_list>: Call
ALLOCATE_CPLUS_STRUCT_TYPE.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,8 @@
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwarf2read.c (read_structure_type) <fi.typedef_field_list>: Call
+ ALLOCATE_CPLUS_STRUCT_TYPE.
+
2010-06-28 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
## -27,8 +32,6 @@
* python/py-inferior.c: New File.
* python/py-infthread.c: New File.
-
-
2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* c-typeprint.c (c_type_print_base): For no fields check include also
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5327,6 +5327,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
{
int i = fi.typedef_field_list_count;
+ ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_TYPEDEF_FIELD_ARRAY (type)
= TYPE_ALLOC (type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * i);
TYPE_TYPEDEF_FIELD_COUNT (type) = i;

View File

@ -1,214 +0,0 @@
commit 78c144e8c3ae7bb36d632f6bfaaaad9c97199ce6
Author: cmoller <cmoller>
Date: Tue Apr 20 20:22:09 2010 +0000
PR 10867
* cp-valprint.c (global): Adding new static array recursion
detection obstack.
(cp_print_value_fields, cp_print_static_field): Added new static
array recursion detection code.
* gdb.cp/Makefile.in (EXECUTABLES): Added pr10687
* gdb.cp/pr10687.cc: New file.
* gdb.cp/pr10687.exp: New file
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,12 @@
+2010-04-20 Chris Moller <cmoller@redhat.com>
+
+ PR 10867
+
+ * cp-valprint.c (global): Adding new static array recursion
+ detection obstack.
+ (cp_print_value_fields, cp_print_static_field): Added new static
+ array recursion detection code.
+
2010-04-20 Mark Kettenis <kettenis@gnu.org>
* i386-linux-tdep.c (i386_linux_regset_sections): Size of the
Index: gdb-7.1/gdb/cp-valprint.c
===================================================================
--- gdb-7.1.orig/gdb/cp-valprint.c 2010-02-08 19:04:16.000000000 +0100
+++ gdb-7.1/gdb/cp-valprint.c 2010-06-28 20:21:53.000000000 +0200
@@ -71,6 +71,7 @@ show_static_field_print (struct ui_file
static struct obstack dont_print_vb_obstack;
static struct obstack dont_print_statmem_obstack;
+static struct obstack dont_print_stat_array_obstack;
extern void _initialize_cp_valprint (void);
@@ -155,12 +156,17 @@ cp_print_value_fields (struct type *type
{
int i, len, n_baseclasses;
int fields_seen = 0;
+ static int last_set_recurse = -1;
CHECK_TYPEDEF (type);
- if (recurse == 0
- && obstack_object_size (&dont_print_statmem_obstack) > 0)
- obstack_free (&dont_print_statmem_obstack, NULL);
+ if (recurse == 0)
+ {
+ if (obstack_object_size (&dont_print_statmem_obstack) > 0)
+ obstack_free (&dont_print_statmem_obstack, NULL);
+ if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
+ obstack_free (&dont_print_stat_array_obstack, NULL);
+ }
fprintf_filtered (stream, "{");
len = TYPE_NFIELDS (type);
@@ -181,12 +187,20 @@ cp_print_value_fields (struct type *type
else
{
void *statmem_obstack_top = NULL;
+ void *stat_array_obstack_top = NULL;
if (dont_print_statmem == 0)
{
/* Set the current printed-statics stack top. */
statmem_obstack_top
= obstack_next_free (&dont_print_statmem_obstack);
+
+ if (last_set_recurse != recurse)
+ {
+ stat_array_obstack_top
+ = obstack_next_free (&dont_print_stat_array_obstack);
+ last_set_recurse = recurse;
+ }
}
for (i = n_baseclasses; i < len; i++)
@@ -307,9 +321,16 @@ cp_print_value_fields (struct type *type
if (dont_print_statmem == 0)
{
- /* In effect, a pop of the printed-statics stack. */
if (obstack_object_size (&dont_print_statmem_obstack) > 0)
obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
+
+ if (last_set_recurse != recurse)
+ {
+ if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
+ obstack_free (&dont_print_stat_array_obstack,
+ stat_array_obstack_top);
+ last_set_recurse = -1;
+ }
}
if (options->pretty)
@@ -508,6 +529,7 @@ cp_print_static_field (struct type *type
const struct value_print_options *options)
{
struct value_print_options opts;
+
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
CORE_ADDR *first_dont_print;
@@ -542,6 +564,32 @@ cp_print_static_field (struct type *type
return;
}
+ if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ {
+ struct type **first_dont_print;
+ int i;
+ struct type *target_type = TYPE_TARGET_TYPE (type);
+
+ first_dont_print
+ = (struct type **) obstack_base (&dont_print_stat_array_obstack);
+ i = obstack_object_size (&dont_print_stat_array_obstack)
+ / sizeof (CORE_ADDR);
+
+ while (--i >= 0)
+ {
+ if (target_type == first_dont_print[i])
+ {
+ fputs_filtered ("<same as static member of an already"
+ " seen type>",
+ stream);
+ return;
+ }
+ }
+
+ obstack_grow (&dont_print_stat_array_obstack, (char *) &target_type,
+ sizeof (struct type *));
+ }
+
opts = *options;
opts.deref_ref = 0;
val_print (type, value_contents_all (val),
@@ -672,6 +720,7 @@ Show printing of object's derived type b
show_objectprint,
&setprintlist, &showprintlist);
+ obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (CORE_ADDR));
obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
}
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr10687.cc
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr10687.cc 2010-06-28 20:21:53.000000000 +0200
@@ -0,0 +1,24 @@
+class vec2
+{
+ public:
+ vec2() { _v[0] = _v[1] = 0; }
+ vec2(int x, int y) { _v[0] = x; _v[1] = y; }
+ static vec2 axis[2];
+ static vec2 axis6[6];
+ private:
+ int _v[2];
+};
+
+vec2 vec2::axis[2] = { vec2(1,0), vec2(0,1) };
+vec2 vec2::axis6[6] = {
+ vec2(1,0), vec2(0,1),
+ vec2(2,0), vec2(0,2),
+ vec2(3,0), vec2(0,3)
+};
+
+int main(int argc, char*argv[])
+{
+ vec2 a;
+
+ return 0; // marker
+}
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr10687.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr10687.exp 2010-06-28 20:21:53.000000000 +0200
@@ -0,0 +1,31 @@
+#Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile pr10687
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+ return -1
+}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "marker"]
+gdb_continue_to_breakpoint "marker"
+
+gdb_test "p a" "{static axis = {{static axis = <same as static member of an already.*"
+

View File

@ -1,163 +0,0 @@
commit d54f5671e190a5c0ca8fd1ff070372bf20eb42a8
Author: cmoller <cmoller>
Date: Wed Apr 21 17:33:51 2010 +0000
PR 9167
* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
method of popping recursion-detection stack with a method based on
obstack_object_size().
* gdb.cp/Makefile.in (EXECUTABLES): Added pr9167.
* gdb.cp/pr9167.cc: New file.
* gdb.cp/pr9167.exp: New file.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,10 @@
+2010-04-21 Chris Moller <cmoller@redhat.com>
+
+ PR 9167
+ * cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
+ method of popping recursion-detection stack with a method based on
+ obstack_object_size().
+
2010-04-21 Pierre Muller <muller@ics.u-strasbg.fr>
PR pascal/11492.
## -3184,7 +3191,7 @@
addr_bit. Adjust LOAD_ADDR sign for cross-arch inferiors.
2010-02-17 Tristan Gingold <gingold@adacore.com>
- Petr Hluzín <petr.hluzin@gmail.com>
+ Petr Hluzín <petr.hluzin@gmail.com>
* avr-tdep.c (avr_scan_prologue): Convert an if statement to a
gdb_assert. Fix info->size for SIG prologue.
Index: gdb-7.1/gdb/cp-valprint.c
===================================================================
--- gdb-7.1.orig/gdb/cp-valprint.c 2010-06-28 20:21:53.000000000 +0200
+++ gdb-7.1/gdb/cp-valprint.c 2010-06-28 20:22:16.000000000 +0200
@@ -186,14 +186,13 @@ cp_print_value_fields (struct type *type
fprintf_filtered (stream, "<No data fields>");
else
{
- void *statmem_obstack_top = NULL;
+ int obstack_initial_size = 0;
void *stat_array_obstack_top = NULL;
if (dont_print_statmem == 0)
{
- /* Set the current printed-statics stack top. */
- statmem_obstack_top
- = obstack_next_free (&dont_print_statmem_obstack);
+ obstack_initial_size =
+ obstack_object_size (&dont_print_statmem_obstack);
if (last_set_recurse != recurse)
{
@@ -321,8 +320,19 @@ cp_print_value_fields (struct type *type
if (dont_print_statmem == 0)
{
- if (obstack_object_size (&dont_print_statmem_obstack) > 0)
- obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
+ int obstack_final_size =
+ obstack_object_size (&dont_print_statmem_obstack);
+
+ if (obstack_final_size > obstack_initial_size) {
+ /* In effect, a pop of the printed-statics stack. */
+
+ void *free_to_ptr =
+ obstack_next_free (&dont_print_statmem_obstack) -
+ (obstack_final_size - obstack_initial_size);
+
+ obstack_free (&dont_print_statmem_obstack,
+ free_to_ptr);
+ }
if (last_set_recurse != recurse)
{
@@ -555,7 +565,6 @@ cp_print_static_field (struct type *type
addr = value_address (val);
obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
sizeof (CORE_ADDR));
-
CHECK_TYPEDEF (type);
cp_print_value_fields (type, value_enclosing_type (val),
value_contents_all (val),
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr9167.cc
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr9167.cc 2010-06-28 20:22:16.000000000 +0200
@@ -0,0 +1,36 @@
+#include <iostream>
+
+template<typename DATA>
+struct ATB
+{
+ int data;
+ ATB() : data(0) {}
+};
+
+
+template<typename DATA,
+ typename DerivedType >
+class A : public ATB<DATA>
+{
+public:
+ static DerivedType const DEFAULT_INSTANCE;
+};
+
+template<typename DATA, typename DerivedType>
+const DerivedType A<DATA, DerivedType>::DEFAULT_INSTANCE;
+
+class B : public A<int, B>
+{
+
+};
+
+int main()
+{
+ B b;
+ // If this if-block is removed then GDB shall
+ // not infinitely recurse when trying to print b.
+
+ return 0; // marker
+}
+
+
Index: gdb-7.1/gdb/testsuite/gdb.cp/pr9167.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.1/gdb/testsuite/gdb.cp/pr9167.exp 2010-06-28 20:22:16.000000000 +0200
@@ -0,0 +1,31 @@
+#Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set testfile pr9167
+set srcfile ${testfile}.cc
+if [prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}] {
+ return -1
+}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return
+}
+
+gdb_breakpoint [gdb_get_line_number "marker"]
+gdb_continue_to_breakpoint "marker"
+
+gdb_test "p b" "{<A<int, B>> = {<ATB<int>> = {data = 0}, static DEFAULT_INSTANCE = <optimized out>}, <No data fields>}"
+

View File

@ -1,85 +0,0 @@
commit 407cb192dcac2602aebaa7e262419adb580ecca6
Author: cmoller <cmoller>
Date: Thu Apr 22 20:12:06 2010 +0000
* cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
method of popping recursion-detection stack with a method based on
obstack_object_size(). (Similar to the PR9167 patch below, but for
the static array obstack rather than the static member obstack.)
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,10 @@
+2010-04-22 Chris Moller <cmoller@redhat.com>
+
+ * cp-valprint.c (cp_print_value_fields): Replaced obstack_base()
+ method of popping recursion-detection stack with a method based on
+ obstack_object_size(). (Similar to the PR9167 patch below, but for
+ the static array obstack rather than the static member obstack.)
+
2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
* amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Removed.
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -186,18 +186,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
fprintf_filtered (stream, "<No data fields>");
else
{
- int obstack_initial_size = 0;
- void *stat_array_obstack_top = NULL;
+ int statmem_obstack_initial_size = 0;
+ int stat_array_obstack_initial_size = 0;
if (dont_print_statmem == 0)
{
- obstack_initial_size =
+ statmem_obstack_initial_size =
obstack_object_size (&dont_print_statmem_obstack);
if (last_set_recurse != recurse)
{
- stat_array_obstack_top
- = obstack_next_free (&dont_print_stat_array_obstack);
+ stat_array_obstack_initial_size =
+ obstack_object_size (&dont_print_stat_array_obstack);
last_set_recurse = recurse;
}
}
@@ -323,12 +323,12 @@ cp_print_value_fields (struct type *type, struct type *real_type,
int obstack_final_size =
obstack_object_size (&dont_print_statmem_obstack);
- if (obstack_final_size > obstack_initial_size) {
+ if (obstack_final_size > statmem_obstack_initial_size) {
/* In effect, a pop of the printed-statics stack. */
void *free_to_ptr =
obstack_next_free (&dont_print_statmem_obstack) -
- (obstack_final_size - obstack_initial_size);
+ (obstack_final_size - statmem_obstack_initial_size);
obstack_free (&dont_print_statmem_obstack,
free_to_ptr);
@@ -336,9 +336,18 @@ cp_print_value_fields (struct type *type, struct type *real_type,
if (last_set_recurse != recurse)
{
- if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
- obstack_free (&dont_print_stat_array_obstack,
- stat_array_obstack_top);
+ int obstack_final_size =
+ obstack_object_size (&dont_print_stat_array_obstack);
+
+ if (obstack_final_size > stat_array_obstack_initial_size)
+ {
+ void *free_to_ptr =
+ obstack_next_free (&dont_print_stat_array_obstack) -
+ (obstack_final_size - stat_array_obstack_initial_size);
+
+ obstack_free (&dont_print_stat_array_obstack,
+ free_to_ptr);
+ }
last_set_recurse = -1;
}
}

View File

@ -1,42 +0,0 @@
commit 744735550d4a4fd6d4be40776069d799dca5ee39
Author: Ulrich Weigand <uweigand@de.ibm.com>
Date: Mon Jun 14 16:09:55 2010 +0000
* cp-valprint.c (cp_print_static_field): Members of
dont_print_stat_array_obstack are of type "struct type *".
(_initialize_cp_valprint): Likewise.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,5 +1,11 @@
2010-06-14 Ulrich Weigand <uweigand@de.ibm.com>
+ * cp-valprint.c (cp_print_static_field): Members of
+ dont_print_stat_array_obstack are of type "struct type *".
+ (_initialize_cp_valprint): Likewise.
+
+2010-06-14 Ulrich Weigand <uweigand@de.ibm.com>
+
* frame.c (frame_register_unwind): Do not access contents
of "optimized out" unwound register value.
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -615,7 +615,7 @@ cp_print_static_field (struct type *type,
first_dont_print
= (struct type **) obstack_base (&dont_print_stat_array_obstack);
i = obstack_object_size (&dont_print_stat_array_obstack)
- / sizeof (CORE_ADDR);
+ / sizeof (struct type *);
while (--i >= 0)
{
@@ -764,7 +764,7 @@ Show printing of object's derived type based on vtable info."), NULL,
show_objectprint,
&setprintlist, &showprintlist);
- obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (CORE_ADDR));
+ obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (struct type *));
obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
}

View File

@ -1,202 +0,0 @@
commit 47c8c764a9be6d023eca450336e6d9de16970fc0
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Jun 28 16:59:43 2010 +0000
gdb/
* cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
obstack_begin after each obstack_free.
gdb/testsuite/
* gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,8 @@
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * cp-valprint.c (cp_print_value_fields) <recurse == 0>: Call
+ obstack_begin after each obstack_free.
+
2010-06-27 Doug Evans <dje@google.com>
* value.c (value_static_field): Use `switch' instead of `if'.
## -12,27 +17,27 @@
2010-06-25 Paul Hilfinger <hilfinger@adacore.com>
- * defs.h (make_command_stats_cleanup): Declare.
- (set_display_time): Declare.
- (set_display_space): Declare.
- * event-top.c (command_handler): Use make_command_stats_cleanup.
- * main.c (display_time, display_space): Move definitions to utils.c.
- (captured_main): Use make_command_stats_cleanup to get start-up
- statistics.
- Use set_display_time and set_display_space for processing OPT_STATISTICS
- case.
- * maint.c (maintenance_time_display): Use set_display_time.
- (maintenance_space_display): Use set_display_space.
- * top.c (execute_command): Remove obsolete 'maint time' code.
- (command_loop): Use make_command_stats_cleanup.
- * utils.c (struct cmd_stats): Structure for storing initial time
- and space usage.
- (display_time, display_space): Move definitions here from utils.c.
- (set_display_time): New function.
- (set_display_space): New function.
- (make_command_stats_cleanup): New function.
- (report_command_stats): New auxiliary function for
- make_command_stats_cleanup.
+ * defs.h (make_command_stats_cleanup): Declare.
+ (set_display_time): Declare.
+ (set_display_space): Declare.
+ * event-top.c (command_handler): Use make_command_stats_cleanup.
+ * main.c (display_time, display_space): Move definitions to utils.c.
+ (captured_main): Use make_command_stats_cleanup to get start-up
+ statistics.
+ Use set_display_time and set_display_space for processing OPT_STATISTICS
+ case.
+ * maint.c (maintenance_time_display): Use set_display_time.
+ (maintenance_space_display): Use set_display_space.
+ * top.c (execute_command): Remove obsolete 'maint time' code.
+ (command_loop): Use make_command_stats_cleanup.
+ * utils.c (struct cmd_stats): Structure for storing initial time
+ and space usage.
+ (display_time, display_space): Move definitions here from utils.c.
+ (set_display_time): New function.
+ (set_display_space): New function.
+ (make_command_stats_cleanup): New function.
+ (report_command_stats): New auxiliary function for
+ make_command_stats_cleanup.
2010-06-25 Ulrich Weigand <uweigand@de.ibm.com>
## -6103,7 +6108,7 @@
PR gdb/9067
* cp-valprint.c (cp_print_value_fields) Fix use of obstacks.
- cp_print_static_field) Fix use of obstacks.
+ (cp_print_static_field) Fix use of obstacks.
2010-02-08 Pedro Alves <pedro@codesourcery.com>
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -164,10 +164,19 @@ cp_print_value_fields (struct type *type, struct type *real_type,
if (recurse == 0)
{
+ /* Any object can be left on obstacks only during an unexpected error. */
+
if (obstack_object_size (&dont_print_statmem_obstack) > 0)
- obstack_free (&dont_print_statmem_obstack, NULL);
+ {
+ obstack_free (&dont_print_statmem_obstack, NULL);
+ obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
+ }
if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
- obstack_free (&dont_print_stat_array_obstack, NULL);
+ {
+ obstack_free (&dont_print_stat_array_obstack, NULL);
+ obstack_begin (&dont_print_stat_array_obstack,
+ 32 * sizeof (struct type *));
+ }
}
fprintf_filtered (stream, "{");
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,3 +1,7 @@
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New.
+
2010-06-28 Doug Evans <dje@google.com>
* gdb.base/break-interp.exp (reach): Relax expected output a bit.
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/static-print-quit.cc
@@ -0,0 +1,32 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+class D
+ {
+ public:
+ int loooooooooooooooooooooooooooooooooooooooooooooong;
+ };
+
+class C
+ {
+ public:
+ int loooooooooooooooooooooooooooooooooooooooooooooong;
+ static D field;
+ };
+
+D C::field;
+C c;
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/static-print-quit.exp
@@ -0,0 +1,50 @@
+# Copyright 2010 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_cplus_tests] } { continue }
+
+set testfile static-print-quit
+set srcfile ${testfile}.cc
+set executable $testfile.o
+set objfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile $srcdir/$subdir/$srcfile $objfile object {debug c++}] != ""} {
+ untested ${testfile}.exp
+ return -1
+}
+
+clean_restart $executable
+
+gdb_test "set width 80"
+gdb_test "set height 2"
+
+set test "print c"
+gdb_test_multiple $test $test {
+ -re " = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n---Type <return> to continue, or q <return> to quit---$" {
+ pass $test
+ }
+ -re " to quit---$" {
+ fail $test
+ return -1
+ }
+}
+
+gdb_test "q" ".*"
+
+# Now the obstack is uninitialized. Excercise it.
+
+gdb_test "set pagination off"
+gdb_test "print c" ".*" "first print"
+gdb_test "print c" ".*" "second print"

View File

@ -1,106 +0,0 @@
commit bb604f9e70de515b13e2a935d8ad9d2fb0290849
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Mon Jun 28 20:12:52 2010 +0000
gdb/
Fix modification of cplus_struct_default.
* dwarf2read.c (dwarf2_add_member_fn) <no DW_AT_vtable_elem_location>:
Call ALLOCATE_CPLUS_STRUCT_TYPE.
<removed>
* gdbtypes.c (cplus_struct_default): New empty initializer, comment it.
</removed>
gdb/testsuite/
* gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data)
(main) <rtti_data>: New.
* gdb.cp/virtbase.exp (print rtti_data): New.
### a/gdb/ChangeLog
### b/gdb/ChangeLog
## -1,3 +1,10 @@
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix modification of cplus_struct_default.
+ * dwarf2read.c (dwarf2_add_member_fn) <no DW_AT_vtable_elem_location>:
+ Call ALLOCATE_CPLUS_STRUCT_TYPE.
+ * gdbtypes.c (cplus_struct_default): New empty initializer, comment it.
+
### a/gdb/testsuite/ChangeLog
### b/gdb/testsuite/ChangeLog
## -1,4 +1,10 @@
+2010-06-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data)
+ (main) <rtti_data>: New.
+ * gdb.cp/virtbase.exp (print rtti_data): New.
+
###--- a/gdb/gdbtypes.c
###+++ b/gdb/gdbtypes.c
###@@ -1733,7 +1733,8 @@ check_stub_method_group (struct type *type, int method_id)
### }
### }
###
###-const struct cplus_struct_type cplus_struct_default;
###+/* Ensure it is in .rodata (if available) by workarounding GCC PR 44690. */
###+const struct cplus_struct_type cplus_struct_default = { };
###
### void
### allocate_cplus_struct_type (struct type *type)
Index: gdb-7.1/gdb/dwarf2read.c
===================================================================
--- gdb-7.1.orig/gdb/dwarf2read.c 2010-06-29 18:26:47.000000000 +0200
+++ gdb-7.1/gdb/dwarf2read.c 2010-06-29 18:39:43.000000000 +0200
@@ -5404,6 +5404,7 @@ dwarf2_add_member_fn (struct field_info
complaint (&symfile_complaints,
_("Member function \"%s\" (offset %d) is virtual but the vtable offset is not specified"),
fieldname, die->offset);
+ ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_CPLUS_DYNAMIC (type) = 1;
}
}
Index: gdb-7.1/gdb/testsuite/gdb.cp/virtbase.cc
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/virtbase.cc 2010-02-03 00:40:28.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.cp/virtbase.cc 2010-06-29 18:39:43.000000000 +0200
@@ -74,8 +74,19 @@ public:
virtual void b() {}
};
+class RTTI_base
+{
+public:
+ virtual ~RTTI_base() {}
+};
-
+class RTTI_data
+{
+public:
+ RTTI_base base;
+ int data;
+ RTTI_data() : data(1) {}
+};
int main() {
ph::Derived tst;
@@ -84,6 +95,7 @@ int main() {
E *e = new E;
RHB *b = new RHC();
+ RTTI_data rtti_data;
return 0; // breakpoint 3
}
Index: gdb-7.1/gdb/testsuite/gdb.cp/virtbase.exp
===================================================================
--- gdb-7.1.orig/gdb/testsuite/gdb.cp/virtbase.exp 2010-02-04 22:04:30.000000000 +0100
+++ gdb-7.1/gdb/testsuite/gdb.cp/virtbase.exp 2010-06-29 18:39:56.000000000 +0200
@@ -60,3 +60,8 @@ gdb_test "print *(D *) e" " = {<C> = {v
# https://bugzilla.redhat.com/show_bug.cgi?id=560741
gdb_test "set print object on" ""
gdb_test "print/x b->mA" " = 0xaaaaaaaa"
+
+# A regression test reported to Red Hat bugzilla, see:
+# https://bugzilla.redhat.com/show_bug.cgi?id=606660
+# `set print object on' is expected.
+gdb_test "print rtti_data" " = .*, data = 1\}"

View File

@ -33,9 +33,11 @@ gdb/
[ Context backport. ]
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1097,8 +1097,18 @@ svr4_current_sos (void)
Index: gdb-7.1.90.20100711/gdb/solib-svr4.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/solib-svr4.c 2010-07-12 23:07:35.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/solib-svr4.c 2010-07-13 00:19:03.000000000 +0200
@@ -1177,8 +1177,18 @@ svr4_current_sos (void)
target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
@ -56,9 +58,11 @@ gdb/
else
{
struct build_id *build_id;
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -538,6 +538,7 @@ update_solib_list (int from_tty, struct target_ops *target)
Index: gdb-7.1.90.20100711/gdb/solib.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/solib.c 2010-05-17 01:49:58.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/solib.c 2010-07-13 00:21:01.000000000 +0200
@@ -705,6 +705,7 @@ update_solib_list (int from_tty, struct
struct target_so_ops *ops = solib_ops (target_gdbarch);
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
@ -66,17 +70,16 @@ gdb/
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
@@ -668,6 +669,12 @@ update_solib_list (int from_tty, struct target_ops *target)
@@ -844,6 +845,12 @@ Error while mapping shared library secti
observer_notify_solib_loaded (i);
}
}
+
+ /* If this was the very first DSO list scan and we possibly read in ld.so
+ recheck all the formerly unreadable DSO names strings. */
+
+ if (saved_so_list_head == NULL && so_list_head != NULL)
+ update_solib_list (from_tty, target);
}
+ /* If this was the very first DSO list scan and we possibly read in ld.so
+ recheck all the formerly unreadable DSO names strings. */
+
+ if (saved_so_list_head == NULL && so_list_head != NULL)
+ return update_solib_list (from_tty, target);
+
/* If a library was not found, issue an appropriate warning
message. We have to use a single call to warning in case the
front end does something special with warnings, e.g., pop up

View File

@ -1,6 +1,8 @@
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -55,20 +55,6 @@ typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR;
Index: gdb-7.1.90.20100711/gdb/f-lang.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/f-lang.c 2010-06-03 00:41:55.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/f-lang.c 2010-07-13 00:24:04.000000000 +0200
@@ -56,20 +56,6 @@ typedef struct saved_bf_symnum SAVED_BF,
/* Local functions */
extern void _initialize_f_language (void);
@ -21,7 +23,7 @@
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)
@@ -458,185 +444,7 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
@ -207,7 +209,7 @@
/* 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)
@@ -659,193 +467,3 @@ find_common_for_function (char *name, ch
}
return (NULL);
}
@ -401,9 +403,11 @@
- 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;
Index: gdb-7.1.90.20100711/gdb/f-lang.h
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/f-lang.h 2010-07-12 23:07:33.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/f-lang.h 2010-07-13 00:24:04.000000000 +0200
@@ -76,14 +76,9 @@ typedef struct saved_f77_common SAVED_F7
typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR;
extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */
@ -418,8 +422,10 @@
#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
Index: gdb-7.1.90.20100711/gdb/f-valprint.c
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/f-valprint.c 2010-07-12 23:07:33.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/f-valprint.c 2010-07-13 00:24:25.000000000 +0200
@@ -35,10 +35,6 @@
#include "command.h"
#include "block.h"
@ -431,7 +437,7 @@
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)
@@ -601,67 +597,6 @@ info_common_command (char *comname, int
comname, funname);
}
@ -484,7 +490,7 @@
- else
- {
- struct minimal_symbol *msymbol =
- lookup_minimal_symbol_by_pc (fi->pc);
- lookup_minimal_symbol_by_pc (fi->pc);
-
- if (msymbol != NULL)
- funname = SYMBOL_LINKAGE_NAME (msymbol);

View File

@ -1,8 +1,8 @@
Index: gdb-7.0.50.20100128/gdb/dwarf2read.c
Index: gdb-7.1.90.20100711/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
--- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-13 00:13:02.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:26:25.000000000 +0200
@@ -5727,12 +5727,14 @@ read_set_type (struct die_info *die, str
return set_die_type (die, set_type, cu);
}
@ -19,7 +19,7 @@ Index: gdb-7.0.50.20100128/gdb/dwarf2read.c
struct attribute *attr;
struct symbol *sym;
CORE_ADDR base = (CORE_ADDR) 0;
@@ -5848,10 +5850,40 @@ read_common_block (struct die_info *die,
@@ -5757,10 +5759,40 @@ read_common_block (struct die_info *die,
}
if (die->child != NULL)
{
@ -60,7 +60,7 @@ Index: gdb-7.0.50.20100128/gdb/dwarf2read.c
attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
if (attr)
{
@@ -5869,8 +5901,25 @@ read_common_block (struct die_info *die,
@@ -5778,8 +5810,25 @@ read_common_block (struct die_info *die,
SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
add_symbol_to_list (sym, &global_symbols);
}
@ -86,7 +86,7 @@ Index: gdb-7.0.50.20100128/gdb/dwarf2read.c
}
}
@@ -9061,6 +9110,13 @@ new_symbol (struct die_info *die, struct
@@ -9106,6 +9155,13 @@ new_symbol (struct die_info *die, struct
{
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
@ -100,8 +100,8 @@ Index: gdb-7.0.50.20100128/gdb/dwarf2read.c
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;
@@ -9277,6 +9333,11 @@ new_symbol (struct die_info *die, struct
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
add_symbol_to_list (sym, &global_symbols);
break;
+ case DW_TAG_common_block:
@ -112,11 +112,11 @@ Index: gdb-7.0.50.20100128/gdb/dwarf2read.c
default:
/* Not a tag we recognize. Hopefully we aren't processing
trash data, but since we must specifically ignore things
Index: gdb-7.0.50.20100128/gdb/f-lang.c
Index: gdb-7.1.90.20100711/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)
--- gdb-7.1.90.20100711.orig/gdb/f-lang.c 2010-07-13 00:24:04.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/f-lang.c 2010-07-13 00:25:56.000000000 +0200
@@ -443,27 +443,3 @@ _initialize_f_language (void)
add_language (&f_language_defn);
}
@ -144,11 +144,11 @@ Index: gdb-7.0.50.20100128/gdb/f-lang.c
- }
- return (NULL);
-}
Index: gdb-7.0.50.20100128/gdb/f-lang.h
Index: gdb-7.1.90.20100711/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
--- gdb-7.1.90.20100711.orig/gdb/f-lang.h 2010-07-13 00:24:04.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/f-lang.h 2010-07-13 00:25:56.000000000 +0200
@@ -52,36 +52,8 @@ enum f90_range_type
NONE_BOUND_DEFAULT /* "(low:high)" */
};
@ -185,10 +185,10 @@ Index: gdb-7.0.50.20100128/gdb/f-lang.h
/* When reasonable array bounds cannot be fetched, such as when
you ask to 'mt print symbols' and there is no stack frame and
Index: gdb-7.0.50.20100128/gdb/f-valprint.c
Index: gdb-7.1.90.20100711/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
--- gdb-7.1.90.20100711.orig/gdb/f-valprint.c 2010-07-13 00:24:25.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/f-valprint.c 2010-07-13 00:32:05.000000000 +0200
@@ -34,6 +34,8 @@
#include "gdbcore.h"
#include "command.h"
@ -198,7 +198,7 @@ Index: gdb-7.0.50.20100128/gdb/f-valprint.c
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
@@ -486,22 +488,54 @@ f_val_print (struct type *type, const gd
return 0;
}
@ -266,7 +266,7 @@ Index: gdb-7.0.50.20100128/gdb/f-valprint.c
}
/* This function is used to print out the values in a given COMMON
@@ -501,11 +535,9 @@ list_all_visible_commons (char *funname)
@@ -511,11 +545,9 @@ list_all_visible_commons (char *funname)
static void
info_common_command (char *comname, int from_tty)
{
@ -280,7 +280,7 @@ Index: gdb-7.0.50.20100128/gdb/f-valprint.c
/* 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
@@ -527,74 +559,31 @@ info_common_command (char *comname, int
/* The following is generally ripped off from stack.c's routine
print_frame_info() */
@ -316,7 +316,7 @@ Index: gdb-7.0.50.20100128/gdb/f-valprint.c
- else
- {
- struct minimal_symbol *msymbol =
- lookup_minimal_symbol_by_pc (get_frame_pc (fi));
- lookup_minimal_symbol_by_pc (get_frame_pc (fi));
-
- if (msymbol != NULL)
- funname = SYMBOL_LINKAGE_NAME (msymbol);
@ -371,39 +371,39 @@ Index: gdb-7.0.50.20100128/gdb/f-valprint.c
}
void
Index: gdb-7.0.50.20100128/gdb/stack.c
Index: gdb-7.1.90.20100711/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 *
--- gdb-7.1.90.20100711.orig/gdb/stack.c 2010-07-01 17:36:17.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/stack.c 2010-07-13 00:29:49.000000000 +0200
@@ -1484,6 +1484,8 @@ iterate_over_block_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);
(*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
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,
Index: gdb-7.1.90.20100711/gdb/symtab.h
===================================================================
--- gdb-7.1.90.20100711.orig/gdb/symtab.h 2010-07-12 23:07:33.000000000 +0200
+++ gdb-7.1.90.20100711/gdb/symtab.h 2010-07-13 00:27:02.000000000 +0200
@@ -396,7 +396,10 @@ typedef enum domain_enum_tag
FUNCTIONS_DOMAIN,
/* All defined types */
- TYPES_DOMAIN
+ TYPES_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
Index: gdb-7.1.90.20100711/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
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp 2010-07-13 00:25:56.000000000 +0200
@@ -0,0 +1,101 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
@ -506,10 +506,10 @@ Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.fortran/common-block.exp
+gdb_test "p ix_x" " = 1 *" "p ix_x in"
+gdb_test "p iy_y" " = 2 *" "p iy_y in"
+gdb_test "p iz_z2" " = 3 *" "p iz_z2 in"
Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.fortran/common-block.f90
Index: gdb-7.1.90.20100711/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
+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.f90 2010-07-13 00:25:56.000000000 +0200
@@ -0,0 +1,67 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!

View File

@ -1,153 +0,0 @@
--- 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,81 +0,0 @@
http://sourceware.org/ml/gdb-patches/2010-02/msg00515.html
Subject: [patch] infcall: Remove gdb_assert ($sp overflow)
Hi,
set $sp=0
call something()
->
../../gdb/infcall.c:521: internal-error: call_function_by_hand: Assertion
`(gdbarch_inner_than (gdbarch, 1, 2) && sp <= old_sp) || (gdbarch_inner_than
(gdbarch, 2, 1) && sp >= old_sp)' failed.
as $sp - frame == 0xffffsmth which is not lower than $sp.
It must not be gdb_assert(). It can be an error() but I left it just to do:
(gdb) set $sp=0
(gdb) call doubleit (1)
Cannot access memory at address 0xffffffffffffff78
(gdb) set $sp=-1
(gdb) call doubleit (1)
Cannot access memory at address 0xffffffffffffff68
Unaware how inconvenient is an intentional crash of the testcase on some
embedded/non-MMU systems.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp.
New comment.
gdb/testsuite/
2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/callfuncs.exp: New tests for $spval 0 and -1. Remove return.
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -518,10 +518,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
/* Stack grows up. */
sp = gdbarch_frame_align (gdbarch, old_sp + 1);
}
- gdb_assert ((gdbarch_inner_than (gdbarch, 1, 2)
- && sp <= old_sp)
- || (gdbarch_inner_than (gdbarch, 2, 1)
- && sp >= old_sp));
+ /* SP may have overflown address zero here from OLD_SP. Memory access
+ functions will probably fail in such case but that is a target's
+ problem. */
}
else
/* FIXME: cagney/2002-09-18: Hey, you loose!
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -469,5 +469,18 @@ if {$old_reg_content == $new_reg_content} then {
fail "nested call dummies preserve register contents"
}
-return 0
+# GDB should not crash by internal error on $sp overflow during the inferior
+# call. It is OK it will stop on some: Cannot access memory at address 0x$hex.
+foreach spval {0 -1} {
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "sp=$spval:"
+
+ gdb_test {set $old_sp = $sp}
+ gdb_test "set \$sp = $spval"
+
+ gdb_test "call doubleit (1)"
+
+ gdb_test {set $sp = $old_sp}
+ set pf_prefix $old_ldprefix
+}

View File

@ -1,443 +0,0 @@
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

@ -1,87 +0,0 @@
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

@ -1,412 +0,0 @@
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

View File

@ -1,127 +0,0 @@
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

Some files were not shown because too many files have changed in this diff Show More