diff --git a/.cvsignore b/.cvsignore index 47c7cd6..4b0e4b4 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1 @@ -gdb-7.1.tar.bz2 -libstdc++-v3-python-r155978.tar.bz2 +gdb-7.1.90.20100721.tar.bz2 diff --git a/gdb-6.3-attach-see-vdso-test.patch b/gdb-6.3-attach-see-vdso-test.patch index 58a15db..a0923f8 100644 --- a/gdb-6.3-attach-see-vdso-test.patch +++ b/gdb-6.3-attach-see-vdso-test.patch @@ -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 . + -+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 diff --git a/gdb-6.3-bt-past-zero-20051201.patch b/gdb-6.3-bt-past-zero-20051201.patch index 4d6e2d8..11b946d 100644 --- a/gdb-6.3-bt-past-zero-20051201.patch +++ b/gdb-6.3-bt-past-zero-20051201.patch @@ -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); diff --git a/gdb-6.3-bz140532-ppc-unwinding-test.patch b/gdb-6.3-bz140532-ppc-unwinding-test.patch index d325ee3..6494cde 100644 --- a/gdb-6.3-bz140532-ppc-unwinding-test.patch +++ b/gdb-6.3-bz140532-ppc-unwinding-test.patch @@ -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 diff --git a/gdb-6.3-ia64-info-frame-fix-20050725.patch b/gdb-6.3-ia64-info-frame-fix-20050725.patch index 9d613fd..2ebab9e 100644 --- a/gdb-6.3-ia64-info-frame-fix-20050725.patch +++ b/gdb-6.3-ia64-info-frame-fix-20050725.patch @@ -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 +} diff --git a/gdb-6.3-ia64-sigill-20051115.patch b/gdb-6.3-ia64-sigill-20051115.patch index 5c94160..07a6b46 100644 --- a/gdb-6.3-ia64-sigill-20051115.patch +++ b/gdb-6.3-ia64-sigill-20051115.patch @@ -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 +} diff --git a/gdb-6.3-inferior-notification-20050721.patch b/gdb-6.3-inferior-notification-20050721.patch index 5a014ff..a789b1b 100644 --- a/gdb-6.3-inferior-notification-20050721.patch +++ b/gdb-6.3-inferior-notification-20050721.patch @@ -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 diff --git a/gdb-6.3-inheritancetest-20050726.patch b/gdb-6.3-inheritancetest-20050726.patch index 5f33571..ab81976 100644 --- a/gdb-6.3-inheritancetest-20050726.patch +++ b/gdb-6.3-inheritancetest-20050726.patch @@ -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 diff --git a/gdb-6.3-large-core-20051206.patch b/gdb-6.3-large-core-20051206.patch index 6f94402..8789a6a 100644 --- a/gdb-6.3-large-core-20051206.patch +++ b/gdb-6.3-large-core-20051206.patch @@ -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 _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 @@ -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. */ diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index 132f3bf..c2f0ea8 100644 --- a/gdb-6.3-readnever-20050907.patch +++ b/gdb-6.3-readnever-20050907.patch @@ -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 #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 ".", 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; diff --git a/gdb-6.3-rh-testversion-20041202.patch b/gdb-6.3-rh-testversion-20041202.patch index 25a1357..7839200 100644 --- a/gdb-6.3-rh-testversion-20041202.patch +++ b/gdb-6.3-rh-testversion-20041202.patch @@ -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 diff --git a/gdb-6.3-security-errata-20050610.patch b/gdb-6.3-security-errata-20050610.patch index 5578570..37765f9 100644 --- a/gdb-6.3-security-errata-20050610.patch +++ b/gdb-6.3-security-errata-20050610.patch @@ -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 . + -+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. */ + diff --git a/gdb-6.3-step-thread-exit-20050211-test.patch b/gdb-6.3-step-thread-exit-20050211-test.patch index fc73d9f..11c2a44 100644 --- a/gdb-6.3-step-thread-exit-20050211-test.patch +++ b/gdb-6.3-step-thread-exit-20050211-test.patch @@ -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} diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch index bcc4565..51308bc 100644 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ b/gdb-6.3-test-dtorfix-20050121.patch @@ -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} diff --git a/gdb-6.3-test-movedir-20050125.patch b/gdb-6.3-test-movedir-20050125.patch index eb3cf73..4b05c13 100644 --- a/gdb-6.3-test-movedir-20050125.patch +++ b/gdb-6.3-test-movedir-20050125.patch @@ -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 diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch index f9d5bb4..440b283 100644 --- a/gdb-6.3-test-pie-20050107.patch +++ b/gdb-6.3-test-pie-20050107.patch @@ -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 diff --git a/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch index 859638d..187a33e 100644 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ b/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -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] { diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index 6b878a0..94c0072 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -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 . + -+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} diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch index bd03985..bb7038f 100644 --- a/gdb-6.5-bz216711-clone-is-outermost.patch +++ b/gdb-6.5-bz216711-clone-is-outermost.patch @@ -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 @@ diff --git a/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch index aa514c2..1c9b1f2 100644 --- a/gdb-6.5-bz243845-stale-testing-zombie-test.patch +++ b/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -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 diff --git a/gdb-6.5-dwarf-stack-overflow.patch b/gdb-6.5-dwarf-stack-overflow.patch index 476bac2..0d107b3 100644 --- a/gdb-6.5-dwarf-stack-overflow.patch +++ b/gdb-6.5-dwarf-stack-overflow.patch @@ -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 diff --git a/gdb-6.5-gcore-buffer-limit-test.patch b/gdb-6.5-gcore-buffer-limit-test.patch index 9442198..dad4833 100644 --- a/gdb-6.5-gcore-buffer-limit-test.patch +++ b/gdb-6.5-gcore-buffer-limit-test.patch @@ -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 diff --git a/gdb-6.5-gcore-i386-on-amd64.patch b/gdb-6.5-gcore-i386-on-amd64.patch deleted file mode 100644 index 34ac13e..0000000 --- a/gdb-6.5-gcore-i386-on-amd64.patch +++ /dev/null @@ -1,847 +0,0 @@ -2006-10-01 Jan Kratochvil - 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 , . - * configure, config.in: Regenerated. - * gdb_user32.h, gdb_procfs32.h: Define 32-bit core files even for - 64-bit gdb, provide fallbacks for and . - * 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 - - Port to GDB-6.7. - -2008-02-24 Jan Kratochvil - - 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 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 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 header file. */ - #undef HAVE_SYS_POLL_H - -+/* Define to 1 if you have the header file. */ -+#undef HAVE_SYS_PROCFS32_H -+ - /* Define to 1 if you have the header file. */ - #undef HAVE_SYS_PROCFS_H - -@@ -517,6 +523,9 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_SYS_TYPES_H - -+/* Define to 1 if you have the header file. */ -+#undef HAVE_SYS_USER32_H -+ - /* Define to 1 if you have the 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 -+ -+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 -+ -+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 ]) - # 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 -+#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 -+#include -+#include -+#include "gdb_user32.h" -+ -+/* We define here only the symbols differing from their 64-bit variant. */ -+#include -+ -+__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 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 -+#else -+ -+#ifdef HAVE_STDINT_H -+#include -+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 *); diff --git a/gdb-6.5-ia64-libunwind-leak-test.patch b/gdb-6.5-ia64-libunwind-leak-test.patch index 79a4753..c77c677 100644 --- a/gdb-6.5-ia64-libunwind-leak-test.patch +++ b/gdb-6.5-ia64-libunwind-leak-test.patch @@ -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 diff --git a/gdb-6.5-missed-trap-on-step-test.patch b/gdb-6.5-missed-trap-on-step-test.patch index cb55193..2f4436d 100644 --- a/gdb-6.5-missed-trap-on-step-test.patch +++ b/gdb-6.5-missed-trap-on-step-test.patch @@ -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} diff --git a/gdb-6.5-tls-of-separate-debuginfo.patch b/gdb-6.5-tls-of-separate-debuginfo.patch deleted file mode 100644 index b838081..0000000 --- a/gdb-6.5-tls-of-separate-debuginfo.patch +++ /dev/null @@ -1,24 +0,0 @@ -Dependency on: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch - - -2006-09-01 Jan Kratochvil - - * 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; diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch index 7809940..a430667 100644 --- a/gdb-6.6-buildid-locate-core-as-arg.patch +++ b/gdb-6.6-buildid-locate-core-as-arg.patch @@ -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 #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 diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index 1aae339..8271992 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -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 if you have headers in a nonstandard directory 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 -- --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 -- --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 -+" -+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 + diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 77bbc7f..ff134f1 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -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. */ + diff --git a/gdb-6.6-bz225783-prelink-path.patch b/gdb-6.6-bz225783-prelink-path.patch deleted file mode 100644 index 22c8829..0000000 --- a/gdb-6.6-bz225783-prelink-path.patch +++ /dev/null @@ -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 - diff --git a/gdb-6.6-bz229517-gcore-without-terminal.patch b/gdb-6.6-bz229517-gcore-without-terminal.patch index de34ed5..686bb9d 100644 --- a/gdb-6.6-bz229517-gcore-without-terminal.patch +++ b/gdb-6.6-bz229517-gcore-without-terminal.patch @@ -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" +} diff --git a/gdb-6.6-bz235197-fork-detach-info.patch b/gdb-6.6-bz235197-fork-detach-info.patch index 075e118..64bc686 100644 --- a/gdb-6.6-bz235197-fork-detach-info.patch +++ b/gdb-6.6-bz235197-fork-detach-info.patch @@ -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} diff --git a/gdb-6.6-gcore32-test.patch b/gdb-6.6-gcore32-test.patch deleted file mode 100644 index 8e4f48f..0000000 --- a/gdb-6.6-gcore32-test.patch +++ /dev/null @@ -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: - } diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch index 44e0314..428102c 100644 --- a/gdb-6.6-scheduler_locking-step-is-default.patch +++ b/gdb-6.6-scheduler_locking-step-is-default.patch @@ -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" \ diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch index 4873608..0eb8a44 100644 --- a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +++ b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -21,11 +21,11 @@ Port to GDB-6.8pre. -Index: gdb-7.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; diff --git a/gdb-6.6-threads-static-test.patch b/gdb-6.6-threads-static-test.patch index e8741a8..2bac722 100644 --- a/gdb-6.6-threads-static-test.patch +++ b/gdb-6.6-threads-static-test.patch @@ -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" { diff --git a/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch b/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch index 2e344ca..9dc8a7b 100644 --- a/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch +++ b/gdb-6.7-bz426600-DW_TAG_interface_type-test.patch @@ -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 diff --git a/gdb-6.7-charsign-test.patch b/gdb-6.7-charsign-test.patch index 2e289ac..793ff8a 100644 --- a/gdb-6.7-charsign-test.patch +++ b/gdb-6.7-charsign-test.patch @@ -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} diff --git a/gdb-6.7-ppc-clobbered-registers-O2-test.patch b/gdb-6.7-ppc-clobbered-registers-O2-test.patch index b8ba5b0..761d10f 100644 --- a/gdb-6.7-ppc-clobbered-registers-O2-test.patch +++ b/gdb-6.7-ppc-clobbered-registers-O2-test.patch @@ -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 diff --git a/gdb-6.7-testsuite-stable-results-prelink.patch b/gdb-6.7-testsuite-stable-results-prelink.patch deleted file mode 100644 index 3c51577..0000000 --- a/gdb-6.7-testsuite-stable-results-prelink.patch +++ /dev/null @@ -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 - - 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 - } - diff --git a/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch index 75f68b3..a4c195c 100644 --- a/gdb-6.7-testsuite-stable-results.patch +++ b/gdb-6.7-testsuite-stable-results.patch @@ -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" diff --git a/gdb-6.8-bz254229-gcore-prpsinfo.patch b/gdb-6.8-bz254229-gcore-prpsinfo.patch index 249aa81..87fd255 100644 --- a/gdb-6.8-bz254229-gcore-prpsinfo.patch +++ b/gdb-6.8-bz254229-gcore-prpsinfo.patch @@ -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 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 - #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 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, diff --git a/gdb-6.8-bz466901-backtrace-full-prelinked.patch b/gdb-6.8-bz466901-backtrace-full-prelinked.patch index f9ec349..2211fa3 100644 --- a/gdb-6.8-bz466901-backtrace-full-prelinked.patch +++ b/gdb-6.8-bz466901-backtrace-full-prelinked.patch @@ -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 diff --git a/gdb-6.8-constant-watchpoints.patch b/gdb-6.8-constant-watchpoints.patch deleted file mode 100644 index 154c0c7..0000000 --- a/gdb-6.8-constant-watchpoints.patch +++ /dev/null @@ -1,236 +0,0 @@ -2008-07-10 Jan Kratochvil - - * 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 - - * gdb.texinfo (Set Watchpoints): Document constant value watchpoints. - -2008-07-10 Jan Kratochvil - - * 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 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 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 diff --git a/gdb-6.8-fortran-tag-constant.patch b/gdb-6.8-fortran-tag-constant.patch index b3d733b..3283984 100644 --- a/gdb-6.8-fortran-tag-constant.patch +++ b/gdb-6.8-fortran-tag-constant.patch @@ -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 diff --git a/gdb-archer-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch index 41409f0..cbd9a36 100644 --- a/gdb-archer-next-over-throw-cxx-exec.patch +++ b/gdb-archer-next-over-throw-cxx-exec.patch @@ -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 @@ diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index 5a9e0c5..e81a8dd 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -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)); } diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index 060b19e..4bcc4b4 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -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: diff --git a/gdb-archer-vla-ref-optimizedout.patch b/gdb-archer-vla-ref-optimizedout.patch deleted file mode 100644 index 6b86bda..0000000 --- a/gdb-archer-vla-ref-optimizedout.patch +++ /dev/null @@ -1,105 +0,0 @@ -commit a683bac73af74a757591672d89d720169c0b5ec9 -Author: Jan Kratochvil -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 /* */ -+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 /* */ -@@ -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 \[\]} diff --git a/gdb-archer-vla-test-oom.patch b/gdb-archer-vla-test-oom.patch deleted file mode 100644 index dad5ca4..0000000 --- a/gdb-archer-vla-test-oom.patch +++ /dev/null @@ -1,21 +0,0 @@ -commit ec5a7769d5c05542d12fc21afa25f32360db7de4 -Author: Jan Kratochvil -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] diff --git a/gdb-archer.patch b/gdb-archer.patch index c9b5c9b..c14a4be 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,289 +2,53 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit 39998c496988faaa1509cc6ab76b5c4777659bf4 +commit 0bc9a93725d7a7bcf1e30f072a12cc5186e41dc2 branch `archer' - the merge of branches: -archer-tromey-delayed-symfile2 -archer-tromey-python -archer-pmuldoon-next-over-throw2 -archer-jankratochvil-fortran-module2 -archer-jankratochvil-watchpoint2 archer-jankratochvil-vla -archer-keiths-expr-cumulative -# plus older archer-jankratochvil-ifunc +archer-jankratochvil-watchpoint3 +archer-jankratochvil-ifunc +archer-pmuldoon-next-over-throw2 +#TODO:archer-tromey-python (possibly only extracted parts) +#TODO:archer-tromey-optional-psymtab (more fresh patches are at gdb-patches@) +#TODO:archer-tromey-threaded-dwarf -diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index 98f42b9..dbf8273 100644 ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -167,6 +167,12 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ - TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ - - # Did the user give us a --with-gdb-datadir option? -+GDB_DATADIR_PATH = @GDB_DATADIR_PATH@ -+ -+# The argument to --with-pythondir. If not given, this is -+# GDB_DATADIR_PATH/python. -+pythondir = @pythondir@ -+ - GDB_DATADIR = @GDB_DATADIR@ - - # Helper code from gnulib. -@@ -267,23 +273,39 @@ SUBDIR_TUI_CFLAGS= \ - # - SUBDIR_PYTHON_OBS = \ - python.o \ -+ py-block.o \ -+ py-breakpoint.o \ - py-cmd.o \ - py-frame.o \ - py-function.o \ -+ py-hooks.o \ -+ py-inferior.o \ -+ py-infthread.o \ - py-lazy-string.o \ - py-objfile.o \ -+ py-param.o \ - py-prettyprint.o \ -+ py-symbol.o \ -+ py-symtab.o \ - py-type.o \ - py-utils.o \ - py-value.o - SUBDIR_PYTHON_SRCS = \ - python/python.c \ -+ python/py-block.c \ -+ python/py-breakpoint.c \ - python/py-cmd.c \ - python/py-frame.c \ - python/py-function.c \ -+ python/py-hooks.c \ -+ python/py-inferior.c \ -+ python/py-infthread.c \ - python/py-lazy-string.c \ - python/py-objfile.c \ -+ python/py-param.c \ - python/py-prettyprint.c \ -+ python/py-symbol.c \ -+ python/py-symtab.c \ - python/py-type.c \ - python/py-utils.c \ - python/py-value.c -@@ -756,7 +778,8 @@ config/rs6000/nm-rs6000.h top.h bsd-kvm.h gdb-stabs.h reggroups.h \ - annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \ - remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \ - sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \ --gdb_usleep.h jit.h xml-syscall.h ada-operator.inc microblaze-tdep.h -+gdb_usleep.h jit.h python/python.h python/python-internal.h \ -+xml-syscall.h ada-operator.inc microblaze-tdep.h - - # Header files that already have srcdir in them, or which are in objdir. - -@@ -1270,6 +1293,12 @@ stamp-h: $(srcdir)/config.in config.status - CONFIG_LINKS= \ - $(SHELL) config.status - -+.gdbinit: $(srcdir)/gdbinit.in config.status -+ CONFIG_FILES=".gdbinit:gdbinit.in" \ -+ CONFIG_COMMANDS= \ -+ CONFIG_HEADERS= \ -+ $(SHELL) config.status -+ - config.status: $(srcdir)/configure configure.tgt configure.host - $(SHELL) config.status --recheck - -@@ -1970,6 +1999,14 @@ python.o: $(srcdir)/python/python.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python.c - $(POSTCOMPILE) - -+py-block.o: $(srcdir)/python/py-block.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-block.c -+ $(POSTCOMPILE) -+ -+py-breakpoint.o: $(srcdir)/python/py-breakpoint.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-breakpoint.c -+ $(POSTCOMPILE) -+ - py-cmd.o: $(srcdir)/python/py-cmd.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-cmd.c - $(POSTCOMPILE) -@@ -1982,6 +2019,18 @@ py-function.o: $(srcdir)/python/py-function.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c - $(POSTCOMPILE) - -+py-hooks.o: $(srcdir)/python/py-hooks.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-hooks.c -+ $(POSTCOMPILE) -+ -+py-inferior.o: $(srcdir)/python/py-inferior.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-inferior.c -+ $(POSTCOMPILE) -+ -+py-infthread.o: $(srcdir)/python/py-infthread.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-infthread.c -+ $(POSTCOMPILE) -+ - py-lazy-string.o: $(srcdir)/python/py-lazy-string.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-lazy-string.c - $(POSTCOMPILE) -@@ -1990,10 +2039,22 @@ py-objfile.o: $(srcdir)/python/py-objfile.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-objfile.c - $(POSTCOMPILE) - -+py-param.o: $(srcdir)/python/py-param.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-param.c -+ $(POSTCOMPILE) -+ - py-prettyprint.o: $(srcdir)/python/py-prettyprint.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-prettyprint.c - $(POSTCOMPILE) - -+py-symbol.o: $(srcdir)/python/py-symbol.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-symbol.c -+ $(POSTCOMPILE) -+ -+py-symtab.o: $(srcdir)/python/py-symtab.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-symtab.c -+ $(POSTCOMPILE) -+ - py-type.o: $(srcdir)/python/py-type.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-type.c - $(POSTCOMPILE) -@@ -2006,6 +2067,36 @@ py-value.o: $(srcdir)/python/py-value.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-value.c - $(POSTCOMPILE) - -+# All python library files, with the "python/lib" stripped off. -+# Note that we should only install files in the "gdb" module. -+PY_FILES = gdb/FrameIterator.py gdb/FrameWrapper.py gdb/command/alias.py \ -+ gdb/command/backtrace.py gdb/command/require.py \ -+ gdb/command/pahole.py gdb/command/upto.py gdb/command/__init__.py \ -+ gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \ -+ gdb/function/caller_is.py gdb/function/in_scope.py \ -+ gdb/function/__init__.py gdb/backtrace.py gdb/__init__.py -+ -+# Install the Python library. Python library files go under -+# $(pythondir). -+install-python: -+ files='$(PY_FILES)'; for file in $$files; do \ -+ dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \ -+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(pythondir)/$$dir; \ -+ $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \ -+ done -+ -+# Other packages may have their files installed in $(pythondir). -+uninstall-python: -+ files='$(PY_FILES)'; for file in $$files; do \ -+ slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'`; \ -+ rm -f $(DESTDIR)$(pythondir)/$$file; \ -+ while test "x$$file" != "x$$slashdir"; do \ -+ rmdir 2>/dev/null "$(DESTDIR)$(pythondir)$$slashdir"; \ -+ file="$$slashdir"; \ -+ slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \ -+ done \ -+ done -+ - # - # Dependency tracking. Most of this is conditional on GNU Make being - # found by configure; if GNU Make is not found, we fall back to a diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c -index 7a2d2ca..4bf4e31 100644 +index 1d4c38b..cafb88e 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c -@@ -4781,14 +4781,10 @@ ada_lookup_symbol (const char *name, const struct block *block0, +@@ -11114,6 +11114,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, - static struct symbol * - ada_lookup_symbol_nonlocal (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain) - { -- if (linkage_name == NULL) -- linkage_name = name; -- return ada_lookup_symbol (linkage_name, block_static_block (block), domain, -- NULL); -+ return ada_lookup_symbol (name, block_static_block (block), domain, NULL); - } - - -@@ -10938,6 +10934,40 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp) - } - } - -+/* Implementation of the exp_descriptor method operator_check. */ -+ -+static int -+ada_operator_check (struct expression *exp, int pos, + static int + ada_operator_check (struct expression *exp, int pos, + int (*type_func) (struct type *type, void *data), -+ int (*objfile_func) (struct objfile *objfile, void *data), -+ void *data) -+{ -+ const union exp_element *const elts = exp->elts; -+ struct type *type = NULL; -+ -+ switch (elts[pos].opcode) -+ { -+ case UNOP_IN_RANGE: -+ case UNOP_QUAL: -+ type = elts[pos + 1].type; -+ break; -+ -+ default: + int (*objfile_func) (struct objfile *objfile, void *data), + void *data) + { +@@ -11128,12 +11129,15 @@ ada_operator_check (struct expression *exp, int pos, + break; + + default: +- return operator_check_standard (exp, pos, objfile_func, data); + return operator_check_standard (exp, pos, type_func, objfile_func, + data); -+ } -+ -+ /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ -+ + } + + /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ + +- if (type && TYPE_OBJFILE (type) + if (type && type_func && (*type_func) (type, data)) + return 1; + if (type && TYPE_OBJFILE (type) && objfile_func -+ && (*objfile_func) (TYPE_OBJFILE (type), data)) -+ return 1; -+ -+ return 0; -+} -+ - static char * - ada_op_name (enum exp_opcode opcode) - { -@@ -11326,6 +11356,7 @@ parse (void) - static const struct exp_descriptor ada_exp_descriptor = { - ada_print_subexp, - ada_operator_length, -+ ada_operator_check, - ada_op_name, - ada_dump_subexp_body, - ada_evaluate_subexp -diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c -index 3c71f2f..bbfe5a1 100644 ---- a/gdb/alpha-linux-tdep.c -+++ b/gdb/alpha-linux-tdep.c -@@ -26,6 +26,7 @@ - #include "symtab.h" - #include "regset.h" - #include "regcache.h" -+#include "linux-tdep.h" + && (*objfile_func) (TYPE_OBJFILE (type), data)) + return 1; - #include "alpha-tdep.h" - -@@ -236,6 +237,9 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - - set_gdbarch_regset_from_core_section - (gdbarch, alpha_linux_regset_from_core_section); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c -index 5c9e558..55a1873 100644 +index c0edc10..17d36b5 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c -@@ -350,6 +350,20 @@ amd64_linux_dr_unset_status (unsigned long mask) +@@ -375,6 +375,20 @@ amd64_linux_dr_unset_status (unsigned long mask) } } @@ -305,7 +69,7 @@ index 5c9e558..55a1873 100644 static void amd64_linux_new_thread (ptid_t ptid) -@@ -702,6 +716,7 @@ _initialize_amd64_linux_nat (void) +@@ -796,6 +810,7 @@ _initialize_amd64_linux_nat (void) i386_dr_low.reset_addr = amd64_linux_dr_reset_addr; i386_dr_low.get_status = amd64_linux_dr_get_status; i386_dr_low.unset_status = amd64_linux_dr_unset_status; @@ -313,68 +77,11 @@ index 5c9e558..55a1873 100644 i386_set_debug_register_length (8); /* Override the GNU/Linux inferior startup hook. */ -diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c -index c28eef7..02c11e1 100644 ---- a/gdb/amd64-linux-tdep.c -+++ b/gdb/amd64-linux-tdep.c -@@ -1481,6 +1481,9 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - amd64_linux_record_tdep.arg6 = AMD64_R9_REGNUM; - - tdep->i386_syscall_record = amd64_linux_syscall_record; -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - -diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c -index af409f6..406c066 100644 ---- a/gdb/arm-linux-tdep.c -+++ b/gdb/arm-linux-tdep.c -@@ -918,6 +918,9 @@ arm_linux_init_abi (struct gdbarch_info info, - set_gdbarch_displaced_step_free_closure (gdbarch, - simple_displaced_step_free_closure); - set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c -index 3e151de..ddbcb6e 100644 ---- a/gdb/ax-gdb.c -+++ b/gdb/ax-gdb.c -@@ -1812,7 +1812,7 @@ gen_expr (struct expression *exp, union exp_element **pc, - - /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER - symbol instead of the LOC_ARG one (if both exist). */ -- sym = lookup_block_symbol (b, this_name, NULL, VAR_DOMAIN); -+ sym = lookup_block_symbol (b, this_name, VAR_DOMAIN); - if (!sym) - error (_("no `%s' found"), this_name); - diff --git a/gdb/block.c b/gdb/block.c -index 48ac21b..0eccecb 100644 +index 48ac21b..ffcc97f 100644 --- a/gdb/block.c +++ b/gdb/block.c -@@ -227,8 +227,9 @@ block_set_scope (struct block *block, const char *scope, - BLOCK_NAMESPACE (block)->scope = scope; - } - --/* This returns the using directives list associated with BLOCK, if -- any. */ -+/* This returns the first using directives associated with BLOCK, if -+ any. Each BLOCK_NAMESPACE()->USING already contains all the namespaces -+ imported at that code point - even those from its parent blocks. */ - - struct using_direct * - block_using (const struct block *block) -@@ -318,6 +319,25 @@ allocate_block (struct obstack *obstack) - BLOCK_SUPERBLOCK (bl) = NULL; - BLOCK_DICT (bl) = NULL; - BLOCK_NAMESPACE (bl) = NULL; -+ BLOCK_FORTRAN_USE (bl) = NULL; +@@ -321,3 +321,21 @@ allocate_block (struct obstack *obstack) return bl; } @@ -397,151 +104,177 @@ index 48ac21b..0eccecb 100644 + return SYMBOL_SYMTAB (func)->objfile; +} diff --git a/gdb/block.h b/gdb/block.h -index 7eedb6c..b147826 100644 +index 7eedb6c..a517e80 100644 --- a/gdb/block.h +++ b/gdb/block.h -@@ -96,6 +96,15 @@ struct block - cplus_specific; - } - language_specific; -+ -+ /* FIXME: It should be in the LANGUAGE_SPECIFIC region but the -+ BLOCK_NAMESPACE accessor is not protected by the C language check. */ -+ -+ struct -+ { -+ struct fortran_using *use; -+ } -+ fortran_specific; - }; - - #define BLOCK_START(bl) (bl)->startaddr -@@ -104,6 +113,7 @@ struct block - #define BLOCK_SUPERBLOCK(bl) (bl)->superblock - #define BLOCK_DICT(bl) (bl)->dict - #define BLOCK_NAMESPACE(bl) (bl)->language_specific.cplus_specific.namespace -+#define BLOCK_FORTRAN_USE(bl) (bl)->fortran_specific.use - - /* Macro to loop through all symbols in a block BL, in no particular - order. ITER helps keep track of the iteration, and should be a -@@ -166,4 +176,6 @@ extern const struct block *block_global_block (const struct block *block); +@@ -166,4 +166,6 @@ extern const struct block *block_global_block (const struct block *block); extern struct block *allocate_block (struct obstack *obstack); +extern struct objfile *block_objfile (const struct block *block); + #endif /* BLOCK_H */ +diff --git a/gdb/blockframe.c b/gdb/blockframe.c +index 0348bf4..f01d0ee 100644 +--- a/gdb/blockframe.c ++++ b/gdb/blockframe.c +@@ -38,6 +38,7 @@ + #include "block.h" + #include "inline-frame.h" + #include "psymtab.h" ++#include "elf-bfd.h" + + /* Return the innermost lexical block in execution + in a specified stack frame. The frame address is assumed valid. +@@ -159,6 +160,7 @@ static CORE_ADDR cache_pc_function_low = 0; + static CORE_ADDR cache_pc_function_high = 0; + static char *cache_pc_function_name = 0; + static struct obj_section *cache_pc_function_section = NULL; ++static int cache_pc_function_is_gnu_ifunc = 0; + + /* Clear cache, e.g. when symbol table is discarded. */ + +@@ -169,6 +171,7 @@ clear_pc_function_cache (void) + cache_pc_function_high = 0; + cache_pc_function_name = (char *) 0; + cache_pc_function_section = NULL; ++ cache_pc_function_is_gnu_ifunc = 0; + } + + /* Finds the "function" (text symbol) that is smaller than PC but +@@ -184,7 +187,7 @@ clear_pc_function_cache (void) + + /* Backward compatibility, no section argument. */ + +-int ++enum find_pc_partial_function_type + find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, + CORE_ADDR *endaddr) + { +@@ -236,6 +239,7 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, + cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f)); + cache_pc_function_name = SYMBOL_LINKAGE_NAME (f); + cache_pc_function_section = section; ++ cache_pc_function_is_gnu_ifunc = TYPE_GNU_IFUNC (SYMBOL_TYPE (f)); + goto return_cached_value; + } + } +@@ -258,12 +262,13 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, + *address = 0; + if (endaddr != NULL) + *endaddr = 0; +- return 0; ++ return FIND_PC_PARTIAL_FUNCTION_NOT_FOUND; + } + + cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol); + cache_pc_function_name = SYMBOL_LINKAGE_NAME (msymbol); + cache_pc_function_section = section; ++ cache_pc_function_is_gnu_ifunc = MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc; + + /* If the minimal symbol has a size, use it for the cache. + Otherwise use the lesser of the next minimal symbol in the same +@@ -323,7 +328,8 @@ find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address, + *endaddr = cache_pc_function_high; + } + +- return 1; ++ return cache_pc_function_is_gnu_ifunc ? FIND_PC_PARTIAL_FUNCTION_GNU_IFUNC ++ : FIND_PC_PARTIAL_FUNCTION_NORMAL; + } + + /* Return the innermost stack frame executing inside of BLOCK, diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 8c97949..0b66740 100644 +index 4affe0a..52105b5 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -61,6 +61,7 @@ - #include "valprint.h" +@@ -62,6 +62,7 @@ #include "jit.h" #include "xml-syscall.h" -+#include "parser-defs.h" + #include "parser-defs.h" ++#include "regcache.h" /* readline include files */ #include "readline/readline.h" -@@ -614,6 +615,53 @@ get_breakpoint (int num) +@@ -92,6 +93,9 @@ static void map_breakpoint_numbers (char *, void (*) (struct breakpoint *, + + static void ignore_command (char *, int); + ++static void update_breakpoint_locations (struct breakpoint *b, ++ struct symtabs_and_lines sals); ++ + static int breakpoint_re_set_one (void *); + + static void clear_command (char *, int); +@@ -106,6 +110,9 @@ static void break_command_1 (char *, int, int); + + static void mention (struct breakpoint *); + ++static struct bp_location *add_location_to_breakpoint (struct breakpoint *b, ++ const struct symtab_and_line *sal); ++ + /* This function is used in gdbtk sources and thus can not be made static. */ + struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch, + struct symtab_and_line, +@@ -230,6 +237,10 @@ static void disable_trace_command (char *, int); + + static void trace_pass_command (char *, int); + ++static void gnu_ifunc_resolver_stop (struct breakpoint *b); ++ ++static void gnu_ifunc_resolver_return_stop (struct breakpoint *b); ++ + /* Assuming we're creating a static tracepoint, does S look like a + static tracepoint marker spec ("-m MARKER_ID")? */ + #define is_marker_spec(s) \ +@@ -1252,6 +1263,22 @@ watchpoint_in_thread_scope (struct breakpoint *b) + && !is_executing (inferior_ptid))); } - -+/* Set break condition of breakpoint B to EXP. */ -+ -+void -+set_breakpoint_condition (struct breakpoint *b, char *exp, int from_tty) ++static void ++watchpoint_del_at_next_stop (struct breakpoint *b) +{ -+ struct bp_location *loc = b->loc; ++ gdb_assert (is_watchpoint (b)); + -+ for (; loc; loc = loc->next) ++ if (b->related_breakpoint != b) + { -+ if (loc->cond) -+ { -+ xfree (loc->cond); -+ loc->cond = 0; -+ } ++ gdb_assert (b->related_breakpoint->type == bp_watchpoint_scope); ++ gdb_assert (b->related_breakpoint->related_breakpoint == b); ++ b->related_breakpoint->disposition = disp_del_at_next_stop; ++ b->related_breakpoint->related_breakpoint = b->related_breakpoint; ++ b->related_breakpoint = b; + } -+ -+ if (b->cond_string != NULL) -+ xfree (b->cond_string); -+ -+ if (*exp == 0) -+ { -+ b->cond_string = NULL; -+ if (from_tty) -+ printf_filtered (_("Breakpoint %d now unconditional.\n"), b->number); -+ } -+ else -+ { -+ char *arg = exp; -+ -+ /* I don't know if it matters whether this is the string the user -+ typed in or the decompiled expression. */ -+ b->cond_string = xstrdup (arg); -+ b->condition_not_parsed = 0; -+ for (loc = b->loc; loc; loc = loc->next) -+ { -+ arg = exp; -+ loc->cond = -+ parse_exp_1 (&arg, block_for_pc (loc->address), 0); -+ if (*arg) -+ error (_("Junk at end of expression")); -+ } -+ } -+ -+ breakpoints_changed (); -+ observer_notify_breakpoint_modified (b->number); ++ b->disposition = disp_del_at_next_stop; +} + - /* condition N EXP -- set break condition of breakpoint N to EXP. */ + /* Assuming that B is a watchpoint: + - Reparse watchpoint expression, if REPARSE is non-zero + - Evaluate expression and store the result in B->val +@@ -1307,6 +1334,8 @@ update_watchpoint (struct breakpoint *b, int reparse) + struct frame_id saved_frame_id; + int frame_saved; - static void -@@ -634,42 +682,7 @@ condition_command (char *arg, int from_tty) - ALL_BREAKPOINTS (b) - if (b->number == bnum) - { -- struct bp_location *loc = b->loc; -- for (; loc; loc = loc->next) -- { -- if (loc->cond) -- { -- xfree (loc->cond); -- loc->cond = 0; -- } -- } -- if (b->cond_string != NULL) -- xfree (b->cond_string); -- -- if (*p == 0) -- { -- b->cond_string = NULL; -- if (from_tty) -- printf_filtered (_("Breakpoint %d now unconditional.\n"), bnum); -- } -- else -- { -- arg = p; -- /* I don't know if it matters whether this is the string the user -- typed in or the decompiled expression. */ -- b->cond_string = xstrdup (arg); -- b->condition_not_parsed = 0; -- for (loc = b->loc; loc; loc = loc->next) -- { -- arg = p; -- loc->cond = -- parse_exp_1 (&arg, block_for_pc (loc->address), 0); -- if (*arg) -- error (_("Junk at end of expression")); -- } -- } -- breakpoints_changed (); -- observer_notify_breakpoint_modified (b->number); -+ set_breakpoint_condition (b, p, from_tty); - return; - } ++ gdb_assert (is_watchpoint (b)); ++ + /* If this is a local watchpoint, we only want to check if the + watchpoint frame is in scope if the current thread is the thread + that was used to create the watchpoint. */ +@@ -1510,13 +1539,7 @@ update_watchpoint (struct breakpoint *b, int reparse) + Watchpoint %d deleted because the program has left the block\n\ + in which its expression is valid.\n"), + b->number); +- if (b->related_breakpoint) +- { +- b->related_breakpoint->disposition = disp_del_at_next_stop; +- b->related_breakpoint->related_breakpoint = NULL; +- b->related_breakpoint= NULL; +- } +- b->disposition = disp_del_at_next_stop; ++ watchpoint_del_at_next_stop (b); + } -@@ -1868,6 +1881,36 @@ create_longjmp_master_breakpoint (char *func_name) + /* Restore the selected frame. */ +@@ -2201,6 +2224,33 @@ create_std_terminate_master_breakpoint (const char *func_name) do_cleanups (old_chain); } @@ -559,14 +292,11 @@ index 8c97949..0b66740 100644 + 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; + } @@ -578,16 +308,17 @@ index 8c97949..0b66740 100644 void update_breakpoints_after_exec (void) { -@@ -1909,7 +1952,7 @@ update_breakpoints_after_exec (void) +@@ -2242,7 +2292,8 @@ update_breakpoints_after_exec (void) /* Thread event breakpoints must be set anew after an exec(), as must overlay event and longjmp master breakpoints. */ if (b->type == bp_thread_event || b->type == bp_overlay_event -- || b->type == bp_longjmp_master) -+ || b->type == bp_longjmp_master || b->type == bp_exception_master) +- || b->type == bp_longjmp_master || b->type == bp_std_terminate_master) ++ || b->type == bp_longjmp_master || b->type == bp_std_terminate_master ++ || b->type == bp_exception_master) { delete_breakpoint (b); continue; -@@ -1924,7 +1967,8 @@ update_breakpoints_after_exec (void) +@@ -2257,7 +2308,8 @@ update_breakpoints_after_exec (void) /* Longjmp and longjmp-resume breakpoints are also meaningless after an exec. */ @@ -597,23 +328,24 @@ index 8c97949..0b66740 100644 { delete_breakpoint (b); continue; -@@ -1985,6 +2029,7 @@ update_breakpoints_after_exec (void) - create_longjmp_master_breakpoint ("_longjmp"); +@@ -2319,6 +2371,7 @@ update_breakpoints_after_exec (void) create_longjmp_master_breakpoint ("siglongjmp"); create_longjmp_master_breakpoint ("_siglongjmp"); + create_std_terminate_master_breakpoint ("std::terminate()"); + create_exception_master_breakpoint (); } int -@@ -2008,6 +2053,7 @@ detach_breakpoints (int pid) - if (b->inserted) - val |= remove_breakpoint_1 (b, mark_inserted); - } +@@ -2346,6 +2399,8 @@ detach_breakpoints (int pid) + /* Detach single-step breakpoints as well. */ + detach_single_step_breakpoints (); + + val |= target_detach_watchpoints (); ++ do_cleanups (old_chain); return val; } -@@ -2107,12 +2153,14 @@ remove_breakpoint_1 (struct bp_location *b, insertion_state_t is) +@@ -2447,9 +2502,11 @@ remove_breakpoint_1 (struct bp_location *b, insertion_state_t is) return val; b->inserted = (is == mark_inserted); } @@ -622,15 +354,12 @@ index 8c97949..0b66740 100644 + target_detach_watchpoints. */ + else if (b->loc_type == bp_loc_hardware_watchpoint && is == mark_uninserted) { - struct value *v; - struct value *n; - - b->inserted = (is == mark_inserted); + b->inserted = 0; - val = target_remove_watchpoint (b->address, b->length, - b->watchpoint_type); + val = target_remove_watchpoint (b->address, b->length, + b->watchpoint_type, b->owner->cond_exp); -@@ -2892,6 +2940,12 @@ print_it_typical (bpstat bs) +@@ -3237,6 +3294,12 @@ print_it_typical (bpstat bs) result = PRINT_NOTHING; break; @@ -643,7 +372,7 @@ index 8c97949..0b66740 100644 case bp_watchpoint: case bp_hardware_watchpoint: annotate_watchpoint (b->number); -@@ -2979,6 +3033,8 @@ print_it_typical (bpstat bs) +@@ -3324,6 +3387,8 @@ print_it_typical (bpstat bs) case bp_none: case bp_longjmp: case bp_longjmp_resume: @@ -652,7 +381,40 @@ index 8c97949..0b66740 100644 case bp_step_resume: case bp_watchpoint_scope: case bp_call_dummy: -@@ -3383,8 +3439,12 @@ bpstat_check_location (const struct bp_location *bl, +@@ -3331,6 +3396,8 @@ print_it_typical (bpstat bs) + case bp_tracepoint: + case bp_fast_tracepoint: + case bp_jit_event: ++ case bp_gnu_ifunc_resolver: ++ case bp_gnu_ifunc_resolver_return: + default: + result = PRINT_UNKNOWN; + break; +@@ -3549,6 +3616,8 @@ watchpoint_check (void *p) + gdb_assert (bs->breakpoint_at->owner != NULL); + b = bs->breakpoint_at->owner; + ++ gdb_assert (is_watchpoint (b)); ++ + /* If this is a local watchpoint, we only want to check if the + watchpoint frame is in scope if the current thread is the thread + that was used to create the watchpoint. */ +@@ -3655,13 +3724,7 @@ watchpoint_check (void *p) + ui_out_text (uiout, " deleted because the program has left the block in\n\ + which its expression is valid.\n"); + +- if (b->related_breakpoint) +- { +- b->related_breakpoint->disposition = disp_del_at_next_stop; +- b->related_breakpoint->related_breakpoint = NULL; +- b->related_breakpoint = NULL; +- } +- b->disposition = disp_del_at_next_stop; ++ watchpoint_del_at_next_stop (b); + + return WP_DELETED; + } +@@ -3730,8 +3793,12 @@ bpstat_check_location (const struct bp_location *bl, /* If BS refers to a watchpoint, determine if the watched values has actually changed, and we should stop. If not, set BS->stop @@ -666,8 +428,19 @@ index 8c97949..0b66740 100644 +static int bpstat_check_watchpoint (bpstat bs) { - const struct bp_location *bl = bs->breakpoint_at; -@@ -3473,8 +3533,10 @@ bpstat_check_watchpoint (bpstat bs) + const struct bp_location *bl; +@@ -3865,9 +3932,7 @@ bpstat_check_watchpoint (bpstat bs) + case 0: + /* Error from catch_errors. */ + printf_filtered (_("Watchpoint %d deleted.\n"), b->number); +- if (b->related_breakpoint) +- b->related_breakpoint->disposition = disp_del_at_next_stop; +- b->disposition = disp_del_at_next_stop; ++ watchpoint_del_at_next_stop (b); + /* We've already printed what needs to be printed. */ + bs->print_it = print_it_done; + break; +@@ -3881,8 +3946,10 @@ bpstat_check_watchpoint (bpstat bs) anything for this watchpoint. */ bs->print_it = print_it_noop; bs->stop = 0; @@ -678,16 +451,25 @@ index 8c97949..0b66740 100644 } -@@ -3588,6 +3650,8 @@ bpstat_stop_status (struct address_space *aspace, +@@ -3914,7 +3981,7 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid) + watchpoint as triggered so that we will handle the + out-of-scope event. We'll get to the watchpoint next + iteration. */ +- if (b->type == bp_watchpoint_scope) ++ if (b->type == bp_watchpoint_scope && b->related_breakpoint != b) + b->related_breakpoint->watchpoint_triggered = watch_triggered_yes; + + if (is_watchpoint (b)) +@@ -4045,6 +4112,8 @@ bpstat_stop_status (struct address_space *aspace, for (bl = b->loc; bl != NULL; bl = bl->next) { + bpstat bs_prev = bs; + /* For hardware watchpoints, we look only at the first location. - The watchpoint_check function will work on entire expression, - not the individual locations. For read watchopints, the -@@ -3605,6 +3669,7 @@ bpstat_stop_status (struct address_space *aspace, + The watchpoint_check function will work on the entire expression, + not the individual locations. For read watchpoints, the +@@ -4062,6 +4131,7 @@ bpstat_stop_status (struct address_space *aspace, /* Come here if it's a watchpoint, or if the break address matches */ bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */ @@ -695,7 +477,7 @@ index 8c97949..0b66740 100644 /* Assume we stop. Should we find watchpoint that is not actually triggered, or if condition of breakpoint is false, we'll reset -@@ -3612,12 +3677,22 @@ bpstat_stop_status (struct address_space *aspace, +@@ -4069,13 +4139,23 @@ bpstat_stop_status (struct address_space *aspace, bs->stop = 1; bs->print = 1; @@ -716,45 +498,107 @@ index 8c97949..0b66740 100644 + } if (b->type == bp_thread_event || b->type == bp_overlay_event -- || b->type == bp_longjmp_master) -+ || b->type == bp_longjmp_master + || b->type == bp_longjmp_master +- || b->type == bp_std_terminate_master) ++ || b->type == bp_std_terminate_master + || b->type == bp_exception_master) /* We do not stop for these. */ bs->stop = 0; else -@@ -3826,6 +3901,7 @@ bpstat_what (bpstat bs) - struct bpstat_what retval; +@@ -4176,7 +4256,7 @@ handle_jit_event (void) + /* Decide what infrun needs to do with this bpstat. */ - retval.call_dummy = 0; + struct bpstat_what +-bpstat_what (bpstat bs) ++bpstat_what (bpstat bs_head) + { + struct bpstat_what retval; + /* We need to defer calling `solib_add', as adding new symbols +@@ -4184,11 +4264,13 @@ bpstat_what (bpstat bs) + and hence may clear unprocessed entries in the BS chain. */ + int shlib_event = 0; + int jit_event = 0; ++ bpstat bs; + + retval.main_action = BPSTAT_WHAT_KEEP_CHECKING; + retval.call_dummy = STOP_NONE; + retval.is_longjmp = 0; - for (; bs != NULL; bs = bs->next) + +- for (; bs != NULL; bs = bs->next) ++ for (bs = bs_head; bs != NULL; bs = bs->next) { - enum class bs_class = no_effect; -@@ -3872,10 +3948,15 @@ bpstat_what (bpstat bs) - bs_class = no_effect; + /* Extract this BS's action. After processing each BS, we check + if its action overrides all we've seem so far. */ +@@ -4242,10 +4324,15 @@ bpstat_what (bpstat bs) + } break; case bp_longjmp: + case bp_exception: - bs_class = long_jump; + this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME; + retval.is_longjmp = bs->breakpoint_at->owner->type == bp_longjmp; break; case bp_longjmp_resume: + case bp_exception_resume: - bs_class = long_resume; + this_action = BPSTAT_WHAT_CLEAR_LONGJMP_RESUME; + retval.is_longjmp + = bs->breakpoint_at->owner->type == bp_longjmp_resume; break; case bp_step_resume: if (bs->stop) -@@ -3898,6 +3979,7 @@ bpstat_what (bpstat bs) - case bp_thread_event: +@@ -4261,6 +4348,7 @@ bpstat_what (bpstat bs) case bp_overlay_event: case bp_longjmp_master: + case bp_std_terminate_master: + case bp_exception_master: - bs_class = bp_nostop; + this_action = BPSTAT_WHAT_SINGLE; break; case bp_catchpoint: -@@ -4042,6 +4124,8 @@ print_one_breakpoint_location (struct breakpoint *b, +@@ -4313,6 +4401,20 @@ bpstat_what (bpstat bs) + out already. */ + internal_error (__FILE__, __LINE__, + _("bpstat_what: tracepoint encountered")); ++ break; ++ case bp_gnu_ifunc_resolver: ++ /* Skip the current breakpoint but otherwise nothing happens. GDB is ++ inserting new bp_gnu_ifunc_resolver_return at this point but ++ bp_gnu_ifunc_resolver is being kept there as another ++ bp_gnu_ifunc_resolver_return may be inserted in the meantime. */ ++ this_action = BPSTAT_WHAT_SINGLE; ++ break; ++ case bp_gnu_ifunc_resolver_return: ++ /* The whole bp_gnu_ifunc_resolver with its associated ++ bp_gnu_ifunc_resolver_return related_breakpoint's has been ++ resolved now, all these helper breakpoints are being removed and ++ new final bp_breakpoint is being put at the target location. */ ++ break; + default: + internal_error (__FILE__, __LINE__, + _("bpstat_what: unhandled bptype %d"), (int) bptype); +@@ -4350,6 +4452,23 @@ bpstat_what (bpstat bs) + handle_jit_event (); + } + ++ for (bs = bs_head; bs != NULL; bs = bs->next) ++ { ++ if (bs->breakpoint_at == NULL) ++ continue; ++ if (bs->breakpoint_at->owner == NULL) ++ continue; ++ switch (bs->breakpoint_at->owner->type) ++ { ++ case bp_gnu_ifunc_resolver: ++ gnu_ifunc_resolver_stop (bs->breakpoint_at->owner); ++ break; ++ case bp_gnu_ifunc_resolver_return: ++ gnu_ifunc_resolver_return_stop (bs->breakpoint_at->owner); ++ break; ++ } ++ } ++ + return retval; + } + +@@ -4461,6 +4580,8 @@ print_one_breakpoint_location (struct breakpoint *b, {bp_access_watchpoint, "acc watchpoint"}, {bp_longjmp, "longjmp"}, {bp_longjmp_resume, "longjmp resume"}, @@ -763,15 +607,22 @@ index 8c97949..0b66740 100644 {bp_step_resume, "step resume"}, {bp_watchpoint_scope, "watchpoint scope"}, {bp_call_dummy, "call dummy"}, -@@ -4049,6 +4133,7 @@ print_one_breakpoint_location (struct breakpoint *b, - {bp_thread_event, "thread events"}, +@@ -4470,11 +4591,14 @@ print_one_breakpoint_location (struct breakpoint *b, {bp_overlay_event, "overlay events"}, {bp_longjmp_master, "longjmp master"}, + {bp_std_terminate_master, "std::terminate master"}, + {bp_exception_master, "exception master"}, {bp_catchpoint, "catchpoint"}, {bp_tracepoint, "tracepoint"}, {bp_fast_tracepoint, "fast tracepoint"}, -@@ -4173,6 +4258,8 @@ print_one_breakpoint_location (struct breakpoint *b, + {bp_static_tracepoint, "static tracepoint"}, + {bp_jit_event, "jit events"}, ++ {bp_gnu_ifunc_resolver, "gnu-ifunc resolver"}, ++ {bp_gnu_ifunc_resolver_return, "gnu-func resolver return"}, + }; + + static char bpenables[] = "nynny"; +@@ -4595,6 +4719,8 @@ print_one_breakpoint_location (struct breakpoint *b, case bp_finish: case bp_longjmp: case bp_longjmp_resume: @@ -780,15 +631,31 @@ index 8c97949..0b66740 100644 case bp_step_resume: case bp_watchpoint_scope: case bp_call_dummy: -@@ -4180,6 +4267,7 @@ print_one_breakpoint_location (struct breakpoint *b, - case bp_thread_event: +@@ -4604,10 +4730,13 @@ print_one_breakpoint_location (struct breakpoint *b, case bp_overlay_event: case bp_longjmp_master: + case bp_std_terminate_master: + case bp_exception_master: case bp_tracepoint: case bp_fast_tracepoint: + case bp_static_tracepoint: case bp_jit_event: -@@ -4816,6 +4904,8 @@ allocate_bp_location (struct breakpoint *bpt) ++ case bp_gnu_ifunc_resolver: ++ case bp_gnu_ifunc_resolver_return: + if (opts.addressprint) + { + annotate_field (4); +@@ -4888,7 +5017,8 @@ user_settable_breakpoint (const struct breakpoint *b) + || b->type == bp_catchpoint + || b->type == bp_hardware_breakpoint + || is_tracepoint (b) +- || is_watchpoint (b)); ++ || is_watchpoint (b) ++ || b->type == bp_gnu_ifunc_resolver); + } + + /* Print information on user settable breakpoint (watchpoint, etc) +@@ -5334,6 +5464,8 @@ allocate_bp_location (struct breakpoint *bpt) case bp_finish: case bp_longjmp: case bp_longjmp_resume: @@ -797,15 +664,76 @@ index 8c97949..0b66740 100644 case bp_step_resume: case bp_watchpoint_scope: case bp_call_dummy: -@@ -4824,6 +4914,7 @@ allocate_bp_location (struct breakpoint *bpt) - case bp_overlay_event: +@@ -5344,6 +5476,9 @@ allocate_bp_location (struct breakpoint *bpt) case bp_jit_event: case bp_longjmp_master: + case bp_std_terminate_master: ++ case bp_gnu_ifunc_resolver: ++ case bp_gnu_ifunc_resolver_return: + case bp_exception_master: loc->loc_type = bp_loc_software_breakpoint; break; case bp_hardware_breakpoint: -@@ -5012,8 +5103,7 @@ make_breakpoint_permanent (struct breakpoint *b) +@@ -5420,6 +5555,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch, + b->syscalls_to_be_caught = NULL; + b->ops = NULL; + b->condition_not_parsed = 0; ++ b->related_breakpoint = b; + + /* Add this breakpoint to the end of the chain + so that a list of breakpoints will come out in order +@@ -5439,7 +5575,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch, + + /* Initialize loc->function_name. */ + static void +-set_breakpoint_location_function (struct bp_location *loc) ++set_breakpoint_location_function (struct bp_location *loc, int explicit_loc) + { + gdb_assert (loc->owner != NULL); + +@@ -5447,8 +5583,29 @@ set_breakpoint_location_function (struct bp_location *loc) + || loc->owner->type == bp_hardware_breakpoint + || is_tracepoint (loc->owner)) + { +- find_pc_partial_function (loc->address, &(loc->function_name), +- NULL, NULL); ++ if (find_pc_partial_function (loc->address, &(loc->function_name), NULL, ++ NULL) == FIND_PC_PARTIAL_FUNCTION_GNU_IFUNC ++ && !explicit_loc) ++ { ++ struct breakpoint *b = loc->owner; ++ ++ gdb_assert (loc->pspace == current_program_space); ++ if (resolve_gnu_ifunc (loc->function_name, &loc->requested_address)) ++ { ++ /* Recalculate ADDRESS based on new REQUESTED_ADDRESS. */ ++ loc->address = adjust_breakpoint_address (loc->gdbarch, ++ loc->requested_address, ++ b->type); ++ } ++ else if (b->type == bp_breakpoint && b->loc == loc ++ && loc->next == NULL && b->related_breakpoint == b) ++ { ++ /* Create only the whole new breakpoint of this type but do not ++ mess more complicated breakpoints with multiple locations. */ ++ b->type = bp_gnu_ifunc_resolver; ++ } ++ } ++ + if (loc->function_name) + loc->function_name = xstrdup (loc->function_name); + } +@@ -5521,7 +5678,8 @@ set_raw_breakpoint (struct gdbarch *gdbarch, + b->loc->section = sal.section; + b->line_number = sal.line; + +- set_breakpoint_location_function (b->loc); ++ set_breakpoint_location_function (b->loc, ++ sal.explicit_pc || sal.explicit_line); + + breakpoints_changed (); + +@@ -5548,8 +5706,7 @@ make_breakpoint_permanent (struct breakpoint *b) } /* Call this routine when stepping and nexting to enable a breakpoint @@ -815,7 +743,7 @@ index 8c97949..0b66740 100644 void set_longjmp_breakpoint (int thread) -@@ -5026,10 +5116,11 @@ set_longjmp_breakpoint (int thread) +@@ -5562,11 +5719,12 @@ set_longjmp_breakpoint (int thread) clones of those and enable them for the requested thread. */ ALL_BREAKPOINTS_SAFE (b, temp) if (b->pspace == current_program_space @@ -824,12 +752,13 @@ index 8c97949..0b66740 100644 + || b->type == bp_exception_master)) { struct breakpoint *clone = clone_momentary_breakpoint (b); + - clone->type = bp_longjmp; + clone->type = b->type == bp_longjmp_master ? bp_longjmp : bp_exception; clone->thread = thread; } } -@@ -5041,7 +5132,7 @@ delete_longjmp_breakpoint (int thread) +@@ -5578,7 +5736,7 @@ delete_longjmp_breakpoint (int thread) struct breakpoint *b, *temp; ALL_BREAKPOINTS_SAFE (b, temp) @@ -838,7 +767,33 @@ index 8c97949..0b66740 100644 { if (b->thread == thread) delete_breakpoint (b); -@@ -6116,6 +6207,8 @@ mention (struct breakpoint *b) +@@ -6595,7 +6753,7 @@ clone_momentary_breakpoint (struct breakpoint *orig) + + copy = set_raw_breakpoint_without_location (orig->gdbarch, orig->type); + copy->loc = allocate_bp_location (copy); +- set_breakpoint_location_function (copy->loc); ++ set_breakpoint_location_function (copy->loc, 1); + + copy->loc->gdbarch = orig->loc->gdbarch; + copy->loc->requested_address = orig->loc->requested_address; +@@ -6694,6 +6852,7 @@ mention (struct breakpoint *b) + do_cleanups (ui_out_chain); + break; + case bp_breakpoint: ++ case bp_gnu_ifunc_resolver: + if (ui_out_is_mi_like_p (uiout)) + { + say_where = 0; +@@ -6704,6 +6863,8 @@ mention (struct breakpoint *b) + else + printf_filtered (_("Breakpoint")); + printf_filtered (_(" %d"), b->number); ++ if (b->type == bp_gnu_ifunc_resolver) ++ printf_filtered (_(" at gnu-indirect-function resolver")); + say_where = 1; + break; + case bp_hardware_breakpoint: +@@ -6750,6 +6911,8 @@ mention (struct breakpoint *b) case bp_finish: case bp_longjmp: case bp_longjmp_resume: @@ -846,16 +801,27 @@ index 8c97949..0b66740 100644 + case bp_exception_resume: case bp_step_resume: case bp_call_dummy: - case bp_watchpoint_scope: -@@ -6124,6 +6217,7 @@ mention (struct breakpoint *b) - case bp_overlay_event: + case bp_std_terminate: +@@ -6760,6 +6923,8 @@ mention (struct breakpoint *b) case bp_jit_event: case bp_longjmp_master: + case bp_std_terminate_master: ++ case bp_gnu_ifunc_resolver_return: + case bp_exception_master: break; } -@@ -7509,6 +7603,7 @@ struct until_break_command_continuation_args +@@ -6820,7 +6985,8 @@ add_location_to_breakpoint (struct breakpoint *b, + gdb_assert (loc->pspace != NULL); + loc->section = sal->section; + +- set_breakpoint_location_function (loc); ++ set_breakpoint_location_function (loc, ++ sal->explicit_pc || sal->explicit_line); + return loc; + } + +@@ -8346,6 +8512,7 @@ struct until_break_command_continuation_args { struct breakpoint *breakpoint; struct breakpoint *breakpoint2; @@ -863,7 +829,7 @@ index 8c97949..0b66740 100644 }; /* This function is called by fetch_inferior_event via the -@@ -7523,6 +7618,7 @@ until_break_command_continuation (void *arg) +@@ -8360,6 +8527,7 @@ until_break_command_continuation (void *arg) delete_breakpoint (a->breakpoint); if (a->breakpoint2) delete_breakpoint (a->breakpoint2); @@ -871,7 +837,7 @@ index 8c97949..0b66740 100644 } void -@@ -7534,6 +7630,8 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -8371,6 +8539,8 @@ until_break_command (char *arg, int from_tty, int anywhere) struct breakpoint *breakpoint; struct breakpoint *breakpoint2 = NULL; struct cleanup *old_chain; @@ -880,7 +846,7 @@ index 8c97949..0b66740 100644 clear_proceed_status (); -@@ -7572,6 +7670,9 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -8409,6 +8579,9 @@ until_break_command (char *arg, int from_tty, int anywhere) old_chain = make_cleanup_delete_breakpoint (breakpoint); @@ -890,7 +856,7 @@ index 8c97949..0b66740 100644 /* Keep within the current frame, or in frames called by the current one. */ -@@ -7584,6 +7685,10 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -8421,6 +8594,10 @@ until_break_command (char *arg, int from_tty, int anywhere) frame_unwind_caller_id (frame), bp_until); make_cleanup_delete_breakpoint (breakpoint2); @@ -901,7 +867,7 @@ index 8c97949..0b66740 100644 } proceed (-1, TARGET_SIGNAL_DEFAULT, 0); -@@ -7600,6 +7705,7 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -8437,6 +8614,7 @@ until_break_command (char *arg, int from_tty, int anywhere) args->breakpoint = breakpoint; args->breakpoint2 = breakpoint2; @@ -909,48 +875,134 @@ index 8c97949..0b66740 100644 discard_cleanups (old_chain); add_continuation (inferior_thread (), -@@ -8796,6 +8902,7 @@ delete_command (char *arg, int from_tty) - && b->type != bp_thread_event +@@ -9564,12 +9742,22 @@ delete_breakpoint (struct breakpoint *bpt) + + /* At least avoid this stale reference until the reference counting of + breakpoints gets resolved. */ +- if (bpt->related_breakpoint != NULL) ++ if (bpt->related_breakpoint != bpt) + { +- gdb_assert (bpt->related_breakpoint->related_breakpoint == bpt); +- bpt->related_breakpoint->disposition = disp_del_at_next_stop; +- bpt->related_breakpoint->related_breakpoint = NULL; +- bpt->related_breakpoint = NULL; ++ if (bpt->type == bp_watchpoint_scope) ++ watchpoint_del_at_next_stop (bpt->related_breakpoint); ++ else if (bpt->related_breakpoint->type == bp_watchpoint_scope) ++ watchpoint_del_at_next_stop (bpt); ++ else ++ { ++ struct breakpoint *related; ++ ++ /* Unlink bpt from the bpt->related_breakpoint ring. */ ++ for (related = bpt; related->related_breakpoint != bpt; ++ related = related->related_breakpoint); ++ related->related_breakpoint = bpt->related_breakpoint; ++ bpt->related_breakpoint = bpt; ++ } + } + + observer_notify_breakpoint_deleted (bpt->number); +@@ -9658,6 +9846,7 @@ delete_command (char *arg, int from_tty) && b->type != bp_overlay_event && b->type != bp_longjmp_master + && b->type != bp_std_terminate_master + && b->type != bp_exception_master && b->number >= 0) { breaks_to_delete = 1; -@@ -8815,6 +8922,7 @@ delete_command (char *arg, int from_tty) - && b->type != bp_jit_event +@@ -9679,6 +9868,7 @@ delete_command (char *arg, int from_tty) && b->type != bp_overlay_event && b->type != bp_longjmp_master + && b->type != bp_std_terminate_master + && b->type != bp_exception_master && b->number >= 0) delete_breakpoint (b); } -@@ -9125,6 +9233,7 @@ breakpoint_re_set_one (void *bint) - reset later by breakpoint_re_set. */ +@@ -9887,6 +10077,9 @@ update_breakpoint_locations (struct breakpoint *b, + return; + + b->loc = NULL; ++ xfree (b->source_file); ++ b->source_file = NULL; ++ b->line_number = 0; + + for (i = 0; i < sals.nelts; ++i) + { +@@ -9913,11 +10106,7 @@ update_breakpoint_locations (struct breakpoint *b, + } + } + +- if (b->source_file != NULL) +- xfree (b->source_file); +- if (sals.sals[i].symtab == NULL) +- b->source_file = NULL; +- else ++ if (sals.sals[i].symtab != NULL && b->source_file == NULL) + b->source_file = xstrdup (sals.sals[i].symtab->filename); + + if (b->line_number == 0) +@@ -9999,6 +10188,7 @@ breakpoint_re_set_one (void *bint) + case bp_tracepoint: + case bp_fast_tracepoint: + case bp_static_tracepoint: ++ case bp_gnu_ifunc_resolver: + /* Do not attempt to re-set breakpoints disabled during startup. */ + if (b->enable_state == bp_startup_disabled) + return 0; +@@ -10139,6 +10329,7 @@ breakpoint_re_set_one (void *bint) case bp_overlay_event: case bp_longjmp_master: + case bp_std_terminate_master: + case bp_exception_master: delete_breakpoint (b); break; -@@ -9147,6 +9256,8 @@ breakpoint_re_set_one (void *bint) +@@ -10162,7 +10353,10 @@ breakpoint_re_set_one (void *bint) case bp_step_resume: case bp_longjmp: case bp_longjmp_resume: + case bp_exception: + case bp_exception_resume: case bp_jit_event: ++ case bp_gnu_ifunc_resolver_return: break; } -@@ -9189,6 +9300,7 @@ breakpoint_re_set (void) - create_longjmp_master_breakpoint ("_longjmp"); + +@@ -10205,6 +10399,7 @@ breakpoint_re_set (void) create_longjmp_master_breakpoint ("siglongjmp"); create_longjmp_master_breakpoint ("_siglongjmp"); + create_std_terminate_master_breakpoint ("std::terminate()"); + create_exception_master_breakpoint (); } /* Reset the thread number of this breakpoint: -@@ -10187,6 +10299,22 @@ all_tracepoints () +@@ -10334,11 +10529,20 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *, + ALL_BREAKPOINTS_SAFE (b, tmp) + if (b->number == num) + { +- struct breakpoint *related_breakpoint = b->related_breakpoint; ++ struct breakpoint *related_breakpoint; ++ + match = 1; +- function (b, data); +- if (related_breakpoint) +- function (related_breakpoint, data); ++ related_breakpoint = b; ++ do ++ { ++ struct breakpoint *next_related_b; ++ ++ /* FUNCTION can be also delete_breakpoint. */ ++ next_related_b = related_breakpoint->related_breakpoint; ++ function (related_breakpoint, data); ++ related_breakpoint = next_related_b; ++ } ++ while (related_breakpoint != b); + break; + } + if (match == 0) +@@ -11428,6 +11632,22 @@ all_tracepoints () return tp_vec; } @@ -973,14 +1025,122 @@ index 8c97949..0b66740 100644 /* This help string is used for the break, hbreak, tbreak and thbreak commands. It is defined as a macro to prevent duplication. -@@ -10731,4 +10859,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."), +@@ -11497,6 +11717,107 @@ save_command (char *arg, int from_tty) + help_list (save_cmdlist, "save ", -1, gdb_stdout); + } + ++static void ++gnu_ifunc_resolver_stop (struct breakpoint *b) ++{ ++ struct breakpoint *b_return; ++ struct frame_info *prev_frame = get_prev_frame (get_current_frame ()); ++ struct frame_id prev_frame_id = get_stack_frame_id (prev_frame); ++ CORE_ADDR prev_pc = get_frame_pc (prev_frame); ++ int thread_id = pid_to_thread_id (inferior_ptid); ++ ++ gdb_assert (b->type == bp_gnu_ifunc_resolver); ++ ++ for (b_return = b->related_breakpoint; b_return != b; ++ b_return = b_return->related_breakpoint) ++ { ++ gdb_assert (b_return->type == bp_gnu_ifunc_resolver_return); ++ gdb_assert (b_return->loc != NULL && b_return->loc->next == NULL); ++ gdb_assert (frame_id_p (b_return->frame_id)); ++ ++ if (b_return->thread == thread_id ++ && b_return->loc->requested_address == prev_pc ++ && frame_id_eq (b_return->frame_id, prev_frame_id)) ++ break; ++ } ++ ++ if (b_return == b) ++ { ++ struct symtab_and_line sal; ++ ++ /* No need to call find_pc_line for symbols resolving as this is only ++ a helper breakpointer never shown to the user. */ ++ ++ init_sal (&sal); ++ sal.pspace = current_inferior ()->pspace; ++ sal.pc = prev_pc; ++ sal.section = find_pc_overlay (sal.pc); ++ sal.explicit_pc = 1; ++ b_return = set_momentary_breakpoint (get_frame_arch (prev_frame), sal, ++ prev_frame_id, ++ bp_gnu_ifunc_resolver_return); ++ ++ /* Add new b_return to the ring list b->related_breakpoint. */ ++ gdb_assert (b_return->related_breakpoint == b_return); ++ b_return->related_breakpoint = b->related_breakpoint; ++ b->related_breakpoint = b_return; ++ } ++} ++ ++static void ++gnu_ifunc_resolver_return_stop (struct breakpoint *b) ++{ ++ struct gdbarch *gdbarch = get_frame_arch (get_current_frame ()); ++ struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func; ++ struct type *value_type = TYPE_TARGET_TYPE (func_func_type); ++ struct regcache *regcache = get_thread_regcache (inferior_ptid); ++ struct value *value; ++ CORE_ADDR resolved_address, resolved_pc; ++ struct symtab_and_line sal; ++ struct symtabs_and_lines sals; ++ ++ gdb_assert (b->type == bp_gnu_ifunc_resolver_return); ++ ++ value = allocate_value (value_type); ++ gdbarch_return_value (gdbarch, func_func_type, value_type, regcache, ++ value_contents_raw (value), NULL); ++ resolved_address = value_as_address (value); ++ resolved_pc = gdbarch_convert_from_func_ptr_addr (gdbarch, ++ resolved_address, ++ ¤t_target); ++ ++ while (b->related_breakpoint != b) ++ { ++ struct breakpoint *b_next = b->related_breakpoint; ++ ++ switch (b->type) ++ { ++ case bp_gnu_ifunc_resolver: ++ break; ++ case bp_gnu_ifunc_resolver_return: ++ delete_breakpoint (b); ++ break; ++ default: ++ internal_error (__FILE__, __LINE__, ++ _("handle_inferior_event: Invalid " ++ "gnu-indirect-function breakpoint type %d"), ++ (int) b->type); ++ } ++ b = b_next; ++ } ++ gdb_assert (b->type == bp_gnu_ifunc_resolver); ++ ++ gdb_assert (current_program_space == b->pspace); ++ gnu_ifunc_record_cache (gdbarch, b->addr_string, resolved_pc); ++ ++ sal = find_pc_line (resolved_pc, 0); ++ sals.nelts = 1; ++ sals.sals = &sal; ++ ++ b->type = bp_breakpoint; ++ update_breakpoint_locations (b, sals); ++} ++ + void + _initialize_breakpoint (void) + { +@@ -12022,4 +12343,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."), automatic_hardware_breakpoints = 1; observer_attach_about_to_proceed (breakpoint_about_to_proceed); + observer_attach_mark_used (breakpoint_types_mark_used); } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h -index 6b373a3..59aa412 100644 +index 6f5d050..d0c3cc1 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -56,6 +56,13 @@ enum bptype @@ -997,9 +1157,9 @@ index 6b373a3..59aa412 100644 /* Used by wait_for_inferior for stepping over subroutine calls, for stepping over signal handlers, and for skipping prologues. */ bp_step_resume, -@@ -118,6 +125,9 @@ enum bptype - - bp_longjmp_master, +@@ -125,6 +132,9 @@ enum bptype + /* Master copies of std::terminate breakpoints. */ + bp_std_terminate_master, + /* Like bp_longjmp_master, but for exceptions. */ + bp_exception_master, @@ -1007,10 +1167,20 @@ index 6b373a3..59aa412 100644 bp_catchpoint, bp_tracepoint, -@@ -603,6 +613,10 @@ struct bpstat_what +@@ -133,6 +143,9 @@ enum bptype + + /* Event for JIT compiled code generation or deletion. */ + bp_jit_event, ++ ++ bp_gnu_ifunc_resolver, ++ bp_gnu_ifunc_resolver_return, + }; + + /* States of enablement of breakpoint. */ +@@ -653,6 +666,10 @@ struct bpstat_what continuing from a call dummy without popping the frame is not a useful one). */ - int call_dummy; + enum stop_stack_kind call_dummy; + + /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME. True if we are + handling a longjmp, false if we are handling an exception. */ @@ -1018,347 +1188,11 @@ index 6b373a3..59aa412 100644 }; /* The possible return values for print_bpstat, print_it_normal, -@@ -985,6 +999,9 @@ extern int catching_syscall_number (int syscall_number); - /* Tell a breakpoint to be quiet. */ - extern void make_breakpoint_silent (struct breakpoint *); - -+/* Set break condition of breakpoint B to EXP. */ -+extern void set_breakpoint_condition (struct breakpoint *b, char *exp, int from_tty); -+ - /* Return a tracepoint with the given number if found. */ - extern struct breakpoint *get_tracepoint (int num); - -diff --git a/gdb/c-exp.y b/gdb/c-exp.y -index 845771c..7a74d7e 100644 ---- a/gdb/c-exp.y -+++ b/gdb/c-exp.y -@@ -186,6 +186,7 @@ static struct stoken operator_stoken (const char *); - %token STRING - %token CHAR - %token NAME /* BLOCKNAME defined below to give it higher precedence. */ -+%token UNKNOWN_CPP_NAME - %token COMPLETE - %token TYPENAME - %type name -@@ -391,6 +392,30 @@ exp : exp '(' - write_exp_elt_opcode (OP_FUNCALL); } - ; - -+exp : UNKNOWN_CPP_NAME '(' -+ { -+ -+ /* This could potentially be a an argument defined -+ lookup function (Koenig). */ -+ write_exp_elt_opcode (OP_ADL_FUNC); -+ write_exp_elt_block (expression_context_block); -+ write_exp_elt_sym (NULL); /* Place holder */ -+ write_exp_string ($1.stoken); -+ write_exp_elt_opcode (OP_ADL_FUNC); -+ -+ /* This is to save the value of arglist_len -+ being accumulated by an outer function call. */ -+ -+ start_arglist (); -+ } -+ arglist ')' %prec ARROW -+ { -+ write_exp_elt_opcode (OP_FUNCALL); -+ write_exp_elt_longcst ((LONGEST) end_arglist ()); -+ write_exp_elt_opcode (OP_FUNCALL); -+ } -+ ; -+ - lcurly : '{' - { start_arglist (); } - ; -@@ -418,6 +443,24 @@ exp : exp '(' nonempty_typelist ')' const_or_volatile - } - ; - -+/* -+exp : BLOCKNAME '(' nonempty_typelist ')' -+ { int i; -+ write_exp_elt_opcode (TYPE_INSTANCE_LOOKUP); -+ write_exp_elt_sym ($1.sym); -+ write_exp_elt_opcode (TYPE_INSTANCE_LOOKUP); -+ -+ write_exp_elt_opcode (TYPE_INSTANCE); -+ write_exp_elt_longcst ((LONGEST) $3[0]); -+ for (i = 0; i < $3[0]; ++i) -+ write_exp_elt_type ($3[i + 1]); -+ write_exp_elt_longcst((LONGEST) $3[0]); -+ write_exp_elt_opcode (TYPE_INSTANCE); -+ do_cleanups (typelist_cleanup); -+ } -+ ; -+*/ -+ - rcurly : '}' - { $$ = end_arglist () - 1; } - ; -@@ -785,12 +828,13 @@ qualified_name: typebase COLONCOLON name - ; - - variable: qualified_name -+ | COLONCOLON qualified_name - | COLONCOLON name - { - char *name = copy_name ($2); - struct symbol *sym; - struct minimal_symbol *msymbol; -- -+ - sym = - lookup_symbol (name, (const struct block *) NULL, - VAR_DOMAIN, (int *) NULL); -@@ -1286,6 +1330,7 @@ name : NAME { $$ = $1.stoken; } - | BLOCKNAME { $$ = $1.stoken; } - | TYPENAME { $$ = $1.stoken; } - | NAME_OR_INT { $$ = $1.stoken; } -+ | UNKNOWN_CPP_NAME { $$ = $1.stoken; } - | operator { $$ = $1; } - ; - -@@ -1298,6 +1343,15 @@ name_not_typename : NAME - context where only a name could occur, this might be useful. - | NAME_OR_INT - */ -+ | UNKNOWN_CPP_NAME -+ | operator -+ { -+ $$.stoken = $1; -+ $$.sym = lookup_symbol ($1.ptr, -+ expression_context_block, -+ VAR_DOMAIN, -+ &$$.is_a_field_of_this); -+ } - ; - - %% -@@ -2033,6 +2087,13 @@ static int last_was_structop; - static int - yylex (void) - { -+ /* name_prefix stores the full qualification of a variable that is -+ specified in the expression. It is used to eleminate confusion -+ during lookup.*/ -+ static char *name_prefix = NULL; -+ static int name_prefix_len = 0; -+ static int terminate_prefix = 0; -+ - int c; - int namelen; - unsigned int i; -@@ -2041,9 +2102,19 @@ yylex (void) - char *copy; - - last_was_structop = 0; -- -+ - retry: -- -+ -+ if (terminate_prefix -+ || lexptr != name_prefix + name_prefix_len) -+ { -+ /* Some token was skipped, so clear name_prefix. */ -+ name_prefix = NULL; -+ name_prefix_len = 0; -+ } -+ -+ terminate_prefix = 1; -+ - /* Check if this is a macro invocation that we need to expand. */ - if (! scanning_macro_expansion ()) - { -@@ -2079,10 +2150,19 @@ yylex (void) - && parse_language->la_language != language_cplus) - break; - -+ if (tokentab2[i].token == COLONCOLON) -+ { -+ name_prefix_len += 2; -+ terminate_prefix = 0; -+ if (name_prefix == NULL) -+ name_prefix = lexptr; -+ } -+ - lexptr += 2; - yylval.opcode = tokentab2[i].opcode; - if (in_parse_field && tokentab2[i].token == ARROW) - last_was_structop = 1; -+ - return tokentab2[i].token; - } - -@@ -2111,6 +2191,8 @@ yylex (void) - return 0; - - case ' ': -+ name_prefix_len++; -+ terminate_prefix = 0; - case '\t': - case '\n': - lexptr++; -@@ -2268,11 +2350,13 @@ yylex (void) - error ("Invalid character '%c' in expression.", c); - - /* It's a name. See how long it is. */ -+ - namelen = 0; - for (c = tokstart[namelen]; - (c == '_' || c == '$' || (c >= '0' && c <= '9') - || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) - { -+ - /* Template parameter lists are part of the name. - FIXME: This mishandles `print $a<4&&$a>3'. */ - -@@ -2357,14 +2441,33 @@ yylex (void) - currently as names of types; NAME for other symbols. - The caller is not constrained to care about the distinction. */ - { -+ char *tmp = copy; - struct symbol *sym; - int is_a_field_of_this = 0; - int hextype; - -- sym = lookup_symbol (copy, expression_context_block, -+ if (name_prefix != NULL) -+ { -+ tmp = alloca (name_prefix_len + namelen + 1); -+ memcpy (tmp, name_prefix, name_prefix_len + namelen); -+ tmp[name_prefix_len + namelen] = '\0'; -+ } -+ -+ sym = lookup_symbol (tmp, expression_context_block, - VAR_DOMAIN, - parse_language->la_language == language_cplus - ? &is_a_field_of_this : (int *) NULL); -+ -+ /* Keep this name as the prefix for the next name. */ -+ if (sym) -+ { -+ if (name_prefix == NULL) -+ name_prefix = tokstart; -+ -+ name_prefix_len += namelen; -+ terminate_prefix = 0; -+ } -+ - /* Call lookup_symtab, not lookup_partial_symtab, in case there are - no psymtabs (coff, xcoff, or some future change to blow away the - psymtabs once once symbols are read). */ -@@ -2423,6 +2526,12 @@ yylex (void) - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - if (in_parse_field && *lexptr == '\0') - saw_name_at_eof = 1; -+ -+ if (sym == NULL -+ && parse_language->la_language == language_cplus -+ && !lookup_minimal_symbol (tmp, NULL, NULL)) -+ return UNKNOWN_CPP_NAME; -+ - return NAME; - } - } -diff --git a/gdb/c-lang.c b/gdb/c-lang.c -index d620881..34cb34a 100644 ---- a/gdb/c-lang.c -+++ b/gdb/c-lang.c -@@ -1140,6 +1140,7 @@ static const struct exp_descriptor exp_descriptor_c = - { - print_subexp_standard, - operator_length_standard, -+ operator_check_standard, - op_name_standard, - dump_subexp_body_standard, - evaluate_subexp_c diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c -index ed98381..3061ab7 100644 +index 926ae2f..a59b965 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c -@@ -32,6 +32,7 @@ - #include "c-lang.h" - #include "typeprint.h" - #include "cp-abi.h" -+#include "jv-lang.h" - - #include "gdb_string.h" - #include -@@ -40,8 +41,6 @@ static void cp_type_print_method_args (struct type *mtype, char *prefix, - char *varstring, int staticp, - struct ui_file *stream); - --static void c_type_print_args (struct type *, struct ui_file *); -- - static void cp_type_print_derivation_info (struct ui_file *, struct type *); - - static void c_type_print_varspec_prefix (struct type *, struct ui_file *, int, -@@ -197,6 +196,23 @@ cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, - fprintf_filtered (stream, "void"); - - fprintf_filtered (stream, ")"); -+ -+ /* For non-static methods, read qualifiers from the type of -+ THIS. */ -+ if (!staticp) -+ { -+ struct type *domain; -+ -+ gdb_assert (nargs > 0); -+ gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR); -+ domain = TYPE_TARGET_TYPE (args[0].type); -+ -+ if (TYPE_CONST (domain)) -+ fprintf_filtered (stream, " const"); -+ -+ if (TYPE_VOLATILE (domain)) -+ fprintf_filtered (stream, " volatile"); -+ } - } - - -@@ -353,10 +369,14 @@ c_type_print_modifier (struct type *type, struct ui_file *stream, - - /* Print out the arguments of TYPE, which should have TYPE_CODE_METHOD - or TYPE_CODE_FUNC, to STREAM. Artificial arguments, such as "this" -- in non-static methods, are displayed. */ -+ in non-static methods, are displayed if SHOW_ARTIFICIAL is -+ non-zero. LANGUAGE is the language in which TYPE was defined. This is -+ a necessary evil since this code is used by the C, C++, and Java -+ backends. */ - --static void --c_type_print_args (struct type *type, struct ui_file *stream) -+void -+c_type_print_args (struct type *type, struct ui_file *stream, -+ int show_artificial, enum language language) - { - int i, len; - struct field *args; -@@ -368,13 +388,19 @@ c_type_print_args (struct type *type, struct ui_file *stream) - - for (i = 0; i < TYPE_NFIELDS (type); i++) - { -+ if (TYPE_FIELD_ARTIFICIAL (type, i) && !show_artificial) -+ continue; -+ - if (printed_any) - { - fprintf_filtered (stream, ", "); - wrap_here (" "); - } - -- c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0); -+ if (language == language_java) -+ java_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0); -+ else -+ c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0); - printed_any = 1; - } - -@@ -558,7 +584,13 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, +@@ -585,7 +585,13 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, fprintf_filtered (stream, ")"); fprintf_filtered (stream, "["); @@ -1373,1716 +1207,11 @@ index ed98381..3061ab7 100644 && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) fprintf_filtered (stream, "%d", (TYPE_LENGTH (type) -@@ -591,7 +623,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - if (passed_a_ptr) - fprintf_filtered (stream, ")"); - if (!demangled_args) -- c_type_print_args (type, stream); -+ c_type_print_args (type, stream, 1, language_c); - c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, show, - passed_a_ptr, 0); - break; -diff --git a/gdb/coffread.c b/gdb/coffread.c -index ba413ad..44676a8 100644 ---- a/gdb/coffread.c -+++ b/gdb/coffread.c -@@ -2123,6 +2123,7 @@ static struct sym_fns coff_sym_fns = - coff_new_init, /* sym_new_init: init anything gbl to entire symtab */ - coff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - coff_symfile_read, /* sym_read: read a symbol file into symtab */ -+ NULL, /* sym_read_psymbols */ - coff_symfile_finish, /* sym_finish: finished with file, cleanup */ - default_symfile_offsets, /* sym_offsets: xlate external to internal form */ - default_symfile_segments, /* sym_segments: Get segment information from -diff --git a/gdb/config.in b/gdb/config.in -index ebde876..907b275 100644 ---- a/gdb/config.in -+++ b/gdb/config.in -@@ -46,11 +46,10 @@ - language is requested. */ - #undef ENABLE_NLS - --/* look for global separate data files in this path [DATADIR/gdb] */ -+/* Global directory for GDB data files. */ - #undef GDB_DATADIR - --/* Define if the gdb-datadir directory should be relocated when GDB is moved. -- */ -+/* Define if GDB datadir should be relocated when GDB is moved. */ - #undef GDB_DATADIR_RELOCATABLE - - /* Define to be a string naming the default host character set. */ -@@ -653,6 +652,9 @@ - 'ptrdiff_t'. */ - #undef PTRDIFF_T_SUFFIX - -+/* Define to install path for Python sources */ -+#undef PYTHONDIR -+ - /* Relocated directory for source files. */ - #undef RELOC_SRCDIR - -diff --git a/gdb/configure b/gdb/configure -index 1983d04..8dca37e 100755 ---- a/gdb/configure -+++ b/gdb/configure -@@ -676,6 +676,8 @@ REPORT_BUGS_TO - PKGVERSION - TARGET_OBS - subdirs -+pythondir -+GDB_DATADIR_PATH - GDB_DATADIR - DEBUGDIR - am__fastdepCC_FALSE -@@ -885,6 +887,7 @@ enable_dependency_tracking - with_separate_debug_dir - with_gdb_datadir - with_relocated_sources -+with_pythondir - enable_targets - enable_64_bit_bfd - enable_gdbcli -@@ -1586,6 +1589,10 @@ Optional Packages: - [DATADIR/gdb] - --with-relocated-sources=PATH - automatically relocate this path for source files -+ --with-gdb-datadir look for global separate data files in this path -+ [DATADIR/gdb] -+ --with-pythondir install Python data files in this path -+ [DATADIR/gdb/python] - --with-libunwind use libunwind frame unwinding support - --with-curses use the curses library instead of the termcap - library -@@ -6866,6 +6873,73 @@ _ACEOF - fi - - -+# GDB's datadir relocation -+ -+gdbdatadir=${datadir}/gdb -+ -+ -+# Check whether --with-gdb-datadir was given. -+if test "${with_gdb_datadir+set}" = set; then : -+ withval=$with_gdb_datadir; gdbdatadir="${withval}" -+fi -+ -+ -+ -+ test "x$prefix" = xNONE && prefix="$ac_default_prefix" -+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -+ ac_define_dir=`eval echo $gdbdatadir` -+ ac_define_dir=`eval echo $ac_define_dir` -+ -+cat >>confdefs.h <<_ACEOF -+#define GDB_DATADIR "$ac_define_dir" -+_ACEOF -+ -+ -+ -+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then -+ if test "x$prefix" = xNONE; then -+ test_prefix=/usr/local -+ else -+ test_prefix=$prefix -+ fi -+else -+ test_prefix=$exec_prefix -+fi -+ -+case ${gdbdatadir} in -+ "${test_prefix}"|"${test_prefix}/"*|\ -+ '${exec_prefix}'|'${exec_prefix}/'*) -+ -+$as_echo "#define GDB_DATADIR_RELOCATABLE 1" >>confdefs.h -+ -+ ;; -+esac -+GDB_DATADIR_PATH=${gdbdatadir} -+ -+ -+ -+# Check whether --with-pythondir was given. -+if test "${with_pythondir+set}" = set; then : -+ withval=$with_pythondir; pythondir="${withval}" -+else -+ pythondir=no -+fi -+ -+ -+# If the user passed in a path, define it. Otherwise, compute it at -+# runtime based on the possibly-relocatable datadir. -+if test "$pythondir" = "no"; then -+ pythondir='$(GDB_DATADIR_PATH)/python' -+else -+ -+cat >>confdefs.h <<_ACEOF -+#define PYTHONDIR "$pythondir" -+_ACEOF -+ -+fi -+ -+ -+ - - - subdirs="$subdirs doc testsuite" -@@ -9604,6 +9678,8 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h - CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)" - CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" - CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" -+ CONFIG_INSTALL="$CONFIG_INSTALL install-python" -+ CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python" - ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" - - # Flags needed to compile Python code (taken from python-config --cflags). -diff --git a/gdb/configure.ac b/gdb/configure.ac -index 6f873b5..77985c8 100644 ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -108,6 +108,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat - [Relocated directory for source files. ]) - ]) - -+# GDB's datadir relocation -+ -+gdbdatadir=${datadir}/gdb -+ -+AC_ARG_WITH([gdb-datadir], -+ [AS_HELP_STRING([--with-gdb-datadir], -+ [look for global separate data files in this path [DATADIR/gdb]])], [gdbdatadir="${withval}"]) -+ -+AC_DEFINE_DIR(GDB_DATADIR, gdbdatadir, -+ [Global directory for GDB data files. ]) -+ -+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then -+ if test "x$prefix" = xNONE; then -+ test_prefix=/usr/local -+ else -+ test_prefix=$prefix -+ fi -+else -+ test_prefix=$exec_prefix -+fi -+ -+case ${gdbdatadir} in -+ "${test_prefix}"|"${test_prefix}/"*|\ -+ '${exec_prefix}'|'${exec_prefix}/'*) -+ AC_DEFINE(GDB_DATADIR_RELOCATABLE, 1, [Define if GDB datadir should be relocated when GDB is moved.]) -+ ;; -+esac -+GDB_DATADIR_PATH=${gdbdatadir} -+AC_SUBST(GDB_DATADIR_PATH) -+ -+AC_ARG_WITH([pythondir], -+ [AS_HELP_STRING([--with-pythondir], -+ [install Python data files in this path [DATADIR/gdb/python]])], [pythondir="${withval}"], [pythondir=no]) -+ -+# If the user passed in a path, define it. Otherwise, compute it at -+# runtime based on the possibly-relocatable datadir. -+if test "$pythondir" = "no"; then -+ pythondir='$(GDB_DATADIR_PATH)/python' -+else -+ AC_DEFINE_UNQUOTED(PYTHONDIR, "$pythondir", -+ [Define to install path for Python sources]) -+fi -+AC_SUBST(pythondir) -+ -+ - AC_CONFIG_SUBDIRS(doc testsuite) - - # Check whether to support alternative target configurations -@@ -674,6 +719,8 @@ if test "${have_libpython}" = yes; then - CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)" - CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" - CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" -+ CONFIG_INSTALL="$CONFIG_INSTALL install-python" -+ CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python" - ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" - - # Flags needed to compile Python code (taken from python-config --cflags). -diff --git a/gdb/configure.tgt b/gdb/configure.tgt -index 62e6683..2b9bb2f 100644 ---- a/gdb/configure.tgt -+++ b/gdb/configure.tgt -@@ -40,7 +40,7 @@ alpha*-*-osf*) - alpha*-*-linux*) - # Target: Little-endian Alpha running Linux - gdb_target_obs="alpha-tdep.o alpha-mdebug-tdep.o alpha-linux-tdep.o \ -- solib.o solib-svr4.o" -+ solib.o solib-svr4.o linux-tdep.o" - ;; - alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu) - # Target: FreeBSD/alpha -@@ -67,7 +67,7 @@ alpha*-*-*) - am33_2.0*-*-linux*) - # Target: Matsushita mn10300 (AM33) running Linux - gdb_target_obs="mn10300-tdep.o mn10300-linux-tdep.o corelow.o \ -- solib.o solib-svr4.o" -+ solib.o solib-svr4.o linux-tdep.o" - ;; - - arm*-wince-pe | arm*-*-mingw32ce*) -@@ -233,7 +233,7 @@ i[34567]86-*-*) - - ia64-*-linux*) - # Target: Intel IA-64 running GNU/Linux -- gdb_target_obs="ia64-tdep.o ia64-linux-tdep.o \ -+ gdb_target_obs="ia64-tdep.o ia64-linux-tdep.o linux-tdep.o \ - solib.o solib-svr4.o symfile-mem.o" - build_gdbserver=yes - ;; -@@ -263,7 +263,8 @@ m32c-*-*) - m32r*-*-linux*) - # Target: Renesas M32R running GNU/Linux - gdb_target_obs="m32r-tdep.o m32r-linux-tdep.o remote-m32r-sdi.o \ -- glibc-tdep.o solib.o solib-svr4.o symfile-mem.o" -+ glibc-tdep.o solib.o solib-svr4.o symfile-mem.o \ -+ linux-tdep.o" - gdb_sim=../sim/m32r/libsim.a - build_gdbserver=yes - ;; -@@ -317,7 +318,7 @@ microblaze*-linux-*) - # Target: Xilinx MicroBlaze running Linux - gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o \ - monitor.o dsrec.o solib.o solib-svr4.o corelow.o \ -- symfile-mem.o" -+ symfile-mem.o linux-tdep.o" - gdb_sim=../sim/microblaze/libsim.a - ;; - microblaze*-xilinx-*) -@@ -337,7 +338,8 @@ mips*-sgi-irix6*) - mips*-*-linux*) - # Target: Linux/MIPS - gdb_target_obs="mips-tdep.o mips-linux-tdep.o glibc-tdep.o \ -- corelow.o solib.o solib-svr4.o symfile-mem.o" -+ corelow.o solib.o solib-svr4.o symfile-mem.o \ -+ linux-tdep.o" - gdb_sim=../sim/mips/libsim.a - build_gdbserver=yes - ;; -@@ -427,7 +429,7 @@ sh*-*-linux*) - # Target: GNU/Linux Super-H - gdb_target_obs="sh-tdep.o sh64-tdep.o sh-linux-tdep.o monitor.o \ - dsrec.o solib.o solib-svr4.o symfile-mem.o \ -- glibc-tdep.o corelow.o" -+ glibc-tdep.o corelow.o linux-tdep.o" - gdb_sim=../sim/sh/libsim.a - build_gdbserver=yes - ;; -@@ -455,7 +457,8 @@ sh*) - sparc-*-linux*) - # Target: GNU/Linux SPARC - gdb_target_obs="sparc-tdep.o sparc-sol2-tdep.o sol2-tdep.o \ -- sparc-linux-tdep.o solib.o solib-svr4.o symfile-mem.o" -+ sparc-linux-tdep.o solib.o solib-svr4.o symfile-mem.o \ -+ linux-tdep.o" - if test "x$enable_64_bit_bfd" = "xyes"; then - # Target: GNU/Linux UltraSPARC - gdb_target_obs="sparc64-tdep.o sparc64-sol2-tdep.o \ -@@ -466,7 +469,7 @@ sparc64-*-linux*) - # Target: GNU/Linux UltraSPARC - gdb_target_obs="sparc64-tdep.o sparc64-sol2-tdep.o sol2-tdep.o \ - sparc64-linux-tdep.o sparc-tdep.o sparc-sol2-tdep.o \ -- sparc-linux-tdep.o solib.o solib-svr4.o" -+ sparc-linux-tdep.o solib.o solib-svr4.o linux-tdep.o" - build_gdbserver=yes - ;; - sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu) -@@ -601,7 +604,8 @@ x86_64-*-openbsd*) - xtensa*-*-linux*) gdb_target=linux - # Target: GNU/Linux Xtensa - gdb_target_obs="xtensa-tdep.o xtensa-config.o xtensa-linux-tdep.o \ -- solib.o solib-svr4.o corelow.o symfile-mem.o" -+ solib.o solib-svr4.o corelow.o symfile-mem.o \ -+ linux-tdep.o" - build_gdbserver=yes - ;; - xtensa*) -diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y -index 81f6a5d..097db65 100644 ---- a/gdb/cp-name-parser.y -+++ b/gdb/cp-name-parser.y -@@ -389,7 +389,7 @@ function - | colon_ext_only function_arglist start_opt - { $$ = fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, $1, $2.comp); - if ($3) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $3); } -- -+ | colon_ext_only - | conversion_op_name start_opt - { $$ = $1.comp; - if ($2) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2); } -diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c -index 5e894d4..6325ead 100644 ---- a/gdb/cp-namespace.c -+++ b/gdb/cp-namespace.c -@@ -34,14 +34,17 @@ - #include "buildsym.h" - - static struct symbol *lookup_namespace_scope (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain, - const char *scope, - int scope_len); - -+static struct symbol *cp_lookup_symbol_in_namespace (const char *namespace, -+ const char *name, -+ const struct block *block, -+ const domain_enum domain); -+ - static struct symbol *lookup_symbol_file (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain, - int anonymous_namespace); -@@ -117,7 +120,7 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) - anonymous namespace. So add symbols in it to the - namespace given by the previous component if there is - one, or to the global namespace if there isn't. */ -- cp_add_using_directive (dest, src, NULL); -+ cp_add_using_directive (dest, src, NULL, "", 0); - } - /* The "+ 2" is for the "::". */ - previous_component = next_component + 2; -@@ -132,7 +135,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) - has already been added, don't add it twice. */ - - void --cp_add_using_directive (const char *dest, const char *src, const char *alias) -+cp_add_using_directive (const char *dest, const char *src, const char *alias, -+ const char *declaration, const int line_number) - { - struct using_direct *current; - struct using_direct *new; -@@ -146,7 +150,8 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias) - return; - } - -- using_directives = cp_add_using (dest, src, alias, using_directives); -+ using_directives = cp_add_using (dest, src, alias, declaration, -+ line_number, using_directives); - - } - -@@ -198,9 +203,11 @@ cp_is_anonymous (const char *namespace) - != NULL); - } - --/* Create a new struct using direct which imports the namespace SRC into the -- scope DEST. ALIAS is the name of the imported namespace in the current -- scope. If ALIAS is NULL then the namespace is known by its original name. -+/* Create a new struct using direct which imports the namespace SRC -+ into the scope DEST. ALIAS is the name of the imported namespace -+ in the current scope. If ALIAS is NULL then the -+ namespace is known by its original name. -+ - Set its next member in the linked list to NEXT; allocate all memory - using xmalloc. It copies the strings, so NAME can be a temporary - string. */ -@@ -209,19 +216,23 @@ struct using_direct * - cp_add_using (const char *dest, - const char *src, - const char *alias, -+ const char *declaration, -+ const int line_number, - struct using_direct *next) - { - struct using_direct *retval; - - retval = xmalloc (sizeof (struct using_direct)); -- retval->import_src = savestring (src, strlen(src)); -- retval->import_dest = savestring (dest, strlen(dest)); -+ retval->import_src = savestring (src, strlen (src)); -+ retval->import_dest = savestring (dest, strlen (dest)); - - if (alias != NULL) - retval->alias = savestring (alias, strlen (alias)); - else - retval->alias = NULL; - -+ retval->declaration = savestring (declaration, strlen (declaration)); -+ retval->line_number = line_number; - retval->next = next; - retval->searched = 0; - -@@ -238,19 +249,100 @@ cp_add_using (const char *dest, - - struct symbol * - cp_lookup_symbol_nonlocal (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain) - { -- struct symbol *sym; -+ struct symbol *sym; - const char *scope = block_scope (block); - -- sym = lookup_namespace_scope (name, linkage_name, block, domain, scope, 0); -+ sym = lookup_namespace_scope (name, block, domain, scope, 0); - if (sym != NULL) - return sym; - -- return cp_lookup_symbol_namespace (scope, name, linkage_name, block, domain, -- 1); -+ return cp_lookup_symbol_namespace(scope, name, block, domain); -+} -+ -+/* Searches for NAME in the current namespace, and by applying relevant import -+ statements belonging to BLOCK and its parents. SCOPE is the namespace -+ scope of the context in which the search is being evaluated. */ -+ -+struct symbol* -+cp_lookup_symbol_namespace (const char *scope, -+ const char *name, -+ const struct block *block, -+ const domain_enum domain) -+{ -+ struct symbol *sym; -+ -+ /* First, try to find the symbol in the given namespace. */ -+ sym = cp_lookup_symbol_in_namespace (scope, name, block, domain); -+ if ( sym != NULL) -+ return sym; -+ -+ /* Search for name in namespaces imported to this and parent blocks. */ -+ while (block != NULL) -+ { -+ sym = cp_lookup_symbol_imports(scope,name, block, domain,0,1); -+ -+ if (sym) -+ return sym; -+ -+ block = BLOCK_SUPERBLOCK(block); -+ } -+ -+ return NULL; -+} -+ -+/* Lookup NAME at namespace scope (or, in C terms, in static and -+ global variables). SCOPE is the namespace that the current -+ function is defined within; only consider namespaces whose length -+ is at least SCOPE_LEN. Other arguments are as in -+ cp_lookup_symbol_nonlocal. -+ -+ For example, if we're within a function A::B::f and looking for a -+ symbol x, this will get called with NAME = "x", SCOPE = "A::B", and -+ SCOPE_LEN = 0. It then calls itself with NAME and SCOPE the same, -+ but with SCOPE_LEN = 1. And then it calls itself with NAME and -+ SCOPE the same, but with SCOPE_LEN = 4. This third call looks for -+ "A::B::x"; if it doesn't find it, then the second call looks for -+ "A::x", and if that call fails, then the first call looks for -+ "x". */ -+ -+struct symbol * -+lookup_namespace_scope (const char *name, -+ const struct block *block, -+ const domain_enum domain, -+ const char *scope, -+ int scope_len) -+{ -+ char *namespace; -+ -+ if (scope[scope_len] != '\0') -+ { -+ /* Recursively search for names in child namespaces first. */ -+ -+ struct symbol *sym; -+ int new_scope_len = scope_len; -+ -+ /* If the current scope is followed by "::", skip past that. */ -+ if (new_scope_len != 0) -+ { -+ gdb_assert (scope[new_scope_len] == ':'); -+ new_scope_len += 2; -+ } -+ new_scope_len += cp_find_first_component (scope + new_scope_len); -+ sym = lookup_namespace_scope (name, block, domain, scope, new_scope_len); -+ if (sym != NULL) -+ return sym; -+ } -+ -+ /* Okay, we didn't find a match in our children, so look for the -+ name in the current namespace. */ -+ -+ namespace = alloca (scope_len + 1); -+ strncpy (namespace, scope, scope_len); -+ namespace[scope_len] = '\0'; -+ return cp_lookup_symbol_in_namespace (namespace, name,block, domain); - } - - /* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in -@@ -258,25 +350,24 @@ cp_lookup_symbol_nonlocal (const char *name, - - static struct symbol * - cp_lookup_symbol_in_namespace (const char *namespace, -- const char *name, -- const char *linkage_name, -- const struct block *block, -- const domain_enum domain) -+ const char *name, -+ const struct block *block, -+ const domain_enum domain) - { -+ - if (namespace[0] == '\0') - { -- return lookup_symbol_file (name, linkage_name, block, -- domain, 0); -+ return lookup_symbol_file (name, block,domain, 0); - } - else - { -- char *concatenated_name = alloca (strlen (namespace) + 2 + -- strlen (name+ 1)); -+ char *concatenated_name -+ = alloca (strlen (namespace) + 2 + strlen (name) + 1); - strcpy (concatenated_name, namespace); - strcat (concatenated_name, "::"); - strcat (concatenated_name, name); -- return lookup_symbol_file (concatenated_name, linkage_name, -- block, domain,cp_is_anonymous (namespace)); -+ return lookup_symbol_file (concatenated_name, block, domain, -+ cp_is_anonymous (namespace)); - } - } - -@@ -291,9 +382,17 @@ reset_directive_searched (void *data) - } - - /* Search for NAME by applying all import statements belonging -- to BLOCK which are applicable in SCOPE. -+ to BLOCK which are applicable in SCOPE. If DECLARATION_ONLY the search -+ is restricted to using declarations. -+ Example: -+ -+ namespace A{ -+ int x; -+ } -+ using A::x; -+ - If SEARCH_PARENTS the search will include imports which are applicable in -- parents of SCOPE. -+ parents of scopes. - Example: - - namespace A{ -@@ -307,26 +406,33 @@ reset_directive_searched (void *data) - and Y will be considered. If SEARCH_PARENTS is false only the import of Y - is considered. */ - --static struct symbol * -+struct symbol * - cp_lookup_symbol_imports (const char *scope, - const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain, -- const int search_parents) -+ int declaration_only, -+ int search_parents) - { - struct using_direct *current; -- struct symbol *sym; -- int len; -+ struct symbol *sym = NULL; - int directive_match; -+ int current_line; - struct cleanup *searched_cleanup; - -- /* First, try to find the symbol in the given namespace. */ -- sym = cp_lookup_symbol_in_namespace (scope, name, linkage_name, block, -- domain); -- if (sym != NULL) -+ if(!declaration_only) -+ /* First, try to find the symbol in the given namespace. */ -+ sym = cp_lookup_symbol_in_namespace (scope, name, block, domain); -+ -+ if ( sym != NULL) - return sym; - -+ if (has_stack_frames ()) -+ current_line = find_pc_line (get_frame_pc (get_selected_frame (NULL)), -+ 0).line; -+ else -+ current_line = 0; -+ - /* Go through the using directives. If any of them add new - names to the namespace we're searching in, see if we can find a - match by applying them. */ -@@ -335,7 +441,10 @@ cp_lookup_symbol_imports (const char *scope, - current != NULL; - current = current->next) - { -- len = strlen (current->import_dest); -+ -+ /* If the import destination is the current scope or one of its ancestors then -+ it is applicable. */ -+ int len = strlen (current->import_dest); - directive_match = (search_parents - ? (strncmp (scope, current->import_dest, - strlen (current->import_dest)) == 0 -@@ -343,130 +452,70 @@ cp_lookup_symbol_imports (const char *scope, - || scope[len] == ':' || scope[len] == '\0')) - : strcmp (scope, current->import_dest) == 0); - -- /* If the import destination is the current scope or one of its ancestors then -- it is applicable. */ -- if (directive_match && !current->searched) -+ if (directive_match && -+ current->line_number < current_line && -+ !current->searched) - { -- /* Mark this import as searched so that the recursive call does not -- search it again. */ -- current->searched = 1; -- searched_cleanup = make_cleanup (reset_directive_searched, current); -- -- if (current->alias != NULL && strcmp (name, current->alias) == 0) -- /* If the import is creating an alias and the alias matches the -- sought name. Pass current->import_src as the NAME to direct the -- search towards the aliased namespace. */ -- { -+ current->searched = 1; -+ searched_cleanup = make_cleanup (reset_directive_searched, current); -+ -+ /* If there is an import of a single declaration, compare the imported -+ declaration with the sought out name. If there is a match pass -+ current->import_src as NAMESPACE to direct the search towards the -+ imported namespace. */ -+ if (strcmp ("", current->declaration) != 0) -+ { -+ if (strcmp (name, current->declaration) == 0) -+ { -+ sym = cp_lookup_symbol_in_namespace (current->import_src, -+ name, -+ block, -+ domain); -+ } -+ -+ current->searched = 0; -+ if (sym) -+ return sym; -+ -+ continue; -+ } -+ -+ if (declaration_only) -+ { -+ current->searched = 0; -+ discard_cleanups (searched_cleanup); -+ continue; -+ } -+ -+ if (current->alias != NULL && strcmp (name, current->alias) == 0) -+ /* If the import is creating an alias and the alias matches the -+ sought name. Pass current->inner as the NAME to direct the -+ search towards the aliased namespace */ -+ { - sym = cp_lookup_symbol_in_namespace (scope, - current->import_src, -- linkage_name, - block, - domain); -- } -- else if (current->alias == NULL) -- { -+ } else if (current->alias == NULL){ - /* If this import statement creates no alias, pass current->inner as -- NAMESPACE to direct the search towards the imported namespace. */ -- sym = cp_lookup_symbol_imports (current->import_src, -- name, -- linkage_name, -- block, -- domain, -- 0); -- } -- current->searched = 0; -- discard_cleanups (searched_cleanup); -- -- if (sym != NULL) -- return sym; -- } -- } -- -- return NULL; --} -- -- /* Searches for NAME in the current namespace, and by applying relevant import -- statements belonging to BLOCK and its parents. SCOPE is the namespace scope -- of the context in which the search is being evaluated. */ -- --struct symbol* --cp_lookup_symbol_namespace (const char *scope, -- const char *name, -- const char *linkage_name, -- const struct block *block, -- const domain_enum domain, -- const int search_parents) --{ -- struct symbol *sym; -- -- /* Search for name in namespaces imported to this and parent blocks. */ -- while (block != NULL) -- { -- sym = cp_lookup_symbol_imports (scope, name, linkage_name, block, domain, -- search_parents); -- -- if (sym) -- return sym; -- -- block = BLOCK_SUPERBLOCK (block); -- } -- -- return NULL; --} -- --/* Lookup NAME at namespace scope (or, in C terms, in static and -- global variables). SCOPE is the namespace that the current -- function is defined within; only consider namespaces whose length -- is at least SCOPE_LEN. Other arguments are as in -- cp_lookup_symbol_nonlocal. -- -- For example, if we're within a function A::B::f and looking for a -- symbol x, this will get called with NAME = "x", SCOPE = "A::B", and -- SCOPE_LEN = 0. It then calls itself with NAME and SCOPE the same, -- but with SCOPE_LEN = 1. And then it calls itself with NAME and -- SCOPE the same, but with SCOPE_LEN = 4. This third call looks for -- "A::B::x"; if it doesn't find it, then the second call looks for -- "A::x", and if that call fails, then the first call looks for -- "x". */ -- --static struct symbol * --lookup_namespace_scope (const char *name, -- const char *linkage_name, -- const struct block *block, -- const domain_enum domain, -- const char *scope, -- int scope_len) --{ -- char *namespace; -- -- if (scope[scope_len] != '\0') -- { -- /* Recursively search for names in child namespaces first. */ -+ NAMESPACE to direct the search towards the imported namespace. */ -+ sym = cp_lookup_symbol_imports (current->import_src, -+ name, -+ block, -+ domain, -+ 0, -+ 0); -+ } - -- struct symbol *sym; -- int new_scope_len = scope_len; -+ current->searched = 0; -+ discard_cleanups (searched_cleanup); - -- /* If the current scope is followed by "::", skip past that. */ -- if (new_scope_len != 0) -- { -- gdb_assert (scope[new_scope_len] == ':'); -- new_scope_len += 2; -+ if (sym != NULL) -+ return sym; - } -- new_scope_len += cp_find_first_component (scope + new_scope_len); -- sym = lookup_namespace_scope (name, linkage_name, block, -- domain, scope, new_scope_len); -- if (sym != NULL) -- return sym; - } - -- /* Okay, we didn't find a match in our children, so look for the -- name in the current namespace. */ -- -- namespace = alloca (scope_len + 1); -- strncpy (namespace, scope, scope_len); -- namespace[scope_len] = '\0'; -- return cp_lookup_symbol_in_namespace (namespace, name, linkage_name, -- block, domain); -+ return NULL; - } - - /* Look up NAME in BLOCK's static block and in global blocks. If -@@ -476,17 +525,15 @@ lookup_namespace_scope (const char *name, - - static struct symbol * - lookup_symbol_file (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain, - int anonymous_namespace) - { - struct symbol *sym = NULL; - -- sym = lookup_symbol_static (name, linkage_name, block, domain); -+ sym = lookup_symbol_static (name, block, domain); - if (sym != NULL) - return sym; -- - if (anonymous_namespace) - { - /* Symbols defined in anonymous namespaces have external linkage -@@ -496,12 +543,11 @@ lookup_symbol_file (const char *name, - const struct block *global_block = block_global_block (block); - - if (global_block != NULL) -- sym = lookup_symbol_aux_block (name, linkage_name, global_block, -- domain); -+ sym = lookup_symbol_aux_block (name, global_block, domain); - } - else - { -- sym = lookup_symbol_global (name, linkage_name, block, domain); -+ sym = lookup_symbol_global (name, block, domain); - } - - if (sym != NULL) -@@ -522,6 +568,7 @@ lookup_symbol_file (const char *name, - sym = lookup_possible_namespace_symbol (name); - if (sym != NULL) - return sym; -+ - } - - return NULL; -@@ -550,10 +597,9 @@ cp_lookup_nested_type (struct type *parent_type, - - const char *parent_name = TYPE_TAG_NAME (parent_type); - struct symbol *sym = cp_lookup_symbol_in_namespace (parent_name, -- nested_name, -- NULL, -- block, -- VAR_DOMAIN); -+ nested_name, -+ block, -+ VAR_DOMAIN); - if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF) - return NULL; - else -@@ -797,7 +843,7 @@ check_one_possible_namespace_symbol (const char *name, int len, - - memcpy (name_copy, name, len); - name_copy[len] = '\0'; -- sym = lookup_block_symbol (block, name_copy, NULL, VAR_DOMAIN); -+ sym = lookup_block_symbol (block, name_copy, VAR_DOMAIN); - - if (sym == NULL) - { -@@ -838,7 +884,7 @@ lookup_possible_namespace_symbol (const char *name) - struct symbol *sym; - - sym = lookup_block_symbol (get_possible_namespace_block (objfile), -- name, NULL, VAR_DOMAIN); -+ name, VAR_DOMAIN); - - if (sym != NULL) - return sym; -diff --git a/gdb/cp-support.c b/gdb/cp-support.c -index c31fcff..8c5d56f 100644 ---- a/gdb/cp-support.c -+++ b/gdb/cp-support.c -@@ -50,7 +50,7 @@ static void demangled_name_complaint (const char *name); - - /* Functions/variables related to overload resolution. */ - --static int sym_return_val_size; -+static int sym_return_val_size = -1; - static int sym_return_val_index; - static struct symbol **sym_return_val; - -@@ -190,7 +190,8 @@ mangled_name_to_comp (const char *mangled_name, int options, - return ret; - } - --/* Return the name of the class containing method PHYSNAME. */ -+/* Return the name of the class or namespace containing -+ function, method, or variable PHYSNAME. */ - - char * - cp_class_name_from_physname (const char *physname) -@@ -711,6 +712,82 @@ make_symbol_overload_list (const char *func_name, - - return sym_return_val; - } -+/* Adds the function FUNC_NAME from NAMESPACE to the overload set. */ -+ -+static void -+make_symbol_overload_list_namespace (const char *func_name, -+ const char *namespace) -+{ -+ -+ if (namespace[0] == '\0') -+ { -+ make_symbol_overload_list_qualified (func_name); -+ } -+ else -+ { -+ char *concatenated_name -+ = alloca (strlen (namespace) + 2 + strlen (func_name) + 1); -+ strcpy (concatenated_name, namespace); -+ strcat (concatenated_name, "::"); -+ strcat (concatenated_name, func_name); -+ make_symbol_overload_list_qualified (concatenated_name); -+ } -+} -+ -+/* Search the namespace of the given type and namespace of and public base -+ types. */ -+static void make_symbol_overload_list_adl_namespace (struct type *type, -+ const char *func_name) -+{ -+ char *namespace; -+ char *type_name; -+ int i, prefix_len; -+ -+ if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF -+ || TYPE_CODE (type) == TYPE_CODE_ARRAY) -+ return make_symbol_overload_list_adl_namespace (TYPE_TARGET_TYPE (type), -+ func_name); -+ -+ type_name = TYPE_NAME (type); -+ -+ prefix_len = cp_entire_prefix_len (type_name); -+ -+ if (prefix_len != 0) -+ { -+ namespace = alloca (prefix_len + 1); -+ strncpy (namespace, type_name, prefix_len); -+ namespace[prefix_len] = '\0'; -+ -+ make_symbol_overload_list_namespace (func_name, namespace); -+ } -+ -+ /* Check public base type */ -+ if (TYPE_CODE(type) == TYPE_CODE_CLASS) -+ for (i = 0; i < TYPE_N_BASECLASSES (type); i++) -+ { -+ if (BASETYPE_VIA_PUBLIC (type, i)) -+ make_symbol_overload_list_adl_namespace (TYPE_BASECLASS (type, i), -+ func_name); -+ } -+ -+} -+ -+/* Adds the the overload list overload candidates for FUNC_NAME found through -+ argument dependent lookup. */ -+ -+struct symbol ** -+make_symbol_overload_list_adl (struct type **arg_types, int nargs, -+ const char *func_name) -+{ -+ int i; -+ -+ gdb_assert (sym_return_val_size != -1); -+ -+ for (i = 1; i <= nargs; i++) -+ make_symbol_overload_list_adl_namespace (arg_types[i - 1], func_name); -+ -+ return sym_return_val; -+} - - /* This applies the using directives to add namespaces to search in, - and then searches for overloads in all of those namespaces. It -@@ -739,20 +816,7 @@ make_symbol_overload_list_using (const char *func_name, - } - - /* Now, add names for this namespace. */ -- -- if (namespace[0] == '\0') -- { -- make_symbol_overload_list_qualified (func_name); -- } -- else -- { -- char *concatenated_name -- = alloca (strlen (namespace) + 2 + strlen (func_name) + 1); -- strcpy (concatenated_name, namespace); -- strcat (concatenated_name, "::"); -- strcat (concatenated_name, func_name); -- make_symbol_overload_list_qualified (concatenated_name); -- } -+ make_symbol_overload_list_namespace (func_name, namespace); - } - - /* This does the bulk of the work of finding overloaded symbols. -@@ -840,9 +904,9 @@ read_in_psymtabs (const char *func_name) - if (ps->readin) - continue; - -- if ((lookup_partial_symbol (ps, func_name, NULL, 1, VAR_DOMAIN) -+ if ((lookup_partial_symbol (ps, func_name, 1, VAR_DOMAIN) - != NULL) -- || (lookup_partial_symbol (ps, func_name, NULL, 0, VAR_DOMAIN) -+ || (lookup_partial_symbol (ps, func_name, 0, VAR_DOMAIN) - != NULL)) - psymtab_to_symtab (ps); - } -diff --git a/gdb/cp-support.h b/gdb/cp-support.h -index a6a9af1..57aa5e5 100644 ---- a/gdb/cp-support.h -+++ b/gdb/cp-support.h -@@ -38,20 +38,24 @@ struct demangle_component; - - /* This struct is designed to store data from using directives. It - says that names from namespace IMPORT_SRC should be visible within -- namespace IMPORT_DEST. These form a linked list; NEXT is the next element -- of the list. If the imported namespace has been aliased, ALIAS is set to a -- string representing the alias. Otherwise, ALIAS is NULL. -- Eg: -- namespace C = A::B; -+ namespace IMPORT_DEST. These form a linked list; NEXT is the next -+ element of the list. ALIAS is set to a non empty string if the imported -+ namespace has been aliased.Eg: -+ namespace C=A::B; - ALIAS = "C" -+ DECLARATION is the name of the imported declaration, if this import -+ statement represents one. Eg: -+ using A::x; -+ Where x is variable in namespace A. declaration is set to x. - */ - - struct using_direct - { - char *import_src; - char *import_dest; -- - char *alias; -+ char *declaration; -+ int line_number; - - struct using_direct *next; - -@@ -64,6 +68,7 @@ struct using_direct - - extern char *cp_canonicalize_string (const char *string); - -+ - extern char *cp_class_name_from_physname (const char *physname); - - extern char *method_name_from_physname (const char *physname); -@@ -79,6 +84,10 @@ extern char *cp_remove_params (const char *demangled_name); - extern struct symbol **make_symbol_overload_list (const char *, - const char *); - -+extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types, -+ int nargs, -+ const char *func_name); -+ - extern struct type *cp_lookup_rtti_type (const char *name, - struct block *block); - -@@ -90,11 +99,15 @@ extern int cp_is_anonymous (const char *namespace); - - extern void cp_add_using_directive (const char *dest, - const char *src, -- const char *alias); -+ const char *alias, -+ const char *declaration, -+ const int line_number); - - extern struct using_direct *cp_add_using (const char *dest, - const char *src, - const char *alias, -+ const char *declaration, -+ const int line_number, - struct using_direct *next); - - extern void cp_initialize_namespace (void); -@@ -111,16 +124,20 @@ extern void cp_set_block_scope (const struct symbol *symbol, - extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol); - - extern struct symbol *cp_lookup_symbol_nonlocal (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain); - -+struct symbol *cp_lookup_symbol_imports (const char *scope, -+ const char *name, -+ const struct block *block, -+ const domain_enum domain, -+ int declaration_only, -+ int search_parents); -+ - extern struct symbol *cp_lookup_symbol_namespace (const char *namespace, -- const char *name, -- const char *linkage_name, -- const struct block *block, -- const domain_enum domain, -- const int search_parents); -+ const char *name, -+ const struct block *block, -+ const domain_enum domain); - - extern struct type *cp_lookup_nested_type (struct type *parent_type, - const char *nested_name, -diff --git a/gdb/dbxread.c b/gdb/dbxread.c -index c9a5754..fc33da2 100644 ---- a/gdb/dbxread.c -+++ b/gdb/dbxread.c -@@ -3565,6 +3565,7 @@ static struct sym_fns aout_sym_fns = - dbx_new_init, /* sym_new_init: init anything gbl to entire symtab */ - dbx_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - dbx_symfile_read, /* sym_read: read a symbol file into symtab */ -+ NULL, /* sym_read_psymbols */ - dbx_symfile_finish, /* sym_finish: finished with file, cleanup */ - default_symfile_offsets, /* sym_offsets: parse user's offsets to - internal form */ -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 0e3e093..661ba18 100644 ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -1157,6 +1157,16 @@ for remote debugging. - Run using @var{device} for your program's standard input and output. - @c FIXME: kingdon thinks there is more to -tty. Investigate. - -+@item -P -+@cindex @code{-P} -+@itemx --python -+@cindex @code{--python} -+Change interpretation of command line so that the argument immediately -+following this switch is taken to be the name of a Python script file. -+This option stops option processing; subsequent options are passed to -+Python as @code{sys.argv}. This option is only available if Python -+scripting support was enabled when @value{GDBN} was configured. -+ - @c resolve the situation of these eventually - @item -tui - @cindex @code{--tui} -@@ -19215,7 +19225,7 @@ using the @code{script-extension} setting. - @table @code - @kindex source - @cindex execute commands from a file --@item source [@code{-v}] @var{filename} -+@item source [@code{-v}] [@code{-p}] @var{filename} - Execute the command file @var{filename}. - @end table - -@@ -19493,8 +19503,6 @@ containing @code{end}. For example: - - @smallexample - (@value{GDBP}) python --Type python script --End with a line saying just "end". - >print 23 - >end - 23 -@@ -19507,6 +19515,14 @@ in a Python script. This can be controlled using @code{maint set - python print-stack}: if @code{on}, the default, then Python stack - printing is enabled; if @code{off}, then Python stack printing is - disabled. -+ -+@kindex maint set python auto-load -+@item maint set python auto-load -+By default, @value{GDBN} will attempt to automatically load Python -+code when an object file is opened. This can be controlled using -+@code{maint set python auto-load}: if @code{on}, the default, then -+Python auto-loading is enabled; if @code{off}, then Python -+auto-loading is disabled. - @end table - - It is also possible to execute a Python script from the @value{GDBN} -@@ -19528,6 +19544,14 @@ and thus is always available. - @cindex python api - @cindex programming in python - -+You can get quick online help for @value{GDBN}'s Python API by issuing -+the command @w{@kbd{python help (gdb)}}. -+ -+Functions and methods which have two or more optional arguments allow -+them to be specified using keyword syntax. This allows passing some -+optional arguments while skipping others. Example: -+@w{@code{gdb.some_function ('foo', bar = 1, baz = 2)}}. -+ - @cindex python stdout - @cindex python pagination - At startup, @value{GDBN} overrides Python's @code{sys.stdout} and -@@ -19540,13 +19564,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown. - * Basic Python:: Basic Python Functions. - * Exception Handling:: - * Auto-loading:: Automatically loading Python code. --* Values From Inferior:: -+* Values From Inferior:: Python representation of values. - * Types In Python:: Python representation of types. - * Pretty Printing:: 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. - * Commands In Python:: Implementing new commands in Python. -+* Parameters In Python:: Adding new @value{GDBN} parameters. - * Functions In Python:: Writing new convenience functions. - * Objfiles In Python:: Object files. -+* Breakpoints In Python:: Manipulating breakpoints using Python. - * Frames In Python:: Acessing inferior stack frames from Python. - * Lazy Strings In Python:: Python representation of lazy strings. - @end menu -@@ -19574,6 +19602,12 @@ command as having originated from the user invoking it interactively. - It must be a boolean value. If omitted, it defaults to @code{False}. - @end defun - -+@findex gdb.breakpoints -+@defun breakpoints -+Return a sequence holding all of @value{GDBN}'s breakpoints. -+@xref{Breakpoints In Python}, for more information. -+@end defun -+ - @findex gdb.parameter - @defun parameter parameter - Return the value of a @value{GDBN} parameter. @var{parameter} is a -@@ -19590,6 +19624,7 @@ a Python value of the appropriate type, and returned. - @defun history number - Return a value from @value{GDBN}'s value history (@pxref{Value - History}). @var{number} indicates which history element to return. -+ - If @var{number} is negative, then @value{GDBN} will take its absolute value - and count backward from the last element (i.e., the most recent element) to - find the value to return. If @var{number} is zero, then @value{GDBN} will -@@ -19614,6 +19649,21 @@ compute values, for example, it is the only way to get the value of a - convenience variable (@pxref{Convenience Vars}) as a @code{gdb.Value}. - @end defun - -+@findex gdb.post_event -+@defun post_event event -+Put @var{event}, a callable object taking no arguments, into -+@value{GDBN}'s internal event queue. This callable will be invoked at -+some later point, during @value{GDBN}'s event processing. Events -+posted using @code{post_event} will be run in the order in which they -+were posted; however, there is no way to know when they will be -+processed relative to other events inside @value{GDBN}. -+ -+@value{GDBN} is not thread-safe. If your Python program uses multiple -+threads, you must be careful to only call @value{GDBN}-specific -+functions in the main @value{GDBN} thread. @code{post_event} ensures -+this. -+@end defun -+ - @findex gdb.write - @defun write string - Print a string to @value{GDBN}'s paginated standard output stream. -@@ -19628,6 +19678,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing - function. - @end defun - -+@findex gdb.solib_address -+@defun solib_address @var{address} -+Return the name of the shared library holding the given address, or None. -+@end defun -+ - @node Exception Handling - @subsubsection Exception Handling - @cindex python exceptions -@@ -19866,6 +19921,9 @@ module: - This function looks up a type by name. @var{name} is the name of the - type to look up. It must be a string. - -+If @var{block} is given, then @var{name} is looked up in that scope. -+Otherwise, it is searched for globally. -+ - Ordinarily, this function will return an instance of @code{gdb.Type}. - If the named type cannot be found, it will throw an exception. - @end defun -@@ -19988,7 +20046,7 @@ If the type does not have a target, this method will throw an - exception. - @end defmethod - --@defmethod Type template_argument n -+@defmethod Type template_argument n [block] - If this @code{gdb.Type} is an instantiation of a template, this will - return a new @code{gdb.Type} which represents the type of the - @var{n}th template argument. -@@ -19996,7 +20054,8 @@ return a new @code{gdb.Type} which represents the type of the - If this @code{gdb.Type} is not a template type, this will throw an - exception. Ordinarily, only C@t{++} code will have template types. - --@var{name} is searched for globally. -+If @var{block} is given, then @var{name} is looked up in that scope. -+Otherwise, it is searched for globally. - @end defmethod - @end table - -@@ -20350,6 +20409,121 @@ import gdb.libstdcxx.v6 - gdb.libstdcxx.v6.register_printers (gdb.current_objfile ()) - @end smallexample - -+@node Inferiors In Python -+@subsubsection Inferiors In Python -+ -+Programs which are being run under @value{GDBN} are called inferiors -+(@pxref{Inferiors and Programs}). Python scripts can access -+information about and manipulate inferiors controlled by @value{GDBN} -+via objects of the @code{gdb.Inferior} class. -+ -+The following inferior-related functions are available in the @code{gdb} -+module: -+ -+@defun inferiors -+Return a tuple containing all inferior objects. -+@end defun -+ -+A @code{gdb.Inferior} object has the following attributes: -+ -+@table @code -+@defivar Inferior num -+ID of inferior, as assigned by GDB. -+@end defivar -+ -+@defivar Inferior pid -+Process ID of the inferior, assigned by the underlying OS. -+@end defivar -+ -+@defivar Inferior was_attached -+Boolean signaling whether the inferior was created using `attach', or -+started by @value{GDBN} itself. -+@end defivar -+@end table -+ -+A @code{gdb.Inferior} object has the following methods: -+ -+@table @code -+@defmethod Inferior threads -+This method returns a tuple holding all the threads which are valid -+when it is called. If there are no valid threads, the method will -+return an empty list. -+@end defmethod -+ -+@findex gdb.read_memory -+@defmethod Inferior read_memory @var{address} @var{length} -+Read @var{length} bytes of memory from the inferior, starting at -+@var{address}. Returns a buffer object, which behaves much like an array -+or a string. It can be modified and given to the @code{gdb.write_memory} -+function. -+@end defmethod -+ -+@findex gdb.write_memory -+@defmethod Inferior write_memory @var{address} @var{buffer} @r{[}@var{length}@r{]} -+Write the contents of @var{buffer} (a Python object which supports the -+buffer protocol, i.e., a string, an array or the object returned from -+@code{gdb.read_memory}) to the inferior, starting at @var{address}. -+If given, @var{length} determines the number of bytes from @var{buffer} to -+be written. -+@end defmethod -+ -+@findex gdb.search_memory -+@defmethod Inferior search_memory @var{address} @var{length} @var{pattern} @r{[}@var{size}@r{]} @r{[}@var{max_count}@r{]} -+Search a region of the inferior memory starting at @var{address} with the -+given @var{length}. @var{pattern} can be a string, a byte array, a buffer -+object, a number, a @code{gdb.Value} object (@pxref{Values From Inferior}) -+or a list or tuple with elements in any combination of those types. If -+@var{size} is given and is non-zero, it specifies the size in bytes of a -+Python scalar or @code{gdb.Value} in the search pattern. If @var{size} is -+zero or not specified, it is taken from the value's type in the current -+language. This is useful when one wants to specify the search pattern as -+a mixture of types. Note that this means, for example, that in the case of -+C-like languages a search for an untyped 0x42 will search for -+@samp{(int) 0x42} which is typically four bytes. @var{max_count} is the -+highest number of matches to search for. -+@end defmethod -+@end table -+ -+@node Threads In Python -+@subsubsection Threads In Python -+ -+Python scripts can access information about and manipulate inferior threads -+controlled by @value{GDBN} via objects of the @code{gdb.InferiorThread} class. -+ -+The following inferior-related functions are available in the @code{gdb} -+module: -+ -+@findex gdb.selected_thread -+@defun selected_thread -+This function returns the thread object for the selected thread. If there -+is no selected thread, this will return @code{None}. -+@end defun -+ -+A @code{gdb.InferiorThread} object has the following attributes: -+ -+@table @code -+@defivar InferiorThread num -+ID of the thread, as assigned by GDB. -+@end defivar -+@end table -+ -+A @code{gdb.InferiorThread} object has the following methods: -+ -+@table @code -+@defmethod InferiorThread frames -+Return a tuple containing all frames in the thread. -+@end defmethod -+ -+@defmethod InferiorThread newest_frame -+Return the newest frame thread's stack. -+@end defmethod -+ -+@defmethod InferiorThread switch_to_thread -+This changes @value{GDBN}'s currently selected thread to the one represented -+by this object. -+@end defmethod -+@end table -+ - @node Commands In Python - @subsubsection Commands In Python - -@@ -20602,6 +20776,135 @@ registration of the command with @value{GDBN}. Depending on how the - Python code is read into @value{GDBN}, you may need to import the - @code{gdb} module explicitly. - -+@node Parameters In Python -+@subsubsection Parameters In Python -+ -+@cindex parameters in python -+@cindex python parameters -+@tindex gdb.Parameter -+@tindex Parameter -+You can implement new @value{GDBN} parameters using Python. A new -+parameter is implemented as an instance of the @code{gdb.Parameter} -+class. Parameters are exposed to the user via the @code{set} and -+@code{show} commands. -+ -+@defmethod Parameter __init__ name @var{command-class} @var{parameter-class} @r{[}@var{enum-sequence}@r{]} -+The object initializer for @code{Parameter} registers the new -+parameter with @value{GDBN}. This initializer is normally invoked -+from the subclass' own @code{__init__} method. -+ -+@var{name} is the name of the new parameter. If @var{name} consists -+of multiple words, then the initial words are looked for as prefix -+commands. In this case, if one of the prefix commands does not exist, -+an exception is raised. -+ -+@var{command-class} should be one of the @samp{COMMAND_} constants -+(@pxref{Commands In Python}). This argument tells @value{GDBN} how to -+categorize the new parameter in the help system. -+ -+@var{parameter-class} should be one of the @samp{PARAM_} constants -+defined below. This argument tells @value{GDBN} the type of the new -+parameter; this information is used for input validation and -+completion. -+ -+If @var{parameter-class} is @code{PARAM_ENUM}, then -+@var{enum-sequence} must be a sequence of strings. These strings -+represent the possible values for the parameter. -+ -+If @var{parameter-class} is not @code{PARAM_ENUM}, then the presence -+of a fourth argument will cause an exception to be thrown. -+ -+The help text for the new parameter is taken from the Python -+documentation string for the parameter's class, if there is one. If -+there is no documentation string, a default value is used. -+@end defmethod -+ -+@defivar Parameter set_doc -+If this attribute exists, and is a string, then its value is used as -+the help text for this parameter's @code{set} command. The value is -+examined when @code{Parameter.__init__} is invoked; subsequent changes -+have no effect. -+@end defivar -+ -+@defivar Parameter show_doc -+If this attribute exists, and is a string, then its value is used as -+the help text for this parameter's @code{show} command. The value is -+examined when @code{Parameter.__init__} is invoked; subsequent changes -+have no effect. -+@end defivar -+ -+@defivar Parameter value -+The @code{value} attribute holds the underlying value of the -+parameter. It can be read and assigned to just as any other -+attribute. @value{GDBN} does validation when assignments are made. -+@end defivar -+ -+ -+When a new parameter is defined, its type must be specified. The -+available types are represented by constants defined in the @code{gdb} -+module: -+ -+@table @code -+@findex PARAM_BOOLEAN -+@findex gdb.PARAM_BOOLEAN -+@item PARAM_BOOLEAN -+The value is a plain boolean. The Python boolean values, @code{True} -+and @code{False} are the only valid values. -+ -+@findex PARAM_AUTO_BOOLEAN -+@findex gdb.PARAM_AUTO_BOOLEAN -+@item PARAM_AUTO_BOOLEAN -+The value has three possible states: true, false, and @samp{auto}. In -+Python, true and false are represented using boolean constants, and -+@samp{auto} is represented using @code{None}. -+ -+@findex PARAM_UINTEGER -+@findex gdb.PARAM_UINTEGER -+@item PARAM_UINTEGER -+The value is an unsigned integer. The value of 0 should be -+interpreted to mean ``unlimited''. -+ -+@findex PARAM_INTEGER -+@findex gdb.PARAM_INTEGER -+@item PARAM_INTEGER -+The value is a signed integer. The value of 0 should be interpreted -+to mean ``unlimited''. -+ -+@findex PARAM_STRING -+@findex gdb.PARAM_STRING -+@item PARAM_STRING -+The value is a string. When the user modifies the string, escapes are -+translated. -+ -+@findex PARAM_STRING_NOESCAPE -+@findex gdb.PARAM_STRING_NOESCAPE -+@item PARAM_STRING_NOESCAPE -+The value is a string. When the user modifies the string, escapes are -+passed through untranslated. -+ -+@findex PARAM_OPTIONAL_FILENAME -+@findex gdb.PARAM_OPTIONAL_FILENAME -+@item PARAM_OPTIONAL_FILENAME -+The value is a either a filename (a string), or @code{None}. -+ -+@findex PARAM_FILENAME -+@findex gdb.PARAM_FILENAME -+@item PARAM_FILENAME -+The value is a filename (a string). -+ -+@findex PARAM_ZINTEGER -+@findex gdb.PARAM_ZINTEGER -+@item PARAM_ZINTEGER -+The value is an integer. This is like @code{PARAM_INTEGER}, except 0 -+is interpreted as itself. -+ -+@findex PARAM_ENUM -+@findex gdb.PARAM_ENUM -+@item PARAM_ENUM -+The value is a string, which must be one of a collection string -+constants provided when the parameter is created. -+@end table -+ - @node Functions In Python - @subsubsection Writing new convenience functions - -@@ -20706,6 +21009,82 @@ which is used to format the value. @xref{Pretty Printing}, for more - information. - @end defivar - -+@node Breakpoints In Python -+@subsubsection Manipulating breakpoints using Python -+ -+@cindex breakpoints in python -+@cindex python breakpoints -+@tindex gdb.Breakpoint -+@tindex Breakpoint -+Python code can manipulate breakpoints via the @code{gdb.Breakpoint} -+class. -+ -+@defmethod Breakpoint __init__ location -+Create a new breakpoint. @var{location} is a string naming the -+location of the breakpoint. The contents can be any location -+recognized by the @code{break} command. -+@end defmethod -+ -+@defmethod Breakpoint is_valid -+Return @code{True} if this @code{Breakpoint} object is valid, -+@code{False} otherwise. A @code{Breakpoint} object can become invalid -+if the user deletes the breakpoint. In this case, the object still -+exists, but the underlying breakpoint does not. -+@end defmethod -+ -+@defivar Breakpoint enabled -+This attribute is @code{True} if the breakpoint is enabled, and -+@code{False} otherwise. This attribute is writable. -+@end defivar -+ -+@defivar Breakpoint silent -+This attribute is @code{True} if the breakpoint is silent, and -+@code{False} otherwise. This attribute is writable. -+ -+Note that a breakpoint can also be silent if it has commands and the -+first command is @code{silent}. This is not reported by the -+@code{silent} attribute. -+@end defivar -+ -+@defivar Breakpoint thread -+If the breakpoint is thread-specific, this attribute holds the thread -+id. If the breakpoint is not thread-specific, this attribute is -+@code{None}. This attribute is writable. -+@end defivar -+ -+@defivar Breakpoint ignore_count -+This attribute holds the ignore count for the breakpoint, an integer. -+This attribute is writable. -+@end defivar -+ -+@defivar Breakpoint number -+This attribute holds the breakpoint's number -- the identifier used by -+the user to manipulate the breakpoint. This attribute is not writable. -+@end defivar -+ -+@defivar Breakpoint hit_count -+This attribute holds the hit count for the breakpoint, an integer. -+This attribute is writable, but currently it can only be set to zero. -+@end defivar -+ -+@defivar Breakpoint location -+This attribute holds the location of the breakpoint, as specified by -+the user. It is a string. This attribute is not writable. -+@end defivar -+ -+@defivar Breakpoint condition -+This attribute holds the condition of the breakpoint, as specified by -+the user. It is a string. If there is no condition, this attribute's -+value is @code{None}. This attribute is writable. -+@end defivar -+ -+@defivar Breakpoint commands -+This attribute holds the commands attached to the breakpoint. If -+there are commands, this returns a string holding all the commands, -+separated by newlines. If there are no commands, this attribute is -+@code{None}. This attribute is not writable. -+@end defivar -+ - @node Frames In Python - @subsubsection Acessing inferior stack frames from Python. - -@@ -20770,6 +21149,14 @@ function to a string. - Returns the frame's resume address. - @end defmethod - -+@defmethod Frame block -+Returns the frame's code block. @c (@pxref{Block,,Code Blocks and Scopes}). -+@end defmethod -+ -+@defmethod Frame function -+Returns the symbol for the function corresponding to this frame. @c (@pxref{Symbols In Python}). -+@end defmethod -+ - @defmethod Frame older - Return the frame that called this frame. - @end defmethod -@@ -20778,10 +21165,18 @@ Return the frame that called this frame. - Return the frame called by this frame. - @end defmethod - -+@defmethod Frame find_sal -+Return the frame's symtab and line object. @c (@pxref{Symtab_and_line,, Symtab and line}). -+@end defmethod -+ - @defmethod Frame read_var variable - Return the value of the given variable in this frame. @var{variable} must - be a string. - @end defmethod -+ -+@defmethod Frame select -+Set this frame to be the user's selected frame. -+@end defmethod - @end table - - @node Lazy Strings In Python diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo -index 7741855..df3fc87 100644 +index 54187dd..320b501 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo -@@ -2107,6 +2107,18 @@ time, and so we attempt to handle symbols incrementally. For instance, +@@ -2102,6 +2102,18 @@ time, and so we attempt to handle symbols incrementally. For instance, we create @dfn{partial symbol tables} consisting of only selected symbols, and only expand them to full symbol tables when necessary. @@ -3101,7 +1230,7 @@ index 7741855..df3fc87 100644 @section Symbol Reading @cindex symbol reading -@@ -2199,6 +2211,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and +@@ -2194,6 +2206,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and zero if there were no symbols in that part of the symbol file. @end table @@ -3109,15 +1238,15 @@ index 7741855..df3fc87 100644 @section Partial Symbol Tables @value{GDBN} has three types of symbol tables: -@@ -2294,6 +2307,7 @@ and all the psymbols themselves are allocated in a pair of large arrays - on an obstack, so there is little to be gained by trying to free them - unless you want to do a lot more work. +@@ -2295,6 +2308,7 @@ and partial symbol tables behind a set of function pointers known as + the @dfn{quick symbol functions}. These are documented in + @file{symfile.h}. +@node Types @section Types @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}). -@@ -2316,6 +2330,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by +@@ -2317,6 +2331,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by other members of the type struct, such as whether the type is signed or unsigned, and how many bits it uses. @@ -3125,7 +1254,7 @@ index 7741855..df3fc87 100644 @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}). These are instances of type structs that roughly correspond to -@@ -2330,6 +2345,7 @@ only one instance exists, while @file{c-lang.c} builds as many +@@ -2331,6 +2346,7 @@ only one instance exists, while @file{c-lang.c} builds as many @code{TYPE_CODE_INT} types as needed, with each one associated with some particular objfile. @@ -3133,7 +1262,7 @@ index 7741855..df3fc87 100644 @section Object File Formats @cindex object file formats -@@ -2415,6 +2431,7 @@ SOM, which is a cross-language ABI). +@@ -2416,6 +2432,7 @@ SOM, which is a cross-language ABI). The SOM reader is in @file{somread.c}. @@ -3141,7 +1270,7 @@ index 7741855..df3fc87 100644 @section Debugging File Formats This section describes characteristics of debugging information that -@@ -2486,6 +2503,7 @@ DWARF 3 is an improved version of DWARF 2. +@@ -2487,6 +2504,7 @@ DWARF 3 is an improved version of DWARF 2. @cindex SOM debugging info Like COFF, the SOM definition includes debugging information. @@ -3149,7 +1278,7 @@ index 7741855..df3fc87 100644 @section Adding a New Symbol Reader to @value{GDBN} @cindex adding debugging info reader -@@ -2508,6 +2526,7 @@ will only ever be implemented by one object file format may be called +@@ -2509,6 +2527,7 @@ will only ever be implemented by one object file format may be called directly. This interface should be described in a file @file{bfd/lib@var{xyz}.h}, which is included by @value{GDBN}. @@ -3157,7 +1286,7 @@ index 7741855..df3fc87 100644 @section Memory Management for Symbol Files Most memory associated with a loaded symbol file is stored on -@@ -2519,10 +2538,45 @@ released when the objfile is unloaded or reloaded. Therefore one +@@ -2520,10 +2539,45 @@ released when the objfile is unloaded or reloaded. Therefore one objfile must not reference symbol or type data from another objfile; they could be unloaded at different times. @@ -3208,10 +1337,10 @@ index 7741855..df3fc87 100644 @node Language Support diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi -index db3d114..759200f 100644 +index e19b8ed..343e160 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi -@@ -213,6 +213,11 @@ Bytes from @var{data} to @var{data} + @var{len} have been written +@@ -223,6 +223,11 @@ Bytes from @var{data} to @var{data} + @var{len} have been written to the current inferior at @var{addr}. @end deftypefun @@ -3220,42 +1349,15 @@ index db3d114..759200f 100644 +collector pass. Currently only @code{type_mark_used} marker is supported. +@end deftypefun + - @deftypefun void test_notification (int @var{somearg}) + @deftypefun void test_notification (int @var{somearg}) This observer is used for internal testing. Do not use. See testsuite/gdb.gdb/observer.exp. -diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c -index 99100d7..5915249 100644 ---- a/gdb/dwarf2-frame.c -+++ b/gdb/dwarf2-frame.c -@@ -38,6 +38,7 @@ - - #include "complaints.h" - #include "dwarf2-frame.h" -+#include "addrmap.h" - - struct comp_unit; - -@@ -1582,6 +1583,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) - CORE_ADDR offset; - CORE_ADDR seek_pc; - -+ if (objfile->quick_addrmap) -+ { -+ if (!addrmap_find (objfile->quick_addrmap, *pc)) -+ continue; -+ } -+ /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */ -+ require_partial_symbols (objfile); -+ - fde_table = objfile_data (objfile, dwarf2_frame_objfile_data); - if (fde_table == NULL) - continue; diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index ed21edf..1b10cb7 100644 +index b9ae108..2555908 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c -@@ -868,6 +868,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, - ctx->initialized = 0; +@@ -875,6 +875,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, + ctx->dwarf_call (ctx, result); goto no_push; + case DW_OP_push_object_address: @@ -3269,15 +1371,20 @@ index ed21edf..1b10cb7 100644 error (_("Unhandled dwarf expression opcode 0x%x"), op); } diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index 437ca39..f7fce92 100644 +index 61b8f00..d94c03c 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h -@@ -102,10 +102,10 @@ struct dwarf_expr_context - The result must be live until the current expression evaluation - is complete. */ - unsigned char *(*get_subr) (void *baton, off_t offset, size_t *length); -+#endif +@@ -108,9 +108,15 @@ struct dwarf_expr_context + #if 0 + /* Not yet implemented. */ ++ /* Return the location expression for the dwarf expression ++ subroutine in the die at OFFSET in the current compilation unit. ++ The result must be live until the current expression evaluation ++ is complete. */ ++ unsigned char *(*get_subr) (void *baton, off_t offset, size_t *length); ++#endif ++ /* Return the `object address' for DW_OP_push_object_address. */ CORE_ADDR (*get_object_address) (void *baton); -#endif @@ -3285,33 +1392,33 @@ index 437ca39..f7fce92 100644 /* The current depth of dwarf expression recursion, via DW_OP_call*, DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index 1c4d057..20dcacd 100644 +index 2a8e557..be74412 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -46,6 +46,12 @@ static void +@@ -48,6 +48,12 @@ static void dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, - gdb_byte **start, size_t *length); + const gdb_byte **start, size_t *length); +static struct value *dwarf2_evaluate_loc_desc (struct type *type, + struct frame_info *frame, -+ gdb_byte *data, ++ const gdb_byte *data, + unsigned short size, + struct dwarf2_per_cu_data *per_cu); + /* A helper function for dealing with location lists. Given a symbol baton (BATON) and a pc value (PC), find the appropriate location expression, set *LOCEXPR_LENGTH, and return a pointer -@@ -121,6 +127,9 @@ struct dwarf_expr_baton +@@ -127,6 +133,9 @@ struct dwarf_expr_baton { struct frame_info *frame; - struct objfile *objfile; + struct dwarf2_per_cu_data *per_cu; + /* From DW_TAG_variable's DW_AT_location (not DW_TAG_type's + DW_AT_data_location) for DW_OP_push_object_address. */ + CORE_ADDR object_address; }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -189,22 +198,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, +@@ -195,23 +204,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, symbaton = SYMBOL_LOCATION_BATON (framefunc); *start = find_location_expression (symbaton, length, pc); } @@ -3319,7 +1426,7 @@ index 1c4d057..20dcacd 100644 + else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_locexpr_funcs) { struct dwarf2_locexpr_baton *symbaton; -+ + symbaton = SYMBOL_LOCATION_BATON (framefunc); - if (symbaton != NULL) - { @@ -3354,8 +1461,8 @@ index 1c4d057..20dcacd 100644 } /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for -@@ -227,6 +247,155 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset) - return target_translate_tls_address (debaton->objfile, offset); +@@ -263,6 +282,158 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset) + return per_cu_dwarf_call (ctx, die_offset, debaton->per_cu); } +static CORE_ADDR @@ -3414,30 +1521,30 @@ index 1c4d057..20dcacd 100644 + pushed on the cleanup chain. */ + +static struct dwarf_expr_context * -+dwarf_expr_prep_ctx (struct frame_info *frame, gdb_byte *data, -+ unsigned short size, struct dwarf2_per_cu_data *per_cu) ++dwarf_expr_prep_ctx (struct frame_info *frame, const gdb_byte *data, ++ size_t size, struct dwarf2_per_cu_data *per_cu) +{ + struct dwarf_expr_context *ctx; + struct dwarf_expr_baton baton; -+ -+ if (!frame) -+ frame = get_selected_frame (NULL); ++ struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); + + baton.frame = frame; -+ baton.objfile = dwarf2_per_cu_objfile (per_cu); ++ baton.per_cu = per_cu; + baton.object_address = object_address; + + ctx = new_dwarf_expr_context (); + make_cleanup_free_dwarf_expr_context (ctx); + -+ ctx->gdbarch = get_objfile_arch (baton.objfile); ++ ctx->gdbarch = get_objfile_arch (objfile); + ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); ++ ctx->offset = dwarf2_per_cu_text_offset (per_cu); + ctx->baton = &baton; + ctx->read_reg = dwarf_expr_read_reg; + ctx->read_mem = dwarf_expr_read_mem; + ctx->get_frame_base = dwarf_expr_frame_base; + ctx->get_frame_cfa = dwarf_expr_frame_cfa; + ctx->get_tls_address = dwarf_expr_tls_address; ++ ctx->dwarf_call = dwarf_expr_dwarf_call; + ctx->get_object_address = dwarf_expr_object_address; + + dwarf_expr_eval (ctx, data, size); @@ -3458,8 +1565,8 @@ index 1c4d057..20dcacd 100644 + CORE_ADDR retval; + struct cleanup *back_to = make_cleanup (null_cleanup, 0); + -+ ctx = dwarf_expr_prep_ctx (NULL, dlbaton->data, dlbaton->size, -+ dlbaton->per_cu); ++ ctx = dwarf_expr_prep_ctx (get_selected_frame (NULL), dlbaton->data, ++ dlbaton->size, dlbaton->per_cu); + if (ctx->num_pieces > 0) + error (_("DW_OP_*piece is unsupported for DW_FORM_block")); + @@ -3490,10 +1597,13 @@ index 1c4d057..20dcacd 100644 + struct type *type, CORE_ADDR *addrp) +{ + struct frame_info *frame = get_selected_frame (NULL); -+ gdb_byte *data; ++ const gdb_byte *data; + 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) @@ -3509,149 +1619,59 @@ index 1c4d057..20dcacd 100644 + struct piece_closure { - /* The number of pieces used to describe this variable. */ -@@ -401,48 +570,31 @@ static struct lval_funcs pieced_value_funcs = { - SIZE, to find the current location of variable VAR in the context - of FRAME. */ - static struct value * --dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, -+dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, - gdb_byte *data, unsigned short size, + /* Reference count. */ +@@ -887,10 +1058,8 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, struct dwarf2_per_cu_data *per_cu) { struct value *retval; - struct dwarf_expr_baton baton; struct dwarf_expr_context *ctx; - struct cleanup *old_chain; +- struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); + struct cleanup *old_chain = make_cleanup (null_cleanup, 0); if (size == 0) { -- retval = allocate_value (SYMBOL_TYPE (var)); -+ retval = allocate_value (type); - VALUE_LVAL (retval) = not_lval; - set_value_optimized_out (retval, 1); +@@ -900,24 +1069,8 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, return retval; } - baton.frame = frame; -- baton.objfile = dwarf2_per_cu_objfile (per_cu); -- +- baton.per_cu = per_cu; ++ ctx = dwarf_expr_prep_ctx (frame, data, size, per_cu); + - ctx = new_dwarf_expr_context (); - old_chain = make_cleanup_free_dwarf_expr_context (ctx); - -- ctx->gdbarch = get_objfile_arch (baton.objfile); +- ctx->gdbarch = get_objfile_arch (objfile); - ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); +- ctx->offset = dwarf2_per_cu_text_offset (per_cu); - ctx->baton = &baton; - ctx->read_reg = dwarf_expr_read_reg; - ctx->read_mem = dwarf_expr_read_mem; - ctx->get_frame_base = dwarf_expr_frame_base; - ctx->get_frame_cfa = dwarf_expr_frame_cfa; - ctx->get_tls_address = dwarf_expr_tls_address; -+ ctx = dwarf_expr_prep_ctx (frame, data, size, per_cu); - +- ctx->dwarf_call = dwarf_expr_dwarf_call; +- - dwarf_expr_eval (ctx, data, size); if (ctx->num_pieces > 0) { struct piece_closure *c; - struct frame_id frame_id = get_frame_id (frame); - - c = allocate_piece_closure (ctx->num_pieces, ctx->pieces, ctx->gdbarch); -- retval = allocate_computed_value (SYMBOL_TYPE (var), -- &pieced_value_funcs, -- c); -+ retval = allocate_computed_value (type, &pieced_value_funcs, c); - VALUE_FRAME_ID (retval) = frame_id; - } - else -@@ -454,7 +606,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, - 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 (SYMBOL_TYPE (var), gdb_regnum, frame); -+ retval = value_from_register (type, gdb_regnum, frame); - } - break; - -@@ -463,7 +615,12 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, - CORE_ADDR address = dwarf_expr_fetch (ctx, 0); +@@ -951,6 +1104,11 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, + CORE_ADDR address = dwarf_expr_fetch_address (ctx, 0); int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); -- retval = allocate_value (SYMBOL_TYPE (var)); + /* object_address_set called here is required in ALLOCATE_VALUE's + CHECK_TYPEDEF for the object's possible + DW_OP_push_object_address. */ + object_address_set (address); + -+ retval = allocate_value (type); + retval = allocate_value (type); VALUE_LVAL (retval) = lval_memory; set_value_lazy (retval, 1); - if (in_stack_memory) -@@ -478,10 +635,10 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, - bfd_byte *contents; - size_t n = ctx->addr_size; - -- retval = allocate_value (SYMBOL_TYPE (var)); -+ retval = allocate_value (type); - contents = value_contents_raw (retval); -- if (n > TYPE_LENGTH (SYMBOL_TYPE (var))) -- n = TYPE_LENGTH (SYMBOL_TYPE (var)); -+ if (n > TYPE_LENGTH (type)) -+ n = TYPE_LENGTH (type); - store_unsigned_integer (contents, n, - gdbarch_byte_order (ctx->gdbarch), - value); -@@ -493,10 +650,10 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, - bfd_byte *contents; - size_t n = ctx->len; - -- retval = allocate_value (SYMBOL_TYPE (var)); -+ retval = allocate_value (type); - contents = value_contents_raw (retval); -- if (n > TYPE_LENGTH (SYMBOL_TYPE (var))) -- n = TYPE_LENGTH (SYMBOL_TYPE (var)); -+ if (n > TYPE_LENGTH (type)) -+ n = TYPE_LENGTH (type); - memcpy (contents, ctx->data, n); - } - break; -@@ -720,8 +877,8 @@ locexpr_read_variable (struct symbol *symbol, struct frame_info *frame) - { - struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol); - struct value *val; -- val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size, -- dlbaton->per_cu); -+ val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data, -+ dlbaton->size, dlbaton->per_cu); - - return val; - } -@@ -844,7 +1001,7 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame) - set_value_optimized_out (val, 1); - } - else -- val = dwarf2_evaluate_loc_desc (symbol, frame, data, size, -+ val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size, - dlbaton->per_cu); - - return val; -@@ -868,7 +1025,7 @@ static int - loclist_describe_location (struct symbol *symbol, struct ui_file *stream) - { - /* FIXME: Could print the entire list of locations. */ -- fprintf_filtered (stream, "a variable with multiple locations"); -+ fprintf_filtered (stream, _("a variable with multiple locations")); - return 1; - } - -@@ -884,16 +1041,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, - - data = find_location_expression (dlbaton, &size, ax->scope); - if (data == NULL) -- error (_("Variable \"%s\" is not available."), SYMBOL_NATURAL_NAME (symbol)); -+ error (_("Variable \"%s\" is not available."), SYMBOL_PRINT_NAME (symbol)); - - dwarf2_tracepoint_var_ref (symbol, gdbarch, ax, value, data, size); +@@ -2586,11 +2744,51 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, + dlbaton->per_cu); } -/* The set of location functions used with the DWARF-2 expression @@ -3679,11 +1699,11 @@ index 1c4d057..20dcacd 100644 + return 0; +} + -+static int -+missing_describe_location (struct symbol *symbol, struct ui_file *stream) ++static void ++missing_describe_location (struct symbol *symbol, CORE_ADDR addr, ++ struct ui_file *stream) +{ + fprintf_filtered (stream, _("a variable we are unable to resolve")); -+ return 1; +} + +static void @@ -3705,10 +1725,10 @@ index 1c4d057..20dcacd 100644 + missing_tracepoint_var_ref +}; diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h -index fa0bd11..3535c1f 100644 +index 826bc45..1e7d8dc 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h -@@ -72,5 +72,14 @@ struct dwarf2_loclist_baton +@@ -86,5 +86,14 @@ struct dwarf2_loclist_baton extern const struct symbol_computed_ops dwarf2_locexpr_funcs; extern const struct symbol_computed_ops dwarf2_loclist_funcs; @@ -3724,132 +1744,10 @@ index fa0bd11..3535c1f 100644 #endif /* dwarf2loc.h */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index a05c946..9452844 100644 +index 16381de..ec31cf1 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -48,6 +48,10 @@ - #include "gdbcmd.h" - #include "block.h" - #include "addrmap.h" -+#include "block.h" -+#include "f-lang.h" -+#include "typeprint.h" -+#include "jv-lang.h" - - #include - #include "gdb_string.h" -@@ -96,7 +100,7 @@ typedef struct pubnames_header - _PUBNAMES_HEADER; - #define _ACTUAL_PUBNAMES_HEADER_SIZE 13 - --/* .debug_pubnames header -+/* .debug_aranges header - Because of alignment constraints, this structure has padding and cannot - be mapped directly onto the beginning of the .debug_info section. */ - typedef struct aranges_header -@@ -153,7 +157,10 @@ struct dwarf2_section_info - asection *asection; - gdb_byte *buffer; - bfd_size_type size; -- int was_mmapped; -+ /* A function to call to deallocate BUFFER. If NULL, no -+ deallocation is needed. A pointer to this structure is passed as -+ the only argument. */ -+ void (*destructor) (struct dwarf2_section_info *); - }; - - struct dwarf2_per_objfile -@@ -333,6 +340,19 @@ struct dwarf2_cu - DIEs for namespaces, we don't need to try to infer them - from mangled names. */ - unsigned int has_namespace_info : 1; -+ -+ /* Fields are valid according to the LANGUAGE field. */ -+ union -+ { -+ /* language_fortran */ -+ struct -+ { -+ /* Module names imported to the block being currently read in. */ -+ struct fortran_using *use; -+ } -+ fortran; -+ } -+ language_specific; - }; - - /* Persistent data held for a compilation unit, even when not -@@ -487,8 +507,7 @@ struct partial_die_info - unsigned int has_byte_size : 1; - - /* The name of this DIE. Normally the value of DW_AT_name, but -- sometimes DW_TAG_MIPS_linkage_name or a string computed in some -- other fashion. */ -+ sometimes a default name for unnamed DIEs. */ - char *name; - - /* The scope to prepend to our children. This is generally -@@ -788,7 +807,8 @@ static void scan_partial_symbols (struct partial_die_info *, - static void add_partial_symbol (struct partial_die_info *, - struct dwarf2_cu *); - --static int pdi_needs_namespace (enum dwarf_tag tag); -+static gdb_byte *read_comp_unit_head (struct comp_unit_head *, gdb_byte *, -+ bfd *); - - static void add_partial_namespace (struct partial_die_info *pdi, - CORE_ADDR *lowpc, CORE_ADDR *highpc, -@@ -813,6 +833,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *); - - static void psymtab_to_symtab_1 (struct partial_symtab *); - -+static void dwarf2_read_section_1 (struct objfile *objfile, -+ struct obstack *obstack, -+ struct dwarf2_section_info *info); -+ - static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu); - - static void dwarf2_free_abbrev_table (void *); -@@ -984,17 +1008,25 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *, - - static void process_structure_scope (struct die_info *, struct dwarf2_cu *); - --static const char *determine_class_name (struct die_info *die, -- struct dwarf2_cu *cu); -- - static void read_common_block (struct die_info *, struct dwarf2_cu *); - - static void read_namespace (struct die_info *die, struct dwarf2_cu *); - -+static void read_import_statement (struct die_info *die, struct dwarf2_cu *); -+ - static void read_module (struct die_info *die, struct dwarf2_cu *cu); - - static void read_import_statement (struct die_info *die, struct dwarf2_cu *); - -+static struct type *read_module_type (struct die_info *die, -+ struct dwarf2_cu *cu); -+ -+static void read_fortran_imported_module (struct die_info *die, -+ struct dwarf2_cu *cu); -+ -+static void read_fortran_imported_declaration (struct die_info *die, -+ struct dwarf2_cu *cu); -+ - static const char *namespace_name (struct die_info *die, - int *is_anonymous, struct dwarf2_cu *); - -@@ -1028,7 +1060,8 @@ static gdb_byte *read_full_die (const struct die_reader_specs *reader, - - static void process_die (struct die_info *, struct dwarf2_cu *); - --static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *); -+static char *fortran_module_linkage_name (struct die_info *die, -+ struct dwarf2_cu *cu); - - static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *, - struct obstack *); -@@ -1114,6 +1147,9 @@ static int attr_form_is_section_offset (struct attribute *); +@@ -1083,6 +1083,9 @@ static int attr_form_is_section_offset (struct attribute *); static int attr_form_is_constant (struct attribute *); @@ -3859,7 +1757,7 @@ index a05c946..9452844 100644 static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu); -@@ -1144,6 +1180,9 @@ static void age_cached_comp_units (void); +@@ -1113,6 +1116,9 @@ static void age_cached_comp_units (void); static void free_one_cached_comp_unit (void *); @@ -3869,1066 +1767,17 @@ index a05c946..9452844 100644 static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); -@@ -1163,22 +1202,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); +@@ -1132,6 +1138,9 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); -+static void destroy_section (struct dwarf2_section_info *info); -+ +static struct dwarf2_locexpr_baton *dwarf2_attr_to_locexpr_baton + (struct attribute *attr, struct dwarf2_cu *cu); + /* Try to locate the sections we need for DWARF 2 debugging information and return true if we have enough to do something. */ - int - dwarf2_has_info (struct objfile *objfile) - { -- struct dwarf2_per_objfile *data; -- -- /* Initialize per-objfile state. */ -- data = obstack_alloc (&objfile->objfile_obstack, sizeof (*data)); -- memset (data, 0, sizeof (*data)); -- set_objfile_data (objfile, dwarf2_objfile_data_key, data); -- dwarf2_per_objfile = data; -+ dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); -+ if (!dwarf2_per_objfile) -+ { -+ /* Initialize per-objfile state. */ -+ struct dwarf2_per_objfile *data -+ = obstack_alloc (&objfile->objfile_obstack, sizeof (*data)); -+ memset (data, 0, sizeof (*data)); -+ set_objfile_data (objfile, dwarf2_objfile_data_key, data); -+ dwarf2_per_objfile = data; - -- bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL); -- return (data->info.asection != NULL && data->abbrev.asection != NULL); -+ bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL); -+ } -+ return (dwarf2_per_objfile->info.asection != NULL -+ && dwarf2_per_objfile->abbrev.asection != NULL); - } - - /* When loading sections, we can either look for ".", or for -@@ -1271,10 +1319,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) - } - - /* Decompress a section that was compressed using zlib. Store the -- decompressed buffer, and its size, in OUTBUF and OUTSIZE. */ -+ decompressed buffer, and its size, in OUTBUF and OUTSIZE. The -+ result is allocated on OBSTACK; if OBSTACK is NULL, xmalloc is -+ used. */ - - static void --zlib_decompress_section (struct objfile *objfile, asection *sectp, -+zlib_decompress_section (struct objfile *objfile, struct obstack *obstack, -+ asection *sectp, - gdb_byte **outbuf, bfd_size_type *outsize) - { - bfd *abfd = objfile->obfd; -@@ -1291,6 +1342,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, - z_stream strm; - int rc; - int header_size = 12; -+ struct cleanup *old = NULL; - - if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 - || bfd_bread (compressed_buffer, compressed_size, abfd) != compressed_size) -@@ -1320,8 +1372,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, - strm.avail_in = compressed_size - header_size; - strm.next_in = (Bytef*) compressed_buffer + header_size; - strm.avail_out = uncompressed_size; -- uncompressed_buffer = obstack_alloc (&objfile->objfile_obstack, -- uncompressed_size); -+ if (obstack) -+ uncompressed_buffer = obstack_alloc (obstack, uncompressed_size); -+ else -+ { -+ uncompressed_buffer = xmalloc (uncompressed_size); -+ old = make_cleanup (xfree, uncompressed_buffer); -+ } - rc = inflateInit (&strm); - while (strm.avail_in > 0) - { -@@ -1342,26 +1399,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, - error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"), - bfd_get_filename (abfd), rc); - -+ if (old) -+ discard_cleanups (old); - do_cleanups (cleanup); - *outbuf = uncompressed_buffer; - *outsize = uncompressed_size; - #endif - } - --/* Read the contents of the section SECTP from object file specified by -- OBJFILE, store info about the section into INFO. -- If the section is compressed, uncompress it before returning. */ -+/* A cleanup that calls destroy_section. */ - - static void --dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) -+destroy_section_cleanup (void *arg) -+{ -+ destroy_section (arg); -+} -+ -+/* Read the .debug_aranges section and construct an address map. */ -+ -+void -+dwarf2_create_quick_addrmap (struct objfile *objfile) -+{ -+ char *aranges_buffer, *aranges_ptr; -+ bfd *abfd = objfile->obfd; -+ CORE_ADDR baseaddr; -+ struct cleanup *old; -+ struct obstack temp_obstack; -+ struct addrmap *mutable_map; -+ -+ if (!dwarf2_per_objfile->aranges.asection) -+ return; -+ -+ baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -+ -+ dwarf2_read_section_1 (objfile, NULL, &dwarf2_per_objfile->aranges); -+ aranges_buffer = dwarf2_per_objfile->aranges.buffer; -+ aranges_ptr = aranges_buffer; -+ old = make_cleanup (destroy_section_cleanup, &dwarf2_per_objfile->aranges); -+ -+ obstack_init (&temp_obstack); -+ make_cleanup_obstack_free (&temp_obstack); -+ mutable_map = addrmap_create_mutable (&temp_obstack); -+ -+ while ((aranges_ptr - aranges_buffer) < dwarf2_per_objfile->aranges.size) -+ { -+ struct comp_unit_head cu_header; -+ unsigned int bytes_read, segment_size, delta; -+ LONGEST info_offset; -+ struct dwarf2_cu cu; -+ char *end_ptr; -+ -+ cu_header.initial_length_size = 0; -+ end_ptr = aranges_ptr; -+ aranges_ptr = read_comp_unit_head (&cu_header, aranges_ptr, abfd); -+ end_ptr += cu_header.initial_length_size + cu_header.length; -+ -+ /* Sanity check. */ -+ if (end_ptr - aranges_ptr >= dwarf2_per_objfile->aranges.size) -+ { -+ do_cleanups (old); -+ complaint (&symfile_complaints, -+ _("aranges entry runs off end of `.debug_aranges' section, ignored")); -+ return; -+ } -+ if (cu_header.addr_size == 0) -+ { -+ do_cleanups (old); -+ complaint (&symfile_complaints, -+ _("aranges entry has zero addr_size, ignored")); -+ return; -+ } -+ -+ segment_size = read_1_byte (abfd, aranges_ptr); -+ aranges_ptr += 1; -+ -+ /* Align the pointer to twice the pointer size. I didn't see -+ this in the spec but it appears to be required. */ -+ delta = (aranges_ptr - aranges_buffer) % (2 * cu_header.addr_size); -+ delta = (2 * cu_header.addr_size - delta) % (2 * cu_header.addr_size); -+ aranges_ptr += delta; -+ -+ memset (&cu, 0, sizeof (cu)); -+ cu.header.addr_size = cu_header.addr_size; -+ -+ while (1) -+ { -+ CORE_ADDR address, length; -+ -+ address = read_address (abfd, aranges_ptr, &cu, &bytes_read); -+ aranges_ptr += bytes_read; -+ -+ length = read_address (abfd, aranges_ptr, &cu, &bytes_read); -+ aranges_ptr += bytes_read; -+ -+ if (address == 0 && length == 0) -+ break; -+ -+ if (length == 0) -+ { -+ do_cleanups (old); -+ complaint (&symfile_complaints, -+ _("aranges entry has zero length, ignored")); -+ return; -+ } -+ -+ address += baseaddr; -+ -+ addrmap_set_empty (mutable_map, address, address + length - 1, -+ objfile); -+ } -+ -+ /* Some older versions of GCC incorrectly started the arange -+ with a (0,0) pair. If we encounter any oddity while reading -+ the section, just abandon the attempt; falling back to the -+ slower code is always safe. */ -+ if (aranges_ptr != end_ptr) -+ { -+ do_cleanups (old); -+ complaint (&symfile_complaints, -+ _("aranges entry ends early, ignored")); -+ return; -+ } -+ } -+ -+ objfile->quick_addrmap = addrmap_create_fixed (mutable_map, -+ &objfile->objfile_obstack); -+ do_cleanups (old); -+} -+ -+/* Free a section buffer allocated with xmalloc. */ -+ -+static void -+xfree_section_buffer (struct dwarf2_section_info *info) -+{ -+ xfree (info->buffer); -+} -+ -+/* If section described by INFO was mmapped, munmap it now. */ -+ -+static void -+munmap_section_buffer (struct dwarf2_section_info *info) -+{ -+#ifdef HAVE_MMAP -+ intptr_t begin = (intptr_t) info->buffer; -+ intptr_t map_begin = begin & ~(pagesize - 1); -+ size_t map_length = info->size + begin - map_begin; -+ gdb_assert (munmap ((void *) map_begin, map_length) == 0); -+#else -+ /* Without HAVE_MMAP, we should never be here to begin with. */ -+ gdb_assert (0); -+#endif -+} -+ -+/* Read the contents of the section at OFFSET and of size SIZE from -+ the object file specified by OBJFILE into OBSTACK and store it into -+ INFO. If OBSTACK is NULL, xmalloc is used instead. If the section -+ is compressed, uncompress it before returning. */ -+ -+static void -+dwarf2_read_section_1 (struct objfile *objfile, -+ struct obstack *obstack, -+ struct dwarf2_section_info *info) - { - bfd *abfd = objfile->obfd; - asection *sectp = info->asection; - gdb_byte *buf, *retbuf; - unsigned char header[4]; -+ struct cleanup *old = NULL; - - info->buffer = NULL; -- info->was_mmapped = 0; -+ info->destructor = 0; - - if (info->asection == NULL || info->size == 0) - return; -@@ -1374,7 +1581,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) - /* Upon decompression, update the buffer and its size. */ - if (strncmp (header, "ZLIB", sizeof (header)) == 0) - { -- zlib_decompress_section (objfile, sectp, &info->buffer, -+ zlib_decompress_section (objfile, obstack, sectp, &info->buffer, - &info->size); - return; - } -@@ -1397,7 +1604,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) - - if (retbuf != MAP_FAILED) - { -- info->was_mmapped = 1; -+ info->destructor = munmap_section_buffer; - info->buffer = retbuf + (sectp->filepos & (pagesize - 1)) ; - return; - } -@@ -1405,8 +1612,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) - #endif - - /* If we get here, we are a normal, not-compressed section. */ -- info->buffer = buf -- = obstack_alloc (&objfile->objfile_obstack, info->size); -+ if (obstack) -+ buf = obstack_alloc (obstack, info->size); -+ else -+ { -+ buf = xmalloc (info->size); -+ old = make_cleanup (xfree, buf); -+ info->destructor = xfree_section_buffer; -+ } -+ info->buffer = buf; - - /* When debugging .o files, we may need to apply relocations; see - http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . -@@ -1415,6 +1629,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) - retbuf = symfile_relocate_debug_section (objfile, sectp, buf); - if (retbuf != NULL) - { -+ if (old) -+ discard_cleanups (old); - info->buffer = retbuf; - return; - } -@@ -1423,6 +1639,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) - || bfd_bread (buf, info->size, abfd) != info->size) - error (_("Dwarf Error: Can't read DWARF data from '%s'"), - bfd_get_filename (abfd)); -+ -+ if (old) -+ discard_cleanups (old); -+} -+ -+/* Read the contents of the section SECTP from object file specified by -+ OBJFILE, store info about the section into INFO. -+ If the section is compressed, uncompress it before returning. */ -+ -+static void -+dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) -+{ -+ dwarf2_read_section_1 (objfile, &objfile->objfile_obstack, info); - } - - /* Fill in SECTP, BUFP and SIZEP with section info, given OBJFILE and -@@ -2070,6 +2299,29 @@ build_type_psymtabs (struct objfile *objfile) - process_type_comp_unit, objfile); - } - -+/* A cleanup function that clears an objfile's psymtabs. There are -+ two cases to consider. If we are reading symbols directly, then on -+ a failure the objfile will be destroyed. In this case, clearing -+ the psymtabs is fine -- a little wasted time, but nothing serious. -+ If we are reading symbols lazily, then it is too late to destroy -+ the objfile. Instead we just make it look like the objfile has no -+ psymtabs. */ -+ -+static void -+do_clear_psymtabs (void *arg) -+{ -+ struct objfile *objfile = arg; -+ -+ objfile->psymtabs_addrmap = NULL; -+ objfile->psymtabs = NULL; -+ bcache_xfree (objfile->psymbol_cache); -+ objfile->psymbol_cache = bcache_xmalloc (); -+ xfree (objfile->global_psymbols.list); -+ memset (&objfile->global_psymbols, 0, sizeof (objfile->global_psymbols)); -+ xfree (objfile->static_psymbols.list); -+ memset (&objfile->static_psymbols, 0, sizeof (objfile->static_psymbols)); -+} -+ - /* Build the partial symbol table by doing a quick pass through the - .debug_info and .debug_abbrev sections. */ - -@@ -2080,7 +2332,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) - mmap() on architectures that support it. (FIXME) */ - bfd *abfd = objfile->obfd; - gdb_byte *info_ptr; -- struct cleanup *back_to; -+ struct cleanup *back_to, *clear_psymtabs; - - info_ptr = dwarf2_per_objfile->info.buffer; - -@@ -2094,6 +2346,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) - - objfile->psymtabs_addrmap = - addrmap_create_mutable (&objfile->objfile_obstack); -+ clear_psymtabs = make_cleanup (do_clear_psymtabs, objfile); - - /* Since the objects we're extracting from .debug_info vary in - length, only the individual functions to extract them (like -@@ -2123,6 +2376,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile) - dwarf2_per_objfile->info.size); - } - -+ discard_cleanups (clear_psymtabs); - objfile->psymtabs_addrmap = addrmap_create_fixed (objfile->psymtabs_addrmap, - &objfile->objfile_obstack); - -@@ -2389,11 +2643,18 @@ partial_die_parent_scope (struct partial_die_info *pdi, - || parent->tag == DW_TAG_union_type - || parent->tag == DW_TAG_enumeration_type) - { -+ char *parent_name = parent->name; -+ -+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */ -+ if (parent->tag == DW_TAG_namespace && parent_name != NULL -+ && strcmp (parent_name, "::") == 0) -+ parent_name = NULL; -+ - if (grandparent_scope == NULL) -- parent->scope = parent->name; -+ parent->scope = parent_name; - else - parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope, -- parent->name, cu); -+ parent_name, cu); - } - else if (parent->tag == DW_TAG_enumerator) - /* Enumerators should not get the name of the enumeration as a prefix. */ -@@ -2405,7 +2666,7 @@ partial_die_parent_scope (struct partial_die_info *pdi, - ignoring them. */ - complaint (&symfile_complaints, - _("unhandled containing DIE tag %d for DIE at %d"), -- parent->tag, pdi->offset); -+ parent->tag, real_pdi->offset); - parent->scope = grandparent_scope; - } - -@@ -2420,12 +2681,22 @@ partial_die_full_name (struct partial_die_info *pdi, - struct dwarf2_cu *cu) - { - char *parent_scope; -+ struct partial_die_info *real_pdi; - -- parent_scope = partial_die_parent_scope (pdi, cu); -- if (parent_scope == NULL) -- return NULL; -- else -+ /* We need to look at our parent DIE; if we have a DW_AT_specification, -+ then this means the parent of the specification DIE. -+ partial_die_parent_scope does this loop also, but we do it here -+ since we need to examine real_pdi->parent ourselves. */ -+ -+ real_pdi = pdi; -+ while (real_pdi->has_specification) -+ real_pdi = find_partial_die (real_pdi->spec_offset, cu); -+ -+ parent_scope = partial_die_parent_scope (real_pdi, cu); -+ if (parent_scope != NULL) - return typename_concat (NULL, parent_scope, pdi->name, cu); -+ -+ return NULL; - } - - static void -@@ -2441,12 +2712,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) - - baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - -- if (pdi_needs_namespace (pdi->tag)) -- { -- actual_name = partial_die_full_name (pdi, cu); -- if (actual_name) -- built_actual_name = 1; -- } -+ actual_name = partial_die_full_name (pdi, cu); -+ if (actual_name) -+ built_actual_name = 1; - - if (actual_name == NULL) - actual_name = pdi->name; -@@ -2543,6 +2811,13 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) - &objfile->global_psymbols, - 0, (CORE_ADDR) 0, cu->language, objfile); - break; -+ case DW_TAG_module: -+ add_psymbol_to_list (actual_name, strlen (actual_name), -+ built_actual_name, -+ MODULE_DOMAIN, LOC_STATIC, -+ &objfile->global_psymbols, -+ 0, (CORE_ADDR) 0, cu->language, objfile); -+ break; - case DW_TAG_class_type: - case DW_TAG_interface_type: - case DW_TAG_structure_type: -@@ -2586,49 +2861,10 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) - break; - } - -- /* Check to see if we should scan the name for possible namespace -- info. Only do this if this is C++, if we don't have namespace -- debugging info in the file, if the psym is of an appropriate type -- (otherwise we'll have psym == NULL), and if we actually had a -- mangled name to begin with. */ -- -- /* FIXME drow/2004-02-22: Why don't we do this for classes, i.e. the -- cases which do not set PSYM above? */ -- -- if (cu->language == language_cplus -- && cu->has_namespace_info == 0 -- && psym != NULL -- && SYMBOL_CPLUS_DEMANGLED_NAME (psym) != NULL) -- cp_check_possible_namespace_symbols (SYMBOL_CPLUS_DEMANGLED_NAME (psym), -- objfile); -- - if (built_actual_name) - xfree (actual_name); - } - --/* Determine whether a die of type TAG living in a C++ class or -- namespace needs to have the name of the scope prepended to the -- name listed in the die. */ -- --static int --pdi_needs_namespace (enum dwarf_tag tag) --{ -- switch (tag) -- { -- case DW_TAG_namespace: -- case DW_TAG_typedef: -- case DW_TAG_class_type: -- case DW_TAG_interface_type: -- case DW_TAG_structure_type: -- case DW_TAG_union_type: -- case DW_TAG_enumeration_type: -- case DW_TAG_enumerator: -- return 1; -- default: -- return 0; -- } --} -- - /* Read a partial die corresponding to a namespace; also, add a symbol - corresponding to that namespace to the symbol table. NAMESPACE is - the name of the enclosing namespace. */ -@@ -2656,12 +2892,12 @@ static void - add_partial_module (struct partial_die_info *pdi, CORE_ADDR *lowpc, - CORE_ADDR *highpc, int need_pc, struct dwarf2_cu *cu) - { -- /* Now scan partial symbols in that module. -+ /* Add a symbol for the module. */ - -- FIXME: Support the separate Fortran module namespaces. */ -+ add_partial_symbol (pdi, cu); - -- if (pdi->has_children) -- scan_partial_symbols (pdi->die_child, lowpc, highpc, need_pc, cu); -+ /* Partial symbols in that module are not scanned as they are never globally -+ visible. They get imported to the specific scopes on the full read. */ - } - - /* Read a partial die corresponding to a subprogram and create a partial -@@ -2739,7 +2975,6 @@ guess_structure_name (struct partial_die_info *struct_pdi, - could fix this by only using the demangled name to get the - prefix (but see comment in read_structure_type). */ - -- struct partial_die_info *child_pdi = struct_pdi->die_child; - struct partial_die_info *real_pdi; - - /* If this DIE (this DIE's specification, if any) has a parent, then -@@ -2752,27 +2987,6 @@ guess_structure_name (struct partial_die_info *struct_pdi, - - if (real_pdi->die_parent != NULL) - return; -- -- while (child_pdi != NULL) -- { -- if (child_pdi->tag == DW_TAG_subprogram) -- { -- char *actual_class_name -- = language_class_name_from_physname (cu->language_defn, -- child_pdi->name); -- if (actual_class_name != NULL) -- { -- struct_pdi->name -- = obsavestring (actual_class_name, -- strlen (actual_class_name), -- &cu->objfile->objfile_obstack); -- xfree (actual_class_name); -- } -- break; -- } -- -- child_pdi = child_pdi->die_sibling; -- } - } - } - -@@ -3325,6 +3539,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) - case DW_TAG_imported_declaration: - case DW_TAG_imported_module: - processing_has_namespace_info = 1; -+ if (cu->language == language_fortran) -+ { -+ if (die->tag == DW_TAG_imported_declaration) -+ read_fortran_imported_declaration (die, cu); -+ else -+ read_fortran_imported_module (die, cu); -+ break; -+ } - if (die->child != NULL && (die->tag == DW_TAG_imported_declaration - || cu->language != language_fortran)) - complaint (&symfile_complaints, _("Tag '%s' has unexpected children"), -@@ -3337,42 +3559,183 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) - } - } - -+/* A helper function for dwarf2_compute_name which determines whether DIE -+ needs to have the name of the scope prepended to the name listed in the -+ die. */ -+ -+static int -+die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) -+{ -+ switch (die->tag) -+ { -+ case DW_TAG_namespace: -+ case DW_TAG_typedef: -+ case DW_TAG_class_type: -+ case DW_TAG_interface_type: -+ case DW_TAG_structure_type: -+ case DW_TAG_union_type: -+ case DW_TAG_enumeration_type: -+ case DW_TAG_enumerator: -+ case DW_TAG_subprogram: -+ case DW_TAG_member: -+ return 1; -+ -+ case DW_TAG_variable: -+ { -+ struct attribute *attr; -+ -+ /* 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 -+ require prefixing, but they are not DW_AT_external.] */ -+ -+ if (dwarf2_attr (die, DW_AT_specification, cu)) -+ { -+ struct dwarf2_cu *spec_cu = cu; -+ return die_needs_namespace (die_specification (die, &spec_cu), -+ spec_cu); -+ } -+ -+ /* A variable in a lexical block of some kind does not need -+ a namespace, even though in C++ such variables may be -+ external and have a mangled name. */ -+ if (die->parent->tag == DW_TAG_lexical_block -+ || die->parent->tag == DW_TAG_try_block -+ || die->parent->tag == DW_TAG_catch_block) -+ return 0; -+ -+ attr = dwarf2_attr (die, DW_AT_external, cu); -+ if (attr || die->parent->tag == DW_TAG_namespace) -+ return 1; -+ -+ return 0; -+ } -+ -+ default: -+ return 0; -+ } -+} -+ -+/* Compute the fully qualified name of DIE in CU. If PHYSNAME is nonzero, -+ compute the physname for the object, which include a method's -+ formal parameters (C++/Java) and return type (Java). -+ -+ The result is allocated on the objfile_obstack and canonicalized. */ -+ -+static const char * -+dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu, -+ int physname) -+{ -+ if (name == NULL) -+ name = dwarf2_name (die, cu); -+ -+ /* These are the only languages we know how to qualify names in. */ -+ if (name != NULL -+ && (cu->language == language_cplus || cu->language == language_java)) -+ { -+ if (die_needs_namespace (die, cu)) -+ { -+ long length; -+ char *prefix; -+ struct ui_file *buf; -+ -+ prefix = determine_prefix (die, cu); -+ buf = mem_fileopen (); -+ if (*prefix != '\0') -+ { -+ char *prefixed_name = typename_concat (NULL, prefix, name, cu); -+ fputs_unfiltered (prefixed_name, buf); -+ xfree (prefixed_name); -+ } -+ else -+ fputs_unfiltered (name ? name : "", buf); -+ -+ /* For Java and C++ methods, append formal parameter type -+ information, if PHYSNAME. */ -+ -+ if (physname && die->tag == DW_TAG_subprogram -+ && (cu->language == language_cplus -+ || cu->language == language_java)) -+ { -+ struct type *type = read_type_die (die, cu); -+ -+ c_type_print_args (type, buf, 0, cu->language); -+ -+ if (cu->language == language_java) -+ { -+ /* For java, we must append the return type to method -+ names. */ -+ if (die->tag == DW_TAG_subprogram) -+ java_print_type (TYPE_TARGET_TYPE (type), "", buf, -+ 0, 0); -+ } -+ else if (cu->language == language_cplus) -+ { -+ if (TYPE_NFIELDS (type) > 0 -+ && TYPE_FIELD_ARTIFICIAL (type, 0) -+ && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)))) -+ fputs_unfiltered (" const", buf); -+ } -+ } -+ -+ name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack, -+ &length); -+ ui_file_delete (buf); -+ -+ if (cu->language == language_cplus) -+ { -+ char *cname -+ = dwarf2_canonicalize_name (name, cu, -+ &cu->objfile->objfile_obstack); -+ if (cname != NULL) -+ name = cname; -+ } -+ } -+ } -+ -+ return name; -+} -+ - /* Return the fully qualified name of DIE, based on its DW_AT_name. - If scope qualifiers are appropriate they will be added. The result - will be allocated on the objfile_obstack, or NULL if the DIE does -- not have a name. */ -+ not have a name. NAME may either be from a previous call to -+ dwarf2_name or NULL. -+ -+ The output string will be canonicalized (if C++/Java). */ - - static const char * --dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu) -+dwarf2_full_name (char *name, struct die_info *die, struct dwarf2_cu *cu) - { -- struct attribute *attr; -- char *prefix, *name; -- struct ui_file *buf = NULL; -+ return dwarf2_compute_name (name, die, cu, 0); -+} - -- name = dwarf2_name (die, cu); -- if (!name) -- return NULL; -+/* Construct a physname for the given DIE in CU. NAME may either be -+ from a previous call to dwarf2_name or NULL. The result will be -+ allocated on teh objfile_objstack or NULL if the DIE does not have a -+ name. - -- /* These are the only languages we know how to qualify names in. */ -- if (cu->language != language_cplus -- && cu->language != language_java) -- return name; -- -- /* If no prefix is necessary for this type of DIE, return the -- unqualified name. The other three tags listed could be handled -- in pdi_needs_namespace, but that requires broader changes. */ -- if (!pdi_needs_namespace (die->tag) -- && die->tag != DW_TAG_subprogram -- && die->tag != DW_TAG_variable -- && die->tag != DW_TAG_member) -- return name; -- -- prefix = determine_prefix (die, cu); -- if (*prefix != '\0') -- name = typename_concat (&cu->objfile->objfile_obstack, prefix, -- name, cu); -+ The output string will be canonicalized (if C++/Java). */ - -- return name; -+static const char * -+dwarf2_physname (char *name, struct die_info *die, struct dwarf2_cu *cu) -+{ -+ return dwarf2_compute_name (name, die, cu, 1); -+} -+ -+/* Read the given DIE's DW_AT_decl_line number. Return -1 if in case of an -+ error. */ -+ -+static int -+dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu) -+{ -+ struct attribute *line_attr; -+ -+ line_attr = dwarf2_attr (die, DW_AT_decl_line, cu); -+ if (line_attr) -+ return DW_UNSND (line_attr); -+ -+ return -1; - } - - /* Read the import statement specified by the given die and record it. */ -@@ -3385,11 +3748,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) - struct dwarf2_cu *imported_cu; - const char *imported_name; - const char *imported_name_prefix; -- char *import_alias; -- -- const char *import_prefix; - char *canonical_name; -- -+ const char *import_alias; -+ const char *imported_declaration = ""; -+ const char *import_prefix; -+ -+ int line_number = -1; -+ -+ int is_anonymous = 0; -+ - import_attr = dwarf2_attr (die, DW_AT_import, cu); - if (import_attr == NULL) - { -@@ -3439,19 +3806,25 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) - } - - /* Figure out the local name after import. */ -- import_alias = dwarf2_name (die, cu); -+ import_alias = dwarf2_name(die, cu); - -- /* Figure out where the statement is being imported to. */ -+ -+ /* Determine the line number at which the import was made */ -+ line_number = dwarf2_read_decl_line(die, cu); -+ -+ /* Figure out where the statement is being imported to */ - import_prefix = determine_prefix (die, cu); - - /* Figure out what the scope of the imported die is and prepend it - to the name of the imported die. */ - imported_name_prefix = determine_prefix (imported_die, imported_cu); -- -- if (strlen (imported_name_prefix) > 0) -- { -- canonical_name = alloca (strlen (imported_name_prefix) -- + 2 + strlen (imported_name) + 1); -+ -+ if(imported_die->tag != DW_TAG_namespace){ -+ imported_declaration = imported_name; -+ canonical_name = (char*)imported_name_prefix; -+ }else{ -+ if(strlen (imported_name_prefix) > 0){ -+ canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1); - strcpy (canonical_name, imported_name_prefix); - strcat (canonical_name, "::"); - strcat (canonical_name, imported_name); -@@ -3461,10 +3834,13 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) - canonical_name = alloca (strlen (imported_name) + 1); - strcpy (canonical_name, imported_name); - } -- -+ } -+ - using_directives = cp_add_using (import_prefix, - canonical_name, - import_alias, -+ imported_declaration, -+ line_number, - using_directives); - } - -@@ -3734,6 +4110,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) - struct attribute *attr; - - attr = dwarf2_attr (die, DW_AT_abstract_origin, cu); -+ -+ /* GCC 4.3 incorrectly uses DW_AT_specification to indicate die inheritence -+ in the case of import statements. The following is to accommodate -+ that. */ -+ if(!attr){ -+ attr = dwarf2_attr (die, DW_AT_specification, cu); -+ } -+ - if (!attr) - return; - -@@ -3832,6 +4216,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) - char *name; - CORE_ADDR baseaddr; - struct block *block; -+ unsigned die_children = 0; - int inlined_func = (die->tag == DW_TAG_inlined_subroutine); - - if (inlined_func) -@@ -3850,13 +4235,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) - - baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - -- name = dwarf2_linkage_name (die, cu); -+ name = dwarf2_name (die, cu); - - /* Ignore functions with missing or empty names and functions with - missing or invalid low and high pc attributes. */ -- if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)) -+ if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)){ -+ /* explore abstract origins if present. They might contain useful information -+ such as import statements. */ -+ child_die = die->child; -+ while (child_die && child_die->tag) -+ { -+ child_die = sibling_die (child_die); -+ die_children++; -+ } -+ inherit_abstract_dies(die, cu); - return; -- -+ } -+ - lowpc += baseaddr; - highpc += baseaddr; - -@@ -3883,14 +4278,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) - - cu->list_in_scope = &local_symbols; - -- if (die->child != NULL) -+ switch (cu->language) - { -- child_die = die->child; -- while (child_die && child_die->tag) -- { -- process_die (child_die, cu); -- child_die = sibling_die (child_die); -- } -+ case language_fortran: -+ cu->language_specific.fortran.use = NULL; -+ break; -+ } -+ -+ child_die = die->child; -+ while (child_die && child_die->tag) -+ { -+ process_die (child_die, cu); -+ child_die = sibling_die (child_die); -+ die_children++; - } - - inherit_abstract_dies (die, cu); -@@ -3906,6 +4306,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) - determine_prefix (die, cu), - processing_has_namespace_info); - -+ switch (cu->language) -+ { -+ case language_fortran: -+ BLOCK_FORTRAN_USE (block) = cu->language_specific.fortran.use; -+ break; -+ } -+ - /* If we have address ranges, record them. */ - dwarf2_record_block_ranges (die, block, baseaddr, cu); - -@@ -4524,7 +4931,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, - return; - - /* Get physical name. */ -- physname = dwarf2_linkage_name (die, cu); -+ physname = (char *) dwarf2_physname (fieldname, die, cu); - - /* The name is already allocated along with this objfile, so we don't - need to duplicate it for the type. */ -@@ -4686,7 +5093,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, - return; - - /* Get the mangled name. */ -- physname = dwarf2_linkage_name (die, cu); -+ physname = (char *) dwarf2_physname (fieldname, die, cu); - - /* Look up member function name in fieldlist. */ - for (i = 0; i < fip->nfnfields; i++) -@@ -4993,14 +5400,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) - if (cu->language == language_cplus - || cu->language == language_java) - { -- const char *new_prefix = determine_class_name (die, cu); -- TYPE_TAG_NAME (type) = (char *) new_prefix; -+ TYPE_TAG_NAME (type) = (char *) dwarf2_full_name (name, die, cu); -+ if (die->tag == DW_TAG_structure_type -+ || die->tag == DW_TAG_class_type) -+ TYPE_NAME (type) = TYPE_TAG_NAME (type); - } - else - { - /* The name is already allocated along with this objfile, so - we don't need to duplicate it for the type. */ -- TYPE_TAG_NAME (type) = name; -+ TYPE_TAG_NAME (type) = (char *) name; -+ if (die->tag == DW_TAG_class_type) -+ TYPE_NAME (type) = TYPE_TAG_NAME (type); - } - } - -@@ -5219,7 +5630,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) - type = alloc_type (objfile); - - TYPE_CODE (type) = TYPE_CODE_ENUM; -- name = dwarf2_full_name (die, cu); -+ name = dwarf2_full_name (NULL, die, cu); - if (name != NULL) - TYPE_TAG_NAME (type) = (char *) name; - -@@ -5244,51 +5655,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) - return set_die_type (die, type, cu); - } - --/* Determine the name of the type represented by DIE, which should be -- a named C++ or Java compound type. Return the name in question, -- allocated on the objfile obstack. */ -- --static const char * --determine_class_name (struct die_info *die, struct dwarf2_cu *cu) --{ -- const char *new_prefix = NULL; -- -- /* If we don't have namespace debug info, guess the name by trying -- to demangle the names of members, just like we did in -- guess_structure_name. */ -- if (!processing_has_namespace_info) -- { -- struct die_info *child; -- -- for (child = die->child; -- child != NULL && child->tag != 0; -- child = sibling_die (child)) -- { -- if (child->tag == DW_TAG_subprogram) -- { -- char *phys_prefix -- = language_class_name_from_physname (cu->language_defn, -- dwarf2_linkage_name -- (child, cu)); -- -- if (phys_prefix != NULL) -- { -- new_prefix -- = obsavestring (phys_prefix, strlen (phys_prefix), -- &cu->objfile->objfile_obstack); -- xfree (phys_prefix); -- break; -- } -- } -- } -- } -- -- if (new_prefix == NULL) -- new_prefix = dwarf2_full_name (die, cu); -- -- return new_prefix; --} -- - /* Given a pointer to a die which begins an enumeration, process all - the dies that define the members of the enumeration, and create the - symbol for the enumeration type. -@@ -5366,6 +5732,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -5531,6 +5540,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) new_symbol (die, this_type, cu); } @@ -4958,7 +1807,7 @@ index a05c946..9452844 100644 /* Extract all information from a DW_TAG_array_type DIE and put it in the DIE's type field. For now, this only handles one dimensional arrays. */ -@@ -5379,7 +5768,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5544,7 +5576,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) struct type *element_type, *range_type, *index_type; struct type **range_types = NULL; struct attribute *attr; @@ -4967,12 +1816,13 @@ index a05c946..9452844 100644 struct cleanup *back_to; char *name; -@@ -5426,16 +5815,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5597,17 +5629,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) type = element_type; if (read_array_order (die, cu) == DW_ORD_col_major) - { - int i = 0; +- - while (i < ndim) - type = create_array_type (NULL, type, range_types[i++]); - } @@ -4989,175 +1839,7 @@ index a05c946..9452844 100644 /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -5624,7 +6008,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) - if (is_anonymous) - { - const char *previous_prefix = determine_prefix (die, cu); -- cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL); -+ cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, "", dwarf2_read_decl_line(die, cu)); - } - } - -@@ -5640,20 +6024,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) - } - } - --/* Read a Fortran module. */ -+/* Read a Fortran module as global symbol which can be later looked up by -+ f_lookup_symbol_nonlocal. */ - - static void - read_module (struct die_info *die, struct dwarf2_cu *cu) - { -- struct die_info *child_die = die->child; -+ struct type *type; -+ -+ type = read_module_type (die, cu); -+ -+ if (type) -+ new_symbol (die, type, cu); -+} -+ -+/* Read a Fortran module as type. -+ -+ Modules present only as declarations - being used only for DW_AT_import of -+ DW_TAG_imported_module - are ignored here. They are read in only in form of -+ the module name by read_fortran_imported_module. */ -+ -+static struct type * -+read_module_type (struct die_info *die, struct dwarf2_cu *cu) -+{ -+ struct objfile *objfile = cu->objfile; -+ struct die_info *child_die; -+ struct type *type; -+ char *module_name; -+ struct context_stack *new; -+ struct pending *save_file_symbols; -+ struct pending *save_global_symbols; -+ struct pending **save_list_in_scope; -+ -+ if (die_is_declaration (die, cu)) -+ return NULL; -+ -+ module_name = dwarf2_name (die, cu); -+ if (!module_name) -+ complaint (&symfile_complaints, _("DW_TAG_module has no name, offset 0x%x"), -+ die->offset); -+ type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile); -+ -+ /* Create a context for reading the module variables. */ -+ -+ new = push_context (0, 0); -+ -+ save_file_symbols = file_symbols; -+ file_symbols = NULL; -+ save_global_symbols = global_symbols; -+ global_symbols = NULL; -+ save_list_in_scope = cu->list_in_scope; - -- /* FIXME: Support the separate Fortran module namespaces. */ -+ /* Process the child DIEs. */ - -+ child_die = die->child; - while (child_die && child_die->tag) - { -+ /* Any DW_TAG_subprogram will reset LIST_IN_SCOPE to LOCAL_SYMBOLS. */ -+ cu->list_in_scope = &global_symbols; -+ - process_die (child_die, cu); - child_die = sibling_die (child_die); - } -+ -+ /* Finish this module and restore the context. */ -+ -+ TYPE_MODULE_BLOCK (type) = finish_block (NULL, &global_symbols, -+ new->old_blocks, 0, 0, objfile); -+ -+ if (file_symbols) -+ complaint (&symfile_complaints, _("DW_TAG_module contains static symbols")); -+ if (local_symbols) -+ complaint (&symfile_complaints, _("DW_TAG_module contains local symbols")); -+ if (param_symbols) -+ complaint (&symfile_complaints, _("DW_TAG_module contains function " -+ "parameters")); -+ -+ file_symbols = save_file_symbols; -+ global_symbols = save_global_symbols; -+ cu->list_in_scope = save_list_in_scope; -+ -+ pop_context (); -+ -+ set_die_type (die, type, cu); -+ -+ return type; -+} -+ -+/* Import a Fortran module. Only store the module name for its later lookup by -+ f_lookup_symbol_nonlocal. */ -+ -+static void -+read_fortran_imported_module (struct die_info *die, struct dwarf2_cu *cu) -+{ -+ struct objfile *objfile = cu->objfile; -+ struct attribute *attr; -+ struct die_info *module_die; -+ char *module_name; -+ struct fortran_using *use; -+ -+ attr = dwarf2_attr (die, DW_AT_import, cu); -+ if (attr == NULL) -+ return; -+ -+ module_die = follow_die_ref (die, attr, &cu); -+ module_name = dwarf2_name (module_die, cu); -+ if (module_name == NULL) -+ { -+ complaint (&symfile_complaints, -+ _("Imported DIE at offset 0x%x has no name"), die->offset); -+ return; -+ } -+ -+ /* Fortran does not allow any duplicity between local and any of the imported -+ symbols. Therefore the order of the USE statements is not portant. -+ gfortran prints: -+ Error: Name 'X' at (1) is an ambiguous reference to 'X' from module 'Y' */ -+ -+ use = obstack_alloc (&objfile->objfile_obstack, sizeof (*use) -+ + strlen (module_name)); -+ strcpy (use->module_name, module_name); -+ gdb_assert (cu->language == language_fortran); -+ use->next = cu->language_specific.fortran.use; -+ cu->language_specific.fortran.use = use; -+} -+ -+/* Import a single Fortran declaration and possibly rename it. */ -+ -+static void -+read_fortran_imported_declaration (struct die_info *die, struct dwarf2_cu *cu) -+{ -+ struct attribute *attr; -+ struct die_info *imported_die; -+ struct symbol *sym; -+ char *rename = dwarf2_name (die, cu); -+ -+ attr = dwarf2_attr (die, DW_AT_import, cu); -+ if (attr == NULL) -+ { -+ complaint (&symfile_complaints, -+ _("Fortran DW_TAG_imported_declaration is missing " -+ "DW_AT_import at offset 0x%x"), die->offset); -+ return; -+ } -+ imported_die = follow_die_ref (die, attr, &cu); -+ -+ sym = new_symbol (imported_die, NULL, cu); -+ -+ if (sym && rename) -+ SYMBOL_CPLUS_DEMANGLED_NAME (sym) = rename; - } - - /* Return the name of the namespace represented by DIE. Set -@@ -5818,29 +6337,115 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -6061,29 +6087,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -5200,7 +1882,7 @@ index a05c946..9452844 100644 + else if (blk->size > 1 && blk->data[0] == DW_OP_regx) + { + ULONGEST ulongest; -+ gdb_byte *end; ++ const gdb_byte *end; + + end = read_uleb128 (&blk->data[1], &blk->data[blk->size], + &ulongest); @@ -5211,34 +1893,33 @@ index a05c946..9452844 100644 + if (length_baton == NULL) + { + struct attribute *size_attr; ++ gdb_byte *data; + + length_baton = obstack_alloc (&cu->comp_unit_obstack, + sizeof (*length_baton)); + length_baton->per_cu = cu->per_cu; + length_baton->size = DW_BLOCK (attr)->size + 2; -+ length_baton->data = obstack_alloc (&cu->comp_unit_obstack, -+ length_baton->size); -+ memcpy (length_baton->data, DW_BLOCK (attr)->data, -+ DW_BLOCK (attr)->size); ++ data = obstack_alloc (&cu->comp_unit_obstack, ++ length_baton->size); ++ length_baton->data = data; ++ memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size); + + /* DW_AT_BYTE_SIZE existing together with DW_AT_STRING_LENGTH + specifies the size of an integer to fetch. */ + size_attr = dwarf2_attr (die, DW_AT_byte_size, cu); + if (size_attr) + { -+ length_baton->data[DW_BLOCK (attr)->size] = DW_OP_deref_size; -+ length_baton->data[DW_BLOCK (attr)->size + 1] = -+ DW_UNSND (size_attr); -+ if (length_baton->data[DW_BLOCK (attr)->size + 1] -+ != DW_UNSND (size_attr)) ++ data[DW_BLOCK (attr)->size] = DW_OP_deref_size; ++ data[DW_BLOCK (attr)->size + 1] = DW_UNSND (size_attr); ++ if (data[DW_BLOCK (attr)->size + 1] != DW_UNSND (size_attr)) + complaint (&symfile_complaints, + _("DW_AT_string_length's DW_AT_byte_size " + "integer exceeds the byte size storage")); + } + else + { -+ length_baton->data[DW_BLOCK (attr)->size] = DW_OP_deref; -+ length_baton->data[DW_BLOCK (attr)->size + 1] = DW_OP_nop; ++ data[DW_BLOCK (attr)->size] = DW_OP_deref; ++ data[DW_BLOCK (attr)->size + 1] = DW_OP_nop; + } + } + @@ -5287,20 +1968,7 @@ index a05c946..9452844 100644 char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -5940,11 +6545,10 @@ static struct type * - read_typedef (struct die_info *die, struct dwarf2_cu *cu) - { - struct objfile *objfile = cu->objfile; -- struct attribute *attr; - const char *name = NULL; - struct type *this_type; - -- name = dwarf2_full_name (die, cu); -+ name = dwarf2_full_name (NULL, die, cu); - this_type = init_type (TYPE_CODE_TYPEDEF, 0, - TYPE_FLAG_TARGET_STUB, NULL, objfile); - TYPE_NAME (this_type) = (char *) name; -@@ -6048,8 +6652,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -6326,60 +6437,136 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; @@ -5309,13 +1977,18 @@ index a05c946..9452844 100644 + LONGEST low; char *name; LONGEST negative_mask; - -@@ -6063,49 +6666,157 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - 0, NULL, cu->objfile); - } + + base_type = die_type (die, cu); ++ /* Preserve BASE_TYPE's original type, just set its LENGTH. */ ++ check_typedef (base_type); + + /* The die_type call above may have already set the type for this DIE. */ + range_type = get_die_type (die, cu); + if (range_type) + return range_type; - if (cu->language == language_fortran) -- { +- { - /* FORTRAN implies a lower bound of 1, if not given. */ - low = 1; - } @@ -5324,6 +1997,11 @@ index a05c946..9452844 100644 + + negative_mask = + (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); ++ ++ /* Exclude language_ada from any TYPE_DYNAMIC constructs below. GDB Ada ++ supports implements the dynamic bounds in a non-DWARF way and the ++ existing DWARF dynamic bounds are invalid, leading to memory access ++ errors. */ - /* FIXME: For variable sized arrays either of these could be - a variable rather than a constant value. We'll allow it, @@ -5331,7 +2009,7 @@ index a05c946..9452844 100644 attr = dwarf2_attr (die, DW_AT_lower_bound, cu); - if (attr) - low = dwarf2_get_attr_constant_value (attr, 0); -+ if (attr && attr_form_is_block (attr)) ++ if (attr && attr_form_is_block (attr) && cu->language != language_ada) + { + TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_BLOCK; + TYPE_RANGE_DATA (range_type)->low.u.dwarf_block = @@ -5340,7 +2018,7 @@ index a05c946..9452844 100644 + /* For setting a default if DW_AT_UPPER_BOUND would be missing. */ + low = 0; + } -+ else if (attr && is_ref_attr (attr)) ++ else if (attr && is_ref_attr (attr) && cu->language != language_ada) + { + struct die_info *target_die; + struct dwarf2_cu *target_cu = cu; @@ -5386,11 +2064,13 @@ index a05c946..9452844 100644 attr = dwarf2_attr (die, DW_AT_upper_bound, cu); - if (attr) -- { -- if (attr->form == DW_FORM_block1) ++ if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr) ++ && !is_ref_attr (attr))) + { +- if (attr->form == DW_FORM_block1 || is_ref_attr (attr)) - { - /* GCC encodes arrays with unspecified or dynamic length -- with a DW_FORM_block1 attribute. +- with a DW_FORM_block1 attribute or a reference attribute. - FIXME: GDB does not yet know how to handle dynamic - arrays properly, treat them as arrays with unspecified - length for now. @@ -5402,9 +2082,8 @@ index a05c946..9452844 100644 - the lower bound we've computed above. */ - high = low - 1; - } -+ if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr) -+ && !is_ref_attr (attr))) -+ { +- else +- high = dwarf2_get_attr_constant_value (attr, 1); + attr = dwarf2_attr (die, DW_AT_count, cu); + /* It does not hurt but it is needlessly ineffective in check_typedef. */ + if (attr && (attr_form_is_block (attr) || attr_form_is_constant (attr))) @@ -5415,14 +2094,14 @@ index a05c946..9452844 100644 + /* Pass it now as the regular DW_AT_upper_bound. */ + } + -+ if (attr && attr_form_is_block (attr)) ++ if (attr && attr_form_is_block (attr) && cu->language != language_ada) + { + TYPE_RANGE_DATA (range_type)->high.kind = RANGE_BOUND_KIND_DWARF_BLOCK; + TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = + dwarf2_attr_to_locexpr_baton (attr, cu); + TYPE_DYNAMIC (range_type) = 1; + } -+ else if (attr && is_ref_attr (attr)) ++ else if (attr && is_ref_attr (attr) && cu->language != language_ada) + { + struct die_info *target_die; + struct dwarf2_cu *target_cu = cu; @@ -5438,27 +2117,33 @@ index a05c946..9452844 100644 + TYPE_RANGE_DATA (range_type)->high.u.dwarf_loclist.type + = die_type (target_die, target_cu); + TYPE_DYNAMIC (range_type) = 1; -+ } -+ else -+ { -+ if (attr && attr_form_is_constant (attr)) -+ { -+ LONGEST high; + } + else + { +- attr = dwarf2_attr (die, DW_AT_count, cu); +- if (attr) ++ LONGEST high; + -+ high = dwarf2_get_attr_constant_value (attr, 0); -+ if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) -+ high |= negative_mask; -+ TYPE_HIGH_BOUND (range_type) = high; -+ } - else -- high = dwarf2_get_attr_constant_value (attr, 1); -+ { ++ if (attr && attr_form_is_constant (attr)) ++ high = dwarf2_get_attr_constant_value (attr, 0); ++ else + { +- int count = dwarf2_get_attr_constant_value (attr, 1); +- high = low + count - 1; + TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -+ TYPE_HIGH_BOUND (range_type) = low - 1; -+ } ++ high = low - 1; + } ++ if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) ++ high |= negative_mask; ++ TYPE_HIGH_BOUND (range_type) = high; } -- negative_mask = + /* Dwarf-2 specifications explicitly allows to create subrange types +@@ -6421,20 +6608,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) + } + } + +- negative_mask = - (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); - if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) - low |= negative_mask; @@ -5466,7 +2151,7 @@ index a05c946..9452844 100644 - high |= negative_mask; + /* DW_AT_bit_stride is currently unsupported as we count in bytes. */ + attr = dwarf2_attr (die, DW_AT_byte_stride, cu); -+ if (attr && attr_form_is_block (attr)) ++ if (attr && attr_form_is_block (attr) && cu->language != language_ada) + { + TYPE_RANGE_DATA (range_type)->byte_stride.kind + = RANGE_BOUND_KIND_DWARF_BLOCK; @@ -5474,7 +2159,7 @@ index a05c946..9452844 100644 + dwarf2_attr_to_locexpr_baton (attr, cu); + TYPE_DYNAMIC (range_type) = 1; + } -+ else if (attr && is_ref_attr (attr)) ++ else if (attr && is_ref_attr (attr) && cu->language != language_ada) + { + struct die_info *target_die; + struct dwarf2_cu *target_cu = cu; @@ -5484,7 +2169,12 @@ index a05c946..9452844 100644 + target_die = follow_die_ref_or_sig (die, attr, &target_cu); + gdb_assert (target_cu->objfile == cu->objfile); + target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ + +- /* Mark arrays with dynamic length at least as an array of unspecified +- length. GDB could check the boundary but before it gets implemented at +- least allow accessing the array elements. */ +- if (attr && attr->form == DW_FORM_block1) +- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + TYPE_RANGE_DATA (range_type)->byte_stride.kind + = RANGE_BOUND_KIND_DWARF_LOCLIST; + TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.loclist @@ -5503,35 +2193,7 @@ index a05c946..9452844 100644 name = dwarf2_name (die, cu); if (name) -@@ -6564,6 +7275,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr, - && abbrev->tag != DW_TAG_lexical_block - && abbrev->tag != DW_TAG_variable - && abbrev->tag != DW_TAG_namespace -+ && abbrev->tag != DW_TAG_module - && abbrev->tag != DW_TAG_member) - { - /* Otherwise we skip to the next sibling, if any. */ -@@ -6772,7 +7484,8 @@ read_partial_die (struct partial_die_info *part_die, - } - break; - case DW_AT_MIPS_linkage_name: -- part_die->name = DW_STRING (&attr); -+ if (cu->language == language_ada) -+ part_die->name = DW_STRING (&attr); - break; - case DW_AT_low_pc: - has_low_pc_attr = 1; -@@ -6970,7 +7683,8 @@ fixup_partial_die (struct partial_die_info *part_die, - /* If we found a reference attribute and the DIE has no name, try - to find a name in the referred to DIE. */ - -- if (part_die->name == NULL && part_die->has_specification) -+ if (part_die->has_specification -+ && (part_die->name == NULL || !part_die->is_external)) - { - struct partial_die_info *spec_die; - -@@ -8312,10 +9026,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, +@@ -8714,10 +8922,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, (i.e. when the value of a register or memory location is referenced, or a thread-local block, etc.). Then again, it might not be worthwhile. I'm assuming that it isn't unless performance @@ -5546,21 +2208,7 @@ index a05c946..9452844 100644 } /* Given a pointer to a DWARF information entry, figure out if we need -@@ -8337,21 +9053,27 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - - baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - -- if (die->tag != DW_TAG_namespace) -- name = dwarf2_linkage_name (die, cu); -- else -- name = TYPE_NAME (type); -- -+ name = dwarf2_name (die, cu); - if (name) - { -+ const char *linkagename; -+ - sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, +@@ -8748,6 +8958,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); @@ -5569,95 +2217,7 @@ index a05c946..9452844 100644 /* Cache this symbol's name and the name's demangled form (if any). */ SYMBOL_LANGUAGE (sym) = cu->language; -- SYMBOL_SET_NAMES (sym, name, strlen (name), 0, objfile); -+ linkagename = dwarf2_physname (name, die, cu); -+ SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile); -+ if (cu->language == language_fortran) -+ { -+ SYMBOL_CPLUS_DEMANGLED_NAME (sym) = SYMBOL_LINKAGE_NAME (sym); -+ SYMBOL_LINKAGE_NAME (sym) = fortran_module_linkage_name (die, cu); -+ } - - /* Default assumptions. - Use the passed type or decode it from the die. */ -@@ -8451,7 +9173,24 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - var_decode_location (attr, sym, cu); - attr2 = dwarf2_attr (die, DW_AT_external, cu); - if (attr2 && (DW_UNSND (attr2) != 0)) -- add_symbol_to_list (sym, &global_symbols); -+ { -+ struct pending **list_to_add; -+ -+ /* Workaround gfortran PR debug/40040 - it uses -+ DW_AT_location for variables in -fPIC libraries which may -+ get overriden by other libraries/executable and get -+ a different address. Resolve it by .dynsym instead. */ -+ -+ if (cu->language == language_fortran && die->parent -+ && die->parent->tag == DW_TAG_module) -+ SYMBOL_CLASS (sym) = LOC_UNRESOLVED; -+ -+ /* A variable with DW_AT_external is never static, but it -+ may be block-scoped. */ -+ list_to_add = (cu->list_in_scope == &file_symbols -+ ? &global_symbols : cu->list_in_scope); -+ add_symbol_to_list (sym, list_to_add); -+ } - else - add_symbol_to_list (sym, cu->list_in_scope); - } -@@ -8576,7 +9315,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - } - break; - case DW_TAG_typedef: -- SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu); -+ SYMBOL_LINKAGE_NAME (sym) -+ = (char *) dwarf2_full_name (name, die, cu); - SYMBOL_CLASS (sym) = LOC_TYPEDEF; - SYMBOL_DOMAIN (sym) = VAR_DOMAIN; - add_symbol_to_list (sym, cu->list_in_scope); -@@ -8588,7 +9328,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - add_symbol_to_list (sym, cu->list_in_scope); - break; - case DW_TAG_enumerator: -- SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu); -+ SYMBOL_LINKAGE_NAME (sym) -+ = (char *) dwarf2_full_name (name, die, cu); - attr = dwarf2_attr (die, DW_AT_const_value, cu); - if (attr) - { -@@ -8612,6 +9353,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - SYMBOL_CLASS (sym) = LOC_TYPEDEF; - add_symbol_to_list (sym, &global_symbols); - break; -+ case DW_TAG_module: -+ SYMBOL_CLASS (sym) = LOC_STATIC; -+ SYMBOL_DOMAIN (sym) = MODULE_DOMAIN; -+ add_symbol_to_list (sym, &global_symbols); -+ break; - default: - /* Not a tag we recognize. Hopefully we aren't processing - trash data, but since we must specifically ignore things -@@ -8625,8 +9371,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - /* For the benefit of old versions of GCC, check for anonymous - namespaces based on the demangled name. */ - if (!processing_has_namespace_info -- && cu->language == language_cplus -- && dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu) != NULL) -+ && cu->language == language_cplus) - cp_scan_for_anonymous_namespaces (sym); - } - return (sym); -@@ -8938,12 +9683,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) - case DW_TAG_namespace: - this_type = read_namespace_type (die, cu); - break; -+ case DW_TAG_module: -+ this_type = read_module_type (die, cu); -+ break; - default: - complaint (&symfile_complaints, _("unexpected tag in read_type_die: '%s'"), - dwarf_tag_name (die->tag)); +@@ -9379,6 +9591,9 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) break; } @@ -5667,89 +2227,48 @@ index a05c946..9452844 100644 return this_type; } -@@ -9011,6 +9762,10 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) - case DW_TAG_namespace: - parent_type = read_type_die (parent, cu); - /* We give a name to even anonymous namespaces. */ -+ -+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */ -+ if (strcmp (TYPE_TAG_NAME (parent_type), "::") == 0) -+ return ""; - return TYPE_TAG_NAME (parent_type); - case DW_TAG_class_type: - case DW_TAG_interface_type: -@@ -9025,7 +9780,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) - So it does not need a prefix. */ - return ""; - default: -- return determine_prefix (parent, cu); -+ return determine_prefix (parent, cu); - } - } - -@@ -9078,17 +9833,37 @@ sibling_die (struct die_info *die) - return die->sibling; - } - --/* Get linkage name of a die, return NULL if not found. */ -+/* Return the fully qualified .symtab name for symbols contained in Fortran -+ modules. Return DWARF2_NAME otherwise. */ - - static char * --dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) -+fortran_module_linkage_name (struct die_info *die, struct dwarf2_cu *cu) - { -- struct attribute *attr; -+ char *name; -+ -+ gdb_assert (cu->language == language_fortran); -+ -+ name = dwarf2_name (die, cu); -+ -+ if (name && die->parent && die->parent->tag == DW_TAG_module) -+ { -+ char *module_name = dwarf2_name (die->parent, cu); -+ -+ if (module_name) -+ { -+ char *retval; - -- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); -- if (attr && DW_STRING (attr)) -- return DW_STRING (attr); -- return dwarf2_name (die, cu); -+ /* `__modulename_MOD_variablename0'. */ -+ retval = obstack_alloc (&cu->objfile->objfile_obstack, -+ 2 + strlen (module_name) + 5 + strlen (name) -+ + 1); -+ sprintf (retval, "__%s_MOD_%s", module_name, name); -+ -+ return retval; -+ } -+ } -+ -+ return name; - } - - /* Get name of a die, return NULL if not found. */ -@@ -11436,64 +12211,94 @@ attr_form_is_constant (struct attribute *attr) +@@ -11983,67 +12198,102 @@ attr_form_is_constant (struct attribute *attr) } } +-static void +-dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, +- struct dwarf2_cu *cu) +/* Convert DW_BLOCK into struct dwarf2_locexpr_baton. ATTR must be a DW_BLOCK + attribute type. */ + +static struct dwarf2_locexpr_baton * +dwarf2_attr_to_locexpr_baton (struct attribute *attr, struct dwarf2_cu *cu) -+{ + { +- if (attr_form_is_section_offset (attr) +- /* ".debug_loc" may not exist at all, or the offset may be outside +- the section. If so, fall through to the complaint in the +- other branch. */ +- && DW_UNSND (attr) < dwarf2_per_objfile->loc.size) +- { +- struct dwarf2_loclist_baton *baton; + struct dwarf2_locexpr_baton *baton; -+ + +- baton = obstack_alloc (&cu->objfile->objfile_obstack, +- sizeof (struct dwarf2_loclist_baton)); +- baton->per_cu = cu->per_cu; +- gdb_assert (baton->per_cu); + gdb_assert (attr_form_is_block (attr)); -+ + +- dwarf2_read_section (dwarf2_per_objfile->objfile, +- &dwarf2_per_objfile->loc); + baton = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (*baton)); + baton->per_cu = cu->per_cu; + gdb_assert (baton->per_cu); -+ + +- /* We don't know how long the location list is, but make sure we +- don't run off the edge of the section. */ +- baton->size = dwarf2_per_objfile->loc.size - DW_UNSND (attr); +- baton->data = dwarf2_per_objfile->loc.buffer + DW_UNSND (attr); +- baton->base_address = cu->base_address; +- if (cu->base_known == 0) +- complaint (&symfile_complaints, +- _("Location list used without specifying the CU base address.")); + /* Note that we're just copying the block's data pointer + here, not the actual data. We're still pointing into the + info_buffer for SYM's objfile; right now we never release @@ -5761,12 +2280,20 @@ index a05c946..9452844 100644 + + return baton; +} -+ + +static struct dwarf2_loclist_baton * +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; ++ ++ dwarf2_read_section (dwarf2_per_objfile->objfile, ++ &dwarf2_per_objfile->loc); ++ + 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 @@ -5793,33 +2320,12 @@ index a05c946..9452844 100644 + +/* SYM may get its SYMBOL_CLASS overriden on invalid ATTR content. */ + - static void - dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, - struct dwarf2_cu *cu) - { -- if (attr_form_is_section_offset (attr) -- /* ".debug_loc" may not exist at all, or the offset may be outside -- the section. If so, fall through to the complaint in the -- other branch. */ -- && DW_UNSND (attr) < dwarf2_per_objfile->loc.size) -- { -- struct dwarf2_loclist_baton *baton; -- -- baton = obstack_alloc (&cu->objfile->objfile_obstack, -- sizeof (struct dwarf2_loclist_baton)); -- baton->per_cu = cu->per_cu; -- gdb_assert (baton->per_cu); -- -- /* We don't know how long the location list is, but make sure we -- don't run off the edge of the section. */ -- baton->size = dwarf2_per_objfile->loc.size - DW_UNSND (attr); -- baton->data = dwarf2_per_objfile->loc.buffer + DW_UNSND (attr); -- baton->base_address = cu->base_address; -- if (cu->base_known == 0) -- complaint (&symfile_complaints, -- _("Location list used without specifying the CU base address.")); ++static void ++dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, ++ struct dwarf2_cu *cu) ++{ + struct dwarf2_loclist_baton *loclist_baton; - ++ + loclist_baton = dwarf2_attr_to_loclist_baton (attr, cu); + if (loclist_baton) + { @@ -5861,12 +2367,11 @@ index a05c946..9452844 100644 - baton->size = 0; - baton->data = NULL; - } -- -- SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs; -- SYMBOL_LOCATION_BATON (sym) = baton; + SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs; + SYMBOL_LOCATION_BATON (sym) = NULL; -+ + +- SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs; +- SYMBOL_LOCATION_BATON (sym) = baton; + /* For functions a missing DW_AT_frame_base does not optimize out the + whole function definition, only its frame base resolving. */ + if (attr->name == DW_AT_location) @@ -5874,7 +2379,7 @@ index a05c946..9452844 100644 } } -@@ -11781,6 +12586,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) +@@ -12372,6 +12622,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) return ofs_lhs->offset == ofs_rhs->offset; } @@ -5904,9 +2409,9 @@ index a05c946..9452844 100644 +} + /* Set the type associated with DIE to TYPE. Save it in CU's hash - table if necessary. For convenience, return TYPE. */ + table if necessary. For convenience, return TYPE. -@@ -11789,6 +12619,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -12395,6 +12670,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { struct dwarf2_offset_and_type **slot, ofs; @@ -5915,64 +2420,19 @@ index a05c946..9452844 100644 /* For Ada types, make sure that the gnat-specific data is always initialized (if not already set). There are a few types where we should not be doing so, because the type-specific area is -@@ -11944,23 +12776,13 @@ show_dwarf2_cmd (char *args, int from_tty) - cmd_show_list (show_dwarf2_cmdlist, from_tty, ""); - } - --/* If section described by INFO was mmapped, munmap it now. */ -+/* A helper function to destroy a debug section. */ - - static void --munmap_section_buffer (struct dwarf2_section_info *info) -+destroy_section (struct dwarf2_section_info *info) - { -- if (info->was_mmapped) -- { --#ifdef HAVE_MMAP -- intptr_t begin = (intptr_t) info->buffer; -- intptr_t map_begin = begin & ~(pagesize - 1); -- size_t map_length = info->size + begin - map_begin; -- gdb_assert (munmap ((void *) map_begin, map_length) == 0); --#else -- /* Without HAVE_MMAP, we should never be here to begin with. */ -- gdb_assert (0); --#endif -- } -+ if (info->destructor) -+ (*info->destructor) (info); - } - - /* munmap debug sections for OBJFILE, if necessary. */ -@@ -11969,15 +12791,15 @@ static void - dwarf2_per_objfile_free (struct objfile *objfile, void *d) - { - struct dwarf2_per_objfile *data = d; -- munmap_section_buffer (&data->info); -- munmap_section_buffer (&data->abbrev); -- munmap_section_buffer (&data->line); -- munmap_section_buffer (&data->str); -- munmap_section_buffer (&data->macinfo); -- munmap_section_buffer (&data->ranges); -- munmap_section_buffer (&data->loc); -- munmap_section_buffer (&data->frame); -- munmap_section_buffer (&data->eh_frame); -+ destroy_section (&data->info); -+ destroy_section (&data->abbrev); -+ destroy_section (&data->line); -+ destroy_section (&data->str); -+ destroy_section (&data->macinfo); -+ destroy_section (&data->ranges); -+ destroy_section (&data->loc); -+ destroy_section (&data->frame); -+ destroy_section (&data->eh_frame); - } - - void _initialize_dwarf2_read (void); diff --git a/gdb/elfread.c b/gdb/elfread.c -index 9a2a1e3..72b1d13 100644 +index 8c00938..4aa1f3f 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -179,7 +179,8 @@ record_minimal_symbol (const char *name, int name_len, int copy_name, +@@ -37,6 +37,7 @@ + #include "complaints.h" + #include "demangle.h" + #include "psympriv.h" ++#include "gdbtypes.h" + + extern void _initialize_elfread (void); + +@@ -180,7 +181,8 @@ record_minimal_symbol (const char *name, int name_len, int copy_name, { struct gdbarch *gdbarch = get_objfile_arch (objfile); @@ -5982,7 +2442,7 @@ index 9a2a1e3..72b1d13 100644 address = gdbarch_smash_text_address (gdbarch, address); return prim_record_minimal_symbol_full (name, name_len, copy_name, address, -@@ -388,7 +389,10 @@ elf_symtab_read (struct objfile *objfile, int type, +@@ -388,7 +390,10 @@ elf_symtab_read (struct objfile *objfile, int type, { if (sym->flags & (BSF_GLOBAL | BSF_WEAK)) { @@ -5994,223 +2454,296 @@ index 9a2a1e3..72b1d13 100644 } else if ((sym->name[0] == '.' && sym->name[1] == 'L') || ((sym->flags & BSF_LOCAL) -@@ -879,20 +883,13 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) - str_sect->filepos, - bfd_section_size (abfd, str_sect)); - } -- if (dwarf2_has_info (objfile)) -- { -- /* DWARF 2 sections */ -- dwarf2_build_psymtabs (objfile); -- } -- -- /* FIXME: kettenis/20030504: This still needs to be integrated with -- dwarf2read.c in a better way. */ -- dwarf2_build_frame_info (objfile); - -+ if (dwarf2_has_info (objfile)) -+ dwarf2_create_quick_addrmap (objfile); - /* If the file has its own symbol tables it has no separate debug info. - `.dynsym'/`.symtab' go to MSYMBOLS, `.debug_info' goes to SYMTABS/PSYMTABS. - `.gnu_debuglink' may no longer be present with `.note.gnu.build-id'. */ -- if (!objfile_has_partial_symbols (objfile)) -+ else - { - char *debugfile; - -@@ -910,6 +907,20 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) +@@ -569,6 +574,250 @@ elf_symtab_read (struct objfile *objfile, int type, } } ++/* FIXME: Delay it through elf_sym_fns. */ ++ +static void -+read_psyms (struct objfile *objfile) ++elf_rel_plt_read (struct objfile *objfile, asymbol **dyn_symbol_table) +{ -+ if (dwarf2_has_info (objfile)) ++ bfd *obfd = objfile->obfd; ++ const struct elf_backend_data *bed = get_elf_backend_data (obfd); ++ asection *plt, *relplt, *got_plt; ++ unsigned u; ++ int plt_elf_idx; ++ bfd_size_type reloc_count, reloc; ++ char *string_buffer = NULL; ++ size_t string_buffer_size = 0; ++ struct cleanup *back_to; ++ struct gdbarch *gdbarch = objfile->gdbarch; ++ struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; ++ size_t ptr_size = TYPE_LENGTH (ptr_type); ++ ++ if (objfile->separate_debug_objfile_backlink) ++ return; ++ ++ plt = bfd_get_section_by_name (obfd, ".plt"); ++ if (plt == NULL) ++ return; ++ plt_elf_idx = elf_section_data (plt)->this_idx; ++ ++ got_plt = bfd_get_section_by_name (obfd, ".got.plt"); ++ if (got_plt == NULL) ++ return; ++ ++ /* This search algorithm is from _bfd_elf_canonicalize_dynamic_reloc. */ ++ for (relplt = obfd->sections; relplt != NULL; relplt = relplt->next) ++ if (elf_section_data (relplt)->this_hdr.sh_info == plt_elf_idx ++ && (elf_section_data (relplt)->this_hdr.sh_type == SHT_REL ++ || elf_section_data (relplt)->this_hdr.sh_type == SHT_RELA)) ++ break; ++ if (relplt == NULL) ++ return; ++ ++ if (! bed->s->slurp_reloc_table (obfd, relplt, dyn_symbol_table, TRUE)) ++ return; ++ ++ back_to = make_cleanup (free_current_contents, &string_buffer); ++ ++ reloc_count = relplt->size / elf_section_data (relplt)->this_hdr.sh_entsize; ++ for (reloc = 0; reloc < reloc_count; reloc++) + { -+ /* DWARF 2 sections */ -+ dwarf2_build_psymtabs (objfile); ++ const char *name, *name_got_plt; ++ struct minimal_symbol *msym; ++ CORE_ADDR address; ++ const char *suffix = "@got.plt"; ++ size_t suffix_len = strlen (suffix); ++ size_t name_len; ++ ++ name = bfd_asymbol_name (*relplt->relocation[reloc].sym_ptr_ptr); ++ name_len = strlen (name); ++ address = relplt->relocation[reloc].address; ++ ++ /* Does the pointer reside in the .got.plt section? */ ++ if (!(bfd_get_section_vma (obfd, got_plt) <= address ++ && address < bfd_get_section_vma (obfd, got_plt) ++ + bfd_get_section_size (got_plt))) ++ continue; ++ ++ /* We cannot check if NAME is a reference to mst_text_gnu_ifunc as in ++ OBJFILE the symbol is undefined and the objfile having NAME defined ++ may not yet have been loaded. */ ++ ++ if (string_buffer_size < name_len + suffix_len) ++ { ++ string_buffer_size = 2 * (name_len + suffix_len); ++ string_buffer = xrealloc (string_buffer, string_buffer_size); ++ } ++ memcpy (string_buffer, name, name_len); ++ memcpy (&string_buffer[name_len], suffix, suffix_len); ++ ++ msym = record_minimal_symbol (string_buffer, name_len + suffix_len, 1, ++ address, mst_slot_got_plt, got_plt, ++ objfile); ++ if (msym) ++ MSYMBOL_SIZE (msym) = ptr_size; + } + -+ /* FIXME: kettenis/20030504: This still needs to be integrated with -+ dwarf2read.c in a better way. */ -+ dwarf2_build_frame_info (objfile); ++ do_cleanups (back_to); +} + - /* This cleans up the objfile's deprecated_sym_stab_info pointer, and - the chain of stab_section_info's, that might be dangling from - it. */ -@@ -1052,6 +1063,7 @@ static struct sym_fns elf_sym_fns = - elf_new_init, /* sym_new_init: init anything gbl to entire symtab */ - elf_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - elf_symfile_read, /* sym_read: read a symbol file into symtab */ -+ read_psyms, /* sym_read_psymbols */ - elf_symfile_finish, /* sym_finish: finished with file, cleanup */ - default_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */ - elf_symfile_segments, /* sym_segments: Get segment information from ++/* Function does not check for possibly created duplicities in the cache. ++ Check it by resolve_gnu_ifunc_by_cache first. */ ++ ++static struct minimal_symbol * ++gnu_ifunc_record_cache_unchecked (const char *function_name, ++ CORE_ADDR function_address) ++{ ++ struct minimal_symbol *msym, *msym_new; ++ asection *sect; ++ struct objfile *objfile; ++ char *function_name_gnu_ifunc_tgt; ++ ++ msym = lookup_minimal_symbol_by_pc (function_address); ++ if (msym == NULL) ++ return NULL; ++ if (SYMBOL_VALUE_ADDRESS (msym) != function_address) ++ return NULL; ++ /* minimal symbols have always SYMBOL_OBJ_SECTION non-NULL. */ ++ sect = SYMBOL_OBJ_SECTION (msym)->the_bfd_section; ++ objfile = SYMBOL_OBJ_SECTION (msym)->objfile; ++ ++ /* If .plt jumps back to .plt the symbol is still deferred for later ++ resolution and it has no use for GDB. Besides ".text" this symbol can ++ reside also in ".opd" for ppc64 function descriptor. */ ++ if (strcmp (bfd_get_section_name (objfile->obfd, sect), ".plt") == 0) ++ return NULL; ++ ++ function_name_gnu_ifunc_tgt = alloca (strlen (function_name) ++ + strlen ("@gnu-ifunc-tgt") + 1); ++ sprintf (function_name_gnu_ifunc_tgt, "%s@gnu-ifunc-tgt", function_name); ++ ++ /* Create new alias "@gnu-ifunc-tgt" for MSYM. */ ++ msym_new = record_minimal_symbol (function_name_gnu_ifunc_tgt, ++ strlen (function_name_gnu_ifunc_tgt), 1, ++ SYMBOL_VALUE_ADDRESS (msym), ++ MSYMBOL_TYPE (msym), sect, objfile); ++ /* Should not happen. */ ++ if (msym_new == NULL) ++ return 0; ++ ++ /* objfile->msymbols array is already allocated on obstack and it cannot be ++ easily extended. Therefore -completion on symbol names will never ++ show the @gnu-ifunc-tgt symbol. Link it at least to the hash table so ++ that resolve_gnu_ifunc_by_cache can find it. */ ++ add_minsym_to_hash_table (msym_new, objfile->msymbol_hash); ++ ++ MSYMBOL_SIZE (msym_new) = MSYMBOL_SIZE (msym); ++ return msym_new; ++} ++ ++/* Check first the cache if it - unlikely - has not been populated since ++ bp_gnu_ifunc_resolver has been created. gnu_ifunc_record_cache_unchecked ++ could create a duplicate symbol otherwise. */ ++ ++void ++gnu_ifunc_record_cache (struct gdbarch *gdbarch, const char *function_name, ++ CORE_ADDR function_address) ++{ ++ struct minimal_symbol *msym; ++ ++ msym = resolve_gnu_ifunc_by_cache (function_name); ++ if (msym == NULL) ++ gnu_ifunc_record_cache_unchecked (function_name, function_address); ++ else if (SYMBOL_VALUE_ADDRESS (msym) != function_address) ++ { ++ /* This case indicates buggy inferior program. GDB would need to update ++ its MSYM cache symbol for function_address. Anyway FUNCTION_NAME is ++ never normally found in the case as in such case no ++ bp_gnu_ifunc_resolver would be created in the first place. */ ++ ++ warning (_("gnu-indirect-function \"%s\" has changed its resolved " ++ "function_address from %s to %s; GDB is using the former one"), ++ function_name, paddress (gdbarch, SYMBOL_VALUE_ADDRESS (msym)), ++ paddress (gdbarch, function_address)); ++ } ++} ++ ++static struct minimal_symbol * ++resolve_gnu_ifunc_by_got (const char *function_name) ++{ ++ char *function_name_got_plt; ++ struct objfile *objfile; ++ ++ function_name_got_plt = alloca (strlen (function_name) + strlen ("@got.plt") ++ + 1); ++ sprintf (function_name_got_plt, "%s@got.plt", function_name); ++ ++ ALL_PSPACE_OBJFILES (current_program_space, objfile) ++ { ++ bfd *obfd = objfile->obfd; ++ struct gdbarch *gdbarch = objfile->gdbarch; ++ struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr; ++ size_t ptr_size = TYPE_LENGTH (ptr_type); ++ CORE_ADDR pointer_address, function_address; ++ asection *plt; ++ gdb_byte *buf = alloca (ptr_size); ++ struct minimal_symbol *msym; ++ ++ msym = lookup_minimal_symbol (function_name_got_plt, NULL, objfile); ++ if (msym == NULL) ++ continue; ++ if (MSYMBOL_TYPE (msym) != mst_slot_got_plt) ++ continue; ++ pointer_address = SYMBOL_VALUE_ADDRESS (msym); ++ ++ plt = bfd_get_section_by_name (obfd, ".plt"); ++ if (plt == NULL) ++ continue; ++ ++ if (MSYMBOL_SIZE (msym) != ptr_size) ++ continue; ++ if (target_read_memory (pointer_address, buf, ptr_size) != 0) ++ continue; ++ function_address = extract_typed_address (buf, ptr_type); ++ ++ msym = gnu_ifunc_record_cache_unchecked (function_name, function_address); ++ if (msym == NULL) ++ continue; ++ return msym; ++ } ++ ++ return NULL; ++} ++ ++struct minimal_symbol * ++resolve_gnu_ifunc_by_cache (const char *function_name) ++{ ++ char *function_name_gnu_ifunc_tgt; ++ ++ function_name_gnu_ifunc_tgt = alloca (strlen (function_name) ++ + strlen ("@gnu-ifunc-tgt") + 1); ++ sprintf (function_name_gnu_ifunc_tgt, "%s@gnu-ifunc-tgt", function_name); ++ ++ return lookup_minimal_symbol (function_name_gnu_ifunc_tgt, NULL, NULL); ++} ++ ++int ++resolve_gnu_ifunc (const char *function_name, CORE_ADDR *function_addressp) ++{ ++ struct minimal_symbol *msym; ++ ++ msym = resolve_gnu_ifunc_by_cache (function_name); ++ if (msym != NULL) ++ { ++ *function_addressp = SYMBOL_VALUE_ADDRESS (msym); ++ return 1; ++ } ++ ++ msym = resolve_gnu_ifunc_by_got (function_name); ++ if (msym != NULL) ++ { ++ *function_addressp = SYMBOL_VALUE_ADDRESS (msym); ++ return 1; ++ } ++ ++ return 0; ++} ++ + struct build_id + { + size_t size; +@@ -797,6 +1046,8 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) + bfd_errmsg (bfd_get_error ())); + + elf_symtab_read (objfile, ST_DYNAMIC, dynsymcount, dyn_symbol_table, 0); ++ ++ elf_rel_plt_read (objfile, dyn_symbol_table); + } + + /* Add synthetic symbols - for instance, names for any PLT entries. */ diff --git a/gdb/eval.c b/gdb/eval.c -index e2ceea7..1bcb4a7 100644 +index ff17c34..7b9e871 100644 --- a/gdb/eval.c +++ b/gdb/eval.c -@@ -43,6 +43,7 @@ - #include "gdb_obstack.h" +@@ -44,6 +44,7 @@ #include "objfiles.h" #include "python/python.h" + #include "wrapper.h" +#include "dwarf2loc.h" #include "gdb_assert.h" -@@ -696,6 +697,7 @@ evaluate_subexp_standard (struct type *expect_type, - long mem_offset; - struct type **arg_types; +@@ -788,6 +789,7 @@ evaluate_subexp_standard (struct type *expect_type, int save_pos1; -+ struct cleanup *old_chain; struct symbol *function = NULL; char *function_name = NULL; ++ struct cleanup *old_chain; -@@ -731,6 +733,7 @@ evaluate_subexp_standard (struct type *expect_type, - return value_from_decfloat (exp->elts[pc + 1].type, - exp->elts[pc + 2].decfloatconst); - -+ case OP_ADL_FUNC: - case OP_VAR_VALUE: - (*pos) += 3; - if (noside == EVAL_SKIP) -@@ -1334,7 +1337,6 @@ evaluate_subexp_standard (struct type *expect_type, - argvec = (struct value **) alloca (sizeof (struct value *) * (nargs + 3)); - if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR) - { -- nargs++; - /* First, evaluate the structure into arg2 */ - pc2 = (*pos)++; - -@@ -1358,21 +1360,40 @@ evaluate_subexp_standard (struct type *expect_type, - - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - -- if (TYPE_CODE (check_typedef (value_type (arg1))) -- != TYPE_CODE_METHODPTR) -- error (_("Non-pointer-to-member value used in pointer-to-member " -- "construct")); -- -- if (noside == EVAL_AVOID_SIDE_EFFECTS) -+ type = check_typedef (value_type (arg1)); -+ switch (TYPE_CODE (type)) - { -- struct type *method_type = check_typedef (value_type (arg1)); -- arg1 = value_zero (method_type, not_lval); -+ case TYPE_CODE_METHODPTR: -+ if (noside == EVAL_AVOID_SIDE_EFFECTS) -+ arg1 = value_zero (TYPE_TARGET_TYPE (type), not_lval); -+ else -+ arg1 = cplus_method_ptr_to_value (&arg2, arg1); -+ -+ /* Now, say which argument to start evaluating from */ -+ nargs++; -+ tem = 2; -+ argvec[1] = arg2; -+ break; -+ -+ case TYPE_CODE_MEMBERPTR: -+ /* Now, convert these values to an address. */ -+ arg2 = value_cast (lookup_pointer_type (TYPE_DOMAIN_TYPE (type)), -+ arg2); -+ -+ mem_offset = value_as_long (arg1); -+ -+ arg1 = value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), -+ value_as_long (arg2) + mem_offset); -+ arg1 = value_ind (arg1); -+ tem = 1; -+ break; -+ -+ default: -+ error (_("Non-pointer-to-member value used in pointer-to-member " -+ "construct")); + pc = (*pos)++; + op = exp->elts[pc].opcode; +@@ -1772,6 +1774,8 @@ evaluate_subexp_standard (struct type *expect_type, + return value_zero (builtin_type (exp->gdbarch)->builtin_int, + not_lval); } -- else -- arg1 = cplus_method_ptr_to_value (&arg2, arg1); - -- /* Now, say which argument to start evaluating from */ -- tem = 2; -+ argvec[0] = arg1; - } - else if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR) - { -@@ -1412,6 +1433,17 @@ evaluate_subexp_standard (struct type *expect_type, - /* Now, say which argument to start evaluating from */ - tem = 2; - } -+ else if (op == OP_ADL_FUNC) -+ { -+ /* Save the function position and move pos so that the arguments -+ can be evaluated. */ -+ int func_name_len; -+ save_pos1 = *pos; -+ tem = 1; -+ -+ func_name_len = longest_to_int (exp->elts[save_pos1 + 3].longconst); -+ (*pos) += 6 + BYTES_TO_EXP_ELEM (func_name_len + 1); -+ } - else if (op == OP_SCOPE - && overload_resolution - && (exp->language_defn->la_language == language_cplus)) -@@ -1433,9 +1465,9 @@ evaluate_subexp_standard (struct type *expect_type, - if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE) - { - function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type), -- name, NULL, -+ name, - get_selected_block (0), -- VAR_DOMAIN, 1); -+ VAR_DOMAIN); - if (function == NULL) - error (_("No symbol \"%s\" in namespace \"%s\"."), - name, TYPE_TAG_NAME (type)); -@@ -1484,6 +1516,33 @@ evaluate_subexp_standard (struct type *expect_type, - /* signal end of arglist */ - argvec[tem] = 0; - -+ if (op == OP_ADL_FUNC) -+ { -+ struct symbol *symp; -+ char *func_name; -+ int name_len; -+ int string_pc = save_pos1 + 3; -+ -+ /* Extract the function name. */ -+ name_len = longest_to_int (exp->elts[string_pc].longconst); -+ func_name = (char *) alloca (name_len + 1); -+ strcpy (func_name, &exp->elts[string_pc + 1].string); -+ -+ /* Prepare list of argument types for overload resolution */ -+ arg_types = (struct type **) alloca (nargs * (sizeof (struct type *))); -+ for (ix = 1; ix <= nargs; ix++) -+ arg_types[ix - 1] = value_type (argvec[ix]); -+ -+ find_overload_match (arg_types, nargs, func_name, -+ 0 /* not method */ , 0 /* strict match */ , -+ NULL, NULL /* pass NULL symbol since symbol is unknown */ , -+ NULL, &symp, NULL); -+ -+ /* Now fix the expression being evaluated */ -+ exp->elts[save_pos1 + 2].symbol = symp; -+ argvec[0] = evaluate_subexp_with_coercion (exp, &save_pos1, noside); -+ } -+ - if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR - || (op == OP_SCOPE && function_name != NULL)) - { -@@ -1552,8 +1611,7 @@ evaluate_subexp_standard (struct type *expect_type, - } - else if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR) - { -- argvec[1] = arg2; -- argvec[0] = arg1; -+ /* Pointer to member. argvec is already set up. */ - } - else if (op == OP_VAR_VALUE || (op == OP_SCOPE && function != NULL)) - { -@@ -1653,6 +1711,8 @@ evaluate_subexp_standard (struct type *expect_type, ++ else if (TYPE_GNU_IFUNC (ftype)) ++ return allocate_value (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (ftype))); + else if (TYPE_TARGET_TYPE (ftype)) + return allocate_value (TYPE_TARGET_TYPE (ftype)); + else +@@ -1798,6 +1802,8 @@ evaluate_subexp_standard (struct type *expect_type, /* First determine the type code we are dealing with. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); @@ -6219,7 +2752,7 @@ index e2ceea7..1bcb4a7 100644 type = check_typedef (value_type (arg1)); code = TYPE_CODE (type); -@@ -1673,6 +1733,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1818,6 +1824,7 @@ evaluate_subexp_standard (struct type *expect_type, code = TYPE_CODE (type); } } @@ -6227,34 +2760,7 @@ index e2ceea7..1bcb4a7 100644 switch (code) { -@@ -1834,6 +1895,26 @@ evaluate_subexp_standard (struct type *expect_type, - xfree (expect_type); - return arg1; - -+ case TYPE_INSTANCE_LOOKUP: -+ { -+ int i; -+ struct symbol *sym; -+ struct type **arg_types; -+ (*pos) += 3; -+ arg_types = (struct type **) alloca (TYPE_NFIELDS (expect_type) -+ * sizeof (struct type *)); -+ for (i = 0; i < TYPE_NFIELDS (expect_type); ++i) -+ arg_types[i] = TYPE_FIELD_TYPE (expect_type, i); -+ (void) find_overload_match (arg_types, TYPE_NFIELDS (expect_type), -+ NULL /* no need for name */, -+ 0 /* not method */, -+ 0 /* strict match */, -+ NULL, exp->elts[pc + 1].symbol, NULL, -+ &sym, NULL); -+ i = 0; -+ } -+ break; -+ - case BINOP_CONCAT: - arg1 = evaluate_subexp_with_coercion (exp, pos, noside); - arg2 = evaluate_subexp_with_coercion (exp, pos, noside); -@@ -2105,13 +2186,19 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2254,13 +2261,19 @@ evaluate_subexp_standard (struct type *expect_type, { int subscript_array[MAX_FORTRAN_DIMS]; int array_size_array[MAX_FORTRAN_DIMS]; @@ -6274,7 +2780,7 @@ index e2ceea7..1bcb4a7 100644 tmp_type = check_typedef (value_type (arg1)); ndimensions = calc_f77_array_dims (type); -@@ -2141,6 +2228,9 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2290,6 +2303,9 @@ evaluate_subexp_standard (struct type *expect_type, upper = f77_get_upperbound (tmp_type); lower = f77_get_lowerbound (tmp_type); @@ -6284,7 +2790,7 @@ index e2ceea7..1bcb4a7 100644 array_size_array[nargs - i - 1] = upper - lower + 1; /* Zero-normalize subscripts so that offsetting will work. */ -@@ -2159,13 +2249,25 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2308,13 +2324,25 @@ evaluate_subexp_standard (struct type *expect_type, tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type)); } @@ -6314,7 +2820,7 @@ index e2ceea7..1bcb4a7 100644 /* Let us now play a dirty trick: we will take arg1 which is a value node pointing to the topmost level -@@ -2175,7 +2277,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2324,7 +2352,7 @@ evaluate_subexp_standard (struct type *expect_type, returns the correct type value */ deprecated_set_value_type (arg1, tmp_type); @@ -6323,7 +2829,7 @@ index e2ceea7..1bcb4a7 100644 } case BINOP_LOGICAL_AND: -@@ -2409,14 +2511,22 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2558,14 +2586,22 @@ evaluate_subexp_standard (struct type *expect_type, if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); arg1 = evaluate_subexp (expect_type, exp, pos, noside); @@ -6348,7 +2854,7 @@ index e2ceea7..1bcb4a7 100644 else if (noside == EVAL_AVOID_SIDE_EFFECTS) { type = check_typedef (value_type (arg1)); -@@ -2425,12 +2535,18 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2574,12 +2610,18 @@ evaluate_subexp_standard (struct type *expect_type, /* In C you can dereference an array to get the 1st elt. */ || TYPE_CODE (type) == TYPE_CODE_ARRAY ) @@ -6372,7 +2878,7 @@ index e2ceea7..1bcb4a7 100644 else error (_("Attempt to take contents of a non-pointer value.")); } -@@ -2440,9 +2556,14 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2589,9 +2631,14 @@ evaluate_subexp_standard (struct type *expect_type, do. "long long" variables are rare enough that BUILTIN_TYPE_LONGEST would seem to be a mistake. */ if (TYPE_CODE (type) == TYPE_CODE_INT) @@ -6390,7 +2896,7 @@ index e2ceea7..1bcb4a7 100644 case UNOP_ADDR: /* C++: check for and handle pointer to members. */ -@@ -2777,7 +2898,7 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -2933,7 +2980,7 @@ evaluate_subexp_with_coercion (struct expression *exp, { enum exp_opcode op; int pc; @@ -6399,7 +2905,7 @@ index e2ceea7..1bcb4a7 100644 struct symbol *var; struct type *type; -@@ -2788,12 +2909,17 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -2944,12 +2991,17 @@ evaluate_subexp_with_coercion (struct expression *exp, { case OP_VAR_VALUE: var = exp->elts[pc + 2].symbol; @@ -6409,7 +2915,7 @@ index e2ceea7..1bcb4a7 100644 + val = address_of_variable (var, exp->elts[pc + 1].block); type = check_typedef (SYMBOL_TYPE (var)); if (TYPE_CODE (type) == TYPE_CODE_ARRAY - && CAST_IS_CONVERSION) + && CAST_IS_CONVERSION (exp->language_defn)) { (*pos) += 4; - val = address_of_variable (var, exp->elts[pc + 1].block); @@ -6418,7 +2924,7 @@ index e2ceea7..1bcb4a7 100644 return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val); } -@@ -2845,9 +2971,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) +@@ -3001,9 +3053,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) case OP_VAR_VALUE: (*pos) += 4; @@ -6435,127 +2941,12 @@ index e2ceea7..1bcb4a7 100644 default: val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); -diff --git a/gdb/expprint.c b/gdb/expprint.c -index e378831..45deffe 100644 ---- a/gdb/expprint.c -+++ b/gdb/expprint.c -@@ -816,6 +816,8 @@ op_name_standard (enum exp_opcode opcode) - return "OP_TYPE"; - case OP_LABELED: - return "OP_LABELED"; -+ case OP_ADL_FUNC: -+ return "OP_ADL_FUNC"; - } - } - -diff --git a/gdb/expression.h b/gdb/expression.h -index ca216cf..6be0b1e 100644 ---- a/gdb/expression.h -+++ b/gdb/expression.h -@@ -95,6 +95,11 @@ enum exp_opcode - TYPE_INSTANCE num_types type0 ... typeN num_types TYPE_INSTANCE */ - TYPE_INSTANCE, - -+ /* TYPE_INSTANCE_LOOKUP is used when the user specifies a specific -+ type instantiation of a function (not a method). In this case, -+ we must toss the results of the parser and manually do the lookup. */ -+ TYPE_INSTANCE_LOOKUP, -+ - /* end of C++. */ - - /* For Modula-2 integer division DIV */ -@@ -347,6 +352,10 @@ enum exp_opcode - Then comes another OP_DECFLOAT. */ - OP_DECFLOAT, - -+ /* OP_ADL_FUNC specifies that the argument is to be looked up in an -+ Argument Dependent manner (Koenig lookup) */ -+ OP_ADL_FUNC, -+ - /* First extension operator. Individual language modules define - extra operators in *.inc include files below always starting with - numbering at OP_EXTENDED0: -@@ -451,4 +460,5 @@ extern char *op_string (enum exp_opcode); - extern void dump_raw_expression (struct expression *, struct ui_file *, char *); - extern void dump_prefix_expression (struct expression *, struct ui_file *); - -+ - #endif /* !defined (EXPRESSION_H) */ -diff --git a/gdb/f-lang.c b/gdb/f-lang.c -index b914b49..78aef2f 100644 ---- a/gdb/f-lang.c -+++ b/gdb/f-lang.c -@@ -31,6 +31,8 @@ - #include "f-lang.h" - #include "valprint.h" - #include "value.h" -+#include "block.h" -+#include "gdb_assert.h" - - - /* Following is dubious stuff that had been in the xcoff reader. */ -@@ -306,6 +308,46 @@ f_language_arch_info (struct gdbarch *gdbarch, - lai->bool_type_default = builtin->builtin_logical_s2; - } - -+/* Find if NAME is not contained in any of the Fortran modules imported by the -+ Fortran USE statement. -+ -+ As Fortran has no nested blocks such lookup can be processed from -+ lookup_symbol_nonlocal - when no local blocks could satisfy the lookup. */ -+ -+static struct symbol * -+f_lookup_symbol_nonlocal (const char *name, -+ const struct block *block, -+ const domain_enum domain) -+{ -+ if (block) -+ { -+ struct fortran_using *use; -+ -+ for (use = BLOCK_FORTRAN_USE (block); use; use = use->next) -+ { -+ struct symbol *sym; -+ struct type *type; -+ struct symbol *retval; -+ -+ sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN); -+ -+ /* Module name lookup should not fail with correct debug info. */ -+ if (sym == NULL) -+ continue; -+ -+ type = SYMBOL_TYPE (sym); -+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE); -+ gdb_assert (TYPE_MODULE_BLOCK (type) != NULL); -+ -+ retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain); -+ if (retval) -+ return retval; -+ } -+ } -+ -+ return basic_lookup_symbol_nonlocal (name, block, domain); -+} -+ - /* This is declared in c-lang.h but it is silly to import that file for what - is already just a hack. */ - extern int c_value_print (struct value *, struct ui_file *, -@@ -333,7 +375,7 @@ const struct language_defn f_language_defn = - c_value_print, /* FIXME */ - NULL, /* Language specific skip_trampoline */ - NULL, /* name_of_this */ -- basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ -+ f_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ - basic_lookup_transparent_type,/* lookup_transparent_type */ - NULL, /* Language specific symbol demangler */ - NULL, /* Language specific class_name_from_physname */ diff --git a/gdb/f-lang.h b/gdb/f-lang.h -index b98c556..c68379a 100644 +index f5bb82d..29cf5ba 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -28,6 +28,10 @@ extern void f_error (char *); /* Defined in f-exp.y */ - extern void f_print_type (struct type *, char *, struct ui_file *, int, + extern void f_print_type (struct type *, const char *, struct ui_file *, int, int); +extern const char *f_object_address_data_valid_print_to_stream @@ -6564,20 +2955,9 @@ index b98c556..c68379a 100644 + extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, struct ui_file *, int, - const struct value_print_options *); -@@ -125,3 +129,10 @@ struct builtin_f_type - /* Return the Fortran type table for the specified architecture. */ - extern const struct builtin_f_type *builtin_f_type (struct gdbarch *gdbarch); - -+/* List of module names being imported by a block though BLOCK_FORTRAN_USE. */ -+ -+struct fortran_using -+ { -+ struct fortran_using *next; -+ char module_name[1]; -+ }; + const struct value *, diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c -index 0332932..6e8668c 100644 +index d35a255..dec81d5 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -32,7 +32,7 @@ @@ -6624,7 +3004,7 @@ index 0332932..6e8668c 100644 /* LEVEL is the depth to indent lines by. */ void -@@ -58,6 +86,9 @@ f_print_type (struct type *type, char *varstring, struct ui_file *stream, +@@ -58,6 +86,9 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, enum type_code code; int demangled_args; @@ -6645,7 +3025,7 @@ index 0332932..6e8668c 100644 { case TYPE_CODE_ARRAY: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 9bd3640..f52b858 100644 +index 85f698d..2f72b97 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; @@ -6692,7 +3072,7 @@ index 9bd3640..f52b858 100644 } return TYPE_ARRAY_UPPER_BOUND_VALUE (type); -@@ -135,24 +140,29 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) +@@ -134,24 +139,29 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) upper = f77_get_upperbound (tmp_type); lower = f77_get_lowerbound (tmp_type); @@ -6741,7 +3121,7 @@ index 9bd3640..f52b858 100644 - address + i * F77_DIM_OFFSET (nss), + valaddr + i * F77_DIM_BYTE_STRIDE (nss), + address + i * F77_DIM_BYTE_STRIDE (nss), - stream, recurse, options, elts); + stream, recurse, val, options, elts); fprintf_filtered (stream, ") "); } - if (*elts >= options->print_max && i < F77_DIM_SIZE (nss)) @@ -6760,7 +3140,7 @@ index 9bd3640..f52b858 100644 0, - address + i * F77_DIM_OFFSET (ndimensions), + address + i * F77_DIM_BYTE_STRIDE (ndimensions), - stream, recurse, options, current_language); + stream, recurse, val, options, current_language); - if (i != (F77_DIM_SIZE (nss) - 1)) + if (i != (F77_DIM_COUNT (nss) - 1)) @@ -6772,7 +3152,7 @@ index 9bd3640..f52b858 100644 fprintf_filtered (stream, "..."); } } -@@ -253,6 +263,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +@@ -256,6 +266,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR addr; int index; @@ -6782,181 +3162,8 @@ index 9bd3640..f52b858 100644 CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { -diff --git a/gdb/findcmd.c b/gdb/findcmd.c -index c752316..df2687c 100644 ---- a/gdb/findcmd.c -+++ b/gdb/findcmd.c -@@ -27,7 +27,7 @@ - - /* Copied from bfd_put_bits. */ - --static void -+void - put_bits (bfd_uint64_t data, char *buf, int bits, bfd_boolean big_p) - { - int i; -@@ -45,6 +45,41 @@ put_bits (bfd_uint64_t data, char *buf, int bits, bfd_boolean big_p) - } - } - -+/* Allocates a buffer in *PATTERN_BUF, with a hard-coded initial size which -+ will be returned in *PATTERN_BUF_SIZE. *PATTERN_BUF_END points to the same -+ place as *PATTERN_BUF, indicating that the buffer is initially empty. */ -+ -+void -+allocate_pattern_buffer (char **pattern_buf, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size) -+{ -+#define INITIAL_PATTERN_BUF_SIZE 100 -+ *pattern_buf_size = INITIAL_PATTERN_BUF_SIZE; -+ *pattern_buf = xmalloc (*pattern_buf_size); -+ *pattern_buf_end = *pattern_buf; -+} -+ -+/* Grows *PATTERN_BUF by a factor of two if it's not large enough to hold -+ VAL_BYTES more bytes or a 64-bit value, whichever is larger. -+ *PATTERN_BUF_END is updated as necessary. */ -+ -+void -+increase_pattern_buffer (char **pattern_buf, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size, int val_bytes) -+{ -+ /* Keep it simple and assume size == 'g' when watching for when we -+ need to grow the pattern buf. */ -+ if ((*pattern_buf_end - *pattern_buf + max (val_bytes, sizeof (int64_t))) -+ > *pattern_buf_size) -+ { -+ size_t current_offset = *pattern_buf_end - *pattern_buf; -+ -+ *pattern_buf_size *= 2; -+ *pattern_buf = xrealloc (*pattern_buf, *pattern_buf_size); -+ *pattern_buf_end = *pattern_buf + current_offset; -+ } -+} -+ - /* Subroutine of find_command to simplify it. - Parse the arguments of the "find" command. */ - -@@ -61,8 +96,7 @@ parse_find_args (char *args, ULONGEST *max_countp, - char *pattern_buf; - /* Current size of search pattern buffer. - We realloc space as needed. */ --#define INITIAL_PATTERN_BUF_SIZE 100 -- ULONGEST pattern_buf_size = INITIAL_PATTERN_BUF_SIZE; -+ ULONGEST pattern_buf_size; - /* Pointer to one past the last in-use part of pattern_buf. */ - char *pattern_buf_end; - ULONGEST pattern_len; -@@ -75,8 +109,7 @@ parse_find_args (char *args, ULONGEST *max_countp, - if (args == NULL) - error (_("Missing search parameters.")); - -- pattern_buf = xmalloc (pattern_buf_size); -- pattern_buf_end = pattern_buf; -+ allocate_pattern_buffer (&pattern_buf, &pattern_buf_end, &pattern_buf_size); - old_cleanups = make_cleanup (free_current_contents, &pattern_buf); - - /* Get search granularity and/or max count if specified. -@@ -173,16 +206,8 @@ parse_find_args (char *args, ULONGEST *max_countp, - v = parse_to_comma_and_eval (&s); - val_bytes = TYPE_LENGTH (value_type (v)); - -- /* Keep it simple and assume size == 'g' when watching for when we -- need to grow the pattern buf. */ -- if ((pattern_buf_end - pattern_buf + max (val_bytes, sizeof (int64_t))) -- > pattern_buf_size) -- { -- size_t current_offset = pattern_buf_end - pattern_buf; -- pattern_buf_size *= 2; -- pattern_buf = xrealloc (pattern_buf, pattern_buf_size); -- pattern_buf_end = pattern_buf + current_offset; -- } -+ increase_pattern_buffer (&pattern_buf, &pattern_buf_end, -+ &pattern_buf_size, val_bytes); - - if (size != '\0') - { -@@ -237,6 +262,45 @@ parse_find_args (char *args, ULONGEST *max_countp, - discard_cleanups (old_cleanups); - } - -+/* Drives target_search_memory to sweep through the specified search space, -+ possibly in several iterations (with one call to this function for each -+ iteration). *START_ADDR is the address where the search starts, and is -+ updated to the next starting address to continue the search. -+ *SEARCH_SPACE_LEN is the amount of bytes which will be searched, and is -+ updated for the next iteration. PATTERN_BUF holds the pattern to be searched -+ for, PATTERN_LEN is the size of the pattern in bytes. If a match is found, -+ it's address is put in *FOUND_ADDR. -+ -+ Returns 1 if found, 0 if not found, and -1 if there was an error requiring -+ halting of the search (e.g. memory read error). */ -+ -+int -+search_memory (CORE_ADDR *start_addr, ULONGEST *search_space_len, -+ const char *pattern_buf, ULONGEST pattern_len, -+ CORE_ADDR *found_addr) -+{ -+ /* Offset from start of this iteration to the next iteration. */ -+ ULONGEST next_iter_incr; -+ int found; -+ -+ found = target_search_memory (*start_addr, *search_space_len, -+ pattern_buf, pattern_len, found_addr); -+ if (found <= 0) -+ return found; -+ -+ /* Begin next iteration at one byte past this match. */ -+ next_iter_incr = (*found_addr - *start_addr) + 1; -+ -+ /* For robustness, we don't let search_space_len go -ve here. */ -+ if (*search_space_len >= next_iter_incr) -+ *search_space_len -= next_iter_incr; -+ else -+ *search_space_len = 0; -+ *start_addr += next_iter_incr; -+ -+ return found; -+} -+ - static void - find_command (char *args, int from_tty) - { -@@ -267,12 +331,11 @@ find_command (char *args, int from_tty) - while (search_space_len >= pattern_len - && found_count < max_count) - { -- /* Offset from start of this iteration to the next iteration. */ -- ULONGEST next_iter_incr; - CORE_ADDR found_addr; -- int found = target_search_memory (start_addr, search_space_len, -- pattern_buf, pattern_len, &found_addr); -+ int found; - -+ found = search_memory (&start_addr, &search_space_len, pattern_buf, -+ pattern_len, &found_addr); - if (found <= 0) - break; - -@@ -280,16 +343,6 @@ find_command (char *args, int from_tty) - printf_filtered ("\n"); - ++found_count; - last_found_addr = found_addr; -- -- /* Begin next iteration at one byte past this match. */ -- next_iter_incr = (found_addr - start_addr) + 1; -- -- /* For robustness, we don't let search_space_len go -ve here. */ -- if (search_space_len >= next_iter_incr) -- search_space_len -= next_iter_incr; -- else -- search_space_len = 0; -- start_addr += next_iter_incr; - } - - /* Record and print the results. */ diff --git a/gdb/findvar.c b/gdb/findvar.c -index e117a8e..6bd3724 100644 +index e0ca12c..de6311a 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -35,6 +35,7 @@ @@ -6967,7 +3174,7 @@ index e117a8e..6bd3724 100644 /* Basic byte-swapping routines. All 'extract' functions return a host-format integer from a target-format integer at ADDR which is -@@ -397,27 +398,16 @@ symbol_read_needs_frame (struct symbol *sym) +@@ -401,27 +402,16 @@ symbol_read_needs_frame (struct symbol *sym) /* Given a struct symbol for a variable, and a stack frame id, read the value of the variable and return a (pointer to a) struct value containing the value. @@ -6999,7 +3206,7 @@ index e117a8e..6bd3724 100644 if (symbol_read_needs_frame (var)) gdb_assert (frame); -@@ -425,32 +415,40 @@ read_var_value (struct symbol *var, struct frame_info *frame) +@@ -429,33 +419,43 @@ read_var_value (struct symbol *var, struct frame_info *frame) switch (SYMBOL_CLASS (var)) { case LOC_CONST: @@ -7026,13 +3233,6 @@ index e117a8e..6bd3724 100644 - CORE_ADDR addr - = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), - SYMBOL_OBJ_SECTION (var)); -- store_typed_address (value_contents_raw (v), type, addr); -- } -- else -- store_typed_address (value_contents_raw (v), type, -- SYMBOL_VALUE_ADDRESS (var)); -- VALUE_LVAL (v) = not_lval; -- return v; + { + /* Put the constant back in target format. */ + struct value *v = allocate_value (type); @@ -7042,6 +3242,14 @@ index e117a8e..6bd3724 100644 + CORE_ADDR addr + = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), + SYMBOL_OBJ_SECTION (var)); + +- store_typed_address (value_contents_raw (v), type, addr); +- } +- else +- store_typed_address (value_contents_raw (v), type, +- SYMBOL_VALUE_ADDRESS (var)); +- VALUE_LVAL (v) = not_lval; +- return v; + store_typed_address (value_contents_raw (v), type, addr); + } + else @@ -7051,16 +3259,20 @@ index e117a8e..6bd3724 100644 + } case LOC_CONST_BYTES: - { -- memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), len); +- memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), len); +- VALUE_LVAL (v) = not_lval; +- return v; ++ { + struct value *v = allocate_value (type); - VALUE_LVAL (v) = not_lval; ++ VALUE_LVAL (v) = not_lval; + memcpy (value_contents_raw (v), SYMBOL_VALUE_BYTES (var), + TYPE_LENGTH (type)); - return v; - } ++ return v; ++ } -@@ -492,12 +490,23 @@ read_var_value (struct symbol *var, struct frame_info *frame) + case LOC_STATIC: + if (overlay_debugging) +@@ -496,12 +496,23 @@ read_var_value (struct symbol *var, struct frame_info *frame) break; case LOC_BLOCK: @@ -7090,7 +3302,7 @@ index e117a8e..6bd3724 100644 case LOC_REGISTER: case LOC_REGPARM_ADDR: -@@ -516,7 +525,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) +@@ -520,7 +531,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) error (_("Value of register variable not available.")); addr = value_as_address (regval); @@ -7098,7 +3310,7 @@ index e117a8e..6bd3724 100644 } else { -@@ -559,18 +567,33 @@ read_var_value (struct symbol *var, struct frame_info *frame) +@@ -563,18 +573,33 @@ read_var_value (struct symbol *var, struct frame_info *frame) break; case LOC_OPTIMIZED_OUT: @@ -7138,7 +3350,7 @@ index e117a8e..6bd3724 100644 } /* Install default attributes for register values. */ -@@ -607,10 +630,11 @@ struct value * +@@ -611,10 +636,11 @@ struct value * value_from_register (struct type *type, int regnum, struct frame_info *frame) { struct gdbarch *gdbarch = get_frame_arch (frame); @@ -7152,7 +3364,7 @@ index e117a8e..6bd3724 100644 { /* The ISA/ABI need to something weird when obtaining the specified value from this register. It might need to -@@ -624,7 +648,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) +@@ -628,7 +654,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) VALUE_FRAME_ID (v) = get_frame_id (frame); VALUE_REGNUM (v) = regnum; gdbarch_register_to_value (gdbarch, @@ -7161,101 +3373,21 @@ index e117a8e..6bd3724 100644 } else { -diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c -index c051a4d..5b07063 100644 ---- a/gdb/frv-linux-tdep.c -+++ b/gdb/frv-linux-tdep.c -@@ -32,6 +32,7 @@ - #include "frame-unwind.h" - #include "regset.h" - #include "gdb_string.h" -+#include "linux-tdep.h" - - /* Define the size (in bytes) of an FR-V instruction. */ - static const int frv_instr_size = 4; -@@ -486,7 +487,21 @@ frv_linux_regset_from_core_section (struct gdbarch *gdbarch, - return NULL; - } - -- -+static CORE_ADDR -+frv_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, -+ CORE_ADDR addr, -+ struct target_ops *targ) -+{ -+ CORE_ADDR pc = frv_convert_from_func_ptr_addr (gdbarch, addr, targ); -+ CORE_ADDR resolved; -+ -+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc); -+ if (resolved != pc) -+ pc = frv_convert_from_func_ptr_addr (gdbarch, resolved, targ); -+ -+ return pc; -+} -+ - static void - frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - { -@@ -494,6 +509,10 @@ frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind); - set_gdbarch_regset_from_core_section (gdbarch, - frv_linux_regset_from_core_section); -+ -+ if (frv_abi (gdbarch) == FRV_ABI_FDPIC) -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ frv_linux_convert_from_func_ptr_addr); - } - - static enum gdb_osabi -diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c -index a38ec8e..b8856a9 100644 ---- a/gdb/frv-tdep.c -+++ b/gdb/frv-tdep.c -@@ -1169,7 +1169,7 @@ find_func_descr (struct gdbarch *gdbarch, CORE_ADDR entry_point) - return descr; - } - --static CORE_ADDR -+CORE_ADDR - frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, - struct target_ops *targ) - { -diff --git a/gdb/frv-tdep.h b/gdb/frv-tdep.h -index 25cc9c4..95d5fe5 100644 ---- a/gdb/frv-tdep.h -+++ b/gdb/frv-tdep.h -@@ -118,3 +118,6 @@ CORE_ADDR frv_fetch_objfile_link_map (struct objfile *objfile); - struct target_so_ops; - extern struct target_so_ops frv_so_ops; - -+CORE_ADDR frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, -+ CORE_ADDR addr, -+ struct target_ops *targ); -diff --git a/gdb/gdbinit.in b/gdb/gdbinit.in -index ffb7f53..a2e7e94 100644 ---- a/gdb/gdbinit.in -+++ b/gdb/gdbinit.in -@@ -1,5 +1,15 @@ - echo Setting up the environment for debugging gdb.\n - -+# Set up the Python library and "require" command. -+python -+from os.path import abspath -+gdb.datadir = abspath ('@srcdir@/python/lib') -+gdb.pythonlibdir = gdb.datadir -+gdb.__path__ = [gdb.datadir + '/gdb'] -+sys.path.insert(0, gdb.datadir) -+end -+source @srcdir@/python/lib/gdb/__init__.py -+ - set complaints 1 - - b internal_error diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h -index cd24eaf..119af7d 100644 +index cd24eaf..9638368 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h -@@ -185,6 +185,10 @@ struct thread_info +@@ -66,6 +66,9 @@ struct thread_info + /* Step-resume or longjmp-resume breakpoint. */ + struct breakpoint *step_resume_breakpoint; + ++ /* Exception-resume breakpoint. */ ++ struct breakpoint *exception_resume_breakpoint; ++ + /* Range to single step within. + + If this is nonzero, respond to a single-step signal by continuing +@@ -185,6 +188,10 @@ struct thread_info /* True if this thread has been explicitly requested to stop. */ int stop_requested; @@ -7266,18 +3398,18 @@ index cd24eaf..119af7d 100644 /* Private data used by the target vector implementation. */ struct private_thread_info *private; -@@ -257,6 +261,9 @@ extern struct thread_info *any_live_thread_of_process (int pid); - /* Change the ptid of thread OLD_PTID to NEW_PTID. */ - void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid); +@@ -221,6 +228,9 @@ extern void delete_thread_silent (ptid_t); + /* Delete a step_resume_breakpoint from the thread database. */ + extern void delete_step_resume_breakpoint (struct thread_info *); -+/* Prune dead threads from the list of threads. */ -+extern void prune_threads (void); ++/* Delete an exception_resume_breakpoint from the thread database. */ ++extern void delete_exception_resume_breakpoint (struct thread_info *); + - /* Iterator function to call a user-provided callback function - once for each known thread. */ - typedef int (*thread_callback_func) (struct thread_info *, void *); + /* Translate the integer thread id (GDB's homegrown id, not the system's) + into a "pid" (which may be overloaded with extra thread information). */ + extern ptid_t thread_id_to_pid (int); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 46846c4..95bcca4 100644 +index 443f6f7..d852a14 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -39,6 +39,9 @@ @@ -7290,23 +3422,10 @@ index 46846c4..95bcca4 100644 /* Floatformat pairs. */ -@@ -119,6 +122,24 @@ static void print_arg_types (struct field *, int, int); +@@ -123,6 +126,11 @@ static void print_arg_types (struct field *, int, int); static void dump_fn_fieldlists (struct type *, int); static void print_cplus_stuff (struct type *, int); -+/* A reference count structure for the type reference count map. Each -+ type in a hierarchy of types is mapped to the same reference -+ count. */ -+struct type_refc_entry -+{ -+ /* One type in the hierarchy. Each type in the hierarchy gets its -+ own slot. */ -+ struct type *type; -+ -+ /* A pointer to the shared reference count. */ -+ int *refc; -+}; -+ +/* The hash table holding all discardable `struct type *' references. */ +static htab_t type_discardable_table; + @@ -7315,7 +3434,7 @@ index 46846c4..95bcca4 100644 /* Allocate a new OBJFILE-associated type structure and fill it with some defaults. Space for the type structure is allocated -@@ -149,6 +170,39 @@ alloc_type (struct objfile *objfile) +@@ -153,6 +161,39 @@ alloc_type (struct objfile *objfile) return type; } @@ -7355,7 +3474,7 @@ index 46846c4..95bcca4 100644 /* Allocate a new GDBARCH-associated type structure and fill it with some defaults. Space for the type structure is allocated on the heap. */ -@@ -274,7 +328,7 @@ make_pointer_type (struct type *type, struct type **typeptr) +@@ -278,7 +319,7 @@ make_pointer_type (struct type *type, struct type **typeptr) if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -7364,7 +3483,7 @@ index 46846c4..95bcca4 100644 if (typeptr) *typeptr = ntype; } -@@ -351,7 +405,7 @@ make_reference_type (struct type *type, struct type **typeptr) +@@ -355,7 +396,7 @@ make_reference_type (struct type *type, struct type **typeptr) if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -7373,7 +3492,7 @@ index 46846c4..95bcca4 100644 if (typeptr) *typeptr = ntype; } -@@ -723,6 +777,7 @@ create_range_type (struct type *result_type, struct type *index_type, +@@ -726,6 +767,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_LOW_BOUND (result_type) = low_bound; TYPE_HIGH_BOUND (result_type) = high_bound; @@ -7381,7 +3500,7 @@ index 46846c4..95bcca4 100644 if (low_bound >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -822,26 +877,45 @@ create_array_type (struct type *result_type, +@@ -825,26 +867,45 @@ create_array_type (struct type *result_type, TYPE_CODE (result_type) = TYPE_CODE_ARRAY; TYPE_TARGET_TYPE (result_type) = element_type; @@ -7440,7 +3559,7 @@ index 46846c4..95bcca4 100644 return result_type; } -@@ -1337,6 +1411,105 @@ stub_noname_complaint (void) +@@ -1353,6 +1414,105 @@ stub_noname_complaint (void) complaint (&symfile_complaints, _("stub type has NULL name")); } @@ -7546,7 +3665,7 @@ index 46846c4..95bcca4 100644 /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989. If this is a stubbed struct (i.e. declared as struct foo *), see if -@@ -1468,51 +1641,36 @@ check_typedef (struct type *type) +@@ -1486,52 +1646,36 @@ check_typedef (struct type *type) } } @@ -7592,33 +3711,34 @@ index 46846c4..95bcca4 100644 - - if (high_bound < low_bound) - len = 0; -- else { -- /* For now, we conservatively take the array length to be 0 -- if its length exceeds UINT_MAX. The code below assumes -- that for x < 0, (ULONGEST) x == -x + ULONGEST_MAX + 1, -- which is technically not guaranteed by C, but is usually true -- (because it would be true if x were unsigned with its -- high-order bit on). It uses the fact that -- high_bound-low_bound is always representable in -- ULONGEST and that if high_bound-low_bound+1 overflows, -- it overflows to 0. We must change these tests if we -- decide to increase the representation of TYPE_LENGTH -- from unsigned int to ULONGEST. */ -- ULONGEST ulow = low_bound, uhigh = high_bound; -- ULONGEST tlen = TYPE_LENGTH (target_type); +- else +- { +- /* For now, we conservatively take the array length to be 0 +- if its length exceeds UINT_MAX. The code below assumes +- that for x < 0, (ULONGEST) x == -x + ULONGEST_MAX + 1, +- which is technically not guaranteed by C, but is usually true +- (because it would be true if x were unsigned with its +- high-order bit on). It uses the fact that +- high_bound-low_bound is always representable in +- ULONGEST and that if high_bound-low_bound+1 overflows, +- it overflows to 0. We must change these tests if we +- decide to increase the representation of TYPE_LENGTH +- from unsigned int to ULONGEST. */ +- ULONGEST ulow = low_bound, uhigh = high_bound; +- ULONGEST tlen = TYPE_LENGTH (target_type); - -- len = tlen * (uhigh - ulow + 1); -- if (tlen == 0 || (len / tlen - 1 + ulow) != uhigh -- || len > UINT_MAX) -- len = 0; -- } +- len = tlen * (uhigh - ulow + 1); +- if (tlen == 0 || (len / tlen - 1 + ulow) != uhigh +- || len > UINT_MAX) +- len = 0; +- } - TYPE_LENGTH (type) = len; + number of elements and the target type's length. */ + TYPE_LENGTH (type) = type_length_get (type, target_type, 0); TYPE_TARGET_STUB (type) = 0; } else if (TYPE_CODE (type) == TYPE_CODE_RANGE) -@@ -1520,9 +1678,12 @@ check_typedef (struct type *type) +@@ -1539,9 +1683,12 @@ check_typedef (struct type *type) TYPE_LENGTH (type) = TYPE_LENGTH (target_type); TYPE_TARGET_STUB (type) = 0; } @@ -7631,7 +3751,7 @@ index 46846c4..95bcca4 100644 return type; } -@@ -1791,6 +1952,8 @@ init_type (enum type_code code, int length, int flags, +@@ -1811,6 +1958,8 @@ init_type (enum type_code code, int length, int flags, TYPE_NOTTEXT (type) = 1; if (flags & TYPE_FLAG_FIXED_INSTANCE) TYPE_FIXED_INSTANCE (type) = 1; @@ -7640,15 +3760,7 @@ index 46846c4..95bcca4 100644 if (name) TYPE_NAME (type) = obsavestring (name, strlen (name), -@@ -1815,6 +1978,7 @@ init_type (enum type_code code, int length, int flags, - TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CALLING_CONVENTION; - break; - } -+ - return type; - } - -@@ -2992,33 +3156,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) +@@ -3006,33 +3155,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) } /* Allocate the hash table used by copy_type_recursive to walk @@ -7706,7 +3818,7 @@ index 46846c4..95bcca4 100644 return type; /* This type shouldn't be pointing to any types in other objfiles; -@@ -3033,8 +3206,10 @@ copy_type_recursive (struct objfile *objfile, +@@ -3047,8 +3205,10 @@ copy_type_recursive (struct objfile *objfile, new_type = alloc_type_arch (get_type_arch (type)); /* We must add the new type to the hash table immediately, in case @@ -7719,7 +3831,7 @@ index 46846c4..95bcca4 100644 stored->old = type; stored->new = new_type; *slot = stored; -@@ -3045,6 +3220,19 @@ copy_type_recursive (struct objfile *objfile, +@@ -3059,6 +3219,19 @@ copy_type_recursive (struct objfile *objfile, TYPE_OBJFILE_OWNED (new_type) = 0; TYPE_OWNER (new_type).gdbarch = get_type_arch (type); @@ -7739,7 +3851,7 @@ index 46846c4..95bcca4 100644 if (TYPE_NAME (type)) TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); if (TYPE_TAG_NAME (type)) -@@ -3053,12 +3241,48 @@ copy_type_recursive (struct objfile *objfile, +@@ -3067,12 +3240,48 @@ copy_type_recursive (struct objfile *objfile, TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); @@ -7788,7 +3900,7 @@ index 46846c4..95bcca4 100644 TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); for (i = 0; i < nfields; i++) { -@@ -3067,8 +3291,8 @@ copy_type_recursive (struct objfile *objfile, +@@ -3081,8 +3290,8 @@ copy_type_recursive (struct objfile *objfile, TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); if (TYPE_FIELD_TYPE (type, i)) TYPE_FIELD_TYPE (new_type, i) @@ -7799,7 +3911,7 @@ index 46846c4..95bcca4 100644 if (TYPE_FIELD_NAME (type, i)) TYPE_FIELD_NAME (new_type, i) = xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -3095,24 +3319,166 @@ copy_type_recursive (struct objfile *objfile, +@@ -3109,24 +3318,166 @@ copy_type_recursive (struct objfile *objfile, } } @@ -7973,7 +4085,7 @@ index 46846c4..95bcca4 100644 /* Maybe copy the type_specific bits. NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -3130,6 +3496,17 @@ copy_type_recursive (struct objfile *objfile, +@@ -3143,6 +3494,17 @@ copy_type_recursive (struct objfile *objfile, return new_type; } @@ -7991,25 +4103,13 @@ index 46846c4..95bcca4 100644 /* Make a copy of the given TYPE, except that the pointer & reference types are not preserved. -@@ -3152,6 +3529,211 @@ copy_type (const struct type *type) +@@ -3165,6 +3527,199 @@ copy_type (const struct type *type) return new_type; } +/* Callback type for main_type_crawl. */ +typedef int (*main_type_crawl_iter) (struct type *type, void *data); + -+#if 0 -+ -+/* Allocate a hash table which is used when freeing a struct type. */ -+ -+static htab_t -+create_deleted_types_hash (void) -+{ -+ return htab_create (1, htab_hash_pointer, htab_eq_pointer, NULL); -+} -+ -+#endif -+ +/* Iterate all main_type structures reachable through any `struct type *' from + TYPE. ITER will be called only for one type of each main_type, use + TYPE_CHAIN traversal to find all the type instances. ITER is being called @@ -8203,7 +4303,7 @@ index 46846c4..95bcca4 100644 /* Helper functions to initialize architecture-specific types. */ -@@ -3475,6 +4057,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch) +@@ -3511,6 +4066,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch) = lookup_pointer_type (builtin_type->builtin_void); builtin_type->builtin_func_ptr = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void)); @@ -8212,19 +4312,26 @@ index 46846c4..95bcca4 100644 /* This type represents a GDB internal function. */ builtin_type->internal_fn -@@ -3588,6 +4172,11 @@ objfile_type (struct objfile *objfile) +@@ -3624,6 +4181,18 @@ objfile_type (struct objfile *objfile) "", objfile); TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol) = objfile_type->builtin_int; + objfile_type->nodebug_text_gnu_ifunc_symbol + = init_type (TYPE_CODE_FUNC, 1, TYPE_FLAG_GNU_IFUNC, -+ "", objfile); ++ "", ++ objfile); + TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol) ++ = objfile_type->nodebug_text_symbol; ++ objfile_type->nodebug_got_plt_symbol ++ = init_type (TYPE_CODE_PTR, gdbarch_addr_bit (gdbarch) / 8, 0, ++ "", ++ objfile); ++ TYPE_TARGET_TYPE (objfile_type->nodebug_got_plt_symbol) + = objfile_type->nodebug_text_symbol; objfile_type->nodebug_data_symbol = init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0, -@@ -3642,6 +4231,11 @@ void +@@ -3678,6 +4247,11 @@ void _initialize_gdbtypes (void) { gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); @@ -8237,19 +4344,10 @@ index 46846c4..95bcca4 100644 add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 643fa03..efe5512 100644 +index 085270e..cb2b88e 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -138,6 +138,8 @@ enum type_code - - TYPE_CODE_DECFLOAT, /* Decimal floating point. */ - -+ TYPE_CODE_MODULE, /* Fortran module. */ -+ - /* Internal function type. */ - TYPE_CODE_INTERNAL_FUNCTION - }; -@@ -171,6 +173,7 @@ enum type_flag_value +@@ -171,6 +171,7 @@ enum type_flag_value TYPE_FLAG_FIXED_INSTANCE = (1 << 15), TYPE_FLAG_STUB_SUPPORTED = (1 << 16), TYPE_FLAG_NOTTEXT = (1 << 17), @@ -8257,7 +4355,7 @@ index 643fa03..efe5512 100644 /* Used for error-checking. */ TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED -@@ -214,6 +217,11 @@ enum type_instance_flag_value +@@ -214,6 +215,11 @@ enum type_instance_flag_value #define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) @@ -8269,11 +4367,11 @@ index 643fa03..efe5512 100644 /* Static type. If this is set, the corresponding type had * a static modifier. * Note: This may be unnecessary, since static data members -@@ -271,6 +279,12 @@ enum type_instance_flag_value +@@ -271,6 +277,12 @@ enum type_instance_flag_value #define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext) -+/* Currently used only for TYPE_CODE_FUNC where specifies the real function ++/* Used only for TYPE_CODE_FUNC where it specifies the real function + address is returned by this function call. TYPE_TARGET_TYPE determines the + final returned function type to be presented to user. */ + @@ -8282,7 +4380,7 @@ index 643fa03..efe5512 100644 /* Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by the objfile retrieved as TYPE_OBJFILE. Otherweise, the type is owned by an architecture; TYPE_OBJFILE is NULL in this case. */ -@@ -285,6 +299,48 @@ enum type_instance_flag_value +@@ -285,6 +297,48 @@ enum type_instance_flag_value #define TYPE_DECLARED_CLASS(t) (TYPE_MAIN_TYPE (t)->flag_declared_class) @@ -8331,17 +4429,7 @@ index 643fa03..efe5512 100644 /* Constant type. If this is set, the corresponding type has a * const modifier. */ -@@ -342,8 +398,7 @@ enum field_loc_kind - { - FIELD_LOC_KIND_BITPOS, /* bitpos */ - FIELD_LOC_KIND_PHYSADDR, /* physaddr */ -- FIELD_LOC_KIND_PHYSNAME, /* physname */ -- FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */ -+ FIELD_LOC_KIND_PHYSNAME /* physname */ - }; - - /* A discriminant to determine which field in the main_type.type_specific -@@ -390,11 +445,19 @@ struct main_type +@@ -389,11 +443,19 @@ struct main_type unsigned int flag_vector : 1; unsigned int flag_stub_supported : 1; unsigned int flag_nottext : 1; @@ -8361,7 +4449,7 @@ index 643fa03..efe5512 100644 /* A discriminant telling us which field of the type_specific union is being used for this type, if any. */ -@@ -465,6 +528,20 @@ struct main_type +@@ -467,6 +529,20 @@ struct main_type struct type *target_type; @@ -8382,20 +4470,7 @@ index 643fa03..efe5512 100644 /* For structure and union types, a description of each field. For set and pascal array types, there is one "field", whose type is the domain type of the set or array. -@@ -501,12 +578,6 @@ struct main_type - - CORE_ADDR physaddr; - char *physname; -- -- /* The field location can be computed by evaluating the following DWARF -- block. This can be used in Fortran variable-length arrays, for -- instance. */ -- -- struct dwarf2_locexpr_baton *dwarf_block; - } - loc; - -@@ -544,13 +615,34 @@ struct main_type +@@ -540,13 +616,34 @@ struct main_type struct range_bounds { @@ -8435,31 +4510,7 @@ index 643fa03..efe5512 100644 /* Flags indicating whether the values of low and high are valid. When true, the respective range value is -@@ -602,6 +694,9 @@ struct main_type - supporting multiple ABIs. Right now this is only fetched from - the Dwarf-2 DW_AT_calling_convention attribute. */ - unsigned calling_convention; -+ -+ /* For TYPE_CODE_MODULE, the list of symbols contained in the module. */ -+ struct block *module_block; - } type_specific; - }; - -@@ -838,13 +933,6 @@ struct cplus_struct_type - int is_dynamic : 2; - }; - --/* Struct used in computing virtual base list */ --struct vbase -- { -- struct type *vbasetype; /* pointer to virtual base */ -- struct vbase *next; /* next in chain */ -- }; -- - /* Struct used for ranking a function for overload resolution */ - struct badness_vector - { -@@ -899,9 +987,9 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -889,9 +986,9 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_CHAIN(thistype) (thistype)->chain @@ -8472,10 +4523,10 @@ index 643fa03..efe5512 100644 calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ #define TYPE_LENGTH(thistype) (thistype)->length /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real -@@ -910,11 +998,16 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -899,11 +996,16 @@ extern void allocate_gnat_aux_type (struct type *); + #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields - #define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args +#define TYPE_DATA_LOCATION_DWARF_BLOCK(thistype) TYPE_MAIN_TYPE (thistype)->data_location.dwarf_block +#define TYPE_DATA_LOCATION_ADDR(thistype) TYPE_MAIN_TYPE (thistype)->data_location.addr +#define TYPE_ALLOCATED(thistype) TYPE_MAIN_TYPE (thistype)->allocated @@ -8491,7 +4542,7 @@ index 643fa03..efe5512 100644 #define TYPE_LOW_BOUND_UNDEFINED(range_type) \ TYPE_RANGE_DATA(range_type)->low_undefined #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \ -@@ -931,7 +1024,14 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -920,7 +1022,14 @@ extern void allocate_gnat_aux_type (struct type *); (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ @@ -8507,41 +4558,7 @@ index 643fa03..efe5512 100644 /* C++ */ -@@ -959,6 +1059,7 @@ extern void allocate_gnat_aux_type (struct type *); - #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff - #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type - #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.calling_convention -+#define TYPE_MODULE_BLOCK(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.module_block - #define TYPE_BASECLASS(thistype,index) TYPE_FIELD_TYPE(thistype, index) - #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses - #define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index) -@@ -977,7 +1078,6 @@ extern void allocate_gnat_aux_type (struct type *); - #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos) - #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) - #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) --#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) - #define SET_FIELD_BITPOS(thisfld, bitpos) \ - (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \ - FIELD_BITPOS (thisfld) = (bitpos)) -@@ -987,9 +1087,6 @@ extern void allocate_gnat_aux_type (struct type *); - #define SET_FIELD_PHYSADDR(thisfld, addr) \ - (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ - FIELD_STATIC_PHYSADDR (thisfld) = (addr)) --#define SET_FIELD_DWARF_BLOCK(thisfld, addr) \ -- (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_DWARF_BLOCK, \ -- FIELD_DWARF_BLOCK (thisfld) = (addr)) - #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial) - #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) - -@@ -1000,7 +1097,6 @@ extern void allocate_gnat_aux_type (struct type *); - #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)) - #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) --#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) - #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) - #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n)) - #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0) -@@ -1139,6 +1235,10 @@ struct builtin_type +@@ -1141,6 +1250,10 @@ struct builtin_type (*) () can server as a generic function pointer. */ struct type *builtin_func_ptr; @@ -8552,15 +4569,16 @@ index 643fa03..efe5512 100644 /* Special-purpose types. */ -@@ -1179,6 +1279,7 @@ struct objfile_type +@@ -1181,6 +1294,8 @@ struct objfile_type /* Types used for symbols with no debug information. */ struct type *nodebug_text_symbol; + struct type *nodebug_text_gnu_ifunc_symbol; ++ struct type *nodebug_got_plt_symbol; struct type *nodebug_data_symbol; struct type *nodebug_unknown_symbol; struct type *nodebug_tls_symbol; -@@ -1333,6 +1434,18 @@ extern struct type *create_array_type (struct type *, struct type *, +@@ -1328,6 +1443,18 @@ extern struct type *create_array_type (struct type *, struct type *, struct type *); extern struct type *lookup_array_range_type (struct type *, int, int); @@ -8579,7 +4597,7 @@ index 643fa03..efe5512 100644 extern struct type *create_string_type (struct type *, struct type *, struct type *); extern struct type *lookup_string_range_type (struct type *, int, int); -@@ -1375,6 +1488,8 @@ extern int is_public_ancestor (struct type *, struct type *); +@@ -1370,6 +1497,8 @@ extern int is_public_ancestor (struct type *, struct type *); extern int is_unique_ancestor (struct type *, struct value *); @@ -8588,7 +4606,7 @@ index 643fa03..efe5512 100644 /* Overload resolution */ #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1437,10 +1552,11 @@ extern void maintenance_print_type (char *, int); +@@ -1432,10 +1561,11 @@ extern void maintenance_print_type (char *, int); extern htab_t create_copied_types_hash (struct objfile *objfile); @@ -8602,134 +4620,11 @@ index 643fa03..efe5512 100644 +extern void free_all_types (void); + #endif /* GDBTYPES_H */ -diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c -index 5321401..b1882a2 100644 ---- a/gdb/gnu-v3-abi.c -+++ b/gdb/gnu-v3-abi.c -@@ -26,6 +26,7 @@ - #include "demangle.h" - #include "objfiles.h" - #include "valprint.h" -+#include "c-lang.h" - - #include "gdb_assert.h" - #include "gdb_string.h" -@@ -456,10 +457,8 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset, - LONGEST adjustment) - { - int i; -- const char *physname; - - /* Search this class first. */ -- physname = NULL; - if (adjustment == 0) - { - int len; -@@ -587,15 +586,24 @@ gnuv3_print_method_ptr (const gdb_byte *contents, - { - char *demangled_name = cplus_demangle (physname, - DMGL_ANSI | DMGL_PARAMS); -- if (demangled_name != NULL) -+ fprintf_filtered (stream, "&virtual "); -+ if (demangled_name == NULL) -+ fputs_filtered (physname, stream); -+ else - { -- fprintf_filtered (stream, "&virtual "); - fputs_filtered (demangled_name, stream); - xfree (demangled_name); -- return; - } -+ return; - } - } -+ else if (ptr_value != 0) -+ { -+ /* Found a non-virtual function: print out the type. */ -+ fputs_filtered ("(", stream); -+ c_print_type (type, "", stream, -1, 0); -+ fputs_filtered (") ", stream); -+ } - - /* We didn't find it; print the raw data. */ - if (vbit) -diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c -index ebfc2f5..e40105b 100644 ---- a/gdb/hppa-linux-tdep.c -+++ b/gdb/hppa-linux-tdep.c -@@ -32,6 +32,7 @@ - #include "regset.h" - #include "regcache.h" - #include "hppa-tdep.h" -+#include "linux-tdep.h" - - #include "elf/common.h" - -@@ -513,7 +514,21 @@ hppa_linux_regset_from_core_section (struct gdbarch *gdbarch, - - return NULL; - } -- -+ -+static CORE_ADDR -+hppa32_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, -+ CORE_ADDR addr, -+ struct target_ops *targ) -+{ -+ CORE_ADDR pc = hppa32_convert_from_func_ptr_addr (gdbarch, addr, targ); -+ CORE_ADDR resolved; -+ -+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc); -+ if (resolved != pc) -+ pc = hppa32_convert_from_func_ptr_addr (gdbarch, resolved, targ); -+ -+ return pc; -+} - - /* Forward declarations. */ - extern initialize_file_ftype _initialize_hppa_linux_tdep; -@@ -555,6 +570,10 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, - svr4_fetch_objfile_link_map); -+ -+ if (tdep->bytes_per_address == 4) -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ hppa32_linux_convert_from_func_ptr_addr); - } - - void -diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c -index a0665ef..347fbe4 100644 ---- a/gdb/hppa-tdep.c -+++ b/gdb/hppa-tdep.c -@@ -1247,7 +1247,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct type *func_type, - } - - --static CORE_ADDR -+CORE_ADDR - hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, - struct target_ops *targ) - { -diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h -index e2d8752..c626637 100644 ---- a/gdb/hppa-tdep.h -+++ b/gdb/hppa-tdep.h -@@ -246,4 +246,8 @@ extern int hppa_in_solib_call_trampoline (struct gdbarch *gdbarch, - CORE_ADDR pc, char *name); - extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc); - -+extern CORE_ADDR hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch, -+ CORE_ADDR addr, -+ struct target_ops *targ); -+ - #endif /* hppa-tdep.h */ diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c -index ff837f2..1710487 100644 +index 4fce1ac..144a899 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c -@@ -696,6 +696,21 @@ i386_linux_dr_unset_status (unsigned long mask) +@@ -747,6 +747,21 @@ i386_linux_dr_unset_status (unsigned long mask) } } @@ -8751,7 +4646,7 @@ index ff837f2..1710487 100644 static void i386_linux_new_thread (ptid_t ptid) { -@@ -868,6 +883,7 @@ _initialize_i386_linux_nat (void) +@@ -976,6 +991,7 @@ _initialize_i386_linux_nat (void) i386_dr_low.reset_addr = i386_linux_dr_reset_addr; i386_dr_low.get_status = i386_linux_dr_get_status; i386_dr_low.unset_status = i386_linux_dr_unset_status; @@ -8759,25 +4654,11 @@ index ff837f2..1710487 100644 i386_set_debug_register_length (4); /* Override the default ptrace resume method. */ -diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c -index 5acd229..aec1736 100644 ---- a/gdb/i386-linux-tdep.c -+++ b/gdb/i386-linux-tdep.c -@@ -798,6 +798,9 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - i386_linux_get_syscall_number); - - set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c -index fa0cce6..42dfd1c 100644 +index eaa3644..0921c7e 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c -@@ -527,6 +527,17 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type) +@@ -533,6 +533,17 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type, return retval; } @@ -8795,7 +4676,7 @@ index fa0cce6..42dfd1c 100644 /* Return non-zero if we can watch a memory region that starts at address ADDR and whose length is LEN bytes. */ -@@ -679,6 +690,7 @@ i386_use_watchpoints (struct target_ops *t) +@@ -685,6 +696,7 @@ i386_use_watchpoints (struct target_ops *t) t->to_stopped_data_address = i386_stopped_data_address; t->to_insert_watchpoint = i386_insert_watchpoint; t->to_remove_watchpoint = i386_remove_watchpoint; @@ -8826,58 +4707,125 @@ index 7317e7d..ea914a5 100644 int debug_register_length; }; -diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c -index b12f282..8ddb24a 100644 ---- a/gdb/ia64-linux-tdep.c -+++ b/gdb/ia64-linux-tdep.c -@@ -26,6 +26,7 @@ - #include "osabi.h" - #include "solib-svr4.h" - #include "symtab.h" -+#include "linux-tdep.h" - - /* The sigtramp code is in a non-readable (executable-only) region - of memory called the ``gate page''. The addresses in question -@@ -139,6 +140,9 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, - svr4_fetch_objfile_link_map); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ diff --git a/gdb/infcall.c b/gdb/infcall.c -index e642894..6ac95cc 100644 +index 0c9a3af..957ec1d 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c -@@ -252,9 +252,17 @@ find_function_addr (struct value *function, struct type **retval_type) +@@ -225,6 +225,56 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, + return value_cast (type, arg); + } + ++/* Call gnu-ifunc (STT_GNU_IFUNC - a function returning addresss of a real ++ function to call). PC is the gnu-ifunc function entry. Function returns ++ function entry of the gnu-ifunc-resolved function to call. If RETVAL_TYPEP ++ is not NULL fill in *RETVAL_TYPEP with return type of the gnu-ifunc-resolved ++ function to call. Keep *RETVAL_TYPEP intact if the return type could not be ++ found. */ ++ ++static CORE_ADDR ++gnu_ifunc_resolve (struct gdbarch *gdbarch, CORE_ADDR pc) ++{ ++ char *name_at_pc; ++ CORE_ADDR start_at_pc, address; ++ struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func; ++ struct value *function, *address_val; ++ ++ if (find_pc_partial_function (pc, &name_at_pc, &start_at_pc, NULL) ++ && start_at_pc == pc) ++ { ++ if (resolve_gnu_ifunc (name_at_pc, &address)) ++ return address; ++ } ++ else ++ name_at_pc = NULL; ++ ++ function = allocate_value (func_func_type); ++ set_value_address (function, pc); ++ ++ /* gnu-ifuncs have no arguments. FUNCTION is the function entry address ++ while ADDRESS is a possible function descriptor.. */ ++ address_val = call_function_by_hand (function, 0, NULL); ++ address = value_as_address (address_val); ++ ++ if (name_at_pc) ++ gnu_ifunc_record_cache (gdbarch, name_at_pc, address); ++ ++ return gdbarch_convert_from_func_ptr_addr (gdbarch, address, ¤t_target); ++} ++ ++static struct type * ++find_function_return_type (CORE_ADDR pc) ++{ ++ struct symbol *sym = find_pc_function (pc); ++ ++ if (sym != NULL && BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) == pc ++ && SYMBOL_TYPE (sym) != NULL) ++ return TYPE_TARGET_TYPE (SYMBOL_TYPE (sym)); ++ ++ return NULL; ++} ++ + /* Determine a function's address and its return type from its value. + Calls error() if the function is not valid for calling. */ + +@@ -233,7 +283,6 @@ find_function_addr (struct value *function, struct type **retval_type) + { + struct type *ftype = check_typedef (value_type (function)); + struct gdbarch *gdbarch = get_type_arch (ftype); +- enum type_code code = TYPE_CODE (ftype); + struct type *value_type = NULL; + CORE_ADDR funaddr; + +@@ -241,24 +290,34 @@ find_function_addr (struct value *function, struct type **retval_type) + part of it. */ + + /* Determine address to call. */ +- if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD) +- { +- funaddr = value_address (function); +- value_type = TYPE_TARGET_TYPE (ftype); +- } +- else if (code == TYPE_CODE_PTR) ++ if (TYPE_CODE (ftype) == TYPE_CODE_FUNC ++ || TYPE_CODE (ftype) == TYPE_CODE_METHOD) ++ funaddr = value_address (function); ++ else if (TYPE_CODE (ftype) == TYPE_CODE_PTR) + { + funaddr = value_as_address (function); + ftype = check_typedef (TYPE_TARGET_TYPE (ftype)); if (TYPE_CODE (ftype) == TYPE_CODE_FUNC || TYPE_CODE (ftype) == TYPE_CODE_METHOD) ++ funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, ++ ¤t_target); ++ } ++ if (TYPE_CODE (ftype) == TYPE_CODE_FUNC ++ || TYPE_CODE (ftype) == TYPE_CODE_METHOD) ++ { ++ value_type = TYPE_TARGET_TYPE (ftype); ++ ++ if (TYPE_GNU_IFUNC (ftype)) { - funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, - ¤t_target); - value_type = TYPE_TARGET_TYPE (ftype); -+ CORE_ADDR funaddr2; ++ funaddr = gnu_ifunc_resolve (gdbarch, funaddr); + -+ funaddr2 = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr, -+ ¤t_target); -+ -+ /* If TYPE_GNU_IFUNC is currently not resolvable keep its type. */ -+ if (funaddr2 != funaddr || !TYPE_GNU_IFUNC (ftype)) -+ { -+ funaddr = funaddr2; -+ value_type = TYPE_TARGET_TYPE (ftype); -+ } ++ /* Skip querying the function symbol if no RETVAL_TYPE has been ++ asked for. */ ++ if (retval_type) ++ value_type = find_function_return_type (funaddr); } } - else if (code == TYPE_CODE_INT) +- else if (code == TYPE_CODE_INT) ++ else if (TYPE_CODE (ftype) == TYPE_CODE_INT) + { + /* Handle the case of functions lacking debugging info. + Their values are characters since their addresses are char */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c -index 29cf427..0ec598e 100644 +index c4cdb06..d213f6a 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c -@@ -808,7 +808,7 @@ nexti_command (char *count_string, int from_tty) +@@ -822,7 +822,7 @@ nexti_command (char *count_string, int from_tty) step_1 (1, 1, count_string); } @@ -8886,7 +4834,7 @@ index 29cf427..0ec598e 100644 delete_longjmp_breakpoint_cleanup (void *arg) { int thread = * (int *) arg; -@@ -848,10 +848,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) +@@ -862,10 +862,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) if (!single_inst || skip_subroutines) /* leave si command alone */ { @@ -8900,7 +4848,7 @@ index 29cf427..0ec598e 100644 make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); } -@@ -1200,6 +1203,15 @@ signal_command (char *signum_exp, int from_tty) +@@ -1219,6 +1222,15 @@ signal_command (char *signum_exp, int from_tty) proceed ((CORE_ADDR) -1, oursig, 0); } @@ -8916,7 +4864,7 @@ index 29cf427..0ec598e 100644 /* Proceed until we reach a different source line with pc greater than our current one or exit the function. We skip calls in both cases. -@@ -1216,6 +1228,8 @@ until_next_command (int from_tty) +@@ -1235,6 +1247,8 @@ until_next_command (int from_tty) struct symbol *func; struct symtab_and_line sal; struct thread_info *tp = inferior_thread (); @@ -8925,7 +4873,7 @@ index 29cf427..0ec598e 100644 clear_proceed_status (); set_step_frame (); -@@ -1251,7 +1265,19 @@ until_next_command (int from_tty) +@@ -1270,7 +1284,19 @@ until_next_command (int from_tty) tp->step_multi = 0; /* Only one call to proceed */ @@ -8945,7 +4893,7 @@ index 29cf427..0ec598e 100644 } static void -@@ -1428,6 +1454,7 @@ finish_command_continuation (void *arg) +@@ -1463,6 +1489,7 @@ finish_command_continuation (void *arg) if (bs != NULL && tp->proceed_to_finish) observer_notify_normal_stop (bs, 1 /* print frame */); delete_breakpoint (a->breakpoint); @@ -8953,7 +4901,7 @@ index 29cf427..0ec598e 100644 } static void -@@ -1511,6 +1538,7 @@ finish_forward (struct symbol *function, struct frame_info *frame) +@@ -1546,6 +1573,7 @@ finish_forward (struct symbol *function, struct frame_info *frame) struct breakpoint *breakpoint; struct cleanup *old_chain; struct finish_command_continuation_args *cargs; @@ -8961,7 +4909,7 @@ index 29cf427..0ec598e 100644 sal = find_pc_line (get_frame_pc (frame), 0); sal.pc = get_frame_pc (frame); -@@ -1521,6 +1549,10 @@ finish_forward (struct symbol *function, struct frame_info *frame) +@@ -1556,6 +1584,10 @@ finish_forward (struct symbol *function, struct frame_info *frame) old_chain = make_cleanup_delete_breakpoint (breakpoint); @@ -8973,10 +4921,10 @@ index 29cf427..0ec598e 100644 cargs = xmalloc (sizeof (*cargs)); diff --git a/gdb/inferior.h b/gdb/inferior.h -index e557d6c..d4ae1df 100644 +index 5abec68..e309277 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h -@@ -275,6 +275,8 @@ extern void interrupt_target_command (char *args, int from_tty); +@@ -291,6 +291,8 @@ extern void interrupt_target_command (char *args, int from_tty); extern void interrupt_target_1 (int all_threads); @@ -8986,7 +4934,7 @@ index e557d6c..d4ae1df 100644 extern void notice_new_inferior (ptid_t, int, int); diff --git a/gdb/infrun.c b/gdb/infrun.c -index 9a5c3a8..ed2f530 100644 +index 57f2ab8..5762a7f 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -45,6 +45,8 @@ @@ -8998,7 +4946,59 @@ index 9a5c3a8..ed2f530 100644 #include "gdb_assert.h" #include "mi/mi-common.h" #include "event-top.h" -@@ -2024,6 +2026,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, +@@ -367,6 +369,7 @@ follow_fork (void) + parent thread structure's run control related fields, not just these. + Initialized to avoid "may be used uninitialized" warnings from gcc. */ + struct breakpoint *step_resume_breakpoint = NULL; ++ struct breakpoint *exception_resume_breakpoint = NULL; + CORE_ADDR step_range_start = 0; + CORE_ADDR step_range_end = 0; + struct frame_id step_frame_id = { 0 }; +@@ -419,6 +422,8 @@ follow_fork (void) + step_range_start = tp->step_range_start; + step_range_end = tp->step_range_end; + step_frame_id = tp->step_frame_id; ++ exception_resume_breakpoint ++ = clone_momentary_breakpoint (tp->exception_resume_breakpoint); + + /* For now, delete the parent's sr breakpoint, otherwise, + parent/child sr breakpoints are considered duplicates, +@@ -429,6 +434,7 @@ follow_fork (void) + tp->step_range_start = 0; + tp->step_range_end = 0; + tp->step_frame_id = null_frame_id; ++ delete_exception_resume_breakpoint (tp); + } + + parent = inferior_ptid; +@@ -470,6 +476,8 @@ follow_fork (void) + tp->step_range_start = step_range_start; + tp->step_range_end = step_range_end; + tp->step_frame_id = step_frame_id; ++ tp->exception_resume_breakpoint ++ = exception_resume_breakpoint; + } + else + { +@@ -523,6 +531,9 @@ follow_inferior_reset_breakpoints (void) + if (tp->step_resume_breakpoint) + breakpoint_re_set_thread (tp->step_resume_breakpoint); + ++ if (tp->exception_resume_breakpoint) ++ breakpoint_re_set_thread (tp->exception_resume_breakpoint); ++ + /* Reinsert all breakpoints in the child. The user may have set + breakpoints after catching the fork, in which case those + were never set in the child, but only in the parent. This makes +@@ -760,6 +771,7 @@ follow_exec (ptid_t pid, char *execd_pathname) + /* If there was one, it's gone now. We cannot truly step-to-next + statement through an exec(). */ + th->step_resume_breakpoint = NULL; ++ th->exception_resume_breakpoint = NULL; + th->step_range_start = 0; + th->step_range_end = 0; + +@@ -2190,6 +2202,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, struct symtab_and_line sr_sal, struct frame_id sr_id); static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR); @@ -9007,7 +5007,23 @@ index 9a5c3a8..ed2f530 100644 static void stop_stepping (struct execution_control_state *ecs); static void prepare_to_wait (struct execution_control_state *ecs); -@@ -2971,6 +2975,10 @@ handle_inferior_event (struct execution_control_state *ecs) +@@ -2313,6 +2327,7 @@ delete_step_resume_breakpoint_callback (struct thread_info *info, void *data) + return 0; + + delete_step_resume_breakpoint (info); ++ delete_exception_resume_breakpoint (info); + return 0; + } + +@@ -2337,6 +2352,7 @@ delete_step_thread_step_resume_breakpoint (void) + struct thread_info *tp = inferior_thread (); + + delete_step_resume_breakpoint (tp); ++ delete_exception_resume_breakpoint (tp); + } + else + /* In all-stop mode, delete all step-resume and longjmp-resume +@@ -3241,6 +3257,10 @@ handle_inferior_event (struct execution_control_state *ecs) stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); @@ -9018,7 +5034,7 @@ index 9a5c3a8..ed2f530 100644 ecs->event_thread->stop_bpstat = bpstat_stop_status (get_regcache_aspace (get_current_regcache ()), stop_pc, ecs->ptid); -@@ -3055,6 +3063,10 @@ handle_inferior_event (struct execution_control_state *ecs) +@@ -3328,6 +3348,10 @@ handle_inferior_event (struct execution_control_state *ecs) stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); @@ -9029,7 +5045,7 @@ index 9a5c3a8..ed2f530 100644 /* Do whatever is necessary to the parent branch of the vfork. */ handle_vfork_child_exec_or_exit (1); -@@ -3793,23 +3805,33 @@ process_event_stop_test: +@@ -4076,23 +4100,33 @@ process_event_stop_test: ecs->event_thread->stepping_over_breakpoint = 1; @@ -9075,31 +5091,37 @@ index 9a5c3a8..ed2f530 100644 keep_going (ecs); return; -@@ -3821,6 +3843,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); - gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); - delete_step_resume_breakpoint (ecs->event_thread); +@@ -4101,8 +4135,52 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); + fprintf_unfiltered (gdb_stdlog, + "infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n"); -+ if (!what.is_longjmp) +- gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); +- delete_step_resume_breakpoint (ecs->event_thread); ++ if (what.is_longjmp) ++ { ++ gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); ++ delete_step_resume_breakpoint (ecs->event_thread); ++ } ++ else + { + /* There are several cases to consider. -+ ++ + 1. The initiating frame no longer exists. In this case + we must stop, because the exception has gone too far. -+ ++ + 2. The initiating frame exists, and is the same as the -+ current frame. -+ -+ 2.1. If we are stepping, defer to the stepping logic. -+ -+ 2.2. Otherwise, we are not stepping, so we are doing a -+ "finish" and we have reached the calling frame. So, -+ stop. -+ ++ current frame. We stop, because the exception has been ++ caught. ++ + 3. The initiating frame exists and is different from + the current frame. This means the exception has been + caught beneath the initiating frame, so keep going. */ + struct frame_info *init_frame + = frame_find_by_id (ecs->event_thread->initiating_frame); ++ ++ gdb_assert (ecs->event_thread->exception_resume_breakpoint != NULL); ++ delete_exception_resume_breakpoint (ecs->event_thread); ++ + if (init_frame) + { + struct frame_id current_id @@ -9107,15 +5129,7 @@ index 9a5c3a8..ed2f530 100644 + if (frame_id_eq (current_id, + ecs->event_thread->initiating_frame)) + { -+ if (ecs->event_thread->step_range_start) -+ { -+ /* Case 2.1. */ -+ break; -+ } -+ else -+ { -+ /* Case 2.2: fall through. */ -+ } ++ /* Case 2. Fall through. */ + } + else + { @@ -9124,12 +5138,15 @@ index 9a5c3a8..ed2f530 100644 + return; + } + } -+ } + ++ /* For Cases 1 and 2, remove the step-resume breakpoint, ++ if it exists. */ ++ delete_step_resume_breakpoint (ecs->event_thread); ++ } + ecs->event_thread->stop_step = 1; print_stop_reason (END_STEPPING_RANGE, 0); - stop_stepping (ecs); -@@ -4840,6 +4909,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) +@@ -5070,6 +5148,97 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume); } @@ -9157,20 +5174,21 @@ index 9a5c3a8..ed2f530 100644 + + vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL); + value = read_var_value (vsym, frame); -+ handler = value_as_address (value); ++ /* If the value was optimized out, revert to the old behavior. */ ++ if (! value_optimized_out (value)) ++ { ++ handler = value_as_address (value); + -+ /* We're going to replace the current step-resume breakpoint -+ with an exception-resume breakpoint. */ -+ delete_step_resume_breakpoint (tp); ++ if (debug_infrun) ++ fprintf_unfiltered (gdb_stdlog, ++ "infrun: exception resume at %lx\n", ++ (unsigned long) handler); + -+ if (debug_infrun) -+ fprintf_unfiltered (gdb_stdlog, -+ "infrun: exception resume at %lx\n", -+ (unsigned long) handler); -+ -+ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), -+ handler, bp_exception_resume); -+ inferior_thread ()->step_resume_breakpoint = bp; ++ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), ++ handler, bp_exception_resume); ++ bp->thread = tp->num; ++ inferior_thread ()->exception_resume_breakpoint = bp; ++ } + } +} + @@ -9226,547 +5244,11 @@ index 9a5c3a8..ed2f530 100644 static void stop_stepping (struct execution_control_state *ecs) { -diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c -index 24b6673..22ed960 100644 ---- a/gdb/jv-lang.c -+++ b/gdb/jv-lang.c -@@ -1121,6 +1121,7 @@ const struct exp_descriptor exp_descriptor_java = - { - print_subexp_standard, - operator_length_standard, -+ operator_check_standard, - op_name_standard, - dump_subexp_body_standard, - evaluate_subexp_java -diff --git a/gdb/language.h b/gdb/language.h -index 4f78a28..e0096f5 100644 ---- a/gdb/language.h -+++ b/gdb/language.h -@@ -258,7 +258,6 @@ struct language_defn - variables. */ - - struct symbol *(*la_lookup_symbol_nonlocal) (const char *, -- const char *, - const struct block *, - const domain_enum); - -diff --git a/gdb/linespec.c b/gdb/linespec.c -index 75a74e2..ec4d569 100644 ---- a/gdb/linespec.c -+++ b/gdb/linespec.c -@@ -40,6 +40,7 @@ - #include "interps.h" - #include "mi/mi-cmds.h" - #include "target.h" -+#include "arch-utils.h" - - /* We share this one with symtab.c, but it is not exported widely. */ - -@@ -50,8 +51,6 @@ extern char *operator_chars (char *, char **); - static void initialize_defaults (struct symtab **default_symtab, - int *default_line); - --static void set_flags (char *arg, int *is_quoted, char **paren_pointer); -- - static struct symtabs_and_lines decode_indirect (char **argptr); - - static char *locate_first_half (char **argptr, int *is_quote_enclosed); -@@ -313,10 +312,7 @@ add_matching_methods (int method_counter, struct type *t, - NULL, VAR_DOMAIN, - language, - (int *) NULL); -- /* See PR10966. Remove check on symbol domain and class when -- we stop using (bad) linkage names on constructors. */ -- if (sym_arr[i1] && (SYMBOL_DOMAIN (sym_arr[i1]) == VAR_DOMAIN -- && SYMBOL_CLASS (sym_arr[i1]) == LOC_BLOCK)) -+ if (sym_arr[i1]) - i1++; - else - { -@@ -631,6 +627,37 @@ See set/show multiple-symbol.")); - discard_cleanups (old_chain); - return return_values; - } -+ -+/* A helper function for decode_line_1 and friends which skips P -+ past any method overload information at the beginning of P, e.g., -+ "(const struct foo *)". -+ -+ This function assumes that P has already been validated to contain -+ overload information, and it will assert if *P != '('. */ -+static char * -+find_method_overload_end (char *p) -+{ -+ int depth = 0; -+ -+ gdb_assert (*p == '('); -+ -+ while (*p) -+ { -+ if (*p == '(') -+ ++depth; -+ else if (*p == ')') -+ { -+ if (--depth == 0) -+ { -+ ++p; -+ break; -+ } -+ } -+ ++p; -+ } -+ -+ return p; -+} - - /* The parser of linespec itself. */ - -@@ -691,18 +718,17 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - struct symtab *file_symtab = NULL; - - char *copy; -- /* This is NULL if there are no parens in *ARGPTR, or a pointer to -- the closing parenthesis if there are parens. */ -- char *paren_pointer; - /* This says whether or not something in *ARGPTR is quoted with - completer_quotes (i.e. with single quotes). */ - int is_quoted; -- /* Is part of *ARGPTR is enclosed in double quotes? */ -+ /* Is *ARGPTR is enclosed in double quotes? */ - int is_quote_enclosed; - int is_objc_method = 0; - char *saved_arg = *argptr; - /* If IS_QUOTED, the end of the quoted bit. */ - char *end_quote = NULL; -+ /* The "first half" of the linespec. */ -+ char *first_half; - - if (not_found_ptr) - *not_found_ptr = 0; -@@ -716,12 +742,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - if (**argptr == '*') - return decode_indirect (argptr); - -- /* Set various flags. 'paren_pointer' is important for overload -- checking, where we allow things like: -- (gdb) break c::f(int) -- */ -- -- set_flags (*argptr, &is_quoted, &paren_pointer); -+ is_quoted = (*argptr -+ && strchr (get_gdb_completer_quote_characters (), -+ **argptr) != NULL); - if (is_quoted) - end_quote = skip_quoted (*argptr); - -@@ -734,15 +757,12 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - will point to "". If this is a C++ name, like "A::B::foo", p will - point to "::B::foo". Argptr is not changed by this call. */ - -- p = locate_first_half (argptr, &is_quote_enclosed); -+ first_half = p = locate_first_half (argptr, &is_quote_enclosed); - - /* Check if this is an Objective-C method (anything that starts with - a '+' or '-' and a '['). */ - if (is_objc_method_format (p)) -- { -- is_objc_method = 1; -- paren_pointer = NULL; /* Just a category name. Ignore it. */ -- } -+ is_objc_method = 1; - - /* Check if the symbol could be an Objective-C selector. */ - -@@ -754,9 +774,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - return values; - } - -- if (is_quoted) -- *argptr = *argptr + 1; -- - /* Does it look like there actually were two parts? */ - - if (p[0] == ':' || p[0] == '.') -@@ -770,67 +787,48 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - - if (p[0] == '.' || p[1] == ':') - { -- if (paren_pointer == NULL) -- return decode_compound (argptr, funfirstline, canonical, -+ struct symtabs_and_lines values; -+ -+ if (is_quote_enclosed) -+ ++saved_arg; -+ values = decode_compound (argptr, funfirstline, canonical, - saved_arg, p, not_found_ptr); -- /* Otherwise, fall through to decode_variable below. */ -+ if (is_quoted && **argptr == '\'') -+ *argptr = *argptr + 1; -+ return values; - } -- else -- { -- /* No, the first part is a filename; set file_symtab to be that file's -- symtab. Also, move argptr past the filename. */ - -- file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed, -- not_found_ptr); -+ /* No, the first part is a filename; set file_symtab to be that file's -+ symtab. Also, move argptr past the filename. */ - -- /* Check for single quotes on the non-filename part. */ -- if (!is_quoted) -- { -- is_quoted = (**argptr -- && strchr (get_gdb_completer_quote_characters (), -- **argptr) != NULL); -- if (is_quoted) -- end_quote = skip_quoted (*argptr); -- } -- } -- } --#if 0 -- /* No one really seems to know why this was added. It certainly -- breaks the command line, though, whenever the passed -- name is of the form ClassName::Method. This bit of code -- singles out the class name, and if funfirstline is set (for -- example, you are setting a breakpoint at this function), -- you get an error. This did not occur with earlier -- verions, so I am ifdef'ing this out. 3/29/99 */ -- else -- { -- /* Check if what we have till now is a symbol name */ -+ file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed, -+ not_found_ptr); - -- /* We may be looking at a template instantiation such -- as "foo". Check here whether we know about it, -- instead of falling through to the code below which -- handles ordinary function names, because that code -- doesn't like seeing '<' and '>' in a name -- the -- skip_quoted call doesn't go past them. So see if we -- can figure it out right now. */ -- -- copy = (char *) alloca (p - *argptr + 1); -- memcpy (copy, *argptr, p - *argptr); -- copy[p - *argptr] = '\000'; -- sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0); -- if (sym) -+ /* Check for single quotes on the non-filename part. */ -+ if (!is_quoted) - { -- *argptr = (*p == '\'') ? p + 1 : p; -- return symbol_found (funfirstline, canonical, copy, sym, NULL); -+ is_quoted = (**argptr -+ && strchr (get_gdb_completer_quote_characters (), -+ **argptr) != NULL); -+ if (is_quoted) -+ end_quote = skip_quoted (*argptr); - } -- /* Otherwise fall out from here and go to file/line spec -- processing, etc. */ - } --#endif - - /* file_symtab is specified file's symtab, or 0 if no file specified. - arg no longer contains the file name. */ - -+ /* If the filename was quoted, we must re-check the quotation. */ -+ -+ if (end_quote == first_half && *end_quote!= '\0') -+ { -+ is_quoted = (**argptr -+ && strchr (get_gdb_completer_quote_characters (), -+ **argptr) != NULL); -+ if (is_quoted) -+ end_quote = skip_quoted (*argptr); -+ } -+ - /* Check whether arg is all digits (and sign). */ - - q = *argptr; -@@ -861,10 +859,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - /* allow word separators in method names for Obj-C */ - p = skip_quoted_chars (*argptr, NULL, ""); - } -- else if (paren_pointer != NULL) -- { -- p = paren_pointer + 1; -- } - else - { - p = skip_quoted (*argptr); -@@ -874,6 +868,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - if (*p == '<') - p = find_template_name_end (p); - -+ /* Keep method overload information. */ -+ if (*p == '(') -+ p = find_method_overload_end (p); -+ -+ /* Make sure we keep important kewords like "const" */ -+ if (strncmp (p, " const", 6) == 0) -+ p += 6; -+ - copy = (char *) alloca (p - *argptr + 1); - memcpy (copy, *argptr, p - *argptr); - copy[p - *argptr] = '\0'; -@@ -921,10 +923,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - function is passed ARGPTR as an argument, it modifies what ARGPTR - points to; typically, it advances *ARGPTR past whatever substring - it has just looked at. (If it doesn't modify *ARGPTR, then the -- function gets passed *ARGPTR instead, which is then called ARG: see -- set_flags, for example.) Also, functions that return a struct -- symtabs_and_lines may modify CANONICAL, as in the description of -- decode_line_1. -+ function gets passed *ARGPTR instead, which is then called ARG.) -+ Also, functions that return a struct symtabs_and_lines may modify -+ CANONICAL, as in the description of decode_line_1. - - If a function returns a struct symtabs_and_lines, then that struct - will immediately make its way up the call chain to be returned by -@@ -951,44 +952,6 @@ initialize_defaults (struct symtab **default_symtab, int *default_line) - } - } - --static void --set_flags (char *arg, int *is_quoted, char **paren_pointer) --{ -- char *ii; -- int has_if = 0; -- -- /* 'has_if' is for the syntax: -- (gdb) break foo if (a==b) -- */ -- if ((ii = strstr (arg, " if ")) != NULL || -- (ii = strstr (arg, "\tif ")) != NULL || -- (ii = strstr (arg, " if\t")) != NULL || -- (ii = strstr (arg, "\tif\t")) != NULL || -- (ii = strstr (arg, " if(")) != NULL || -- (ii = strstr (arg, "\tif( ")) != NULL) -- has_if = 1; -- /* Temporarily zap out "if (condition)" to not confuse the -- parenthesis-checking code below. This is undone below. Do not -- change ii!! */ -- if (has_if) -- { -- *ii = '\0'; -- } -- -- *is_quoted = (*arg -- && strchr (get_gdb_completer_quote_characters (), -- *arg) != NULL); -- -- *paren_pointer = strchr (arg, '('); -- if (*paren_pointer != NULL) -- *paren_pointer = strrchr (*paren_pointer, ')'); -- -- /* Now that we're safely past the paren_pointer check, put back " if -- (condition)" so outer layers can see it. */ -- if (has_if) -- *ii = ' '; --} -- - - - /* Decode arg of the form *PC. */ -@@ -1059,7 +1022,14 @@ locate_first_half (char **argptr, int *is_quote_enclosed) - p++; - } - else -- *is_quote_enclosed = 0; -+ { -+ *is_quote_enclosed = 0; -+ if (strchr (get_gdb_completer_quote_characters (), *p)) -+ { -+ ++(*argptr); -+ ++p; -+ } -+ } - for (; *p; p++) - { - if (p[0] == '<') -@@ -1088,8 +1058,9 @@ locate_first_half (char **argptr, int *is_quote_enclosed) - if (p[0] == '.' && strchr (p, ':') == NULL) - { - /* Java qualified method. Find the *last* '.', since the -- others are package qualifiers. */ -- for (p1 = p; *p1; p1++) -+ others are package qualifiers. Stop at any open parenthesis -+ which might provide overload information. */ -+ for (p1 = p; *p1 && *p1 != '('; p1++) - { - if (*p1 == '.') - p = p1; -@@ -1241,6 +1212,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, - struct symbol *sym_class; - struct symbol **sym_arr; - struct type *t; -+ char *saved_java_argptr = NULL; - - /* First check for "global" namespace specification, of the form - "::foo". If found, skip over the colons and jump to normal -@@ -1289,7 +1261,8 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, - /* PASS2: p2->"::fun", p->":fun" */ - - /* Move pointer ahead to next double-colon. */ -- while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'')) -+ while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'') -+ && (*p != '(')) - { - if (current_language->la_language == language_cplus) - p += cp_validate_operator (p); -@@ -1367,8 +1340,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, - else - { - /* At this point argptr->"fun". */ -+ char *a; - p = *argptr; -- while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':') -+ while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':' -+ && *p != '(') - p++; - /* At this point p->"". String ended. */ - /* Nope, C++ operators could have spaces in them -@@ -1380,6 +1355,42 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, - /* The above loop has already swallowed "operator". */ - p += cp_validate_operator (p - 8) - 8; - } -+ -+ /* Keep any template parameters */ -+ if (*p == '<') -+ p = find_template_name_end (p); -+ -+ /* Keep method overload information. */ -+ a = strchr (p, '('); -+ if (a != NULL) -+ p = find_method_overload_end (a); -+ -+ /* Make sure we keep important kewords like "const" */ -+ if (strncmp (p, " const", 6) == 0) -+ p += 6; -+ -+ /* Java may append typenames, so assume that if there is -+ anything else left in *argptr, it must be a typename. */ -+ if (*p && current_language->la_language == language_java) -+ { -+ struct type *type; -+ p2 = p; -+ while (*p2) -+ ++p2; -+ copy = (char *) alloca (p2 - p + 1); -+ memcpy (copy, p, p2 - p); -+ copy[p2 - p] = '\0'; -+ type = lookup_typename (current_language, get_current_arch (), -+ copy, NULL, 1); -+ if (type != NULL) -+ { -+ /* Save the location of this just in case this -+ method/type combination isn't actually defined. -+ It will be checked later. */ -+ saved_java_argptr = p; -+ p = p2; -+ } -+ } - } - - /* Allocate our own copy of the substring between argptr and -@@ -1408,9 +1419,26 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, - here, we return. If not, and we are at the and of the string, - we'll lookup the whole string in the symbol tables. */ - -- return find_method (funfirstline, canonical, saved_arg, -- copy, t, sym_class, not_found_ptr); -- -+ values = find_method (funfirstline, canonical, saved_arg, -+ copy, t, sym_class, not_found_ptr); -+ if (saved_java_argptr != NULL && values.nelts == 1) -+ { -+ /* The user specified a specific return type for a java method. -+ Double-check that it really is the one the user specified. -+ [This is a necessary evil because strcmp_iw_ordered stops -+ comparisons too prematurely.] */ -+ sym = find_pc_sect_function (values.sals[0].pc, -+ values.sals[0].section); -+ /* We just found a SAL, we had better be able to go backwards! */ -+ gdb_assert (sym != NULL); -+ if (strcmp_iw (SYMBOL_LINKAGE_NAME (sym), saved_arg) != 0) -+ { -+ xfree (values.sals); -+ error (_("the class `%s' does not have any method instance named %s\n"), -+ SYMBOL_PRINT_NAME (sym_class), copy); -+ } -+ } -+ return values; - } /* End if symbol found */ - - -@@ -1534,8 +1562,39 @@ find_method (int funfirstline, char ***canonical, char *saved_arg, - } - if (i1 > 0) - { -- /* There is more than one field with that name -- (overloaded). Ask the user which one to use. */ -+ /* If we were given a specific overload instance, use that -+ (or error if no matches were found). Otherwise ask the user -+ which one to use. */ -+ if (strchr (saved_arg, '(') != NULL) -+ { -+ int i; -+ for (i = 0; i < i1; ++i) -+ { -+ char *name = saved_arg; -+ char *canon = cp_canonicalize_string (name); -+ if (canon != NULL) -+ name = canon; -+ -+ if (strcmp_iw (name, SYMBOL_LINKAGE_NAME (sym_arr[i])) == 0) -+ { -+ values.sals = (struct symtab_and_line *) -+ xmalloc (sizeof (struct symtab_and_line)); -+ values.nelts = 1; -+ values.sals[0] = find_function_start_sal (sym_arr[i], -+ funfirstline); -+ if (canon) -+ xfree (canon); -+ return values; -+ } -+ -+ if (canon) -+ xfree (canon); -+ } -+ -+ error (_("the class `%s' does not have any method instance named %s\n"), -+ SYMBOL_PRINT_NAME (sym_class), copy); -+ } -+ - return decode_line_2 (sym_arr, i1, funfirstline, canonical); - } - else -@@ -1577,7 +1636,8 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed, - copy = (char *) alloca (p - *argptr + 1); - memcpy (copy, *argptr, p - *argptr); - /* It may have the ending quote right after the file name. */ -- if (is_quote_enclosed && copy[p - *argptr - 1] == '"') -+ if ((is_quote_enclosed && copy[p - *argptr - 1] == '"') -+ || copy[p - *argptr - 1] == '\'') - copy[p - *argptr - 1] = 0; - else - copy[p - *argptr] = 0; -@@ -1840,7 +1900,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy, - { - struct blockvector *bv = BLOCKVECTOR (SYMBOL_SYMTAB (sym)); - struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); -- if (lookup_block_symbol (b, copy, NULL, VAR_DOMAIN) != NULL) -+ if (lookup_block_symbol (b, copy, VAR_DOMAIN) != NULL) - build_canonical_line_spec (values.sals, copy, canonical); - } - return values; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c -index e55d958..e41ed74 100644 +index 93adfcd..34412a6 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c -@@ -2618,6 +2618,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) +@@ -2587,6 +2587,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) return lp->stopped_data_address_p; } @@ -9806,7 +5288,7 @@ index e55d958..e41ed74 100644 /* Wait until LP is stopped. */ static int -@@ -5584,6 +5617,8 @@ linux_nat_add_target (struct target_ops *t) +@@ -5606,6 +5639,8 @@ linux_nat_add_target (struct target_ops *t) t->to_thread_address_space = linux_nat_thread_address_space; t->to_stopped_by_watchpoint = linux_nat_stopped_by_watchpoint; t->to_stopped_data_address = linux_nat_stopped_data_address; @@ -9816,7 +5298,7 @@ index e55d958..e41ed74 100644 t->to_can_async_p = linux_nat_can_async_p; t->to_is_async_p = linux_nat_is_async_p; diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c -index 07fd67c..02b2342 100644 +index 07fd67c..2524250 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -23,6 +23,8 @@ @@ -9828,285 +5310,11 @@ index 07fd67c..02b2342 100644 /* This function is suitable for architectures that don't extend/override the standard siginfo structure. */ -@@ -152,3 +154,43 @@ linux_has_shared_address_space (void) - - return target_is_uclinux; - } -+ -+/* Call gnu-ifunc to resolve breakpoint at its returned function. */ -+ -+CORE_ADDR -+linux_convert_from_func_and_ptr (struct gdbarch *gdbarch, CORE_ADDR func_ptr, -+ CORE_ADDR pc) -+{ -+ struct type *func_func_type = builtin_type (gdbarch)->builtin_func_func; -+ struct minimal_symbol *msymbol; -+ struct value *function, *address; -+ -+ if (!target_has_execution) -+ return pc; -+ -+ msymbol = lookup_minimal_symbol_by_pc (func_ptr); -+ if (msymbol == NULL) -+ return pc; -+ if (MSYMBOL_TYPE (msymbol) != mst_text_gnu_ifunc) -+ return pc; -+ -+ /* Not at the gnu-ifunc entry point? */ -+ if (SYMBOL_VALUE_ADDRESS (msymbol) != func_ptr) -+ return pc; -+ -+ function = allocate_value (func_func_type); -+ set_value_address (function, pc); -+ -+ /* gnu-ifuncs have no arguments. FUNCTION is the code instruction address -+ while ADDRESS is a function descriptor. */ -+ address = call_function_by_hand (function, 0, NULL); -+ -+ return value_as_address (address); -+} -+ -+CORE_ADDR -+linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, -+ struct target_ops *targ) -+{ -+ return linux_convert_from_func_and_ptr (gdbarch, addr, addr); -+} -diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h -index a8b522b..282190e 100644 ---- a/gdb/linux-tdep.h -+++ b/gdb/linux-tdep.h -@@ -22,4 +22,11 @@ - - struct type *linux_get_siginfo_type (struct gdbarch *); - -+CORE_ADDR linux_convert_from_func_and_ptr (struct gdbarch *gdbarch, -+ CORE_ADDR func_ptr, CORE_ADDR pc); -+ -+CORE_ADDR linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, -+ CORE_ADDR addr, -+ struct target_ops *targ); -+ - #endif /* linux-tdep.h */ -diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c -index 80e9bf9..3057774 100644 ---- a/gdb/m2-lang.c -+++ b/gdb/m2-lang.c -@@ -356,6 +356,7 @@ const struct exp_descriptor exp_descriptor_modula2 = - { - print_subexp_standard, - operator_length_standard, -+ operator_check_standard, - op_name_standard, - dump_subexp_body_standard, - evaluate_subexp_modula2 -diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c -index 6804609..2cb1bf9 100644 ---- a/gdb/m32r-linux-tdep.c -+++ b/gdb/m32r-linux-tdep.c -@@ -30,6 +30,7 @@ - #include "gdb_string.h" - - #include "glibc-tdep.h" -+#include "linux-tdep.h" - #include "solib-svr4.h" - #include "symtab.h" - -@@ -422,6 +423,9 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - /* Enable TLS support. */ - set_gdbarch_fetch_tls_load_module_address (gdbarch, - svr4_fetch_objfile_link_map); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -diff --git a/gdb/machoread.c b/gdb/machoread.c -index a810bb2..b416970 100644 ---- a/gdb/machoread.c -+++ b/gdb/machoread.c -@@ -842,6 +842,7 @@ static struct sym_fns macho_sym_fns = { - macho_new_init, /* sym_new_init: init anything gbl to entire symtab */ - macho_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - macho_symfile_read, /* sym_read: read a symbol file into symtab */ -+ NULL, /* sym_read_psymbols */ - macho_symfile_finish, /* sym_finish: finished with file, cleanup */ - macho_symfile_offsets, /* sym_offsets: xlate external to internal form */ - default_symfile_segments, /* sym_segments: Get segment information from -diff --git a/gdb/main.c b/gdb/main.c -index e261348..92c63a7 100644 ---- a/gdb/main.c -+++ b/gdb/main.c -@@ -40,6 +40,7 @@ - #include "interps.h" - #include "main.h" - -+#include "python/python.h" - #include "source.h" - - /* If nonzero, display time usage both at startup and for each command. */ -@@ -259,6 +260,8 @@ captured_main (void *data) - char *cdarg = NULL; - char *ttyarg = NULL; - -+ int python_script = 0; -+ - /* These are static so that we can take their address in an initializer. */ - static int print_help; - static int print_version; -@@ -434,10 +437,14 @@ captured_main (void *data) - {"args", no_argument, &set_args, 1}, - {"l", required_argument, 0, 'l'}, - {"return-child-result", no_argument, &return_child_result, 1}, -+#if HAVE_PYTHON -+ {"python", no_argument, 0, 'P'}, -+ {"P", no_argument, 0, 'P'}, -+#endif - {0, no_argument, 0, 0} - }; - -- while (1) -+ while (!python_script) - { - int option_index; - -@@ -455,6 +462,9 @@ captured_main (void *data) - case 0: - /* Long option that just sets a flag. */ - break; -+ case 'P': -+ python_script = 1; -+ break; - case OPT_SE: - symarg = optarg; - execarg = optarg; -@@ -641,7 +651,31 @@ extern int gdbtk_test (char *); - - /* Now that gdb_init has created the initial inferior, we're in position - to set args for that inferior. */ -- if (set_args) -+ if (python_script) -+ { -+ /* The first argument is a python script to evaluate, and -+ subsequent arguments are passed to the script for -+ processing there. */ -+ if (optind >= argc) -+ { -+ fprintf_unfiltered (gdb_stderr, -+ _("%s: Python script file name required\n"), -+ argv[0]); -+ exit (1); -+ } -+ -+ /* FIXME: should handle inferior I/O intelligently here. -+ E.g., should be possible to run gdb in pipeline and have -+ Python (and gdb) output go to stderr or file; and if a -+ prompt is needed, open the tty. */ -+ quiet = 1; -+ /* FIXME: should read .gdbinit if, and only if, a prompt is -+ requested by the script. Though... maybe this is not -+ ideal? */ -+ /* FIXME: likewise, reading in history. */ -+ inhibit_gdbinit = 1; -+ } -+ else if (set_args) - { - /* The remaining options are the command-line options for the - inferior. The first one is the sym/exec file, and the rest -@@ -867,7 +901,8 @@ Can't attach to process and specify a core file at the same time.")); - xfree (cmdarg); - - /* Read in the old history after all the command files have been read. */ -- init_history (); -+ if (!python_script) -+ init_history (); - - if (batch) - { -@@ -896,13 +931,25 @@ Can't attach to process and specify a core file at the same time.")); - #endif - } - -- /* NOTE: cagney/1999-11-07: There is probably no reason for not -- moving this loop and the code found in captured_command_loop() -- into the command_loop() proper. The main thing holding back that -- change - SET_TOP_LEVEL() - has been eliminated. */ -- while (1) -+#if HAVE_PYTHON -+ if (python_script) - { -- catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); -+ extern int pagination_enabled; -+ pagination_enabled = 0; -+ run_python_script (argc - optind, &argv[optind]); -+ return 1; -+ } -+ else -+#endif -+ { -+ /* NOTE: cagney/1999-11-07: There is probably no reason for not -+ moving this loop and the code found in captured_command_loop() -+ into the command_loop() proper. The main thing holding back that -+ change - SET_TOP_LEVEL() - has been eliminated. */ -+ while (1) -+ { -+ catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); -+ } - } - /* No exit -- exit is through quit_command. */ - } -@@ -934,7 +981,12 @@ print_gdb_help (struct ui_file *stream) - fputs_unfiltered (_("\ - This is the GNU debugger. Usage:\n\n\ - gdb [options] [executable-file [core-file or process-id]]\n\ -- gdb [options] --args executable-file [inferior-arguments ...]\n\n\ -+ gdb [options] --args executable-file [inferior-arguments ...]\n"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream); -+#endif -+ fputs_unfiltered (_("\n\ - Options:\n\n\ - "), stream); - fputs_unfiltered (_("\ -@@ -972,7 +1024,13 @@ Options:\n\n\ - --nw Do not use a window interface.\n\ - --nx Do not read "), stream); - fputs_unfiltered (gdbinit, stream); -- fputs_unfiltered (_(" file.\n\ -+ fputs_unfiltered (_(" file.\n"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ --python, -P Following argument is Python script file; remaining\n\ -+ arguments are passed to script.\n"), stream); -+#endif -+ fputs_unfiltered (_("\ - --quiet Do not print version number on startup.\n\ - --readnow Fully read symbol files on first access.\n\ - "), stream); -diff --git a/gdb/maint.c b/gdb/maint.c -index 4316d66..fe8a069 100644 ---- a/gdb/maint.c -+++ b/gdb/maint.c -@@ -914,4 +914,12 @@ When enabled GDB is profiled."), - show_maintenance_profile_p, - &maintenance_set_cmdlist, - &maintenance_show_cmdlist); -+ add_setshow_filename_cmd ("gdb_datadir", class_maintenance, -+ &gdb_datadir, _("Set GDB's datadir path."), -+ _("Show GDB's datadir path."), -+ _("\ -+When set, GDB uses the specified path to search for data files."), -+ NULL, NULL, -+ &maintenance_set_cmdlist, -+ &maintenance_show_cmdlist); - } diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c -index b227411..3b932f0 100644 +index 310ade9..d8710a1 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c -@@ -697,7 +697,6 @@ mi_cmd_var_update (char *command, char **argv, int argc) +@@ -702,7 +702,6 @@ mi_cmd_var_update (char *command, char **argv, int argc) } else { @@ -10114,33 +5322,11 @@ index b227411..3b932f0 100644 struct varobj *var = varobj_get_handle (name); varobj_update_one (var, print_values, 1 /* explicit */); -diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c -index a691b62..d679516 100644 ---- a/gdb/microblaze-linux-tdep.c -+++ b/gdb/microblaze-linux-tdep.c -@@ -35,6 +35,7 @@ - #include "trad-frame.h" - #include "frame-unwind.h" - #include "tramp-frame.h" -+#include "linux-tdep.h" - - - static int -@@ -133,6 +134,9 @@ microblaze_linux_init_abi (struct gdbarch_info info, - /* Trampolines. */ - tramp_frame_prepend_unwinder (gdbarch, - µblaze_linux_sighandler_tramp_frame); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - void diff --git a/gdb/minsyms.c b/gdb/minsyms.c -index 287f9de..1fe0fbe 100644 +index cb4545c..92d4027 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c -@@ -331,8 +331,9 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf) +@@ -337,8 +337,9 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf) msymbol = msymbol->hash_next) { if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 && @@ -10152,7 +5338,7 @@ index 287f9de..1fe0fbe 100644 { switch (MSYMBOL_TYPE (msymbol)) { -@@ -694,6 +695,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR pc) +@@ -700,6 +701,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR pc) return lookup_minimal_symbol_by_pc_section (pc, NULL); } @@ -10169,7 +5355,7 @@ index 287f9de..1fe0fbe 100644 /* Find the minimal symbol named NAME, and return both the minsym struct and its objfile. This only checks the linkage name. Sets *OBJFILE_P and returns the minimal symbol, if it is found. If it -@@ -763,6 +774,7 @@ prim_record_minimal_symbol (const char *name, CORE_ADDR address, +@@ -769,6 +780,7 @@ prim_record_minimal_symbol (const char *name, CORE_ADDR address, switch (ms_type) { case mst_text: @@ -10177,7 +5363,7 @@ index 287f9de..1fe0fbe 100644 case mst_file_text: case mst_solib_trampoline: section = SECT_OFF_TEXT (objfile); -@@ -1228,7 +1240,8 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) +@@ -1235,7 +1247,8 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) { ALL_MSYMBOLS (objfile, msymbol) { @@ -10187,205 +5373,128 @@ index 287f9de..1fe0fbe 100644 && strcmp (SYMBOL_LINKAGE_NAME (msymbol), SYMBOL_LINKAGE_NAME (tsymbol)) == 0) return SYMBOL_VALUE_ADDRESS (msymbol); -diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c -index 5924b30..2957024 100644 ---- a/gdb/mips-linux-tdep.c -+++ b/gdb/mips-linux-tdep.c +diff --git a/gdb/p-lang.c b/gdb/p-lang.c +index 08738ac..64d2e9f 100644 +--- a/gdb/p-lang.c ++++ b/gdb/p-lang.c +@@ -222,7 +222,11 @@ pascal_printstr (struct ui_file *stream, struct type *type, + unsigned int things_printed = 0; + int in_quotes = 0; + int need_comma = 0; +- int width = TYPE_LENGTH (type); ++ int width; ++ ++ /* Preserve TYPE's original type, just set its LENGTH. */ ++ check_typedef (type); ++ width = TYPE_LENGTH (type); + + /* If the string was not truncated due to `set print elements', and + the last byte of it is a null, we don't print that, in traditional C +diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c +index 4d39bed..d0ddebc 100644 +--- a/gdb/p-valprint.c ++++ b/gdb/p-valprint.c @@ -38,6 +38,7 @@ - #include "target-descriptions.h" - #include "mips-linux-tdep.h" - #include "glibc-tdep.h" -+#include "linux-tdep.h" + #include "p-lang.h" + #include "cp-abi.h" + #include "cp-support.h" ++#include "dwarf2loc.h" + - static struct target_so_ops mips_svr4_so_ops; -@@ -1222,6 +1223,9 @@ mips_linux_init_abi (struct gdbarch_info info, - tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM, - "restart"); +@@ -68,8 +69,27 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + struct type *char_type; + LONGEST val; + CORE_ADDR addr; ++ struct cleanup *back_to; ++ struct type *saved_type = type; ++ CORE_ADDR saved_address = address; ++ ++ back_to = make_cleanup (null_cleanup, 0); ++ type = object_address_get_data (type, &address); ++ if (type == NULL) ++ { ++ fputs_filtered (object_address_data_not_valid (saved_type), stream); ++ gdb_flush (stream); ++ do_cleanups (back_to); ++ return 0; ++ } ++ if (address != saved_address) ++ { ++ size_t length = TYPE_LENGTH (type); + +- CHECK_TYPEDEF (type); ++ valaddr = xmalloc (length); ++ make_cleanup (xfree, (gdb_byte *) valaddr); ++ read_memory (address, (gdb_byte *) valaddr, length); ++ } + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: +@@ -125,8 +145,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + { + i = 0; + } +- val_print_array_elements (type, valaddr + embedded_offset, address, stream, +- recurse, original_value, options, i); ++ val_print_array_elements (saved_type, valaddr + embedded_offset, ++ saved_address, stream, recurse, ++ original_value, options, i); + fprintf_filtered (stream, "}"); + } + break; +@@ -164,6 +185,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + /* Try to print what function it points to. */ + print_address_demangle (gdbarch, addr, stream, demangle); + /* Return value is irrelevant except for string pointers. */ ++ do_cleanups (back_to); + return (0); + } + +@@ -252,6 +274,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + /* Return number of characters printed, including the terminating + '\0' if we reached the end. val_print_string takes care including + the terminating '\0' if necessary. */ ++ do_cleanups (back_to); + return i; + + break; +@@ -554,6 +577,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, + error (_("Invalid pascal type code %d in symbol table."), TYPE_CODE (type)); } -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); + gdb_flush (stream); ++ do_cleanups (back_to); + return (0); } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -diff --git a/gdb/mipsread.c b/gdb/mipsread.c -index 093313e..9144d00 100644 ---- a/gdb/mipsread.c -+++ b/gdb/mipsread.c -@@ -394,6 +394,7 @@ static struct sym_fns ecoff_sym_fns = - mipscoff_new_init, /* sym_new_init: init anything gbl to entire symtab */ - mipscoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - mipscoff_symfile_read, /* sym_read: read a symbol file into symtab */ -+ NULL, /* sym_read_psymbols */ - mipscoff_symfile_finish, /* sym_finish: finished with file, cleanup */ - default_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */ - default_symfile_segments, /* sym_segments: Get segment information from -diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c -index d4602a4..7bba707 100644 ---- a/gdb/mn10300-linux-tdep.c -+++ b/gdb/mn10300-linux-tdep.c -@@ -32,6 +32,7 @@ - #include "frame.h" - #include "trad-frame.h" - #include "tramp-frame.h" -+#include "linux-tdep.h" - - #include - -@@ -718,6 +719,9 @@ am33_linux_init_osabi (struct gdbarch_info gdbinfo, struct gdbarch *gdbarch) - - tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe); - tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c -index a050f15..04d1f1c 100644 ---- a/gdb/objc-lang.c -+++ b/gdb/objc-lang.c -@@ -1178,16 +1178,6 @@ find_methods (struct symtab *symtab, char type, - - QUIT; - -- /* The minimal symbol might point to a function descriptor; -- resolve it to the actual code address instead. */ -- pc = gdbarch_convert_from_func_ptr_addr (gdbarch, pc, -- ¤t_target); -- -- if (symtab) -- if (pc < BLOCK_START (block) || pc >= BLOCK_END (block)) -- /* Not in the specified symtab. */ -- continue; -- - symname = SYMBOL_NATURAL_NAME (msymbol); - if (symname == NULL) - continue; -@@ -1223,6 +1213,17 @@ find_methods (struct symtab *symtab, char type, - ((nselector == NULL) || (strcmp (selector, nselector) != 0))) - continue; - -+ /* The minimal symbol might point to a function descriptor; -+ resolve it to the actual code address instead. Delay the call as -+ its resolution may be expensive. */ -+ pc = gdbarch_convert_from_func_ptr_addr (gdbarch, pc, -+ ¤t_target); -+ -+ if (symtab) -+ if (pc < BLOCK_START (block) || pc >= BLOCK_END (block)) -+ /* Not in the specified symtab. */ -+ continue; -+ - sym = find_pc_function (pc); - if (sym != NULL) - { -diff --git a/gdb/objfiles.c b/gdb/objfiles.c -index c2763c2..5d62020 100644 ---- a/gdb/objfiles.c -+++ b/gdb/objfiles.c -@@ -792,6 +792,10 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets) - } - } - -+ if (objfile->quick_addrmap) -+ addrmap_relocate (objfile->quick_addrmap, -+ ANOFFSET (delta, SECT_OFF_TEXT (objfile))); -+ - { - struct partial_symbol **psym; - -@@ -917,7 +921,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) - int - objfile_has_partial_symbols (struct objfile *objfile) - { -- return objfile->psymtabs != NULL; -+ return objfile->psymtabs != NULL || objfile->quick_addrmap; - } - - /* Return non-zero if OBJFILE has full symbols. */ -@@ -957,6 +961,20 @@ have_partial_symbols (void) - if (objfile_has_partial_symbols (ofp)) - return 1; - } -+ -+ /* Try again, after reading partial symbols. We do this in two -+ passes because objfiles are always added to the head of the list, -+ and there might be a later objfile for which we've already read -+ partial symbols. */ -+ ALL_OBJFILES (ofp) -+ { -+ require_partial_symbols (ofp); -+ if (ofp->psymtabs != NULL) -+ { -+ return 1; -+ } -+ } -+ - return 0; - } - -diff --git a/gdb/objfiles.h b/gdb/objfiles.h -index c689622..eb3ae10 100644 ---- a/gdb/objfiles.h -+++ b/gdb/objfiles.h -@@ -213,6 +213,11 @@ struct objfile - - struct partial_symtab *psymtabs; - -+ /* An address map that can be used to quickly determine if an -+ address comes from this objfile. This can be NULL. */ -+ -+ struct addrmap *quick_addrmap; -+ - /* Map addresses to the entries of PSYMTABS. It would be more efficient to - have a map per the whole process but ADDRMAP cannot selectively remove - its items during FREE_OBJFILE. This mapping is already present even for -@@ -426,6 +431,15 @@ struct objfile - - #define OBJF_USERLOADED (1 << 3) /* User loaded */ - -+/* Set if we have tried to read partial symtabs for this objfile. -+ This is used to allow lazy reading of partial symtabs. */ -+ -+#define OBJF_SYMTABS_READ (1 << 6) -+ -+/* This flag is set for the main objfile. */ -+ -+#define OBJF_MAIN (1 << 7) -+ - /* The object file that contains the runtime common minimal symbols - for SunOS4. Note that this objfile has no associated BFD. */ - -@@ -606,6 +620,13 @@ extern void gdb_bfd_unref (struct bfd *abfd); - ALL_OBJFILES (objfile) \ - ALL_OBJFILE_PSYMTABS (objfile, p) - -+/* Like ALL_PSYMTABS, but ensure that partial symbols have been read -+ before examining the objfile. */ -+ -+#define ALL_PSYMTABS_REQUIRED(objfile, p) \ -+ ALL_OBJFILES (objfile) \ -+ ALL_OBJFILE_PSYMTABS (require_partial_symbols (objfile), p) -+ - #define ALL_PSPACE_PSYMTABS(ss, objfile, p) \ - ALL_PSPACE_OBJFILES (ss, objfile) \ - ALL_OBJFILE_PSYMTABS (objfile, p) + diff --git a/gdb/parse.c b/gdb/parse.c -index aabc461..e2ab8d9 100644 +index c885c6a..cbf9c65 100644 --- a/gdb/parse.c +++ b/gdb/parse.c -@@ -62,6 +62,7 @@ const struct exp_descriptor exp_descriptor_standard = - { - print_subexp_standard, - operator_length_standard, -+ operator_check_standard, - op_name_standard, - dump_subexp_body_standard, - evaluate_subexp_standard -@@ -523,6 +524,11 @@ write_exp_msymbol (struct minimal_symbol *msymbol) +@@ -487,9 +487,21 @@ write_exp_msymbol (struct minimal_symbol *msymbol) + pc = gdbarch_convert_from_func_ptr_addr (gdbarch, addr, ¤t_target); + if (pc != addr) + { ++ struct minimal_symbol *ifunc_msym = lookup_minimal_symbol_by_pc (pc); ++ + /* In this case, assume we have a code symbol instead of + a data symbol. */ +- type = mst_text; ++ ++ if (ifunc_msym != NULL && MSYMBOL_TYPE (ifunc_msym) == mst_text_gnu_ifunc ++ && SYMBOL_VALUE_ADDRESS (ifunc_msym) == pc) ++ { ++ /* A function descriptor has been resolved but PC is still in the ++ gnu-ifunc resolver body (such as because inferior does not run to ++ be able to call it). */ ++ type = mst_text_gnu_ifunc; ++ } ++ else ++ type = mst_text; + section = NULL; + addr = pc; + } +@@ -521,6 +533,11 @@ write_exp_msymbol (struct minimal_symbol *msymbol) write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol); break; @@ -10397,158 +5506,96 @@ index aabc461..e2ab8d9 100644 case mst_data: case mst_file_data: case mst_bss: -@@ -853,6 +859,10 @@ operator_length_standard (struct expression *expr, int endpos, - args = 1; +@@ -528,6 +545,10 @@ write_exp_msymbol (struct minimal_symbol *msymbol) + write_exp_elt_type (objfile_type (objfile)->nodebug_data_symbol); break; -+ case TYPE_INSTANCE_LOOKUP: -+ oplen = 3; ++ case mst_slot_got_plt: ++ write_exp_elt_type (objfile_type (objfile)->nodebug_got_plt_symbol); + break; + - case OP_OBJC_MSGCALL: /* Objective C message (method) call */ - oplen = 4; - args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); -@@ -889,6 +899,13 @@ operator_length_standard (struct expression *expr, int endpos, - args = 1; + default: + write_exp_elt_type (objfile_type (objfile)->nodebug_unknown_symbol); break; +@@ -1412,6 +1433,7 @@ parser_fprintf (FILE *x, const char *y, ...) -+ case OP_ADL_FUNC: -+ oplen = longest_to_int (expr->elts[endpos - 2].longconst); -+ oplen = 4 + BYTES_TO_EXP_ELEM (oplen + 1); -+ oplen++; -+ oplen++; -+ break; -+ - case OP_LABELED: - case STRUCTOP_STRUCT: - case STRUCTOP_PTR: -@@ -1373,6 +1390,151 @@ parser_fprintf (FILE *x, const char *y, ...) - va_end (args); - } - -+/* Implementation of the exp_descriptor method operator_check. */ -+ -+int -+operator_check_standard (struct expression *exp, int pos, + int + operator_check_standard (struct expression *exp, int pos, + int (*type_func) (struct type *type, void *data), -+ int (*objfile_func) (struct objfile *objfile, -+ void *data), -+ void *data) -+{ -+ const union exp_element *const elts = exp->elts; -+ struct type *type = NULL; -+ struct objfile *objfile = NULL; -+ -+ /* Extended operators should have been already handled by exp_descriptor -+ iterate method of its specific language. */ -+ gdb_assert (elts[pos].opcode < OP_EXTENDED0); -+ -+ /* Track the callers of write_exp_elt_type for this table. */ -+ -+ switch (elts[pos].opcode) -+ { -+ case BINOP_VAL: -+ case OP_COMPLEX: -+ case OP_DECFLOAT: -+ case OP_DOUBLE: -+ case OP_LONG: -+ case OP_SCOPE: -+ case OP_TYPE: -+ case UNOP_CAST: -+ case UNOP_MAX: -+ case UNOP_MEMVAL: -+ case UNOP_MIN: -+ type = elts[pos + 1].type; -+ break; -+ -+ case UNOP_MEMVAL_TLS: -+ objfile = elts[pos + 1].objfile; -+ type = elts[pos + 2].type; -+ break; -+ -+ case OP_VAR_VALUE: -+ { -+ const struct block *const block = elts[pos + 1].block; -+ const struct symbol *const symbol = elts[pos + 2].symbol; -+ const struct obj_section *const section = SYMBOL_OBJ_SECTION (symbol); -+ -+ /* Check objfile where the variable itself is placed. -+ SYMBOL_OBJ_SECTION (symbol) may be NULL. */ -+ if (objfile_func && (*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data)) -+ return 1; -+ -+ /* Check objfile where is placed the code touching the variable. */ -+ objfile = block_objfile (block); -+ -+ type = SYMBOL_TYPE (symbol); -+ } -+ break; -+ } -+ -+ /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ -+ + int (*objfile_func) (struct objfile *objfile, + void *data), + void *data) +@@ -1453,7 +1475,7 @@ operator_check_standard (struct expression *exp, int pos, + struct type *type = elts[pos + 2 + arg].type; + struct objfile *objfile = TYPE_OBJFILE (type); + +- if (objfile && (*objfile_func) (objfile, data)) ++ if (objfile && objfile_func && (*objfile_func) (objfile, data)) + return 1; + } + } +@@ -1471,7 +1493,8 @@ operator_check_standard (struct expression *exp, int pos, + + /* Check objfile where the variable itself is placed. + SYMBOL_OBJ_SECTION (symbol) may be NULL. */ +- if ((*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data)) ++ if (objfile_func ++ && (*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data)) + return 1; + + /* Check objfile where is placed the code touching the variable. */ +@@ -1484,24 +1507,27 @@ operator_check_standard (struct expression *exp, int pos, + + /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ + +- if (type && TYPE_OBJFILE (type) + if (type && type_func && (*type_func) (type, data)) + return 1; + if (type && TYPE_OBJFILE (type) && objfile_func -+ && (*objfile_func) (TYPE_OBJFILE (type), data)) -+ return 1; + && (*objfile_func) (TYPE_OBJFILE (type), data)) + return 1; +- if (objfile && (*objfile_func) (objfile, data)) + if (objfile && objfile_func && (*objfile_func) (objfile, data)) -+ return 1; -+ -+ return 0; -+} -+ + return 1; + + return 0; + } + +-/* Call OBJFILE_FUNC for any TYPE and OBJFILE found being referenced by EXP. +- The functions are never called with NULL OBJFILE. Functions get passed an +- arbitrary caller supplied DATA pointer. If any of the functions returns +- non-zero value then (any other) non-zero value is immediately returned to +- the caller. Otherwise zero is returned after iterating through whole EXP. +- */ +/* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being + referenced by EXP. The functions are never called with NULL TYPE or NULL + OBJFILE. Functions get passed an arbitrary caller supplied DATA pointer. + If any of the functions returns non-zero value then (any other) non-zero + value is immediately returned to the caller. Otherwise zero is returned + after iterating through whole EXP. */ -+ -+static int -+exp_iterate (struct expression *exp, + + static int + exp_iterate (struct expression *exp, + int (*type_func) (struct type *type, void *data), -+ int (*objfile_func) (struct objfile *objfile, void *data), -+ void *data) -+{ -+ int endpos; -+ const union exp_element *const elts = exp->elts; -+ -+ for (endpos = exp->nelts; endpos > 0; ) -+ { -+ int pos, args, oplen = 0; -+ -+ exp->language_defn->la_exp_desc->operator_length (exp, endpos, -+ &oplen, &args); -+ gdb_assert (oplen > 0); -+ -+ pos = endpos - oplen; -+ if (exp->language_defn->la_exp_desc->operator_check (exp, pos, type_func, -+ objfile_func, data)) -+ return 1; -+ -+ endpos = pos; -+ } -+ -+ return 0; -+} -+ -+/* Helper for exp_uses_objfile. */ -+ -+static int -+exp_uses_objfile_iter (struct objfile *exp_objfile, void *objfile_voidp) -+{ -+ struct objfile *objfile = objfile_voidp; -+ -+ return exp_objfile == objfile; -+} -+ -+/* Return 1 if EXP uses OBJFILE (and will become dangling when OBJFILE -+ is unloaded), otherwise return 0. */ -+ -+int -+exp_uses_objfile (struct expression *exp, struct objfile *objfile) -+{ + int (*objfile_func) (struct objfile *objfile, void *data), + void *data) + { +@@ -1516,7 +1542,9 @@ exp_iterate (struct expression *exp, + + pos = endpos - oplen; + if (exp->language_defn->la_exp_desc->operator_check (exp, pos, +- objfile_func, data)) ++ type_func, ++ objfile_func, ++ data)) + return 1; + + endpos = pos; +@@ -1547,7 +1575,26 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) + { + gdb_assert (objfile->separate_debug_objfile_backlink == NULL); + +- return exp_iterate (exp, exp_uses_objfile_iter, objfile); + return exp_iterate (exp, NULL, exp_uses_objfile_iter, objfile); +} + @@ -10563,59 +5610,39 @@ index aabc461..e2ab8d9 100644 + return 0; +} + -+/* Call type_mark_used for any TYPE contained in EXP. */ ++/* Call type_mark_used for any type contained in EXP. */ + +void +exp_types_mark_used (struct expression *exp) +{ + exp_iterate (exp, exp_types_mark_used_iter, NULL, NULL); -+} -+ + } + void - _initialize_parse (void) - { diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h -index c4eb1a0..2a43fe3 100644 +index bb79ae1..fbbd600 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h -@@ -192,6 +192,13 @@ extern void operator_length (struct expression *, int, int *, int *); +@@ -194,6 +194,8 @@ extern void operator_length_standard (const struct expression *, int, int *, + int *); - extern void operator_length_standard (struct expression *, int, int *, int *); - -+extern int operator_check_standard (struct expression *exp, int pos, + extern int operator_check_standard (struct expression *exp, int pos, + int (*type_func) (struct type *type, + void *data), -+ int (*objfile_func) -+ (struct objfile *objfile, void *data), -+ void *data); -+ - extern char *op_name_standard (enum exp_opcode); - - extern struct type *follow_types (struct type *); -@@ -270,6 +277,20 @@ struct exp_descriptor - the number of subexpressions it takes. */ - void (*operator_length) (struct expression*, int, int*, int *); - -+ /* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being -+ referenced by the single operator of EXP at position POS. Operator -+ parameters are located at positive (POS + number) offsets in EXP. -+ The functions should never be called with NULL TYPE or NULL OBJFILE. -+ Functions should get passed an arbitrary caller supplied DATA pointer. -+ If any of the functions returns non-zero value then (any other) non-zero -+ value should be immediately returned to the caller. Otherwise zero -+ should be returned. */ -+ int (*operator_check) (struct expression *exp, int pos, + int (*objfile_func) + (struct objfile *objfile, void *data), + void *data); +@@ -285,6 +287,7 @@ struct exp_descriptor + value should be immediately returned to the caller. Otherwise zero + should be returned. */ + int (*operator_check) (struct expression *exp, int pos, + int (*type_func) (struct type *type, void *data), -+ int (*objfile_func) (struct objfile *objfile, -+ void *data), -+ void *data); -+ - /* Name of this operator for dumping purposes. */ - char *(*op_name) (enum exp_opcode); + int (*objfile_func) (struct objfile *objfile, + void *data), + void *data); +@@ -323,4 +326,8 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); -@@ -302,4 +323,8 @@ extern void print_subexp_standard (struct expression *, int *, - - extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3); + extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); +extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); + @@ -10623,11 +5650,11 @@ index c4eb1a0..2a43fe3 100644 + #endif /* PARSER_DEFS_H */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c -index 10ff73d..5b68f56 100644 +index e8d96f6..8bf097c 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c -@@ -1391,6 +1391,24 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) - return 0; +@@ -2010,6 +2010,24 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, + return ret; } +/* See target_detach_watchpoints. Do not use wrapper @@ -10651,7 +5678,7 @@ index 10ff73d..5b68f56 100644 static void ppc_linux_new_thread (ptid_t ptid) { -@@ -1648,6 +1666,7 @@ _initialize_ppc_linux_nat (void) +@@ -2349,6 +2367,7 @@ _initialize_ppc_linux_nat (void) t->to_region_ok_for_hw_watchpoint = ppc_linux_region_ok_for_hw_watchpoint; t->to_insert_watchpoint = ppc_linux_insert_watchpoint; t->to_remove_watchpoint = ppc_linux_remove_watchpoint; @@ -10659,53 +5686,11 @@ index 10ff73d..5b68f56 100644 t->to_stopped_by_watchpoint = ppc_linux_stopped_by_watchpoint; t->to_stopped_data_address = ppc_linux_stopped_data_address; t->to_watchpoint_addr_within_range = ppc_linux_watchpoint_addr_within_range; -diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c -index fae5ab2..94f993e 100644 ---- a/gdb/ppc-linux-tdep.c -+++ b/gdb/ppc-linux-tdep.c -@@ -48,6 +48,7 @@ - #include "arch-utils.h" - #include "spu-tdep.h" - #include "xml-syscall.h" -+#include "linux-tdep.h" - - #include "features/rs6000/powerpc-32l.c" - #include "features/rs6000/powerpc-altivec32l.c" -@@ -672,8 +673,19 @@ ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch, - res = bfd_get_section_contents (s->bfd, s->the_bfd_section, - &buf, addr - s->addr, 8); - if (res != 0) -- return extract_unsigned_integer (buf, 8, byte_order) -- - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr; -+ { -+ CORE_ADDR pc, resolved; -+ -+ pc = extract_unsigned_integer (buf, 8, byte_order) -+ - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr; -+ -+ resolved = linux_convert_from_func_and_ptr (gdbarch, addr, pc); -+ if (resolved != pc) -+ pc = ppc64_linux_convert_from_func_ptr_addr (gdbarch, resolved, -+ targ); -+ -+ return pc; -+ } - } - - return addr; diff --git a/gdb/printcmd.c b/gdb/printcmd.c -index c8cb35c..18dae9e 100644 +index 5ffa099..58d9c79 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c -@@ -46,7 +46,6 @@ - #include "exceptions.h" - #include "observer.h" - #include "solist.h" --#include "solib.h" - #include "parser-defs.h" - #include "charset.h" - #include "arch-utils.h" -@@ -941,6 +940,11 @@ print_command_1 (char *exp, int inspect, int voidprint) +@@ -971,6 +971,11 @@ print_command_1 (char *exp, int inspect, int voidprint) else val = access_value_history (0); @@ -10717,7 +5702,7 @@ index c8cb35c..18dae9e 100644 if (voidprint || (val && value_type (val) && TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) { -@@ -1437,6 +1441,22 @@ x_command (char *exp, int from_tty) +@@ -1471,6 +1476,22 @@ x_command (char *exp, int from_tty) set_internalvar (lookup_internalvar ("__"), last_examine_value); } } @@ -10740,5099 +5725,15 @@ index c8cb35c..18dae9e 100644 /* Add an expression to the auto-display chain. -@@ -1859,51 +1879,6 @@ disable_display_command (char *args, int from_tty) - } - } - --/* Return 1 if D uses SOLIB (and will become dangling when SOLIB -- is unloaded), otherwise return 0. */ -- --static int --display_uses_solib_p (const struct display *d, -- const struct so_list *solib) --{ -- int endpos; -- struct expression *const exp = d->exp; -- const union exp_element *const elts = exp->elts; -- -- if (d->block != NULL -- && d->pspace == solib->pspace -- && solib_contains_address_p (solib, d->block->startaddr)) -- return 1; -- -- for (endpos = exp->nelts; endpos > 0; ) -- { -- int i, args, oplen = 0; -- -- exp->language_defn->la_exp_desc->operator_length (exp, endpos, -- &oplen, &args); -- gdb_assert (oplen > 0); -- -- i = endpos - oplen; -- if (elts[i].opcode == OP_VAR_VALUE) -- { -- const struct block *const block = elts[i + 1].block; -- const struct symbol *const symbol = elts[i + 2].symbol; -- -- if (block != NULL -- && solib_contains_address_p (solib, -- block->startaddr)) -- return 1; -- -- /* SYMBOL_OBJ_SECTION (symbol) may be NULL. */ -- if (SYMBOL_SYMTAB (symbol)->objfile == solib->objfile) -- return 1; -- } -- endpos -= oplen; -- } -- -- return 0; --} -- - /* display_chain items point to blocks and expressions. Some expressions in - turn may point to symbols. - Both symbols and blocks are obstack_alloc'd on objfile_stack, and are -@@ -1915,18 +1890,20 @@ display_uses_solib_p (const struct display *d, - static void - clear_dangling_display_expressions (struct so_list *solib) - { -+ struct objfile *objfile = solib->objfile; - struct display *d; -- struct objfile *objfile = NULL; - -- for (d = display_chain; d; d = d->next) -- { -- if (d->exp && display_uses_solib_p (d, solib)) -- { -- xfree (d->exp); -- d->exp = NULL; -- d->block = NULL; -- } -- } -+ if (objfile == NULL) -+ return; -+ -+ for (d = display_chain; d != NULL; d = d->next) -+ if (block_objfile (d->block) == objfile -+ || (d->exp && exp_uses_objfile (d->exp, objfile))) -+ { -+ xfree (d->exp); -+ d->exp = NULL; -+ d->block = NULL; -+ } - } - - -@@ -2811,4 +2788,6 @@ Show printing of source filename and line number with ."), NULL, - NULL, - show_print_symbol_filename, - &setprintlist, &showprintlist); +@@ -2869,4 +2890,6 @@ Show printing of source filename and line number with ."), NULL, + add_com ("eval", no_class, eval_command, _("\ + Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\ + a command line, and call it.")); + + observer_attach_mark_used (print_types_mark_used); } -diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py -new file mode 100644 -index 0000000..5654546 ---- /dev/null -+++ b/gdb/python/lib/gdb/FrameIterator.py -@@ -0,0 +1,33 @@ -+# Iterator over frames. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+class FrameIterator: -+ """An iterator that iterates over frames.""" -+ -+ def __init__ (self, frame): -+ "Initialize a FrameIterator. FRAME is the starting frame." -+ self.frame = frame -+ -+ def __iter__ (self): -+ return self -+ -+ def next (self): -+ result = self.frame -+ if result is None: -+ raise StopIteration -+ self.frame = result.older () -+ return result -diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py -new file mode 100644 -index 0000000..b790a54 ---- /dev/null -+++ b/gdb/python/lib/gdb/FrameWrapper.py -@@ -0,0 +1,112 @@ -+# Wrapper API for frames. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+# FIXME: arguably all this should be on Frame somehow. -+class FrameWrapper: -+ def __init__ (self, frame): -+ self.frame = frame; -+ -+ def write_symbol (self, stream, sym, block): -+ if len (sym.linkage_name): -+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block) -+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER: -+ sym = nsym -+ -+ stream.write (sym.print_name + "=") -+ try: -+ val = self.read_var (sym) -+ if val != None: -+ val = str (val) -+ # FIXME: would be nice to have a more precise exception here. -+ except RuntimeError, text: -+ val = text -+ if val == None: -+ stream.write ("???") -+ else: -+ stream.write (str (val)) -+ -+ def print_frame_locals (self, stream, func): -+ if not func: -+ return -+ -+ first = True -+ block = func.value -+ -+ for sym in block: -+ if sym.is_argument: -+ continue; -+ -+ self.write_symbol (stream, sym, block) -+ stream.write ('\n') -+ -+ def print_frame_args (self, stream, func): -+ if not func: -+ return -+ -+ first = True -+ block = func.value -+ -+ for sym in block: -+ if not sym.is_argument: -+ continue; -+ -+ if not first: -+ stream.write (", ") -+ -+ self.write_symbol (stream, sym, block) -+ first = False -+ -+ # FIXME: this should probably just be a method on gdb.Frame. -+ # But then we need stream wrappers. -+ def describe (self, stream, full): -+ if self.type () == gdb.DUMMY_FRAME: -+ stream.write (" \n") -+ elif self.type () == gdb.SIGTRAMP_FRAME: -+ stream.write (" \n") -+ else: -+ sal = self.find_sal () -+ pc = self.pc () -+ name = self.name () -+ if not name: -+ name = "??" -+ if pc != sal.pc or not sal.symtab: -+ stream.write (" 0x%08x in" % pc) -+ stream.write (" " + name + " (") -+ -+ func = self.function () -+ self.print_frame_args (stream, func) -+ -+ stream.write (")") -+ -+ if sal.symtab and sal.symtab.filename: -+ stream.write (" at " + sal.symtab.filename) -+ stream.write (":" + str (sal.line)) -+ -+ if not self.name () or (not sal.symtab or not sal.symtab.filename): -+ lib = gdb.solib_address (pc) -+ if lib: -+ stream.write (" from " + lib) -+ -+ stream.write ("\n") -+ -+ if full: -+ self.print_frame_locals (stream, func) -+ -+ def __getattr__ (self, name): -+ return getattr (self.frame, name) -diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py -new file mode 100644 -index 0000000..b375c68 ---- /dev/null -+++ b/gdb/python/lib/gdb/__init__.py -@@ -0,0 +1,19 @@ -+# Startup code. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Load the require command by default. -+import gdb.command.require -diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py -new file mode 100644 -index 0000000..2baab5f ---- /dev/null -+++ b/gdb/python/lib/gdb/backtrace.py -@@ -0,0 +1,42 @@ -+# Filtering backtrace. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import itertools -+ -+# Our only exports. -+__all__ = ['push_frame_filter', 'create_frame_filter'] -+ -+frame_filter = None -+ -+def push_frame_filter (constructor): -+ """Register a new backtrace filter class with the 'backtrace' command. -+The filter will be passed an iterator as an argument. The iterator -+will return gdb.Frame-like objects. The filter should in turn act as -+an iterator returning such objects.""" -+ global frame_filter -+ if frame_filter == None: -+ frame_filter = constructor -+ else: -+ frame_filter = lambda iterator: constructor (frame_filter (iterator)) -+ -+def create_frame_filter (iter): -+ global frame_filter -+ if frame_filter is None: -+ return iter -+ return frame_filter (iter) -+ -diff --git a/gdb/python/lib/gdb/command/__init__.py b/gdb/python/lib/gdb/command/__init__.py -new file mode 100644 -index 0000000..8b13789 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/__init__.py -@@ -0,0 +1 @@ -+ -diff --git a/gdb/python/lib/gdb/command/alias.py b/gdb/python/lib/gdb/command/alias.py -new file mode 100644 -index 0000000..96b6618 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/alias.py -@@ -0,0 +1,59 @@ -+# Alias command. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class AliasImplementation (gdb.Command): -+ def __init__ (self, name, real, doc): -+ # Have to set __doc__ before the super init call. -+ # It would be nice if gdb's help looked up __doc__ dynamically. -+ self.__doc__ = doc -+ # Note: no good way to complete :( -+ super (AliasImplementation, self).__init__ (name, gdb.COMMAND_NONE) -+ self.real = real -+ -+ def invoke(self, arg, from_tty): -+ gdb.execute (self.real + ' ' + arg, from_tty) -+ -+class AliasCommand (gdb.Command): -+ """Alias one command to another. -+In the simplest form, the first word is the name of the alias, and -+the remaining words are the the expansion. -+An '=' by itself can be used to define a multi-word alias; words -+before the '=' are the name of the new command.""" -+ -+ def __init__ (self): -+ # Completion is not quite right here. -+ super (AliasCommand, self).__init__ ("alias", gdb.COMMAND_NONE, -+ gdb.COMPLETE_COMMAND) -+ -+ def invoke (self, arg, from_tty): -+ self.dont_repeat () -+ # Without some form of quoting we can't alias a multi-word -+ # command to another command. -+ args = arg.split() -+ try: -+ start = args.index ('=') -+ end = start + 1 -+ except ValueError: -+ start = 1 -+ end = 1 -+ target = " ".join(args[end:]) -+ AliasImplementation (" ".join (args[0:start]), target, -+ "This command is an alias for '%s'." % target) -+ -+AliasCommand() -diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py -new file mode 100644 -index 0000000..ec9a527 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/backtrace.py -@@ -0,0 +1,106 @@ -+# New backtrace command. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import gdb.backtrace -+import itertools -+from gdb.FrameIterator import FrameIterator -+from gdb.FrameWrapper import FrameWrapper -+import sys -+ -+class ReverseBacktraceParameter (gdb.Parameter): -+ """The new-backtrace command can show backtraces in 'reverse' order. -+This means that the innermost frame will be printed last. -+Note that reverse backtraces are more expensive to compute.""" -+ -+ set_doc = "Enable or disable reverse backtraces." -+ show_doc = "Show whether backtraces will be printed in reverse order." -+ -+ def __init__(self): -+ gdb.Parameter.__init__ (self, "reverse-backtrace", -+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN) -+ # Default to compatibility with gdb. -+ self.value = False -+ -+class FilteringBacktrace (gdb.Command): -+ """Print backtrace of all stack frames, or innermost COUNT frames. -+With a negative argument, print outermost -COUNT frames. -+Use of the 'full' qualifier also prints the values of the local variables. -+Use of the 'raw' qualifier avoids any filtering by loadable modules. -+""" -+ -+ def __init__ (self): -+ # FIXME: this is not working quite well enough to replace -+ # "backtrace" yet. -+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK) -+ self.reverse = ReverseBacktraceParameter() -+ -+ def reverse_iter (self, iter): -+ result = [] -+ for item in iter: -+ result.append (item) -+ result.reverse() -+ return result -+ -+ def final_n (self, iter, x): -+ result = [] -+ for item in iter: -+ result.append (item) -+ return result[x:] -+ -+ def invoke (self, arg, from_tty): -+ i = 0 -+ count = 0 -+ filter = True -+ full = False -+ -+ for word in arg.split (" "): -+ if word == '': -+ continue -+ elif word == 'raw': -+ filter = False -+ elif word == 'full': -+ full = True -+ else: -+ count = int (word) -+ -+ # FIXME: provide option to start at selected frame -+ # However, should still number as if starting from newest -+ newest_frame = gdb.selected_thread ().newest_frame () -+ iter = itertools.imap (FrameWrapper, -+ FrameIterator (newest_frame)) -+ if filter: -+ iter = gdb.backtrace.create_frame_filter (iter) -+ -+ # Now wrap in an iterator that numbers the frames. -+ iter = itertools.izip (itertools.count (0), iter) -+ -+ # Reverse if the user wanted that. -+ if self.reverse.value: -+ iter = self.reverse_iter (iter) -+ -+ # Extract sub-range user wants. -+ if count < 0: -+ iter = self.final_n (iter, count) -+ elif count > 0: -+ iter = itertools.islice (iter, 0, count) -+ -+ for pair in iter: -+ sys.stdout.write ("#%-2d" % pair[0]) -+ pair[1].describe (sys.stdout, full) -+ -+FilteringBacktrace() -diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py -new file mode 100644 -index 0000000..6fa48ff ---- /dev/null -+++ b/gdb/python/lib/gdb/command/ignore_errors.py -@@ -0,0 +1,37 @@ -+# Ignore errors in user commands. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class IgnoreErrorsCommand (gdb.Command): -+ """Execute a single command, ignoring all errors. -+Only one-line commands are supported. -+This is primarily useful in scripts.""" -+ -+ def __init__ (self): -+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors", -+ gdb.COMMAND_OBSCURE, -+ # FIXME... -+ gdb.COMPLETE_COMMAND) -+ -+ def invoke (self, arg, from_tty): -+ try: -+ gdb.execute (arg, from_tty) -+ except: -+ pass -+ -+IgnoreErrorsCommand () -diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py -new file mode 100644 -index 0000000..21a0bf0 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/pahole.py -@@ -0,0 +1,75 @@ -+# pahole command for gdb -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class Pahole (gdb.Command): -+ """Show the holes in a structure. -+This command takes a single argument, a type name. -+It prints the type and displays comments showing where holes are.""" -+ -+ def __init__ (self): -+ super (Pahole, self).__init__ ("pahole", gdb.COMMAND_NONE, -+ gdb.COMPLETE_SYMBOL) -+ -+ def pahole (self, type, level, name): -+ if name is None: -+ name = '' -+ tag = type.tag -+ if tag is None: -+ tag = '' -+ print '%sstruct %s {' % (' ' * (2 * level), tag) -+ bitpos = 0 -+ for field in type.fields (): -+ # Skip static fields. -+ if not hasattr (field, ('bitpos')): -+ continue -+ -+ ftype = field.type.strip_typedefs() -+ -+ if bitpos != field.bitpos: -+ hole = field.bitpos - bitpos -+ print ' /* XXX %d bit hole, try to pack */' % hole -+ bitpos = field.bitpos -+ if field.bitsize > 0: -+ fieldsize = field.bitsize -+ else: -+ # TARGET_CHAR_BIT here... -+ fieldsize = 8 * ftype.sizeof -+ -+ # TARGET_CHAR_BIT -+ print ' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)), -+ bitpos = bitpos + fieldsize -+ -+ if ftype.code == gdb.TYPE_CODE_STRUCT: -+ self.pahole (ftype, level + 1, field.name) -+ else: -+ print ' ' * (2 + 2 * level), -+ print '%s %s' % (str (ftype), field.name) -+ -+ print ' ' * (14 + 2 * level), -+ print '} %s' % name -+ -+ def invoke (self, arg, from_tty): -+ type = gdb.lookup_type (arg) -+ type = type.strip_typedefs () -+ if type.code != gdb.TYPE_CODE_STRUCT: -+ raise TypeError, '%s is not a struct type' % arg -+ print ' ' * 14, -+ self.pahole (type, 0, '') -+ -+Pahole() -diff --git a/gdb/python/lib/gdb/command/require.py b/gdb/python/lib/gdb/command/require.py -new file mode 100644 -index 0000000..1fbc1e8 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/require.py -@@ -0,0 +1,57 @@ -+# Demand-loading commands. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import os -+ -+class RequireCommand (gdb.Command): -+ """Prefix command for requiring features.""" -+ -+ def __init__ (self): -+ super (RequireCommand, self).__init__ ("require", -+ gdb.COMMAND_SUPPORT, -+ gdb.COMPLETE_NONE, -+ True) -+ -+class RequireSubcommand (gdb.Command): -+ """Demand-load a command by name.""" -+ -+ def __init__ (self, name): -+ self.__doc__ = "Demand-load a %s by name." % name -+ super (RequireSubcommand, self).__init__ ("require %s" % name, -+ gdb.COMMAND_SUPPORT) -+ self.name = name -+ -+ def invoke (self, arg, from_tty): -+ for cmd in arg.split(): -+ exec ('import gdb.' + self.name + '.' + cmd, globals ()) -+ -+ def complete (self, text, word): -+ dir = gdb.pythondir + '/gdb/' + self.name -+ result = [] -+ for file in os.listdir(dir): -+ if not file.startswith (word) or not file.endswith ('.py'): -+ continue -+ feature = file[0:-3] -+ if feature == 'require' or feature == '__init__': -+ continue -+ result.append (feature) -+ return result -+ -+RequireCommand() -+RequireSubcommand("command") -+RequireSubcommand("function") -diff --git a/gdb/python/lib/gdb/command/save_breakpoints.py b/gdb/python/lib/gdb/command/save_breakpoints.py -new file mode 100644 -index 0000000..6143187 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/save_breakpoints.py -@@ -0,0 +1,65 @@ -+# Save breakpoints. -+ -+# Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+from __future__ import with_statement -+import gdb -+ -+class SavePrefixCommand (gdb.Command): -+ "Prefix command for saving things." -+ -+ def __init__ (self): -+ super (SavePrefixCommand, self).__init__ ("save", -+ gdb.COMMAND_SUPPORT, -+ gdb.COMPLETE_NONE, True) -+ -+class SaveBreakpointsCommand (gdb.Command): -+ """Save the current breakpoints to a file. -+This command takes a single argument, a file name. -+The breakpoints can be restored using the 'source' command.""" -+ -+ def __init__ (self): -+ super (SaveBreakpointsCommand, self).__init__ ("save breakpoints", -+ gdb.COMMAND_SUPPORT, -+ gdb.COMPLETE_FILENAME) -+ -+ def invoke (self, arg, from_tty): -+ self.dont_repeat () -+ bps = gdb.breakpoints () -+ if bps is None: -+ raise RuntimeError, 'No breakpoints to save' -+ with open (arg.strip (), 'w') as f: -+ for bp in bps: -+ print >> f, "break", bp.location, -+ if bp.thread is not None: -+ print >> f, " thread", bp.thread, -+ if bp.condition is not None: -+ print >> f, " if", bp.condition, -+ print >> f -+ if not bp.enabled: -+ print >> f, "disable $bpnum" -+ # Note: we don't save the ignore count; there doesn't -+ # seem to be much point. -+ commands = bp.commands -+ if commands is not None: -+ print >> f, "commands" -+ # Note that COMMANDS has a trailing newline. -+ print >> f, commands, -+ print >> f, "end" -+ print >> f -+ -+SavePrefixCommand () -+SaveBreakpointsCommand () -diff --git a/gdb/python/lib/gdb/command/upto.py b/gdb/python/lib/gdb/command/upto.py -new file mode 100644 -index 0000000..faf54ed ---- /dev/null -+++ b/gdb/python/lib/gdb/command/upto.py -@@ -0,0 +1,129 @@ -+# upto command. -+ -+# Copyright (C) 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import re -+from gdb.FrameIterator import FrameIterator -+from gdb.FrameWrapper import FrameWrapper -+ -+class UptoPrefix (gdb.Command): -+ def __init__ (self): -+ super (UptoPrefix, self).__init__ ("upto", gdb.COMMAND_STACK, -+ prefix = True) -+ -+class UptoImplementation (gdb.Command): -+ def __init__ (self, subcommand): -+ super (UptoImplementation, self).__init__ ("upto " + subcommand, -+ gdb.COMMAND_STACK) -+ -+ def search (self): -+ saved = gdb.selected_frame () -+ iter = FrameIterator (saved) -+ found = False -+ try: -+ for frame in iter: -+ frame.select () -+ try: -+ if self.filter (frame): -+ wrapper = FrameWrapper (frame) -+ wrapper.describe (sys.stdout, False) -+ return -+ except: -+ pass -+ except: -+ pass -+ saved.select () -+ raise RuntimeError, 'Could not find a matching frame' -+ -+ def invoke (self, arg, from_tty): -+ self.rx = re.compile (arg) -+ self.search () -+ -+class UptoSymbolCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on symbol. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose symbol matches the regular -+expression.""" -+ -+ def __init__ (self): -+ super (UptoSymbolCommand, self).__init__ ("symbol") -+ -+ def filter (self, frame): -+ name = frame.name () -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoSourceCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on source file. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose source file name matches the -+regular expression.""" -+ -+ def __init__ (self): -+ super (UptoSourceCommand, self).__init__ ("source") -+ -+ def filter (self, frame): -+ name = frame.find_sal ().symtab.filename -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoObjectCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on object file. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose object file name matches the -+regular expression.""" -+ -+ def __init__ (self): -+ super (UptoObjectCommand, self).__init__ ("object") -+ -+ def filter (self, frame): -+ name = frame.find_sal ().symtab.objfile.filename -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoWhereCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on expression. -+The argument is an expression. This command moves up the stack, -+parsing and evaluating the expression in each frame. This stops when -+the expression evaluates to a non-zero (true) value.""" -+ -+ def __init__ (self): -+ super (UptoWhereCommand, self).__init__ ("where") -+ -+ def filter (self, frame): -+ try: -+ if gdb.parse_and_eval (self.expression): -+ return True -+ except: -+ pass -+ return False -+ -+ def invoke (self, arg, from_tty): -+ self.expression = arg -+ self.search () -+ -+UptoPrefix () -+UptoSymbolCommand () -+UptoSourceCommand () -+UptoObjectCommand () -+UptoWhereCommand () -diff --git a/gdb/python/lib/gdb/function/__init__.py b/gdb/python/lib/gdb/function/__init__.py -new file mode 100644 -index 0000000..8b13789 ---- /dev/null -+++ b/gdb/python/lib/gdb/function/__init__.py -@@ -0,0 +1 @@ -+ -diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py -new file mode 100644 -index 0000000..2b9c5c7 ---- /dev/null -+++ b/gdb/python/lib/gdb/function/caller_is.py -@@ -0,0 +1,58 @@ -+# Caller-is functions. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+import re -+ -+class CallerIs (gdb.Function): -+ """Return True if the calling function's name is equal to a string. -+This function takes one or two arguments. -+The first argument is the name of a function; if the calling function's -+name is equal to this argument, this function returns True. -+The optional second argument tells this function how many stack frames -+to traverse to find the calling function. The default is 1.""" -+ -+ def __init__ (self): -+ super (CallerIs, self).__init__ ("caller_is") -+ -+ def invoke (self, name, nframes = 1): -+ frame = gdb.selected_frame () -+ while nframes > 0: -+ frame = frame.older () -+ nframes = nframes - 1 -+ return frame.name () == name.string () -+ -+class CallerMatches (gdb.Function): -+ """Return True if the calling function's name matches a string. -+This function takes one or two arguments. -+The first argument is a regular expression; if the calling function's -+name is matched by this argument, this function returns True. -+The optional second argument tells this function how many stack frames -+to traverse to find the calling function. The default is 1.""" -+ -+ def __init__ (self): -+ super (CallerMatches, self).__init__ ("caller_matches") -+ -+ def invoke (self, name, nframes = 1): -+ frame = gdb.selected_frame () -+ while nframes > 0: -+ frame = frame.older () -+ nframes = nframes - 1 -+ return re.match (name.string (), frame.name ()) is not None -+ -+CallerIs() -+CallerMatches() -diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py -new file mode 100644 -index 0000000..debb3bb ---- /dev/null -+++ b/gdb/python/lib/gdb/function/in_scope.py -@@ -0,0 +1,47 @@ -+# In-scope function. -+ -+# Copyright (C) 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class InScope (gdb.Function): -+ """Return True if all the given variables or macros are in scope. -+Takes one argument for each variable name to be checked.""" -+ -+ def __init__ (self): -+ super (InScope, self).__init__ ("in_scope") -+ -+ def invoke (self, *vars): -+ if len (vars) == 0: -+ raise TypeError, "in_scope takes at least one argument" -+ -+ # gdb.Value isn't hashable so it can't be put in a map. -+ # Convert to string first. -+ wanted = set (map (lambda x: x.string (), vars)) -+ found = set () -+ block = gdb.selected_frame ().block () -+ while block: -+ for sym in block: -+ if (sym.is_argument or sym.is_constant -+ or sym.is_function or sym.is_variable): -+ if sym.name in wanted: -+ found.add (sym.name) -+ -+ block = block.superblock -+ -+ return wanted == found -+ -+InScope () -diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c -new file mode 100644 -index 0000000..8019e9d ---- /dev/null -+++ b/gdb/python/py-block.c -@@ -0,0 +1,265 @@ -+/* Python interface to blocks. -+ -+ Copyright (C) 2008 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "block.h" -+#include "dictionary.h" -+#include "symtab.h" -+#include "python-internal.h" -+ -+typedef struct { -+ PyObject_HEAD -+ struct block *block; -+} block_object; -+ -+typedef struct { -+ PyObject_HEAD -+ struct dictionary *dict; -+ struct dict_iterator iter; -+ int initialized_p; -+} block_syms_iterator_object; -+ -+static PyTypeObject block_syms_iterator_object_type; -+ -+static PyObject * -+blpy_iter (PyObject *self) -+{ -+ block_syms_iterator_object *block_iter_obj; -+ -+ block_iter_obj = PyObject_New (block_syms_iterator_object, -+ &block_syms_iterator_object_type); -+ if (block_iter_obj == NULL) -+ { -+ PyErr_SetString (PyExc_MemoryError, -+ "Could not allocate iterator object."); -+ return NULL; -+ } -+ -+ block_iter_obj->dict = BLOCK_DICT (((block_object *) self)->block); -+ block_iter_obj->initialized_p = 0; -+ -+ return (PyObject *) block_iter_obj; -+} -+ -+static PyObject * -+blpy_get_start (PyObject *self, void *closure) -+{ -+ block_object *self_block = (block_object *) self; -+ -+ return PyLong_FromUnsignedLongLong (BLOCK_START (self_block->block)); -+} -+ -+static PyObject * -+blpy_get_end (PyObject *self, void *closure) -+{ -+ block_object *self_block = (block_object *) self; -+ -+ return PyLong_FromUnsignedLongLong (BLOCK_END (self_block->block)); -+} -+ -+static PyObject * -+blpy_get_function (PyObject *self, void *closure) -+{ -+ block_object *self_block = (block_object *) self; -+ struct symbol *sym; -+ -+ sym = BLOCK_FUNCTION (self_block->block); -+ if (sym) -+ return symbol_to_symbol_object (sym); -+ -+ Py_RETURN_NONE; -+} -+ -+static PyObject * -+blpy_get_superblock (PyObject *self, void *closure) -+{ -+ block_object *self_block = (block_object *) self; -+ struct block *block; -+ -+ block = BLOCK_SUPERBLOCK (self_block->block); -+ if (block) -+ return block_to_block_object (block); -+ -+ Py_RETURN_NONE; -+} -+ -+PyObject * -+block_to_block_object (struct block *block) -+{ -+ block_object *block_obj; -+ -+ block_obj = PyObject_New (block_object, &block_object_type); -+ if (block_obj == NULL) -+ { -+ PyErr_SetString (PyExc_MemoryError, "Could not allocate block object."); -+ return NULL; -+ } -+ -+ block_obj->block = block; -+ -+ return (PyObject *) block_obj; -+} -+ -+struct block * -+block_object_to_block (PyObject *obj) -+{ -+ if (! PyObject_TypeCheck (obj, &block_object_type)) -+ return NULL; -+ return ((block_object *) obj)->block; -+} -+ -+static PyObject * -+blpy_block_syms_iter (PyObject *self) -+{ -+ return self; -+} -+ -+static PyObject * -+blpy_block_syms_iternext (PyObject *self) -+{ -+ block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) self; -+ struct symbol *sym; -+ -+ if (!iter_obj->initialized_p) -+ { -+ sym = dict_iterator_first (iter_obj->dict, &(iter_obj->iter)); -+ iter_obj->initialized_p = 1; -+ } -+ else -+ sym = dict_iterator_next (&(iter_obj->iter)); -+ -+ return (sym == NULL)? NULL : symbol_to_symbol_object (sym); -+} -+ -+/* Return the innermost lexical block containing the specified pc value, -+ or 0 if there is none. */ -+ -+PyObject * -+gdbpy_block_for_pc (PyObject *self, PyObject *args) -+{ -+ unsigned PY_LONG_LONG pc; -+ struct block *block; -+ PyObject *sym_obj; -+ -+ if (!PyArg_ParseTuple (args, "K", &pc)) -+ return NULL; -+ -+ block = block_for_pc (pc); -+ if (block) -+ return block_to_block_object (block); -+ -+ Py_RETURN_NONE; -+} -+ -+void -+gdbpy_initialize_blocks (void) -+{ -+ block_object_type.tp_new = PyType_GenericNew; -+ if (PyType_Ready (&block_object_type) < 0) -+ return; -+ -+ block_syms_iterator_object_type.tp_new = PyType_GenericNew; -+ if (PyType_Ready (&block_syms_iterator_object_type) < 0) -+ return; -+ -+ Py_INCREF (&block_object_type); -+ PyModule_AddObject (gdb_module, "Block", (PyObject *) &block_object_type); -+ -+ Py_INCREF (&block_syms_iterator_object_type); -+ PyModule_AddObject (gdb_module, "BlockIterator", -+ (PyObject *) &block_syms_iterator_object_type); -+} -+ -+ -+ -+static PyGetSetDef block_object_getset[] = { -+ { "start", blpy_get_start, NULL, "Start address of the block.", NULL }, -+ { "end", blpy_get_end, NULL, "End address of the block.", NULL }, -+ { "function", blpy_get_function, NULL, -+ "Symbol that names the block, or None.", NULL }, -+ { "superblock", blpy_get_superblock, NULL, -+ "Block containing the block, or None.", NULL }, -+ { NULL } /* Sentinel */ -+}; -+ -+PyTypeObject block_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Block", /*tp_name*/ -+ sizeof (block_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ 0, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ 0, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/ -+ "GDB block object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ blpy_iter, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ block_object_getset /* tp_getset */ -+}; -+ -+static PyTypeObject block_syms_iterator_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.BlockIterator", /*tp_name*/ -+ sizeof (block_syms_iterator_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ 0, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ 0, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/ -+ "GDB block syms iterator object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ blpy_block_syms_iter, /* tp_iter */ -+ blpy_block_syms_iternext, /* tp_iternext */ -+ 0 /* tp_methods */ -+}; -diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c -new file mode 100644 -index 0000000..783385e ---- /dev/null -+++ b/gdb/python/py-breakpoint.c -@@ -0,0 +1,666 @@ -+/* Python interface to breakpoints -+ -+ Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "value.h" -+#include "exceptions.h" -+#include "python-internal.h" -+#include "charset.h" -+#include "breakpoint.h" -+#include "gdbcmd.h" -+#include "gdbthread.h" -+#include "observer.h" -+#include "arch-utils.h" -+#include "language.h" -+ -+/* From breakpoint.c. */ -+extern struct breakpoint *breakpoint_chain; -+ -+ -+typedef struct breakpoint_object breakpoint_object; -+ -+static PyTypeObject breakpoint_object_type; -+ -+/* A dynamically allocated vector of breakpoint objects. Each -+ breakpoint has a number. A breakpoint is valid if its slot in this -+ vector is non-null. When a breakpoint is deleted, we drop our -+ reference to it and zero its slot; this is how we let the Python -+ object have a lifetime which is independent from that of the gdb -+ breakpoint. */ -+static breakpoint_object **bppy_breakpoints; -+ -+/* Number of slots in bppy_breakpoints. */ -+static int bppy_slots; -+ -+/* Number of live breakpoints. */ -+static int bppy_live; -+ -+/* Variables used to pass information between the Breakpoint -+ constructor and the breakpoint-created hook function. */ -+static breakpoint_object *bppy_pending_object; -+ -+struct breakpoint_object -+{ -+ PyObject_HEAD -+ -+ /* The breakpoint number according to gdb. */ -+ int number; -+ -+ /* The gdb breakpoint object, or NULL if the breakpoint has been -+ deleted. */ -+ struct breakpoint *bp; -+}; -+ -+/* Evaluate to true if the breakpoint NUM is valid, false otherwise. */ -+#define BPPY_VALID_P(Num) \ -+ ((Num) >= 0 \ -+ && (Num) < bppy_slots \ -+ && bppy_breakpoints[Num] != NULL) -+ -+/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python -+ exception if it is invalid. */ -+#define BPPY_REQUIRE_VALID(Breakpoint) \ -+ do { \ -+ if (! BPPY_VALID_P ((Breakpoint)->number)) \ -+ return PyErr_Format (PyExc_RuntimeError, "breakpoint %d is invalid", \ -+ (Breakpoint)->number); \ -+ } while (0) -+ -+/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python -+ exception if it is invalid. This macro is for use in setter functions. */ -+#define BPPY_SET_REQUIRE_VALID(Breakpoint) \ -+ do { \ -+ if (! BPPY_VALID_P ((Breakpoint)->number)) \ -+ { \ -+ PyErr_Format (PyExc_RuntimeError, "breakpoint %d is invalid", \ -+ (Breakpoint)->number); \ -+ return -1; \ -+ } \ -+ } while (0) -+ -+/* Python function which checks the validity of a breakpoint object. */ -+static PyObject * -+bppy_is_valid (PyObject *self, PyObject *args) -+{ -+ if (((breakpoint_object *) self)->bp) -+ Py_RETURN_TRUE; -+ Py_RETURN_FALSE; -+} -+ -+/* Python function to test whether or not the breakpoint is enabled. */ -+static PyObject * -+bppy_get_enabled (PyObject *self, void *closure) -+{ -+ if (! ((breakpoint_object *) self)->bp) -+ Py_RETURN_FALSE; -+ /* Not clear what we really want here. */ -+ if (((breakpoint_object *) self)->bp->enable_state == bp_enabled) -+ Py_RETURN_TRUE; -+ Py_RETURN_FALSE; -+} -+ -+/* Python function to test whether or not the breakpoint is silent. */ -+static PyObject * -+bppy_get_silent (PyObject *self, void *closure) -+{ -+ BPPY_REQUIRE_VALID ((breakpoint_object *) self); -+ if (((breakpoint_object *) self)->bp->silent) -+ Py_RETURN_TRUE; -+ Py_RETURN_FALSE; -+} -+ -+/* Python function to set the enabled state of a breakpoint. */ -+static int -+bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ int cmp; -+ -+ BPPY_SET_REQUIRE_VALID (self_bp); -+ -+ if (newvalue == NULL) -+ { -+ PyErr_SetString (PyExc_TypeError, "cannot delete `enabled' attribute"); -+ return -1; -+ } -+ else if (! PyBool_Check (newvalue)) -+ { -+ PyErr_SetString (PyExc_TypeError, -+ "the value of `enabled' must be a boolean"); -+ return -1; -+ } -+ -+ cmp = PyObject_IsTrue (newvalue); -+ if (cmp < 0) -+ return -1; -+ else if (cmp == 1) -+ enable_breakpoint (self_bp->bp); -+ else -+ disable_breakpoint (self_bp->bp); -+ return 0; -+} -+ -+/* Python function to set the 'silent' state of a breakpoint. */ -+static int -+bppy_set_silent (PyObject *self, PyObject *newvalue, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ int cmp; -+ -+ BPPY_SET_REQUIRE_VALID (self_bp); -+ -+ if (newvalue == NULL) -+ { -+ PyErr_SetString (PyExc_TypeError, "cannot delete `silent' attribute"); -+ return -1; -+ } -+ else if (! PyBool_Check (newvalue)) -+ { -+ PyErr_SetString (PyExc_TypeError, -+ "the value of `silent' must be a boolean"); -+ return -1; -+ } -+ -+ cmp = PyObject_IsTrue (newvalue); -+ if (cmp < 0) -+ return -1; -+ else -+ self_bp->bp->silent = cmp; -+ -+ return 0; -+} -+ -+/* Python function to set the thread of a breakpoint. */ -+static int -+bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ int id; -+ -+ BPPY_SET_REQUIRE_VALID (self_bp); -+ -+ if (newvalue == NULL) -+ { -+ PyErr_SetString (PyExc_TypeError, "cannot delete `thread' attribute"); -+ return -1; -+ } -+ else if (PyInt_Check (newvalue)) -+ { -+ id = (int) PyInt_AsLong (newvalue); -+ if (! valid_thread_id (id)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "invalid thread id"); -+ return -1; -+ } -+ } -+ else if (newvalue == Py_None) -+ id = -1; -+ else -+ { -+ PyErr_SetString (PyExc_TypeError, -+ "the value of `thread' must be an integer or None"); -+ return -1; -+ } -+ -+ self_bp->bp->thread = id; -+ -+ return 0; -+} -+ -+/* Python function to set the ignore count of a breakpoint. */ -+static int -+bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ long value; -+ -+ BPPY_SET_REQUIRE_VALID (self_bp); -+ -+ if (newvalue == NULL) -+ { -+ PyErr_SetString (PyExc_TypeError, -+ "cannot delete `ignore_count' attribute"); -+ return -1; -+ } -+ else if (! PyInt_Check (newvalue)) -+ { -+ PyErr_SetString (PyExc_TypeError, -+ "the value of `ignore_count' must be an integer"); -+ return -1; -+ } -+ -+ value = PyInt_AsLong (newvalue); -+ if (value < 0) -+ value = 0; -+ set_ignore_count (self_bp->number, (int) value, 0); -+ -+ return 0; -+} -+ -+/* Python function to set the hit count of a breakpoint. */ -+static int -+bppy_set_hit_count (PyObject *self, PyObject *newvalue, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ -+ BPPY_SET_REQUIRE_VALID (self_bp); -+ -+ if (newvalue == NULL) -+ { -+ PyErr_SetString (PyExc_TypeError, "cannot delete `hit_count' attribute"); -+ return -1; -+ } -+ else if (! PyInt_Check (newvalue) || PyInt_AsLong (newvalue) != 0) -+ { -+ PyErr_SetString (PyExc_AttributeError, -+ "the value of `hit_count' must be zero"); -+ return -1; -+ } -+ -+ self_bp->bp->hit_count = 0; -+ -+ return 0; -+} -+ -+/* Python function to get the location of a breakpoint. */ -+static PyObject * -+bppy_get_location (PyObject *self, void *closure) -+{ -+ char *str; -+ -+ BPPY_REQUIRE_VALID ((breakpoint_object *) self); -+ str = ((breakpoint_object *) self)->bp->addr_string; -+ /* FIXME: watchpoints? tracepoints? */ -+ if (! str) -+ str = ""; -+ return PyString_Decode (str, strlen (str), host_charset (), NULL); -+} -+ -+/* Python function to get the condition expression of a breakpoint. */ -+static PyObject * -+bppy_get_condition (PyObject *self, void *closure) -+{ -+ char *str; -+ BPPY_REQUIRE_VALID ((breakpoint_object *) self); -+ -+ str = ((breakpoint_object *) self)->bp->cond_string; -+ if (! str) -+ Py_RETURN_NONE; -+ return PyString_Decode (str, strlen (str), host_charset (), NULL); -+} -+ -+static int -+bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure) -+{ -+ char *exp; -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ volatile struct gdb_exception except; -+ -+ BPPY_SET_REQUIRE_VALID (self_bp); -+ -+ if (newvalue == NULL) -+ { -+ PyErr_SetString (PyExc_TypeError, "cannot delete `condition' attribute"); -+ return -1; -+ } -+ else if (newvalue == Py_None) -+ exp = ""; -+ else -+ { -+ exp = python_string_to_host_string (newvalue); -+ if (exp == NULL) -+ return -1; -+ } -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ set_breakpoint_condition (self_bp->bp, exp, 0); -+ } -+ GDB_PY_SET_HANDLE_EXCEPTION (except); -+ -+ return 0; -+} -+ -+/* Python function to get the commands attached to a breakpoint. */ -+static PyObject * -+bppy_get_commands (PyObject *self, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ long length; -+ volatile struct gdb_exception except; -+ struct ui_file *string_file; -+ struct cleanup *chain; -+ PyObject *result; -+ char *cmdstr; -+ -+ BPPY_REQUIRE_VALID (self_bp); -+ -+ if (! self_bp->bp->commands) -+ Py_RETURN_NONE; -+ -+ string_file = mem_fileopen (); -+ chain = make_cleanup_ui_file_delete (string_file); -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ /* FIXME: this can fail. Maybe we need to be making a new -+ ui_out object here? */ -+ ui_out_redirect (uiout, string_file); -+ print_command_lines (uiout, self_bp->bp->commands, 0); -+ ui_out_redirect (uiout, NULL); -+ } -+ cmdstr = ui_file_xstrdup (string_file, &length); -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ result = PyString_Decode (cmdstr, strlen (cmdstr), host_charset (), NULL); -+ do_cleanups (chain); -+ xfree (cmdstr); -+ return result; -+} -+ -+/* Python function to get the breakpoint's number. */ -+static PyObject * -+bppy_get_number (PyObject *self, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ -+ BPPY_REQUIRE_VALID (self_bp); -+ -+ return PyInt_FromLong (self_bp->number); -+} -+ -+/* Python function to get the breakpoint's thread ID. */ -+static PyObject * -+bppy_get_thread (PyObject *self, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ -+ BPPY_REQUIRE_VALID (self_bp); -+ -+ if (self_bp->bp->thread == -1) -+ Py_RETURN_NONE; -+ -+ return PyInt_FromLong (self_bp->bp->thread); -+} -+ -+/* Python function to get the breakpoint's hit count. */ -+static PyObject * -+bppy_get_hit_count (PyObject *self, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ -+ BPPY_REQUIRE_VALID (self_bp); -+ -+ return PyInt_FromLong (self_bp->bp->hit_count); -+} -+ -+/* Python function to get the breakpoint's ignore count. */ -+static PyObject * -+bppy_get_ignore_count (PyObject *self, void *closure) -+{ -+ breakpoint_object *self_bp = (breakpoint_object *) self; -+ -+ BPPY_REQUIRE_VALID (self_bp); -+ -+ return PyInt_FromLong (self_bp->bp->ignore_count); -+} -+ -+/* Python function to create a new breakpoint. */ -+static PyObject * -+bppy_new (PyTypeObject *subtype, PyObject *args, PyObject *kwargs) -+{ -+ PyObject *result; -+ char *spec; -+ volatile struct gdb_exception except; -+ -+ /* FIXME: allow condition, thread, temporary, ... ? */ -+ if (! PyArg_ParseTuple (args, "s", &spec)) -+ return NULL; -+ result = subtype->tp_alloc (subtype, 0); -+ if (! result) -+ return NULL; -+ bppy_pending_object = (breakpoint_object *) result; -+ bppy_pending_object->number = -1; -+ bppy_pending_object->bp = NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ set_breakpoint (python_gdbarch, spec, NULL, 0, 0, -1, 0, -+ AUTO_BOOLEAN_TRUE, 1); -+ } -+ if (except.reason < 0) -+ { -+ subtype->tp_free (result); -+ return PyErr_Format (except.reason == RETURN_QUIT -+ ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, -+ "%s", except.message); -+ } -+ -+ BPPY_REQUIRE_VALID ((breakpoint_object *) result); -+ return result; -+} -+ -+ -+ -+/* Static function to return a tuple holding all breakpoints. */ -+ -+PyObject * -+gdbpy_breakpoints (PyObject *self, PyObject *args) -+{ -+ PyObject *result; -+ -+ if (bppy_live == 0) -+ Py_RETURN_NONE; -+ -+ result = PyTuple_New (bppy_live); -+ if (result) -+ { -+ int i, out = 0; -+ for (i = 0; out < bppy_live; ++i) -+ { -+ if (! bppy_breakpoints[i]) -+ continue; -+ Py_INCREF (bppy_breakpoints[i]); -+ PyTuple_SetItem (result, out, (PyObject *) bppy_breakpoints[i]); -+ ++out; -+ } -+ } -+ return result; -+} -+ -+ -+ -+/* Event callback functions. */ -+ -+/* Callback that is used when a breakpoint is created. This function -+ will create a new Python breakpoint object. */ -+static void -+gdbpy_breakpoint_created (int num) -+{ -+ breakpoint_object *newbp; -+ struct breakpoint *bp; -+ struct cleanup *cleanup; -+ -+ if (num < 0) -+ return; -+ -+ for (bp = breakpoint_chain; bp; bp = bp->next) -+ if (bp->number == num) -+ break; -+ if (! bp) -+ return; -+ -+ if (num >= bppy_slots) -+ { -+ int old = bppy_slots; -+ bppy_slots = bppy_slots * 2 + 10; -+ bppy_breakpoints -+ = (breakpoint_object **) xrealloc (bppy_breakpoints, -+ (bppy_slots -+ * sizeof (breakpoint_object *))); -+ memset (&bppy_breakpoints[old], 0, -+ (bppy_slots - old) * sizeof (PyObject *)); -+ } -+ -+ ++bppy_live; -+ -+ cleanup = ensure_python_env (get_current_arch (), current_language); -+ -+ if (bppy_pending_object) -+ { -+ newbp = bppy_pending_object; -+ bppy_pending_object = NULL; -+ } -+ else -+ newbp = PyObject_New (breakpoint_object, &breakpoint_object_type); -+ if (newbp) -+ { -+ PyObject *hookfn; -+ -+ newbp->number = num; -+ newbp->bp = bp; -+ bppy_breakpoints[num] = newbp; -+ -+ hookfn = gdbpy_get_hook_function ("new_breakpoint"); -+ if (hookfn) -+ { -+ PyObject *result; -+ result = PyObject_CallFunctionObjArgs (hookfn, newbp, NULL); -+ if (result) -+ { -+ Py_DECREF (result); -+ } -+ Py_DECREF (hookfn); -+ } -+ } -+ -+ /* Just ignore errors here. */ -+ PyErr_Clear (); -+ -+ do_cleanups (cleanup); -+} -+ -+/* Callback that is used when a breakpoint is deleted. This will -+ invalidate the corresponding Python object. */ -+static void -+gdbpy_breakpoint_deleted (int num) -+{ -+ struct cleanup *cleanup; -+ -+ cleanup = ensure_python_env (get_current_arch (), current_language); -+ if (BPPY_VALID_P (num)) -+ { -+ bppy_breakpoints[num]->bp = NULL; -+ Py_DECREF (bppy_breakpoints[num]); -+ bppy_breakpoints[num] = NULL; -+ --bppy_live; -+ } -+ do_cleanups (cleanup); -+} -+ -+ -+ -+/* Initialize the Python breakpoint code. */ -+void -+gdbpy_initialize_breakpoints (void) -+{ -+ breakpoint_object_type.tp_new = bppy_new; -+ if (PyType_Ready (&breakpoint_object_type) < 0) -+ return; -+ -+ Py_INCREF (&breakpoint_object_type); -+ PyModule_AddObject (gdb_module, "Breakpoint", -+ (PyObject *) &breakpoint_object_type); -+ -+ observer_attach_breakpoint_created (gdbpy_breakpoint_created); -+ observer_attach_breakpoint_deleted (gdbpy_breakpoint_deleted); -+} -+ -+ -+ -+static PyGetSetDef breakpoint_object_getset[] = { -+ { "enabled", bppy_get_enabled, bppy_set_enabled, -+ "Boolean telling whether the breakpoint is enabled.", NULL }, -+ { "silent", bppy_get_silent, bppy_set_silent, -+ "Boolean telling whether the breakpoint is silent.", NULL }, -+ { "thread", bppy_get_thread, bppy_set_thread, -+ "Thread ID for the breakpoint.\n\ -+If the value is a thread ID (integer), then this is a thread-specific breakpoint.\n\ -+If the value is None, then this breakpoint not thread-specific.\n\ -+No other type of value can be used.", NULL }, -+ { "ignore_count", bppy_get_ignore_count, bppy_set_ignore_count, -+ "Number of times this breakpoint should be automatically continued.", -+ NULL }, -+ { "number", bppy_get_number, NULL, -+ "Breakpoint's number assigned by GDB.", NULL }, -+ { "hit_count", bppy_get_hit_count, bppy_set_hit_count, -+ "Number of times the breakpoint has been hit.\n\ -+Can be set to zero to clear the count. No other value is valid\n\ -+when setting this property.", NULL }, -+ { "location", bppy_get_location, NULL, -+ "Location of the breakpoint, as specified by the user.", NULL}, -+ { "condition", bppy_get_condition, bppy_set_condition, -+ "Condition of the breakpoint, as specified by the user,\ -+or None if no condition set."}, -+ { "commands", bppy_get_commands, NULL, -+ "Commands of the breakpoint, as specified by the user."}, -+ { NULL } /* Sentinel. */ -+}; -+ -+static PyMethodDef breakpoint_object_methods[] = -+{ -+ { "is_valid", bppy_is_valid, METH_NOARGS, -+ "Return true if this breakpoint is valid, false if not." }, -+ { NULL } /* Sentinel. */ -+}; -+ -+static PyTypeObject breakpoint_object_type = -+{ -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Breakpoint", /*tp_name*/ -+ sizeof (breakpoint_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ 0, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ 0, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT, /*tp_flags*/ -+ "GDB breakpoint object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ breakpoint_object_methods, /* tp_methods */ -+ 0, /* tp_members */ -+ breakpoint_object_getset /* tp_getset */ -+}; -diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c -index ae462d9..dd364df 100644 ---- a/gdb/python/py-cmd.c -+++ b/gdb/python/py-cmd.c -@@ -49,8 +49,7 @@ static struct cmdpy_completer completers[] = - - #define N_COMPLETERS (sizeof (completers) / sizeof (completers[0])) - --/* A gdb command. For the time being only ordinary commands (not -- set/show commands) are allowed. */ -+/* A gdb command. */ - struct cmdpy_object - { - PyObject_HEAD -@@ -263,10 +262,13 @@ cmdpy_completer (struct cmd_list_element *command, char *text, char *word) - *BASE_LIST is set to the final prefix command's list of - *sub-commands. - -+ START_LIST is the list in which the search starts. -+ - This function returns the xmalloc()d name of the new command. On - error sets the Python error and returns NULL. */ --static char * --parse_command_name (char *text, struct cmd_list_element ***base_list) -+char * -+gdbpy_parse_command_name (char *text, struct cmd_list_element ***base_list, -+ struct cmd_list_element **start_list) - { - struct cmd_list_element *elt; - int len = strlen (text); -@@ -299,7 +301,7 @@ parse_command_name (char *text, struct cmd_list_element ***base_list) - ; - if (i < 0) - { -- *base_list = &cmdlist; -+ *base_list = start_list; - return result; - } - -@@ -308,7 +310,7 @@ parse_command_name (char *text, struct cmd_list_element ***base_list) - prefix_text[i + 1] = '\0'; - - text = prefix_text; -- elt = lookup_cmd_1 (&text, cmdlist, NULL, 1); -+ elt = lookup_cmd_1 (&text, *start_list, NULL, 1); - if (!elt || elt == (struct cmd_list_element *) -1) - { - PyErr_Format (PyExc_RuntimeError, _("could not find command prefix %s"), -@@ -399,7 +401,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw) - return -1; - } - -- cmd_name = parse_command_name (name, &cmd_list); -+ cmd_name = gdbpy_parse_command_name (name, &cmd_list, &cmdlist); - if (! cmd_name) - return -1; - -diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c -index 334bad9..524353d 100644 ---- a/gdb/python/py-frame.c -+++ b/gdb/python/py-frame.c -@@ -202,10 +202,59 @@ frapy_pc (PyObject *self, PyObject *args) - return PyLong_FromUnsignedLongLong (pc); - } - -+/* Implementation of gdb.Frame.block (self) -> gdb.Block. -+ Returns the frame's code block. */ -+ -+static PyObject * -+frapy_block (PyObject *self, PyObject *args) -+{ -+ struct frame_info *frame; -+ struct block *block = NULL; -+ volatile struct gdb_exception except; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ FRAPY_REQUIRE_VALID ((frame_object *) self, frame); -+ -+ block = block_for_pc (get_frame_address_in_block (frame)); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (block) -+ return block_to_block_object (block); -+ -+ Py_RETURN_NONE; -+} -+ -+ -+/* Implementation of gdb.Frame.function (self) -> gdb.Symbol. -+ Returns the symbol for the function corresponding to this frame. */ -+ -+static PyObject * -+frapy_function (PyObject *self, PyObject *args) -+{ -+ struct symbol *sym = NULL; -+ struct frame_info *frame; -+ volatile struct gdb_exception except; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ FRAPY_REQUIRE_VALID ((frame_object *) self, frame); -+ -+ sym = find_pc_function (get_frame_address_in_block (frame)); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (sym) -+ return symbol_to_symbol_object (sym); -+ -+ Py_RETURN_NONE; -+} -+ - /* Convert a frame_info struct to a Python Frame object. - Sets a Python exception and returns NULL on error. */ - --static frame_object * -+PyObject * - frame_info_to_frame_object (struct frame_info *frame) - { - frame_object *frame_obj; -@@ -235,7 +284,7 @@ frame_info_to_frame_object (struct frame_info *frame) - - frame_obj->gdbarch = get_frame_arch (frame); - -- return frame_obj; -+ return (PyObject *) frame_obj; - } - - /* Implementation of gdb.Frame.older (self) -> gdb.Frame. -@@ -296,7 +345,30 @@ frapy_newer (PyObject *self, PyObject *args) - return next_obj; - } - --/* Implementation of gdb.Frame.read_var_value (self, variable) -> gdb.Value. -+/* Implementation of gdb.Frame.find_sal (self) -> gdb.Symtab_and_line. -+ Returns the frame's symtab and line. */ -+ -+static PyObject * -+frapy_find_sal (PyObject *self, PyObject *args) -+{ -+ struct frame_info *frame; -+ struct symtab_and_line sal; -+ volatile struct gdb_exception except; -+ PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */ -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ FRAPY_REQUIRE_VALID ((frame_object *) self, frame); -+ -+ find_frame_sal (frame, &sal); -+ sal_obj = symtab_and_line_to_sal_object (sal); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ return sal_obj; -+} -+ -+/* Implementation of gdb.Frame.read_var (self, variable) -> gdb.Value. - Returns the value of the given variable in this frame. The argument must be - a string. Returns None if GDB can't find the specified variable. */ - -@@ -312,7 +384,9 @@ frapy_read_var (PyObject *self, PyObject *args) - if (!PyArg_ParseTuple (args, "O", &sym_obj)) - return NULL; - -- if (gdbpy_is_string (sym_obj)) -+ if (PyObject_TypeCheck (sym_obj, &symbol_object_type)) -+ var = symbol_object_to_symbol (sym_obj); -+ else if (gdbpy_is_string (sym_obj)) - { - char *var_name; - struct block *block = NULL; -@@ -365,6 +439,25 @@ frapy_read_var (PyObject *self, PyObject *args) - Py_RETURN_NONE; - } - -+/* Select this frame. */ -+ -+static PyObject * -+frapy_select (PyObject *self, PyObject *args) -+{ -+ struct frame_info *fi; -+ frame_object *frame = (frame_object *) self; -+ volatile struct gdb_exception except; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ FRAPY_REQUIRE_VALID (frame, fi); -+ select_frame (fi); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ Py_RETURN_NONE; -+} -+ - /* Implementation of gdb.selected_frame () -> gdb.Frame. - Returns the selected frame object. */ - -@@ -372,7 +465,7 @@ PyObject * - gdbpy_selected_frame (PyObject *self, PyObject *args) - { - struct frame_info *frame; -- frame_object *frame_obj = NULL; /* Initialize to appease gcc warning. */ -+ PyObject *frame_obj = NULL; /* Initialize to appease gcc warning. */ - volatile struct gdb_exception except; - - TRY_CATCH (except, RETURN_MASK_ALL) -@@ -382,7 +475,7 @@ gdbpy_selected_frame (PyObject *self, PyObject *args) - } - GDB_PY_HANDLE_EXCEPTION (except); - -- return (PyObject *) frame_obj; -+ return frame_obj; - } - - /* Implementation of gdb.stop_reason_string (Integer) -> String. -@@ -484,15 +577,26 @@ Return the reason why it's not possible to find frames older than this." }, - { "pc", frapy_pc, METH_NOARGS, - "pc () -> Long.\n\ - Return the frame's resume address." }, -+ { "block", frapy_block, METH_NOARGS, -+ "block () -> gdb.Block.\n\ -+Return the frame's code block." }, -+ { "function", frapy_function, METH_NOARGS, -+ "function () -> gdb.Symbol.\n\ -+Returns the symbol for the function corresponding to this frame." }, - { "older", frapy_older, METH_NOARGS, - "older () -> gdb.Frame.\n\ - Return the frame that called this frame." }, - { "newer", frapy_newer, METH_NOARGS, - "newer () -> gdb.Frame.\n\ - Return the frame called by this frame." }, -+ { "find_sal", frapy_find_sal, METH_NOARGS, -+ "find_sal () -> gdb.Symtab_and_line.\n\ -+Return the frame's symtab and line." }, - { "read_var", frapy_read_var, METH_VARARGS, - "read_var (variable) -> gdb.Value.\n\ - Return the value of the variable in this frame." }, -+ { "select", frapy_select, METH_NOARGS, -+ "Select this frame as the user's current frame." }, - {NULL} /* Sentinel */ - }; - -diff --git a/gdb/python/py-hooks.c b/gdb/python/py-hooks.c -new file mode 100644 -index 0000000..a3140bc ---- /dev/null -+++ b/gdb/python/py-hooks.c -@@ -0,0 +1,50 @@ -+/* Notifications from gdb to Python -+ -+ Copyright (C) 2008 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "cli/cli-decode.h" -+#include "charset.h" -+#include "python.h" -+#include "python-internal.h" -+#include "observer.h" -+ -+PyObject * -+gdbpy_get_hook_function (const char *name) -+{ -+ PyObject *hooks; -+ PyObject *result; -+ -+ if (! PyObject_HasAttrString (gdb_module, "hooks")) -+ return NULL; -+ hooks = PyObject_GetAttrString (gdb_module, "hooks"); -+ if (! hooks) -+ return NULL; -+ /* The cast is because the Python function doesn't declare const argument. -+ This is a problem in Python version 2.4, but not in 2.5. */ -+ if (! PyObject_HasAttrString (hooks, (char *) name)) -+ { -+ Py_DECREF (hooks); -+ return NULL; -+ } -+ /* The cast is because the Python function doesn't declare const argument. -+ This is a problem in Python version 2.4, but not in 2.5. */ -+ result = PyObject_GetAttrString (hooks, (char *) name); -+ Py_DECREF (hooks); -+ return result; -+} -diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c -new file mode 100644 -index 0000000..b259ab5 ---- /dev/null -+++ b/gdb/python/py-inferior.c -@@ -0,0 +1,934 @@ -+/* Python interface to inferiors. -+ -+ Copyright (C) 2009, 2010 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "exceptions.h" -+#include "gdbcore.h" -+#include "gdbthread.h" -+#include "inferior.h" -+#include "observer.h" -+#include "python-internal.h" -+#include "arch-utils.h" -+#include "language.h" -+ -+struct threadlist_entry { -+ thread_object *thread_obj; -+ struct threadlist_entry *next; -+}; -+ -+typedef struct -+{ -+ PyObject_HEAD -+ -+ /* The inferior we represent. */ -+ struct inferior *inferior; -+ -+ /* thread_object instances under this inferior. This list owns a reference -+ to each object it contains. */ -+ struct threadlist_entry *threads; -+ -+ /* Number of threads in the list. */ -+ int nthreads; -+} inferior_object; -+ -+static PyTypeObject inferior_object_type; -+ -+typedef struct { -+ PyObject_HEAD -+ void *buffer; -+ -+ /* These are kept just for mbpy_str. */ -+ CORE_ADDR addr; -+ CORE_ADDR length; -+} membuf_object; -+ -+static PyTypeObject membuf_object_type; -+ -+/* Require that INFERIOR be a valid inferior ID. */ -+#define INFPY_REQUIRE_VALID(Inferior) \ -+ do { \ -+ if (!Inferior->inferior) \ -+ { \ -+ PyErr_SetString (PyExc_RuntimeError, \ -+ "inferior no longer exists"); \ -+ return NULL; \ -+ } \ -+ } while (0) -+ -+struct inflist_entry { -+ inferior_object *inf_obj; -+ struct inflist_entry *next; -+}; -+ -+ -+ -+/* Inferior objects list. */ -+ -+/* List containing inferior_objects. This list owns a reference to each -+ object it contains. */ -+static struct inflist_entry *gdbpy_inferior_list; -+ -+static int ninferiors; -+ -+ -+/* An observer callback function that is called when an inferior has -+ been created. Creates a corresponding Python object for the inferior -+ and adds it to the list. */ -+static void -+add_inferior_object (int pid) -+{ -+ struct inferior *inf = find_inferior_pid (pid); -+ inferior_object *inf_obj; -+ struct inflist_entry *entry; -+ struct cleanup *cleanup; -+ -+ if (!inf) -+ { -+ warning (_("Can't create Python Inferior object.")); -+ return; -+ } -+ -+ /* While creating new inferior no inferior thread is available. Therefore -+ get_current_arch has no valid current frame (and it would crash). */ -+ -+ cleanup = ensure_python_env (target_gdbarch, current_language); -+ -+ inf_obj = PyObject_New (inferior_object, &inferior_object_type); -+ if (!inf_obj) -+ { -+ warning (_("Can't create Python Inferior object.")); -+ gdbpy_print_stack (); -+ do_cleanups (cleanup); -+ return; -+ } -+ -+ inf_obj->inferior = inf; -+ inf_obj->threads = NULL; -+ inf_obj->nthreads = 0; -+ -+ entry = xmalloc (sizeof (struct inflist_entry)); -+ entry->inf_obj = inf_obj; -+ entry->next = gdbpy_inferior_list; -+ -+ gdbpy_inferior_list = entry; -+ -+ ninferiors++; -+ -+ do_cleanups (cleanup); -+} -+ -+/* An observer callback function that is called when an inferior has -+ been deleted. Removes the corresponding Python object from the -+ inferior list, and removes the list's reference to the object. */ -+static void -+delete_inferior_object (int pid) -+{ -+ struct cleanup *cleanup; -+ struct inflist_entry **inf_entry, *inf_tmp; -+ struct threadlist_entry *th_entry, *th_tmp; -+ -+ /* Find inferior_object for the given PID. */ -+ for (inf_entry = &gdbpy_inferior_list; *inf_entry != NULL; -+ inf_entry = &(*inf_entry)->next) -+ if ((*inf_entry)->inf_obj->inferior->pid == pid) -+ break; -+ -+ if (!*inf_entry) -+ return; -+ -+ cleanup = ensure_python_env (get_current_arch (), current_language); -+ -+ inf_tmp = *inf_entry; -+ inf_tmp->inf_obj->inferior = NULL; -+ -+ /* Deallocate threads list. */ -+ for (th_entry = inf_tmp->inf_obj->threads; th_entry != NULL;) -+ { -+ Py_DECREF (th_entry->thread_obj); -+ -+ th_tmp = th_entry; -+ th_entry = th_entry->next; -+ xfree (th_tmp); -+ } -+ -+ inf_tmp->inf_obj->nthreads = 0; -+ -+ *inf_entry = (*inf_entry)->next; -+ Py_DECREF (inf_tmp->inf_obj); -+ xfree (inf_tmp); -+ -+ ninferiors--; -+ -+ do_cleanups (cleanup); -+} -+ -+/* Finds the Python Inferior object for the given pid. Returns a borrowed -+ reference. */ -+PyObject * -+find_inferior_object (int pid) -+{ -+ struct inflist_entry *p; -+ -+ for (p = gdbpy_inferior_list; p != NULL; p = p->next) -+ if (p->inf_obj->inferior->pid == pid) -+ return (PyObject *) p->inf_obj; -+ -+ return NULL; -+} -+ -+/* Finds the Python InferiorThread object for the given ptid. Returns a -+ borrowed reference. */ -+thread_object * -+find_thread_object (ptid_t ptid) -+{ -+ int pid; -+ struct inflist_entry *p; -+ struct threadlist_entry *q; -+ -+ pid = PIDGET (ptid); -+ for (p = gdbpy_inferior_list; p != NULL; p = p->next) -+ if (p->inf_obj->inferior->pid == pid) -+ for (q = p->inf_obj->threads; q != NULL; q = q->next) -+ if (ptid_equal (q->thread_obj->thread->ptid, ptid)) -+ return q->thread_obj; -+ -+ return NULL; -+} -+ -+ -+ -+/* Inferior object. */ -+ -+static void -+add_thread_object (struct thread_info *tp) -+{ -+ struct cleanup *cleanup; -+ thread_object *thread_obj; -+ inferior_object *inf_obj; -+ struct threadlist_entry *entry; -+ -+ /* Note that the arch does not matter here, because we can't run -+ arbitrary Python code. Calling get_current_arch here will -+ crash. */ -+ cleanup = ensure_python_env (target_gdbarch, current_language); -+ -+ thread_obj = create_thread_object (tp); -+ if (!thread_obj) -+ { -+ warning (_("Can't create Python InferiorThread object.")); -+ gdbpy_print_stack (); -+ do_cleanups (cleanup); -+ return; -+ } -+ -+ inf_obj = (inferior_object *) thread_obj->inf_obj; -+ -+ entry = xmalloc (sizeof (struct threadlist_entry)); -+ entry->thread_obj = thread_obj; -+ entry->next = inf_obj->threads; -+ -+ inf_obj->threads = entry; -+ inf_obj->nthreads++; -+ -+ do_cleanups (cleanup); -+} -+ -+static void -+delete_thread_object (struct thread_info *tp, int ignore) -+{ -+ struct cleanup *cleanup; -+ inferior_object *inf_obj; -+ thread_object *thread_obj; -+ struct threadlist_entry **entry, *tmp; -+ -+ inf_obj = (inferior_object *) find_inferior_object (PIDGET(tp->ptid)); -+ if (!inf_obj) -+ return; -+ -+ /* Find thread entry in its inferior's thread_list. */ -+ for (entry = &inf_obj->threads; *entry != NULL; entry = &(*entry)->next) -+ if ((*entry)->thread_obj->thread == tp) -+ break; -+ -+ if (!*entry) -+ return; -+ -+ cleanup = ensure_python_env (get_current_arch (), current_language); -+ -+ tmp = *entry; -+ tmp->thread_obj->thread = NULL; -+ -+ *entry = (*entry)->next; -+ inf_obj->nthreads--; -+ -+ Py_DECREF (tmp->thread_obj); -+ xfree (tmp); -+ -+ -+ do_cleanups (cleanup); -+} -+ -+static PyObject * -+infpy_threads (PyObject *self, PyObject *args) -+{ -+ int i; -+ struct threadlist_entry *entry; -+ inferior_object *inf_obj = (inferior_object *) self; -+ PyObject *tuple; -+ -+ INFPY_REQUIRE_VALID (inf_obj); -+ -+ -+ tuple = PyTuple_New (inf_obj->nthreads); -+ if (!tuple) -+ return NULL; -+ -+ /* The list is in reverse order of thread age (i.e., newest comes first), -+ is this a problem? */ -+ for (i = 0, entry = inf_obj->threads; i < inf_obj->nthreads; -+ i++, entry = entry->next) -+ { -+ Py_INCREF (entry->thread_obj); -+ PyTuple_SET_ITEM (tuple, i, (PyObject *) entry->thread_obj); -+ } -+ -+ return tuple; -+} -+ -+static PyObject * -+infpy_get_num (PyObject *self, void *closure) -+{ -+ inferior_object *inf = (inferior_object *) self; -+ -+ INFPY_REQUIRE_VALID (inf); -+ -+ return PyLong_FromLong (inf->inferior->num); -+} -+ -+static PyObject * -+infpy_get_pid (PyObject *self, void *closure) -+{ -+ inferior_object *inf = (inferior_object *) self; -+ -+ INFPY_REQUIRE_VALID (inf); -+ -+ return PyLong_FromLong (inf->inferior->pid); -+} -+ -+static PyObject * -+infpy_get_was_attached (PyObject *self, void *closure) -+{ -+ inferior_object *inf = (inferior_object *) self; -+ INFPY_REQUIRE_VALID (inf); -+ if (inf->inferior->attach_flag) -+ Py_RETURN_TRUE; -+ Py_RETURN_FALSE; -+} -+ -+ -+ -+/* Implementation of gdb.inferiors () -> (gdb.Inferior, ...). -+ Returns a list of all inferiors. */ -+ -+PyObject * -+gdbpy_inferiors (PyObject *unused, PyObject *unused2) -+{ -+ int i; -+ struct inflist_entry *entry; -+ PyObject *tuple; -+ -+ tuple = PyTuple_New (ninferiors); -+ if (!tuple) -+ return NULL; -+ -+ /* The list is in reverse order of inferior age (i.e., newest comes first), -+ is this a problem? */ -+ for (i = 0, entry = gdbpy_inferior_list; -+ i < ninferiors; -+ i++, entry = entry->next) -+ { -+ Py_INCREF (entry->inf_obj); -+ PyTuple_SET_ITEM (tuple, i, (PyObject *) entry->inf_obj); -+ } -+ -+ return tuple; -+} -+ -+ -+ -+/* Membuf and memory manipulation. */ -+ -+/* Implementation of gdb.read_memory (address, length). -+ Returns a Python buffer object with LENGTH bytes of the inferior's memory -+ at ADDRESS. Both arguments are integers. */ -+ -+static PyObject * -+infpy_read_memory (PyObject *self, PyObject *args) -+{ -+ int error = 0; -+ CORE_ADDR addr, length; -+ void *buffer = NULL; -+ membuf_object *membuf_obj; -+ PyObject *addr_obj, *length_obj; -+ struct cleanup *cleanups; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "OO", &addr_obj, &length_obj)) -+ return NULL; -+ -+ cleanups = make_cleanup (null_cleanup, NULL); -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (!get_addr_from_python (addr_obj, &addr) -+ || !get_addr_from_python (length_obj, &length)) -+ { -+ error = 1; -+ break; -+ } -+ -+ buffer = xmalloc (length); -+ make_cleanup (xfree, buffer); -+ -+ read_memory (addr, buffer, length); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (error) -+ { -+ do_cleanups (cleanups); -+ return NULL; -+ } -+ -+ membuf_obj = PyObject_New (membuf_object, &membuf_object_type); -+ if (membuf_obj == NULL) -+ { -+ PyErr_SetString (PyExc_MemoryError, -+ "Could not allocate memory buffer object."); -+ do_cleanups (cleanups); -+ return NULL; -+ } -+ -+ discard_cleanups (cleanups); -+ -+ membuf_obj->buffer = buffer; -+ membuf_obj->addr = addr; -+ membuf_obj->length = length; -+ -+ return PyBuffer_FromReadWriteObject ((PyObject *) membuf_obj, 0, -+ Py_END_OF_BUFFER); -+} -+ -+/* Implementation of gdb.write_memory (address, buffer [, length]). -+ Writes the contents of BUFFER (a Python object supporting the read buffer -+ protocol) at ADDRESS in the inferior's memory. Write LENGTH bytes from -+ BUFFER, or its entire contents if the argument is not provided. The -+ function returns nothing. */ -+ -+static PyObject * -+infpy_write_memory (PyObject *self, PyObject *args) -+{ -+ int buf_len, error = 0; -+ const char *buffer; -+ CORE_ADDR addr, length; -+ PyObject *addr_obj, *length_obj = NULL; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "Os#|O", &addr_obj, &buffer, &buf_len, -+ &length_obj)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (!get_addr_from_python (addr_obj, &addr)) -+ { -+ error = 1; -+ break; -+ } -+ -+ if (!length_obj) -+ length = buf_len; -+ else if (!get_addr_from_python (length_obj, &length)) -+ { -+ error = 1; -+ break; -+ } -+ -+ write_memory (addr, buffer, length); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (error) -+ return NULL; -+ -+ Py_RETURN_NONE; -+} -+ -+/* Destructor of Membuf objects. */ -+ -+static void -+mbpy_dealloc (PyObject *self) -+{ -+ xfree (((membuf_object *) self)->buffer); -+ self->ob_type->tp_free (self); -+} -+ -+/* Return a description of the Membuf object. */ -+ -+static PyObject * -+mbpy_str (PyObject *self) -+{ -+ membuf_object *membuf_obj = (membuf_object *) self; -+ -+ return PyString_FromFormat ("memory buffer for address %s, %s bytes long", -+ paddress (python_gdbarch, membuf_obj->addr), -+ pulongest (membuf_obj->length)); -+} -+ -+static Py_ssize_t -+get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr) -+{ -+ membuf_object *membuf_obj = (membuf_object *) self; -+ -+ if (segment) -+ { -+ PyErr_SetString (PyExc_SystemError, -+ "The memory buffer supports only one segment."); -+ return -1; -+ } -+ -+ *ptrptr = membuf_obj->buffer; -+ -+ return membuf_obj->length; -+} -+ -+static Py_ssize_t -+get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr) -+{ -+ return get_read_buffer (self, segment, ptrptr); -+} -+ -+static Py_ssize_t -+get_seg_count (PyObject *self, Py_ssize_t *lenp) -+{ -+ if (lenp) -+ *lenp = ((membuf_object *) self)->length; -+ -+ return 1; -+} -+ -+static Py_ssize_t -+get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr) -+{ -+ void *ptr = NULL; -+ Py_ssize_t ret; -+ -+ ret = get_read_buffer (self, segment, &ptr); -+ *ptrptr = (char *) ptr; -+ -+ return ret; -+} -+ -+/* Adds GDB value V to the pattern buffer in *PATTERN_BUF. If SIZE is not zero, -+ it specifies the number of bytes from V to copy to *PATTERN_BUF. The -+ function increases the size of *PATTERN_BUF as necessary, adjusting -+ *PATTERN_BUF_END and *PATTERN_BUF_SIZE in the process. */ -+ -+static void -+add_value_pattern (struct value *v, int size, char **pattern_buf, -+ char **pattern_buf_end, ULONGEST *pattern_buf_size) -+{ -+ int val_bytes; -+ -+ if (size) -+ { -+ LONGEST x = value_as_long (v); -+ -+ if (size == 1) -+ *(*pattern_buf_end)++ = x; -+ else -+ { -+ put_bits (x, *pattern_buf_end, size * 8, -+ gdbarch_byte_order (python_gdbarch) == BFD_ENDIAN_BIG); -+ *pattern_buf_end += size; -+ } -+ } -+ else -+ { -+ val_bytes = TYPE_LENGTH (value_type (v)); -+ -+ increase_pattern_buffer (pattern_buf, pattern_buf_end, -+ pattern_buf_size, val_bytes); -+ -+ memcpy (*pattern_buf_end, value_contents_raw (v), val_bytes); -+ *pattern_buf_end += val_bytes; -+ } -+} -+ -+/* This function does the actual work of constructing the pattern buffer from -+ OBJ. If OBJ is an object which implements the read buffer protocol (such -+ as a string, a byte array or gdb.Membuf), then its contents are directly -+ copied to *PATTERN_BUF. If it is a list, then this function is recursively -+ called for each of its elements. If OBJ is an object which can be converted -+ to a GDB value, then the contents of the value are copied to PATTERN_BUF. -+ If SIZE is different than zero, then it limits the number of bytes which -+ are copied to the buffer in case OBJ is converted to a GDB value. That -+ means that SIZE influences only Python scalars and gdb.Value objects. -+ The function increases the size of *PATTERN_BUF as necessary, adjusting -+ *PATTERN_BUF_END and *PATTERN_BUF_SIZE in the process. -+ -+ Returns 1 on success or 0 on failure, with a Python exception set. This -+ function can also throw GDB exceptions. */ -+ -+static int -+add_pattern_element (PyObject *obj, int size, char **pattern_buf, -+ char **pattern_buf_end, ULONGEST *pattern_buf_size) -+{ -+ if (PyObject_CheckReadBuffer (obj)) -+ { -+ /* Handle string, Unicode string, byte array, gdb.Membuf and any other -+ object implementing the buffer protocol. The SIZE parameter is -+ ignored in this case. */ -+ -+ Py_ssize_t val_bytes; -+ const void *buffer; -+ -+ if (PyObject_AsReadBuffer (obj, &buffer, &val_bytes) == -1) -+ return 0; -+ -+ increase_pattern_buffer (pattern_buf, pattern_buf_end, -+ pattern_buf_size, val_bytes); -+ -+ memcpy (*pattern_buf_end, buffer, val_bytes); -+ *pattern_buf_end += val_bytes; -+ } -+ else if (gdbpy_is_value_object (obj)) -+ add_value_pattern (value_object_to_value (obj), size, pattern_buf, -+ pattern_buf_end, pattern_buf_size); -+ else if (PySequence_Check (obj)) -+ { -+ /* Handle lists and tuples. */ -+ -+ Py_ssize_t i, num_objs; -+ -+ num_objs = PySequence_Size (obj); -+ for (i = 0; i < num_objs; i++) -+ if (!add_pattern_element (PySequence_GetItem (obj, i), size, -+ pattern_buf, pattern_buf_end, -+ pattern_buf_size)) -+ return 0; -+ } -+ else -+ { -+ /* See if we can convert from a Python object to a GDB value. */ -+ -+ struct value *v = convert_value_from_python (obj); -+ -+ if (v) -+ add_value_pattern (v, size, pattern_buf, pattern_buf_end, -+ pattern_buf_size); -+ else -+ return 0; -+ } -+ -+ return 1; -+} -+ -+/* Constructs the search pattern from OBJ, putting it in *PATTERN_BUFP, and its -+ size in *PATTERN_LENP. See the function add_pattern_element to learn how -+ the search pattern is obtained from OBJ. -+ -+ Returns 1 on success or 0 on failure, with a Python exception set. This -+ function can also throw GDB exceptions. */ -+ -+static int -+get_search_pattern (PyObject *obj, int size, char **pattern_bufp, -+ ULONGEST *pattern_lenp) -+{ -+ /* Buffer to hold the search pattern. */ -+ char *pattern_buf; -+ /* Current size of search pattern buffer. -+ We realloc space as needed. */ -+ ULONGEST pattern_buf_size; -+ /* Pointer to one past the last in-use part of pattern_buf. */ -+ char *pattern_buf_end; -+ struct cleanup *old_cleanups; -+ -+ allocate_pattern_buffer (&pattern_buf, &pattern_buf_end, &pattern_buf_size); -+ old_cleanups = make_cleanup (free_current_contents, &pattern_buf); -+ -+ if (!add_pattern_element (obj, size, &pattern_buf, &pattern_buf_end, -+ &pattern_buf_size)) -+ { -+ do_cleanups (old_cleanups); -+ -+ return 0; -+ } -+ -+ *pattern_bufp = pattern_buf; -+ *pattern_lenp = pattern_buf_end - pattern_buf; -+ -+ discard_cleanups (old_cleanups); -+ -+ return 1; -+} -+ -+/* Implementation of -+ gdb.search_memory (address, length, pattern [, size] [, max_count]). -+ The third argument may be either a pattern, or a list or tupple of patterns -+ to be searched. Size is the size in bytes of each search query value, either -+ 1, 2, 4 or 8. Returns a list of the addresses where matches were found. */ -+ -+static PyObject * -+infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) -+{ -+ int size = 0; -+ unsigned int found_count = 0; -+ long max_count = 0; -+ CORE_ADDR start_addr, length; -+ char *pattern_buf; -+ static char *keywords[] = { "address", "length", "pattern", "size", -+ "max_count", NULL }; -+ ULONGEST pattern_len, search_space_len; -+ PyObject *pattern, *list = NULL, *start_addr_obj, *length_obj; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTupleAndKeywords (args, kw, "OOO|il", keywords, -+ &start_addr_obj, &length_obj, &pattern, -+ &size, &max_count)) -+ return NULL; -+ -+ if (!max_count) -+ max_count = LONG_MAX; -+ -+ if (size != 0 && size != 1 && size != 2 && size != 4 && size != 8) -+ { -+ PyErr_SetString (PyExc_ValueError, "invalid pattern size"); -+ return NULL; -+ } -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (get_addr_from_python (start_addr_obj, &start_addr) -+ && get_addr_from_python (length_obj, &length)) -+ { -+ if (!length) -+ { -+ PyErr_SetString (PyExc_ValueError, "empty search range"); -+ break; -+ } -+ /* Watch for overflows. */ -+ else if (length > CORE_ADDR_MAX -+ || (start_addr + length - 1) < start_addr) -+ { -+ PyErr_SetString (PyExc_ValueError, "search range too large"); -+ break; -+ } -+ -+ search_space_len = length; -+ -+ if (get_search_pattern (pattern, size, &pattern_buf, &pattern_len)) -+ { -+ /* Any cleanups get automatically executed on an exception. */ -+ struct cleanup *cleanups = make_cleanup (xfree, pattern_buf); -+ -+ list = PyList_New (0); -+ -+ while (search_space_len >= pattern_len && found_count < max_count) -+ { -+ CORE_ADDR found_addr; -+ int found; -+ -+ found = search_memory (&start_addr, &search_space_len, -+ pattern_buf, pattern_len, &found_addr); -+ if (found <= 0) -+ break; -+ -+ PyList_Append (list, PyLong_FromUnsignedLong (found_addr)); -+ ++found_count; -+ } -+ -+ do_cleanups (cleanups); -+ } -+ } -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ return list; -+} -+ -+ -+ -+void -+gdbpy_initialize_inferior (void) -+{ -+ if (PyType_Ready (&inferior_object_type) < 0) -+ return; -+ -+ Py_INCREF (&inferior_object_type); -+ PyModule_AddObject (gdb_module, "Inferior", -+ (PyObject *) &inferior_object_type); -+ -+ gdbpy_inferior_list = NULL; -+ ninferiors = 0; -+ -+ observer_attach_inferior_appeared (add_inferior_object); -+ observer_attach_inferior_exit (delete_inferior_object); -+ observer_attach_new_thread (add_thread_object); -+ observer_attach_thread_exit (delete_thread_object); -+ -+ if (PyType_Ready (&membuf_object_type) < 0) -+ return; -+ -+ Py_INCREF (&membuf_object_type); -+ PyModule_AddObject (gdb_module, "Membuf", (PyObject *) &membuf_object_type); -+} -+ -+ -+ -+static PyGetSetDef inferior_object_getset[] = -+{ -+ { "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL }, -+ { "pid", infpy_get_pid, NULL, "PID of inferior, as assigned by the OS.", -+ NULL }, -+ { "was_attached", infpy_get_was_attached, NULL, -+ "True if the inferior was created using 'attach'.", NULL }, -+ -+ { NULL } -+}; -+ -+static PyMethodDef inferior_object_methods[] = -+{ -+ { "threads", infpy_threads, METH_NOARGS, -+ "Return all the threads of this inferior." }, -+ -+ { "read_memory", infpy_read_memory, METH_VARARGS, -+ "read_memory (address, length) -> buffer\n\ -+Return a buffer object for reading from the inferior's memory." }, -+ { "write_memory", infpy_write_memory, METH_VARARGS, -+ "write_memory (address, buffer [, length])\n\ -+Write the given buffer object to the inferior's memory." }, -+ { "search_memory", (PyCFunction) infpy_search_memory, METH_VARARGS | METH_KEYWORDS, -+ "search_memory (address, length, pattern [, size] [, max_count]) -> list\n\ -+Return a list with the addresses where matches were found." }, -+ -+ { NULL } -+}; -+ -+static PyTypeObject inferior_object_type = -+{ -+ PyObject_HEAD_INIT (NULL) -+ 0, /* ob_size */ -+ "gdb.Inferior", /* tp_name */ -+ sizeof (inferior_object), /* tp_basicsize */ -+ 0, /* tp_itemsize */ -+ 0, /* tp_dealloc */ -+ 0, /* tp_print */ -+ 0, /* tp_getattr */ -+ 0, /* tp_setattr */ -+ 0, /* tp_compare */ -+ 0, /* tp_repr */ -+ 0, /* tp_as_number */ -+ 0, /* tp_as_sequence */ -+ 0, /* tp_as_mapping */ -+ 0, /* tp_hash */ -+ 0, /* tp_call */ -+ 0, /* tp_str */ -+ 0, /* tp_getattro */ -+ 0, /* tp_setattro */ -+ 0, /* tp_as_buffer */ -+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /* tp_flags */ -+ "GDB inferior object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ inferior_object_methods, /* tp_methods */ -+ 0, /* tp_members */ -+ inferior_object_getset, /* tp_getset */ -+ 0, /* tp_base */ -+ 0, /* tp_dict */ -+ 0, /* tp_descr_get */ -+ 0, /* tp_descr_set */ -+ 0, /* tp_dictoffset */ -+ 0, /* tp_init */ -+ 0 /* tp_alloc */ -+}; -+ -+ -+ -+/* Python doesn't provide a decent way to get compatibility here. */ -+#if HAVE_LIBPYTHON2_4 -+#define CHARBUFFERPROC_NAME getcharbufferproc -+#else -+#define CHARBUFFERPROC_NAME charbufferproc -+#endif -+ -+static PyBufferProcs buffer_procs = { -+ get_read_buffer, -+ get_write_buffer, -+ get_seg_count, -+ /* The cast here works around a difference between Python 2.4 and -+ Python 2.5. */ -+ (CHARBUFFERPROC_NAME) get_char_buffer -+}; -+ -+static PyTypeObject membuf_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Membuf", /*tp_name*/ -+ sizeof (membuf_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ mbpy_dealloc, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ mbpy_str, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ &buffer_procs, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT, /*tp_flags*/ -+ "GDB memory buffer object", /*tp_doc*/ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ 0, /* tp_getset */ -+ 0, /* tp_base */ -+ 0, /* tp_dict */ -+ 0, /* tp_descr_get */ -+ 0, /* tp_descr_set */ -+ 0, /* tp_dictoffset */ -+ 0, /* tp_init */ -+ 0, /* tp_alloc */ -+ PyType_GenericNew /* tp_new */ -+}; -diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c -new file mode 100644 -index 0000000..21e4eab ---- /dev/null -+++ b/gdb/python/py-infthread.c -@@ -0,0 +1,285 @@ -+/* Python interface to inferior threads. -+ -+ Copyright (C) 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "exceptions.h" -+#include "gdbthread.h" -+#include "inferior.h" -+#include "python-internal.h" -+ -+static PyTypeObject thread_object_type; -+ -+/* Require that INFERIOR be a valid inferior ID. */ -+#define THPY_REQUIRE_VALID(Thread) \ -+ do { \ -+ if (!Thread->thread) \ -+ { \ -+ PyErr_SetString (PyExc_RuntimeError, \ -+ "thread no longer exists"); \ -+ return NULL; \ -+ } \ -+ } while (0) -+ -+ -+ -+thread_object * -+create_thread_object (struct thread_info *tp) -+{ -+ thread_object *thread_obj; -+ -+ thread_obj = PyObject_New (thread_object, &thread_object_type); -+ if (!thread_obj) -+ return NULL; -+ -+ thread_obj->thread = tp; -+ thread_obj->inf_obj = find_inferior_object (PIDGET (tp->ptid)); -+ Py_INCREF (thread_obj->inf_obj); -+ -+ return thread_obj; -+} -+ -+ -+ -+static void -+thpy_dealloc (PyObject *self) -+{ -+ Py_DECREF (((thread_object *) self)->inf_obj); -+ self->ob_type->tp_free (self); -+} -+ -+static PyObject * -+thpy_get_num (PyObject *self, void *closure) -+{ -+ thread_object *thread_obj = (thread_object *) self; -+ -+ THPY_REQUIRE_VALID (thread_obj); -+ -+ return PyLong_FromLong (thread_obj->thread->num); -+} -+ -+ -+ -+/* Implementation of Inferior.frames () -> (gdb.Frame, ...). -+ Returns a tuple of all frame objects. */ -+PyObject * -+thpy_frames (PyObject *self, PyObject *args) -+{ -+ int result = 0; -+ struct frame_info *frame; -+ PyObject *frame_obj; -+ PyObject *list, *tuple; -+ thread_object *thread_obj = (thread_object *) self; -+ struct cleanup *cleanup; -+ volatile struct gdb_exception except; -+ -+ THPY_REQUIRE_VALID (thread_obj); -+ -+ list = PyList_New (0); -+ if (list == NULL) -+ { -+ PyErr_SetString (PyExc_MemoryError, "Could not allocate frames list."); -+ return NULL; -+ } -+ -+ cleanup = make_cleanup_restore_current_thread (); -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ switch_to_thread (thread_obj->thread->ptid); -+ -+ for (frame = get_current_frame (); frame; frame = get_prev_frame (frame)) -+ { -+ frame_obj = frame_info_to_frame_object (frame); -+ if (frame_obj == NULL) -+ { -+ Py_DECREF (list); -+ list = NULL; -+ break; -+ } -+ -+ PyList_Append (list, frame_obj); -+ } -+ } -+ if (except.reason < 0) -+ { -+ Py_DECREF (list); -+ return PyErr_Format (except.reason == RETURN_QUIT -+ ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, -+ "%s", except.message); -+ } -+ -+ do_cleanups (cleanup); -+ -+ if (list) -+ { -+ tuple = PyList_AsTuple (list); -+ Py_DECREF (list); -+ } -+ else -+ tuple = NULL; -+ -+ return tuple; -+} -+ -+/* Implementation of InferiorThread.newest_frame () -> gdb.Frame. -+ Returns the newest frame object. */ -+PyObject * -+thpy_newest_frame (PyObject *self, PyObject *args) -+{ -+ struct frame_info *frame; -+ PyObject *frame_obj = NULL; /* Initialize to appease gcc warning. */ -+ thread_object *thread_obj = (thread_object *) self; -+ struct cleanup *cleanup; -+ volatile struct gdb_exception except; -+ -+ THPY_REQUIRE_VALID (thread_obj); -+ -+ cleanup = make_cleanup_restore_current_thread (); -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ switch_to_thread (thread_obj->thread->ptid); -+ -+ frame = get_current_frame (); -+ frame_obj = frame_info_to_frame_object (frame); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ do_cleanups (cleanup); -+ -+ return frame_obj; -+} -+ -+/* Implementation of InferiorThread.switch (). -+ Makes this the GDB selected thread. */ -+static PyObject * -+thpy_switch (PyObject *self, PyObject *args) -+{ -+ thread_object *thread_obj = (thread_object *) self; -+ struct cleanup *cleanup; -+ volatile struct gdb_exception except; -+ -+ THPY_REQUIRE_VALID (thread_obj); -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ switch_to_thread (thread_obj->thread->ptid); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ Py_RETURN_NONE; -+} -+ -+ -+ -+/* Implementation of gdb.selected_thread () -> gdb.InferiorThread. -+ Returns the selected thread object. */ -+PyObject * -+gdbpy_selected_thread (PyObject *self, PyObject *args) -+{ -+ PyObject *thread_obj; -+ -+ thread_obj = (PyObject *) find_thread_object (inferior_ptid); -+ if (thread_obj) -+ { -+ Py_INCREF (thread_obj); -+ return thread_obj; -+ } -+ -+ Py_RETURN_NONE; -+} -+ -+ -+ -+void -+gdbpy_initialize_thread (void) -+{ -+ if (PyType_Ready (&thread_object_type) < 0) -+ return; -+ -+ Py_INCREF (&thread_object_type); -+ PyModule_AddObject (gdb_module, "InferiorThread", -+ (PyObject *) &thread_object_type); -+} -+ -+ -+ -+static PyGetSetDef thread_object_getset[] = -+{ -+ { "num", thpy_get_num, NULL, "ID of the thread, as assigned by GDB.", NULL }, -+ -+ { NULL } -+}; -+ -+static PyMethodDef thread_object_methods[] = -+{ -+ { "frames", thpy_frames, METH_NOARGS, -+ "frames () -> (gdb.Frame, ...)\n\ -+Return a tuple containing all frames in the thread." }, -+ { "newest_frame", thpy_newest_frame, METH_NOARGS, -+ "newest_frame () -> gdb.Frame\n\ -+Return the newest frame in the thread." }, -+ { "switch", thpy_switch, METH_NOARGS, -+ "switch ()\n\ -+Makes this the GDB selected thread." }, -+ -+ { NULL } -+}; -+ -+static PyTypeObject thread_object_type = -+{ -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.InferiorThread", /*tp_name*/ -+ sizeof (thread_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ thpy_dealloc, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ 0, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER, /*tp_flags*/ -+ "GDB thread object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ thread_object_methods, /* tp_methods */ -+ 0, /* tp_members */ -+ thread_object_getset, /* tp_getset */ -+ 0, /* tp_base */ -+ 0, /* tp_dict */ -+ 0, /* tp_descr_get */ -+ 0, /* tp_descr_set */ -+ 0, /* tp_dictoffset */ -+ 0, /* tp_init */ -+ 0 /* tp_alloc */ -+}; -diff --git a/gdb/python/py-membuf.c b/gdb/python/py-membuf.c -new file mode 100644 -index 0000000..7bc294c ---- /dev/null -+++ b/gdb/python/py-membuf.c -@@ -0,0 +1,268 @@ -+/* Python interface to the inferior memory. -+ -+ Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "exceptions.h" -+#include "gdbcore.h" -+#include "python-internal.h" -+ -+typedef struct { -+ PyObject_HEAD -+ void *buffer; -+ -+ /* These are kept just for mbpy_str. */ -+ CORE_ADDR addr; -+ CORE_ADDR length; -+} membuf_object; -+ -+static PyTypeObject membuf_object_type; -+ -+/* Implementation of gdb.read_memory (address, length). -+ Returns a Python buffer object with LENGTH bytes of the inferior's memory -+ at ADDRESS. Both arguments are integers. */ -+ -+PyObject * -+gdbpy_read_memory (PyObject *self, PyObject *args) -+{ -+ int error = 0; -+ CORE_ADDR addr, length; -+ void *buffer = NULL; -+ membuf_object *membuf_obj; -+ PyObject *addr_obj, *length_obj; -+ struct cleanup *cleanups = NULL; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "OO", &addr_obj, &length_obj)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (!get_addr_from_python (addr_obj, &addr) -+ || !get_addr_from_python (length_obj, &length)) -+ { -+ error = 1; -+ break; -+ } -+ -+ buffer = xmalloc (length); -+ cleanups = make_cleanup (xfree, buffer); -+ -+ read_memory (addr, buffer, length); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (error) -+ return NULL; -+ -+ discard_cleanups (cleanups); -+ -+ membuf_obj = PyObject_New (membuf_object, &membuf_object_type); -+ if (membuf_obj == NULL) -+ { -+ xfree (buffer); -+ PyErr_SetString (PyExc_MemoryError, -+ "Could not allocate memory buffer object."); -+ return NULL; -+ } -+ -+ membuf_obj->buffer = buffer; -+ membuf_obj->addr = addr; -+ membuf_obj->length = length; -+ -+ return PyBuffer_FromReadWriteObject ((PyObject *) membuf_obj, 0, -+ Py_END_OF_BUFFER); -+} -+ -+/* Implementation of gdb.write_memory (address, buffer [, length]). -+ Writes the contents of BUFFER (a Python object supporting the read buffer -+ protocol) at ADDRESS in the inferior's memory. Write LENGTH bytes from -+ BUFFER, or its entire contents if the argument is not provided. The -+ function returns nothing. */ -+ -+PyObject * -+gdbpy_write_memory (PyObject *self, PyObject *args) -+{ -+ int buf_len, error = 0; -+ const char *buffer; -+ CORE_ADDR addr, length; -+ PyObject *addr_obj, *length_obj = NULL; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "Os#|O", &addr_obj, &buffer, &buf_len, -+ &length_obj)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (!get_addr_from_python (addr_obj, &addr)) -+ { -+ error = 1; -+ break; -+ } -+ -+ if (!length_obj) -+ length = buf_len; -+ else if (!get_addr_from_python (length_obj, &length)) -+ { -+ error = 1; -+ break; -+ } -+ -+ write_memory (addr, buffer, length); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (error) -+ return NULL; -+ -+ Py_RETURN_NONE; -+} -+ -+/* Destructor of Membuf objects. */ -+ -+static void -+mbpy_dealloc (PyObject *self) -+{ -+ xfree (((membuf_object *) self)->buffer); -+ self->ob_type->tp_free (self); -+} -+ -+/* Return a description of the Membuf object. */ -+ -+static PyObject * -+mbpy_str (PyObject *self) -+{ -+ membuf_object *membuf_obj = (membuf_object *) self; -+ -+ return PyString_FromFormat ("memory buffer for address %s, %s bytes long", -+ paddress (membuf_obj->addr), -+ pulongest (membuf_obj->length)); -+} -+ -+static Py_ssize_t -+get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr) -+{ -+ membuf_object *membuf_obj = (membuf_object *) self; -+ -+ if (segment) -+ { -+ PyErr_SetString (PyExc_SystemError, -+ "The memory buffer supports only one segment."); -+ return -1; -+ } -+ -+ *ptrptr = membuf_obj->buffer; -+ -+ return membuf_obj->length; -+} -+ -+static Py_ssize_t -+get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr) -+{ -+ return get_read_buffer (self, segment, ptrptr); -+} -+ -+static Py_ssize_t -+get_seg_count (PyObject *self, Py_ssize_t *lenp) -+{ -+ if (lenp) -+ *lenp = ((membuf_object *) self)->length; -+ -+ return 1; -+} -+ -+static Py_ssize_t -+get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr) -+{ -+ void *ptr = NULL; -+ Py_ssize_t ret; -+ -+ ret = get_read_buffer (self, segment, &ptr); -+ *ptrptr = (char *) ptr; -+ -+ return ret; -+} -+ -+/* Python doesn't provide a decent way to get compatibility here. */ -+#if HAVE_LIBPYTHON2_4 -+#define CHARBUFFERPROC_NAME getcharbufferproc -+#else -+#define CHARBUFFERPROC_NAME charbufferproc -+#endif -+ -+static PyBufferProcs buffer_procs = { -+ get_read_buffer, -+ get_write_buffer, -+ get_seg_count, -+ /* The cast here works around a difference between Python 2.4 and -+ Python 2.5. */ -+ (CHARBUFFERPROC_NAME) get_char_buffer -+}; -+ -+static PyTypeObject membuf_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Membuf", /*tp_name*/ -+ sizeof (membuf_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ mbpy_dealloc, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ mbpy_str, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ &buffer_procs, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT, /*tp_flags*/ -+ "GDB memory buffer object", /*tp_doc*/ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ 0, /* tp_getset */ -+ 0, /* tp_base */ -+ 0, /* tp_dict */ -+ 0, /* tp_descr_get */ -+ 0, /* tp_descr_set */ -+ 0, /* tp_dictoffset */ -+ 0, /* tp_init */ -+ 0, /* tp_alloc */ -+ PyType_GenericNew /* tp_new */ -+}; -+ -+void -+gdbpy_initialize_membuf (void) -+{ -+ if (PyType_Ready (&membuf_object_type) < 0) -+ return; -+ -+ Py_INCREF (&membuf_object_type); -+ PyModule_AddObject (gdb_module, "Membuf", (PyObject *) &membuf_object_type); -+} -diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c -new file mode 100644 -index 0000000..1f591a8 ---- /dev/null -+++ b/gdb/python/py-param.c -@@ -0,0 +1,606 @@ -+/* gdb parameters implemented in Python -+ -+ Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+ -+#include "defs.h" -+#include "value.h" -+#include "exceptions.h" -+#include "python-internal.h" -+#include "charset.h" -+#include "gdbcmd.h" -+#include "cli/cli-decode.h" -+#include "completer.h" -+ -+/* Parameter constants and their values. */ -+struct parm_constant -+{ -+ char *name; -+ int value; -+}; -+ -+struct parm_constant parm_constants[] = -+{ -+ { "PARAM_BOOLEAN", var_boolean }, -+ { "PARAM_AUTO_BOOLEAN", var_auto_boolean }, -+ { "PARAM_UINTEGER", var_uinteger }, -+ { "PARAM_INTEGER", var_integer }, -+ { "PARAM_STRING", var_string }, -+ { "PARAM_STRING_NOESCAPE", var_string_noescape }, -+ { "PARAM_OPTIONAL_FILENAME", var_optional_filename }, -+ { "PARAM_FILENAME", var_filename }, -+ { "PARAM_ZINTEGER", var_zinteger }, -+ { "PARAM_ENUM", var_enum }, -+ { NULL, 0 } -+}; -+ -+/* A union that can hold anything described by enum var_types. */ -+union parmpy_variable -+{ -+ /* Hold an integer value, for boolean and integer types. */ -+ int intval; -+ -+ /* Hold an auto_boolean. */ -+ enum auto_boolean autoboolval; -+ -+ /* Hold an unsigned integer value, for uinteger. */ -+ unsigned int uintval; -+ -+ /* Hold a string, for the various string types. */ -+ char *stringval; -+ -+ /* Hold a string, for enums. */ -+ const char *cstringval; -+}; -+ -+/* A gdb parameter. */ -+struct parmpy_object -+{ -+ PyObject_HEAD -+ -+ /* The type of the parameter. */ -+ enum var_types type; -+ -+ /* The value of the parameter. */ -+ union parmpy_variable value; -+ -+ /* For an enum command, the possible values. The vector is -+ allocated with xmalloc, as is each element. It is -+ NULL-terminated. */ -+ const char **enumeration; -+}; -+ -+typedef struct parmpy_object parmpy_object; -+ -+static PyTypeObject parmpy_object_type; -+ -+/* Some handy string constants. */ -+static PyObject *set_doc_cst; -+static PyObject *show_doc_cst; -+ -+ -+ -+/* Get an attribute. */ -+static PyObject * -+get_attr (PyObject *obj, PyObject *attr_name) -+{ -+ if (PyString_Check (attr_name) -+ && ! strcmp (PyString_AsString (attr_name), "value")) -+ { -+ parmpy_object *self = (parmpy_object *) obj; -+ return gdbpy_parameter_value (self->type, &self->value); -+ } -+ -+ return PyObject_GenericGetAttr (obj, attr_name); -+} -+ -+/* Set a parameter value from a Python value. Return 0 on success, -1 -+ on failure. */ -+static int -+set_parameter_value (parmpy_object *self, PyObject *value) -+{ -+ int cmp; -+ -+ switch (self->type) -+ { -+ case var_string: -+ case var_string_noescape: -+ case var_optional_filename: -+ case var_filename: -+ if (! gdbpy_is_string (value) -+ && (self->type == var_filename -+ || value != Py_None)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "string required"); -+ return -1; -+ } -+ if (self->value.stringval) -+ xfree (self->value.stringval); -+ if (value == Py_None) -+ { -+ if (self->type == var_optional_filename) -+ self->value.stringval = xstrdup (""); -+ else -+ self->value.stringval = NULL; -+ } -+ else -+ self->value.stringval = python_string_to_host_string (value); -+ break; -+ -+ case var_enum: -+ { -+ int i; -+ char *str; -+ -+ if (! gdbpy_is_string (value)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "string required"); -+ return -1; -+ } -+ -+ str = python_string_to_host_string (value); -+ for (i = 0; self->enumeration[i]; ++i) -+ if (! strcmp (self->enumeration[i], str)) -+ break; -+ xfree (str); -+ if (! self->enumeration[i]) -+ { -+ PyErr_SetString (PyExc_RuntimeError, -+ "value must be member of enumeration"); -+ return -1; -+ } -+ self->value.cstringval = self->enumeration[i]; -+ break; -+ } -+ -+ case var_boolean: -+ if (! PyBool_Check (value)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "boolean required"); -+ return -1; -+ } -+ cmp = PyObject_IsTrue (value); -+ if (cmp < 0) -+ return -1; -+ self->value.intval = cmp; -+ break; -+ -+ case var_auto_boolean: -+ if (! PyBool_Check (value) && value != Py_None) -+ { -+ PyErr_SetString (PyExc_RuntimeError, -+ "boolean or None required"); -+ return -1; -+ } -+ -+ if (value == Py_None) -+ self->value.autoboolval = AUTO_BOOLEAN_AUTO; -+ else -+ { -+ cmp = PyObject_IsTrue (value); -+ if (cmp < 0 ) -+ return -1; -+ if (cmp == 1) -+ self->value.autoboolval = AUTO_BOOLEAN_TRUE; -+ else -+ self->value.autoboolval = AUTO_BOOLEAN_FALSE; -+ -+ break; -+ } -+ -+ case var_integer: -+ case var_zinteger: -+ case var_uinteger: -+ { -+ long l; -+ int ok; -+ -+ if (! PyInt_Check (value)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "value must be integer"); -+ return -1; -+ } -+ -+ l = PyInt_AsLong (value); -+ if (self->type == var_uinteger) -+ { -+ ok = (l >= 0 && l <= UINT_MAX); -+ if (l == 0) -+ l = UINT_MAX; -+ } -+ else if (self->type == var_integer) -+ { -+ ok = (l >= INT_MIN && l <= INT_MAX); -+ if (l == 0) -+ l = INT_MAX; -+ } -+ else -+ ok = (l >= INT_MIN && l <= INT_MAX); -+ -+ if (! ok) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "range exceeded"); -+ return -1; -+ } -+ -+ self->value.intval = (int) l; -+ break; -+ } -+ -+ default: -+ PyErr_SetString (PyExc_RuntimeError, "programmer error: unhandled type"); -+ return -1; -+ } -+ -+ return 0; -+} -+ -+/* Set an attribute. */ -+static int -+set_attr (PyObject *obj, PyObject *attr_name, PyObject *val) -+{ -+ if (PyString_Check (attr_name) -+ && ! strcmp (PyString_AsString (attr_name), "value")) -+ { -+ if (!val) -+ { -+ PyErr_SetString (PyExc_RuntimeError, -+ "cannot delete a parameter's value"); -+ return -1; -+ } -+ return set_parameter_value ((parmpy_object *) obj, val); -+ } -+ -+ return PyObject_GenericSetAttr (obj, attr_name, val); -+} -+ -+ -+ -+/* A helper function that dispatches to the appropriate add_setshow -+ function. */ -+static void -+add_setshow_generic (int parmclass, enum command_class cmdclass, -+ char *cmd_name, parmpy_object *self, -+ char *set_doc, char *show_doc, char *help_doc, -+ struct cmd_list_element **set_list, -+ struct cmd_list_element **show_list) -+{ -+ switch (parmclass) -+ { -+ case var_boolean: -+ add_setshow_boolean_cmd (cmd_name, cmdclass, &self->value.intval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_auto_boolean: -+ add_setshow_auto_boolean_cmd (cmd_name, cmdclass, -+ &self->value.autoboolval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_uinteger: -+ add_setshow_uinteger_cmd (cmd_name, cmdclass, &self->value.uintval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_integer: -+ add_setshow_integer_cmd (cmd_name, cmdclass, &self->value.intval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_string: -+ add_setshow_string_cmd (cmd_name, cmdclass, &self->value.stringval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_string_noescape: -+ add_setshow_string_noescape_cmd (cmd_name, cmdclass, -+ &self->value.stringval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_optional_filename: -+ add_setshow_optional_filename_cmd (cmd_name, cmdclass, -+ &self->value.stringval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_filename: -+ add_setshow_filename_cmd (cmd_name, cmdclass, &self->value.stringval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_zinteger: -+ add_setshow_zinteger_cmd (cmd_name, cmdclass, &self->value.intval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ break; -+ -+ case var_enum: -+ add_setshow_enum_cmd (cmd_name, cmdclass, self->enumeration, -+ &self->value.cstringval, -+ set_doc, show_doc, help_doc, -+ NULL, NULL, set_list, show_list); -+ /* Initialize the value, just in case. */ -+ self->value.cstringval = self->enumeration[0]; -+ break; -+ } -+} -+ -+/* A helper which computes enum values. Returns 1 on success, 0 on -+ error. */ -+static int -+compute_enum_values (parmpy_object *self, PyObject *enum_values) -+{ -+ Py_ssize_t size, i; -+ -+ if (! enum_values) -+ { -+ PyErr_SetString (PyExc_RuntimeError, -+ "enumeration required for PARAM_ENUM"); -+ return 0; -+ } -+ -+ if (! PySequence_Check (enum_values)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "enumeration is not a sequence"); -+ return 0; -+ } -+ -+ size = PySequence_Size (enum_values); -+ if (size < 0) -+ return 0; -+ if (size == 0) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "empty enumeration"); -+ return 0; -+ } -+ -+ self->enumeration = xmalloc ((size + 1) * sizeof (char *)); -+ memset (self->enumeration, 0, (size + 1) * sizeof (char *)); -+ -+ for (i = 0; i < size; ++i) -+ { -+ PyObject *item = PySequence_GetItem (enum_values, i); -+ if (! item) -+ return 0; -+ if (! gdbpy_is_string (item)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "enumeration item not a string"); -+ return 0; -+ } -+ self->enumeration[i] = python_string_to_host_string (item); -+ } -+ -+ return 1; -+} -+ -+/* A helper function which returns a documentation string for an -+ object. */ -+static char * -+get_doc_string (PyObject *object, PyObject *attr) -+{ -+ char *result = NULL; -+ if (PyObject_HasAttr (object, attr)) -+ { -+ PyObject *ds_obj = PyObject_GetAttr (object, attr); -+ if (ds_obj && gdbpy_is_string (ds_obj)) -+ result = python_string_to_host_string (ds_obj); -+ } -+ if (! result) -+ result = xstrdup ("This command is not documented."); -+ return result; -+} -+ -+/* Object initializer; sets up gdb-side structures for command. -+ -+ Use: __init__(NAME, CMDCLASS, PARMCLASS, [ENUM]) -+ -+ NAME is the name of the parameter. It may consist of multiple -+ words, in which case the final word is the name of the new command, -+ and earlier words must be prefix commands. -+ -+ CMDCLASS is the kind of command. It should be one of the COMMAND_* -+ constants defined in the gdb module. -+ -+ PARMCLASS is the type of the parameter. It should be one of the -+ PARAM_* constants defined in the gdb module. -+ -+ If PARMCLASS is PARAM_ENUM, then the final argument should be a -+ collection of strings. These strings are the valid values for this -+ parameter. -+ -+ The documentation for the parameter is taken from the doc string -+ for the python class. -+ -+*/ -+static int -+parmpy_init (PyObject *self, PyObject *args, PyObject *kwds) -+{ -+ parmpy_object *obj = (parmpy_object *) self; -+ char *name; -+ char *set_doc, *show_doc, *doc; -+ char *cmd_name; -+ int parmclass, cmdtype; -+ PyObject *enum_values = NULL; -+ struct cmd_list_element *cmd_list; -+ struct cmd_list_element **set_list, **show_list; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "sii|O", &name, &cmdtype, &parmclass, -+ &enum_values)) -+ return -1; -+ -+ if (cmdtype != no_class && cmdtype != class_run -+ && cmdtype != class_vars && cmdtype != class_stack -+ && cmdtype != class_files && cmdtype != class_support -+ && cmdtype != class_info && cmdtype != class_breakpoint -+ && cmdtype != class_trace && cmdtype != class_obscure -+ && cmdtype != class_maintenance) -+ { -+ PyErr_Format (PyExc_RuntimeError, "invalid command class argument"); -+ return -1; -+ } -+ -+ if (parmclass != var_boolean && parmclass != var_auto_boolean -+ && parmclass != var_uinteger && parmclass != var_integer -+ && parmclass != var_string && parmclass != var_string_noescape -+ && parmclass != var_optional_filename && parmclass != var_filename -+ && parmclass != var_zinteger && parmclass != var_enum) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "invalid parameter class argument"); -+ return -1; -+ } -+ -+ if (enum_values && parmclass != var_enum) -+ { -+ PyErr_SetString (PyExc_RuntimeError, -+ "only PARAM_ENUM accepts a fourth argument"); -+ return -1; -+ } -+ if (parmclass == var_enum) -+ { -+ if (! compute_enum_values (obj, enum_values)) -+ return -1; -+ } -+ -+ obj->type = (enum var_types) parmclass; -+ memset (&obj->value, 0, sizeof (obj->value)); -+ obj->enumeration = NULL; -+ -+ cmd_name = gdbpy_parse_command_name (name, &set_list, &setlist); -+ if (! cmd_name) -+ return -1; -+ xfree (cmd_name); -+ cmd_name = gdbpy_parse_command_name (name, &show_list, &showlist); -+ if (! cmd_name) -+ return -1; -+ -+ /* FIXME: there is no way to register a destructor function for -+ set/show commands. So, these are leaked. */ -+ set_doc = get_doc_string (self, set_doc_cst); -+ show_doc = get_doc_string (self, show_doc_cst); -+ doc = get_doc_string (self, gdbpy_doc_cst); -+ -+ Py_INCREF (self); -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ add_setshow_generic (parmclass, (enum command_class) cmdtype, -+ cmd_name, obj, -+ set_doc, show_doc, -+ doc, set_list, show_list); -+ } -+ if (except.reason < 0) -+ { -+ xfree (cmd_name); -+ xfree (set_doc); -+ xfree (show_doc); -+ xfree (doc); -+ Py_DECREF (self); -+ PyErr_Format (except.reason == RETURN_QUIT -+ ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, -+ "%s", except.message); -+ return -1; -+ } -+ return 0; -+} -+ -+ -+ -+/* Initialize the 'parameters' module. */ -+void -+gdbpy_initialize_parameters (void) -+{ -+ int i; -+ -+ if (PyType_Ready (&parmpy_object_type) < 0) -+ return; -+ -+ set_doc_cst = PyString_FromString ("set_doc"); -+ if (! set_doc_cst) -+ return; -+ show_doc_cst = PyString_FromString ("show_doc"); -+ if (! show_doc_cst) -+ return; -+ -+ for (i = 0; parm_constants[i].name; ++i) -+ { -+ if (PyModule_AddIntConstant (gdb_module, -+ parm_constants[i].name, -+ parm_constants[i].value) < 0) -+ return; -+ } -+ -+ Py_INCREF (&parmpy_object_type); -+ PyModule_AddObject (gdb_module, "Parameter", -+ (PyObject *) &parmpy_object_type); -+} -+ -+ -+ -+static PyTypeObject parmpy_object_type = -+{ -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Parameter", /*tp_name*/ -+ sizeof (parmpy_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ 0, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ 0, /*tp_str*/ -+ get_attr, /*tp_getattro*/ -+ set_attr, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ -+ "GDB parameter object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ 0, /* tp_getset */ -+ 0, /* tp_base */ -+ 0, /* tp_dict */ -+ 0, /* tp_descr_get */ -+ 0, /* tp_descr_set */ -+ 0, /* tp_dictoffset */ -+ parmpy_init, /* tp_init */ -+ 0, /* tp_alloc */ -+ PyType_GenericNew /* tp_new */ -+}; -diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c -index 454aa5a..9991f13 100644 ---- a/gdb/python/py-prettyprint.c -+++ b/gdb/python/py-prettyprint.c -@@ -143,10 +143,15 @@ pretty_print_one_value (PyObject *printer, struct value **out_value) - if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result)) - { - *out_value = convert_value_from_python (result); -- if (PyErr_Occurred ()) -- *out_value = NULL; -- Py_DECREF (result); -- result = NULL; -+ if (PyErr_Occurred ()) -+ *out_value = NULL; -+ else -+ /* We must increment the value's refcount, because we -+ are about to decref RESULT, and this may result in -+ the value being destroyed. */ -+ value_incref (*out_value); -+ Py_DECREF (result); -+ result = NULL; - } - } - } -@@ -605,14 +610,7 @@ gdbpy_get_varobj_pretty_printer (struct value *value) - { - PyObject *val_obj; - PyObject *pretty_printer = NULL; -- volatile struct gdb_exception except; - -- TRY_CATCH (except, RETURN_MASK_ALL) -- { -- value = value_copy (value); -- } -- GDB_PY_HANDLE_EXCEPTION (except); -- - val_obj = value_to_value_object (value); - if (! val_obj) - return NULL; -diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c -new file mode 100644 -index 0000000..03d43c1 ---- /dev/null -+++ b/gdb/python/py-symbol.c -@@ -0,0 +1,336 @@ -+/* Python interface to symbols. -+ -+ Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "block.h" -+#include "exceptions.h" -+#include "frame.h" -+#include "symtab.h" -+#include "python-internal.h" -+ -+typedef struct { -+ PyObject_HEAD -+ struct symbol *symbol; -+} symbol_object; -+ -+ -+static PyObject * -+sympy_str (PyObject *self) -+{ -+ int ret; -+ char *s; -+ PyObject *result; -+ -+ ret = asprintf (&s, "symbol for %s", -+ SYMBOL_PRINT_NAME (((symbol_object *) self)->symbol)); -+ if (ret < 0) -+ Py_RETURN_NONE; -+ -+ result = PyString_FromString (s); -+ xfree (s); -+ -+ return result; -+} -+ -+static PyObject * -+sympy_get_value (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ -+ switch (SYMBOL_CLASS (self_sym->symbol)) -+ { -+ case LOC_BLOCK: -+ return block_to_block_object (SYMBOL_BLOCK_VALUE (self_sym->symbol)); -+ } -+ -+ PyErr_SetString (PyExc_NotImplementedError, -+ "Symbol type not yet supported in Python scripts."); -+ return NULL; -+} -+ -+static PyObject * -+sympy_get_symtab (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ -+ return symtab_to_symtab_object (SYMBOL_SYMTAB (self_sym->symbol)); -+} -+ -+static PyObject * -+sympy_get_name (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ -+ return PyString_FromString (SYMBOL_NATURAL_NAME (self_sym->symbol)); -+} -+ -+static PyObject * -+sympy_get_linkage_name (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ -+ return PyString_FromString (SYMBOL_LINKAGE_NAME (self_sym->symbol)); -+} -+ -+static PyObject * -+sympy_get_print_name (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ -+ return PyString_FromString (SYMBOL_PRINT_NAME (self_sym->symbol)); -+} -+ -+static PyObject * -+sympy_get_addr_class (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ -+ return PyInt_FromLong (SYMBOL_CLASS (self_sym->symbol)); -+} -+ -+static PyObject * -+sympy_is_argument (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ -+ return PyBool_FromLong (SYMBOL_IS_ARGUMENT (self_sym->symbol)); -+} -+ -+static PyObject * -+sympy_is_constant (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ enum address_class class = SYMBOL_CLASS (self_sym->symbol); -+ -+ return PyBool_FromLong (class == LOC_CONST || class == LOC_CONST_BYTES); -+} -+ -+static PyObject * -+sympy_is_function (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ enum address_class class = SYMBOL_CLASS (self_sym->symbol); -+ -+ return PyBool_FromLong (class == LOC_BLOCK); -+} -+ -+static PyObject * -+sympy_is_variable (PyObject *self, void *closure) -+{ -+ symbol_object *self_sym = (symbol_object *) self; -+ enum address_class class = SYMBOL_CLASS (self_sym->symbol); -+ -+ return PyBool_FromLong (!SYMBOL_IS_ARGUMENT (self_sym->symbol) -+ && (class == LOC_LOCAL || class == LOC_REGISTER || class == LOC_STATIC -+ || class == LOC_COMPUTED || class == LOC_OPTIMIZED_OUT)); -+} -+ -+PyObject * -+symbol_to_symbol_object (struct symbol *sym) -+{ -+ symbol_object *sym_obj; -+ -+ sym_obj = PyObject_New (symbol_object, &symbol_object_type); -+ if (sym_obj == NULL) -+ { -+ PyErr_SetString (PyExc_MemoryError, "Could not allocate symbol object."); -+ return NULL; -+ } -+ -+ sym_obj->symbol = sym; -+ -+ return (PyObject *) sym_obj; -+} -+ -+struct symbol * -+symbol_object_to_symbol (PyObject *obj) -+{ -+ if (! PyObject_TypeCheck (obj, &symbol_object_type)) -+ return NULL; -+ return ((symbol_object *) obj)->symbol; -+} -+ -+/* Implementation of -+ gdb.lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this) -+ A tuple with 2 elements is always returned. The first is the symbol -+ object or None, the second is a boolean with the value of -+ is_a_field_of_this (see comment in lookup_symbol_in_language). */ -+ -+PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw) -+{ -+ int domain = VAR_DOMAIN, is_a_field_of_this = 0; -+ const char *name; -+ static char *keywords[] = { "name", "block", "domain", NULL }; -+ struct symbol *symbol; -+ PyObject *block_obj = NULL, *ret_tuple, *sym_obj, *bool_obj; -+ struct block *block = NULL; -+ -+ if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O!i", keywords, &name, -+ &block_object_type, &block_obj, &domain)) -+ return NULL; -+ -+ if (block_obj) -+ block = block_object_to_block (block_obj); -+ else -+ { -+ struct frame_info *selected_frame; -+ volatile struct gdb_exception except; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ selected_frame = get_selected_frame (_("No frame selected.")); -+ block = block_for_pc (get_frame_address_in_block (selected_frame)); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ } -+ -+ symbol = lookup_symbol (name, block, domain, &is_a_field_of_this); -+ -+ ret_tuple = PyTuple_New (2); -+ if (!ret_tuple) -+ { -+ PyErr_SetString (PyExc_MemoryError, "Could not allocate tuple object."); -+ return NULL; -+ } -+ -+ if (symbol) -+ { -+ sym_obj = symbol_to_symbol_object (symbol); -+ if (!sym_obj) -+ { -+ Py_DECREF (ret_tuple); -+ return NULL; -+ } -+ } -+ else -+ { -+ sym_obj = Py_None; -+ Py_INCREF (Py_None); -+ } -+ PyTuple_SET_ITEM (ret_tuple, 0, sym_obj); -+ -+ bool_obj = is_a_field_of_this? Py_True : Py_False; -+ Py_INCREF (bool_obj); -+ PyTuple_SET_ITEM (ret_tuple, 1, bool_obj); -+ -+ return ret_tuple; -+} -+ -+void -+gdbpy_initialize_symbols (void) -+{ -+ if (PyType_Ready (&symbol_object_type) < 0) -+ return; -+ -+ /* FIXME: These would probably be best exposed as class attributes of Symbol, -+ but I don't know how to do it except by messing with the type's dictionary. -+ That seems too messy. */ -+ /* FIXME 2: Some of these were removed from GDB since I first wrote this code, -+ so it's probably a good idea not to expose them to Python. */ -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST", LOC_CONST); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC", LOC_STATIC); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER", LOC_REGISTER); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG", LOC_ARG); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG", LOC_REF_ARG); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL", LOC_LOCAL); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF", LOC_TYPEDEF); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL", LOC_LABEL); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK", LOC_BLOCK); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES", -+ LOC_CONST_BYTES); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED", LOC_UNRESOLVED); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT", -+ LOC_OPTIMIZED_OUT); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED", LOC_COMPUTED); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR", -+ LOC_REGPARM_ADDR); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN", UNDEF_DOMAIN); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN", VAR_DOMAIN); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN", STRUCT_DOMAIN); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN", LABEL_DOMAIN); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN", -+ VARIABLES_DOMAIN); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN", -+ FUNCTIONS_DOMAIN); -+ PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN", TYPES_DOMAIN); -+ -+ Py_INCREF (&symbol_object_type); -+ PyModule_AddObject (gdb_module, "Symbol", (PyObject *) &symbol_object_type); -+} -+ -+ -+ -+static PyGetSetDef symbol_object_getset[] = { -+ { "value", sympy_get_value, NULL, "Value of the symbol.", NULL }, -+ { "symtab", sympy_get_symtab, NULL, -+ "Symbol table in which the symbol appears.", NULL }, -+ { "name", sympy_get_name, NULL, -+ "Name of the symbol, as it appears in the source code.", NULL }, -+ { "linkage_name", sympy_get_linkage_name, NULL, -+ "Name of the symbol, as used by the linker (i.e., may be mangled).", NULL }, -+ { "print_name", sympy_get_print_name, NULL, -+ "Name of the symbol in a form suitable for output.\n\ -+This is either name or linkage_name, depending on whether the user asked GDB\n\ -+to display demangled or mangled names.", NULL }, -+ { "addr_class", sympy_get_addr_class, NULL, "Address class of the symbol." }, -+ { "is_argument", sympy_is_argument, NULL, -+ "True if the symbol is an argument of a function." }, -+ { "is_constant", sympy_is_constant, NULL, -+ "True if the symbol is a constant." }, -+ { "is_function", sympy_is_function, NULL, -+ "True if the symbol is a function or method." }, -+ { "is_variable", sympy_is_variable, NULL, -+ "True if the symbol is a variable." }, -+ { NULL } /* Sentinel */ -+}; -+ -+PyTypeObject symbol_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Symbol", /*tp_name*/ -+ sizeof (symbol_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ 0, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ sympy_str, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT, /*tp_flags*/ -+ "GDB symbol object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ symbol_object_getset /* tp_getset */ -+}; -diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c -new file mode 100644 -index 0000000..830e586 ---- /dev/null -+++ b/gdb/python/py-symtab.c -@@ -0,0 +1,322 @@ -+/* Python interface to symbol tables. -+ -+ Copyright (C) 2008, 2009 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "charset.h" -+#include "symtab.h" -+#include "source.h" -+#include "python-internal.h" -+ -+typedef struct { -+ PyObject_HEAD -+ struct symtab *symtab; -+} symtab_object; -+ -+static PyTypeObject symtab_object_type; -+ -+typedef struct { -+ PyObject_HEAD -+ symtab_object *symtab; -+ struct symtab_and_line *sal; -+} sal_object; -+ -+static PyTypeObject sal_object_type; -+ -+ -+static PyObject * -+stpy_str (PyObject *self) -+{ -+ int ret; -+ char *s; -+ PyObject *result; -+ -+ ret = asprintf (&s, "symbol table for %s", -+ ((symtab_object *) self)->symtab->filename); -+ if (ret < 0) -+ Py_RETURN_NONE; -+ -+ result = PyString_FromString (s); -+ xfree (s); -+ -+ return result; -+} -+ -+static PyObject * -+stpy_get_filename (PyObject *self, void *closure) -+{ -+ symtab_object *self_symtab = (symtab_object *) self; -+ PyObject *str_obj; -+ -+ /* FIXME: Can symtab->filename really be NULL? */ -+ if (self_symtab->symtab->filename) -+ str_obj = PyString_Decode (self_symtab->symtab->filename, -+ strlen (self_symtab->symtab->filename), -+ host_charset (), NULL); -+ else -+ { -+ str_obj = Py_None; -+ Py_INCREF (Py_None); -+ } -+ -+ return str_obj; -+} -+ -+static PyObject * -+stpy_get_objfile (PyObject *self, void *closure) -+{ -+ symtab_object *self_symtab = (symtab_object *) self; -+ PyObject *result = objfile_to_objfile_object (self_symtab->symtab->objfile); -+ Py_INCREF (result); -+ return result; -+} -+ -+static PyObject * -+stpy_fullname (PyObject *self, PyObject *args) -+{ -+ char *fullname; -+ -+ fullname = symtab_to_fullname (((symtab_object *) self)->symtab); -+ if (fullname) -+ return PyString_Decode (fullname, strlen (fullname), host_charset (), NULL); -+ -+ Py_RETURN_NONE; -+} -+ -+static PyObject * -+salpy_str (PyObject *self) -+{ -+ int ret; -+ char *s, *filename; -+ sal_object *sal_obj; -+ PyObject *result; -+ -+ sal_obj = (sal_object *) self; -+ filename = (sal_obj->symtab == (symtab_object *) Py_None)? "" : -+ sal_obj->symtab->symtab->filename; -+ ret = asprintf (&s, "symbol and line for %s, line %d", filename, -+ sal_obj->sal->line); -+ if (ret < 0) -+ Py_RETURN_NONE; -+ -+ result = PyString_FromString (s); -+ xfree (s); -+ -+ return result; -+} -+ -+static PyObject * -+salpy_get_pc (PyObject *self, void *closure) -+{ -+ return PyLong_FromUnsignedLongLong (((sal_object *) self)->sal->pc); -+} -+ -+static PyObject * -+salpy_get_line (PyObject *self, void *closure) -+{ -+ return PyLong_FromUnsignedLongLong (((sal_object *) self)->sal->line); -+} -+ -+static PyObject * -+salpy_get_symtab (PyObject *self, void *closure) -+{ -+ sal_object *self_sal = (sal_object *) self; -+ -+ Py_INCREF (self_sal->symtab); -+ -+ return (PyObject *) self_sal->symtab; -+} -+ -+static void -+salpy_dealloc (PyObject *self) -+{ -+ sal_object *self_sal = (sal_object *) self; -+ -+ Py_DECREF (self_sal->symtab); -+ xfree (self_sal->sal); -+ self_sal->ob_type->tp_free (self); -+} -+ -+PyObject * -+symtab_and_line_to_sal_object (struct symtab_and_line sal) -+{ -+ sal_object *sal_obj; -+ symtab_object *symtab_obj; -+ -+ sal_obj = PyObject_New (sal_object, &sal_object_type); -+ if (sal_obj == NULL) -+ { -+ PyErr_SetString (PyExc_MemoryError, -+ "Could not allocate Symtab_and_line object."); -+ return NULL; -+ } -+ -+ if (sal.symtab) -+ { -+ symtab_obj = (symtab_object *) symtab_to_symtab_object (sal.symtab); -+ if (symtab_obj == NULL) -+ { -+ Py_DECREF (sal_obj); -+ return NULL; -+ } -+ -+ symtab_obj->symtab = sal.symtab; -+ } -+ else -+ { -+ symtab_obj = (symtab_object *) Py_None; -+ Py_INCREF (Py_None); -+ } -+ -+ sal_obj->sal = (struct symtab_and_line *) -+ xmalloc (sizeof (struct symtab_and_line)); -+ *(sal_obj->sal) = sal; -+ sal_obj->symtab = symtab_obj; -+ -+ return (PyObject *) sal_obj; -+} -+ -+PyObject * -+symtab_to_symtab_object (struct symtab *symtab) -+{ -+ symtab_object *symtab_obj; -+ -+ symtab_obj = PyObject_New (symtab_object, &symtab_object_type); -+ if (symtab_obj == NULL) -+ { -+ PyErr_SetString (PyExc_MemoryError, -+ "Could not allocate Symtab object."); -+ -+ return NULL; -+ } -+ -+ symtab_obj->symtab = symtab; -+ -+ return (PyObject *) symtab_obj; -+} -+ -+void -+gdbpy_initialize_symtabs (void) -+{ -+ symtab_object_type.tp_new = PyType_GenericNew; -+ if (PyType_Ready (&symtab_object_type) < 0) -+ return; -+ -+ sal_object_type.tp_new = PyType_GenericNew; -+ if (PyType_Ready (&sal_object_type) < 0) -+ return; -+ -+ Py_INCREF (&symtab_object_type); -+ PyModule_AddObject (gdb_module, "Symtab", (PyObject *) &symtab_object_type); -+ -+ Py_INCREF (&sal_object_type); -+ PyModule_AddObject (gdb_module, "Symtab_and_line", -+ (PyObject *) &sal_object_type); -+} -+ -+ -+ -+static PyGetSetDef symtab_object_getset[] = { -+ { "filename", stpy_get_filename, NULL, -+ "The symbol table's source filename.", NULL }, -+ { "objfile", stpy_get_objfile, NULL, "The symtab's objfile.", -+ NULL }, -+ {NULL} /* Sentinel */ -+}; -+ -+static PyMethodDef symtab_object_methods[] = { -+ { "fullname", stpy_fullname, METH_NOARGS, -+ "Return the symtab's full source filename." }, -+ {NULL} /* Sentinel */ -+}; -+ -+static PyTypeObject symtab_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Symtab", /*tp_name*/ -+ sizeof (symtab_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ 0, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ stpy_str, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT, /*tp_flags*/ -+ "GDB symtab object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ symtab_object_methods, /* tp_methods */ -+ 0, /* tp_members */ -+ symtab_object_getset /* tp_getset */ -+}; -+ -+static PyGetSetDef sal_object_getset[] = { -+ { "symtab", salpy_get_symtab, NULL, "Symtab object.", NULL }, -+ { "pc", salpy_get_pc, NULL, "Return the symtab_and_line's pc.", NULL }, -+ { "line", salpy_get_line, NULL, -+ "Return the symtab_and_line's line.", NULL }, -+ {NULL} /* Sentinel */ -+}; -+ -+static PyTypeObject sal_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Symtab_and_line", /*tp_name*/ -+ sizeof (sal_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ salpy_dealloc, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ salpy_str, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ 0, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT, /*tp_flags*/ -+ "GDB symtab_and_line object", /* tp_doc */ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ sal_object_getset /* tp_getset */ -+}; diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c -index a97c125..ac366bb 100644 +index b901255..4ff18e5 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -27,6 +27,8 @@ @@ -15863,87 +5764,7 @@ index a97c125..ac366bb 100644 static PyTypeObject type_object_type; /* A Field object. */ -@@ -434,7 +442,7 @@ typy_get_sizeof (PyObject *self, void *closure) - } - - static struct type * --typy_lookup_typename (char *type_name) -+typy_lookup_typename (char *type_name, struct block *block) - { - struct type *type = NULL; - volatile struct gdb_exception except; -@@ -448,7 +456,7 @@ typy_lookup_typename (char *type_name) - type = lookup_enum (type_name + 5, NULL); - else - type = lookup_typename (python_language, python_gdbarch, -- type_name, NULL, 0); -+ type_name, block, 0); - } - if (except.reason < 0) - { -@@ -462,7 +470,8 @@ typy_lookup_typename (char *type_name) - } - - static struct type * --typy_lookup_type (struct demangle_component *demangled) -+typy_lookup_type (struct demangle_component *demangled, -+ struct block *block) - { - struct type *type; - char *type_name; -@@ -477,7 +486,7 @@ typy_lookup_type (struct demangle_component *demangled) - || demangled_type == DEMANGLE_COMPONENT_CONST - || demangled_type == DEMANGLE_COMPONENT_VOLATILE) - { -- type = typy_lookup_type (demangled->u.s_binary.left); -+ type = typy_lookup_type (demangled->u.s_binary.left, block); - if (! type) - return NULL; - -@@ -495,7 +504,7 @@ typy_lookup_type (struct demangle_component *demangled) - } - - type_name = cp_comp_to_string (demangled, 10); -- type = typy_lookup_typename (type_name); -+ type = typy_lookup_typename (type_name, block); - xfree (type_name); - - return type; -@@ -509,10 +518,23 @@ typy_template_argument (PyObject *self, PyObject *args) - struct demangle_component *demangled; - const char *err; - struct type *argtype; -+ struct block *block = NULL; -+ PyObject *block_obj = NULL; - -- if (! PyArg_ParseTuple (args, "i", &argno)) -+ if (! PyArg_ParseTuple (args, "i|O", &argno, &block_obj)) - return NULL; - -+ if (block_obj) -+ { -+ block = block_object_to_block (block_obj); -+ if (! block) -+ { -+ PyErr_SetString (PyExc_RuntimeError, -+ "second argument must be block"); -+ return NULL; -+ } -+ } -+ - type = check_typedef (type); - if (TYPE_CODE (type) == TYPE_CODE_REF) - type = check_typedef (TYPE_TARGET_TYPE (type)); -@@ -555,7 +577,7 @@ typy_template_argument (PyObject *self, PyObject *args) - return NULL; - } - -- argtype = typy_lookup_type (demangled->u.s_binary.left); -+ argtype = typy_lookup_type (demangled->u.s_binary.left, block); - if (! argtype) - return NULL; - -@@ -597,8 +619,59 @@ typy_str (PyObject *self) +@@ -618,8 +626,59 @@ typy_str (PyObject *self) @@ -16003,7 +5824,7 @@ index a97c125..ac366bb 100644 static void save_objfile_types (struct objfile *objfile, void *datum) { -@@ -616,12 +689,13 @@ save_objfile_types (struct objfile *objfile, void *datum) +@@ -637,12 +696,13 @@ save_objfile_types (struct objfile *objfile, void *datum) { type_object *next = obj->next; @@ -16021,7 +5842,7 @@ index a97c125..ac366bb 100644 obj = next; } -@@ -632,41 +706,25 @@ save_objfile_types (struct objfile *objfile, void *datum) +@@ -653,42 +713,25 @@ save_objfile_types (struct objfile *objfile, void *datum) } static void @@ -16060,6 +5881,7 @@ index a97c125..ac366bb 100644 - { - /* Must reset head of list. */ - struct objfile *objfile = TYPE_OBJFILE (type->type); +- - if (objfile) - set_objfile_data (objfile, typy_objfile_data_key, type->next); - } @@ -16075,7 +5897,7 @@ index a97c125..ac366bb 100644 } /* Create a new Type referring to TYPE. */ -@@ -677,7 +735,10 @@ type_to_type_object (struct type *type) +@@ -699,7 +742,10 @@ type_to_type_object (struct type *type) type_obj = PyObject_New (type_object, &type_object_type); if (type_obj) @@ -16087,39 +5909,7 @@ index a97c125..ac366bb 100644 return (PyObject *) type_obj; } -@@ -696,14 +757,28 @@ type_object_to_type (PyObject *obj) - PyObject * - gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw) - { -- static char *keywords[] = { "name", NULL }; -+ static char *keywords[] = { "name", "block", NULL }; - char *type_name = NULL; - struct type *type = NULL; -+ PyObject *block_obj = NULL; -+ struct block *block = NULL; - -- if (! PyArg_ParseTupleAndKeywords (args, kw, "s", keywords, &type_name)) -+ if (! PyArg_ParseTupleAndKeywords (args, kw, "s|O", keywords, -+ &type_name, &block_obj)) - return NULL; - -- type = typy_lookup_typename (type_name); -+ if (block_obj) -+ { -+ block = block_object_to_block (block_obj); -+ if (! block) -+ { -+ PyErr_SetString (PyExc_RuntimeError, -+ "'block' argument must be a Block"); -+ return NULL; -+ } -+ } -+ -+ type = typy_lookup_typename (type_name, block); - if (! type) - return NULL; - -@@ -737,6 +812,8 @@ gdbpy_initialize_types (void) +@@ -773,6 +819,8 @@ gdbpy_initialize_types (void) Py_INCREF (&field_object_type); PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type); @@ -16128,69 +5918,8 @@ index a97c125..ac366bb 100644 } -diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c -index 4ccf97f..87cde73 100644 ---- a/gdb/python/py-utils.c -+++ b/gdb/python/py-utils.c -@@ -19,6 +19,7 @@ - - #include "defs.h" - #include "charset.h" -+#include "value.h" - #include "python-internal.h" - - -@@ -219,3 +220,48 @@ gdbpy_is_string (PyObject *obj) - { - return PyString_Check (obj) || PyUnicode_Check (obj); - } -+ -+/* Converts OBJ to a CORE_ADDR value. -+ -+ Returns 1 on success or 0 on failure, with a Python exception set. This -+ function can also throw GDB exceptions. */ -+ -+int -+get_addr_from_python (PyObject *obj, CORE_ADDR *addr) -+{ -+ if (gdbpy_is_value_object (obj)) -+ *addr = value_as_address (value_object_to_value (obj)); -+ else if (PyLong_Check (obj)) -+ { -+ /* Assume CORE_ADDR corresponds to unsigned long. */ -+ *addr = PyLong_AsUnsignedLong (obj); -+ if (PyErr_Occurred () != NULL) -+ return 0; -+ } -+ else if (PyInt_Check (obj)) -+ { -+ long val; -+ -+ /* Assume CORE_ADDR corresponds to unsigned long. */ -+ val = PyInt_AsLong (obj); -+ -+ if (val >= 0) -+ *addr = val; -+ else -+ { -+ /* If no error ocurred, VAL is indeed negative. */ -+ if (PyErr_Occurred () != NULL) -+ return 0; -+ -+ PyErr_SetString (PyExc_ValueError, "negative address"); -+ return 0; -+ } -+ } -+ else -+ { -+ PyErr_SetString (PyExc_TypeError, "invalid type for address"); -+ return 0; -+ } -+ -+ return 1; -+} diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c -index a792819..bdac80e 100644 +index 2024021..e8be12d 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -25,6 +25,7 @@ @@ -16201,55 +5930,8 @@ index a792819..bdac80e 100644 #ifdef HAVE_PYTHON -@@ -43,6 +44,10 @@ - /* Python's long type corresponds to C's long long type. */ - #define builtin_type_pylong builtin_type (python_gdbarch)->builtin_long_long - -+/* Python's long type corresponds to C's long long type. Unsigned version. */ -+#define builtin_type_upylong builtin_type \ -+ (python_gdbarch)->builtin_unsigned_long_long -+ - #define builtin_type_pybool \ - language_bool_type (python_language, python_gdbarch) - -@@ -945,7 +950,34 @@ convert_value_from_python (PyObject *obj) - { - LONGEST l = PyLong_AsLongLong (obj); - -- if (! PyErr_Occurred ()) -+ if (PyErr_Occurred ()) -+ { -+ /* If the error was an overflow, we can try converting to -+ ULONGEST instead. */ -+ if (PyErr_ExceptionMatches (PyExc_OverflowError)) -+ { -+ PyObject *etype, *evalue, *etraceback, *zero; -+ -+ PyErr_Fetch (&etype, &evalue, &etraceback); -+ zero = PyInt_FromLong (0); -+ -+ /* Check whether obj is positive. */ -+ if (PyObject_RichCompareBool (obj, zero, Py_GT) > 0) -+ { -+ ULONGEST ul; -+ -+ ul = PyLong_AsUnsignedLongLong (obj); -+ if (! PyErr_Occurred ()) -+ value = value_from_ulongest (builtin_type_upylong, ul); -+ } -+ else -+ /* There's nothing we can do. */ -+ PyErr_Restore (etype, evalue, etraceback); -+ -+ Py_DECREF (zero); -+ } -+ } -+ else - value = value_from_longest (builtin_type_pylong, l); - } - else if (PyFloat_Check (obj)) -@@ -1011,6 +1043,25 @@ gdbpy_history (PyObject *self, PyObject *args) - return value_to_value_object (res_val); +@@ -1067,6 +1068,17 @@ gdbpy_is_value_object (PyObject *obj) + return PyObject_TypeCheck (obj, &value_object_type); } +/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ @@ -16262,19 +5944,11 @@ index a792819..bdac80e 100644 + for (iter = values_in_python; iter; iter = iter->next) + type_mark_used (value_type (iter->value)); +} -+ -+/* Returns 1 in OBJ is a gdb.Value object, 0 otherwise. */ -+ -+int -+gdbpy_is_value_object (PyObject *obj) -+{ -+ return PyObject_TypeCheck (obj, &value_object_type); -+} + void gdbpy_initialize_values (void) { -@@ -1021,6 +1072,8 @@ gdbpy_initialize_values (void) +@@ -1077,6 +1089,8 @@ gdbpy_initialize_values (void) PyModule_AddObject (gdb_module, "Value", (PyObject *) &value_object_type); values_in_python = NULL; @@ -16283,726 +5957,11 @@ index a792819..bdac80e 100644 } -diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h -index 1bfa700..52f9b39 100644 ---- a/gdb/python/python-internal.h -+++ b/gdb/python/python-internal.h -@@ -61,36 +61,79 @@ typedef int Py_ssize_t; - #define PyEval_ReleaseLock() 0 - #endif - -+#include "command.h" -+ -+struct block; -+struct symbol; -+struct symtab_and_line; - struct value; - struct language_defn; - - extern PyObject *gdb_module; -+extern PyTypeObject block_object_type; - extern PyTypeObject value_object_type; -+extern PyTypeObject symbol_object_type; -+ -+/* Used in python-inferior.c. */ -+typedef struct -+{ -+ PyObject_HEAD -+ -+ /* The thread we represent. */ -+ struct thread_info *thread; -+ -+ /* The Inferior object to which this thread belongs. */ -+ PyObject *inf_obj; -+} thread_object; - - PyObject *gdbpy_history (PyObject *self, PyObject *args); -+PyObject *gdbpy_breakpoints (PyObject *, PyObject *); - PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *); -+PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw); - PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args); -+PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args); - PyObject *gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw); - PyObject *gdbpy_create_lazy_string_object (CORE_ADDR address, long length, - const char *encoding, struct type *type); -+PyObject *gdbpy_inferiors (PyObject *unused, PyObject *unused2); -+PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args); - -+PyObject *symtab_and_line_to_sal_object (struct symtab_and_line sal); -+PyObject *symtab_to_symtab_object (struct symtab *symtab); -+PyObject *symbol_to_symbol_object (struct symbol *sym); -+PyObject *block_to_block_object (struct block *block); - PyObject *value_to_value_object (struct value *v); - PyObject *type_to_type_object (struct type *); - PyObject *objfile_to_objfile_object (struct objfile *); -+PyObject *frame_info_to_frame_object (struct frame_info *frame); -+thread_object *create_thread_object (struct thread_info *tp); -+thread_object *find_thread_object (ptid_t ptid); -+PyObject *find_inferior_object (int pid); - - PyObject *objfpy_get_printers (PyObject *, void *); - -+struct block *block_object_to_block (PyObject *obj); -+struct symbol *symbol_object_to_symbol (PyObject *obj); - struct value *value_object_to_value (PyObject *self); - struct value *convert_value_from_python (PyObject *obj); - struct type *type_object_to_type (PyObject *obj); - -+PyObject *gdbpy_get_hook_function (const char *); -+ - void gdbpy_initialize_values (void); -+void gdbpy_initialize_breakpoints (void); - void gdbpy_initialize_frames (void); -+void gdbpy_initialize_symtabs (void); - void gdbpy_initialize_commands (void); -+void gdbpy_initialize_symbols (void); - void gdbpy_initialize_types (void); -+void gdbpy_initialize_blocks (void); - void gdbpy_initialize_functions (void); - void gdbpy_initialize_objfile (void); - void gdbpy_initialize_lazy_string (void); -+void gdbpy_initialize_parameters (void); -+void gdbpy_initialize_thread (void); -+void gdbpy_initialize_inferior (void); - - struct cleanup *make_cleanup_py_decref (PyObject *py); - -@@ -100,6 +143,12 @@ struct cleanup *ensure_python_env (struct gdbarch *gdbarch, - extern struct gdbarch *python_gdbarch; - extern const struct language_defn *python_language; - -+char *gdbpy_parse_command_name (char *text, -+ struct cmd_list_element ***base_list, -+ struct cmd_list_element **start_list); -+ -+PyObject *gdbpy_parameter_value (enum var_types, void *); -+ - /* Use this after a TRY_EXCEPT to throw the appropriate Python - exception. */ - #define GDB_PY_HANDLE_EXCEPTION(Exception) \ -@@ -110,6 +159,19 @@ extern const struct language_defn *python_language; - "%s", Exception.message); \ - } while (0) - -+/* Use this after a TRY_EXCEPT to throw the appropriate Python -+ exception. This macro is for use inside setter functions. */ -+#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \ -+ do { \ -+ if (Exception.reason < 0) \ -+ { \ -+ PyErr_Format (Exception.reason == RETURN_QUIT \ -+ ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, \ -+ "%s", Exception.message); \ -+ return -1; \ -+ } \ -+ } while (0) -+ - - void gdbpy_print_stack (void); - -@@ -125,17 +187,22 @@ gdb_byte *gdbpy_extract_lazy_string (PyObject *string, - struct type **str_type, - long *length, char **encoding); - -+int gdbpy_is_value_object (PyObject *obj); -+ - /* Note that these are declared here, and not in python.h with the - other pretty-printer functions, because they refer to PyObject. */ - PyObject *apply_varobj_pretty_printer (PyObject *print_obj, - struct value **replacement); - PyObject *gdbpy_get_varobj_pretty_printer (struct value *value); -+PyObject *gdbpy_instantiate_printer (PyObject *cons, PyObject *value); - char *gdbpy_get_display_hint (PyObject *printer); - PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args); - --extern PyObject *gdbpy_doc_cst; - extern PyObject *gdbpy_children_cst; - extern PyObject *gdbpy_to_string_cst; - extern PyObject *gdbpy_display_hint_cst; -+extern PyObject *gdbpy_doc_cst; -+ -+int get_addr_from_python (PyObject *obj, CORE_ADDR *addr); - - #endif /* GDB_PYTHON_INTERNAL_H */ -diff --git a/gdb/python/python.c b/gdb/python/python.c -index 29386c9..195dace 100644 ---- a/gdb/python/python.c -+++ b/gdb/python/python.c -@@ -28,6 +28,7 @@ - #include "value.h" - #include "language.h" - #include "exceptions.h" -+#include "event-loop.h" - - #include - -@@ -46,10 +47,17 @@ static int gdbpy_auto_load = 1; - #include "cli/cli-decode.h" - #include "charset.h" - #include "top.h" -+#include "solib.h" - #include "python-internal.h" -+#include "linespec.h" -+#include "symtab.h" -+#include "source.h" - #include "version.h" -+#include "inferior.h" -+#include "gdbthread.h" - #include "target.h" - #include "gdbthread.h" -+#include "event-top.h" - - static PyMethodDef GdbMethods[]; - -@@ -197,10 +205,10 @@ python_command (char *arg, int from_tty) - NULL (and set a Python exception) on error. Helper function for - get_parameter. */ - --static PyObject * --parameter_to_python (struct cmd_list_element *cmd) -+PyObject * -+gdbpy_parameter_value (enum var_types type, void *var) - { -- switch (cmd->var_type) -+ switch (type) - { - case var_string: - case var_string_noescape: -@@ -208,7 +216,7 @@ parameter_to_python (struct cmd_list_element *cmd) - case var_filename: - case var_enum: - { -- char *str = * (char **) cmd->var; -+ char *str = * (char **) var; - if (! str) - str = ""; - return PyString_Decode (str, strlen (str), host_charset (), NULL); -@@ -216,7 +224,7 @@ parameter_to_python (struct cmd_list_element *cmd) - - case var_boolean: - { -- if (* (int *) cmd->var) -+ if (* (int *) var) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; -@@ -224,7 +232,7 @@ parameter_to_python (struct cmd_list_element *cmd) - - case var_auto_boolean: - { -- enum auto_boolean ab = * (enum auto_boolean *) cmd->var; -+ enum auto_boolean ab = * (enum auto_boolean *) var; - if (ab == AUTO_BOOLEAN_TRUE) - Py_RETURN_TRUE; - else if (ab == AUTO_BOOLEAN_FALSE) -@@ -234,15 +242,15 @@ parameter_to_python (struct cmd_list_element *cmd) - } - - case var_integer: -- if ((* (int *) cmd->var) == INT_MAX) -+ if ((* (int *) var) == INT_MAX) - Py_RETURN_NONE; - /* Fall through. */ - case var_zinteger: -- return PyLong_FromLong (* (int *) cmd->var); -+ return PyLong_FromLong (* (int *) var); - - case var_uinteger: - { -- unsigned int val = * (unsigned int *) cmd->var; -+ unsigned int val = * (unsigned int *) var; - if (val == UINT_MAX) - Py_RETURN_NONE; - return PyLong_FromUnsignedLong (val); -@@ -280,7 +288,7 @@ gdbpy_parameter (PyObject *self, PyObject *args) - - if (! cmd->var) - return PyErr_Format (PyExc_RuntimeError, "`%s' is not a parameter", arg); -- return parameter_to_python (cmd); -+ return gdbpy_parameter_value (cmd->var_type, cmd->var); - } - - /* A Python function which evaluates a string using the gdb CLI. */ -@@ -323,6 +331,105 @@ execute_gdb_command (PyObject *self, PyObject *args) - Py_RETURN_NONE; - } - -+/* Implementation of gdb.solib_address (Long) -> String. -+ Returns the name of the shared library holding a given address, or None. */ -+ -+static PyObject * -+gdbpy_solib_address (PyObject *self, PyObject *args) -+{ -+ unsigned long long pc; -+ char *soname; -+ PyObject *str_obj; -+ -+ if (!PyArg_ParseTuple (args, "K", &pc)) -+ return NULL; -+ -+ soname = solib_name_from_address (current_program_space, pc); -+ if (soname) -+ str_obj = PyString_Decode (soname, strlen (soname), host_charset (), NULL); -+ else -+ { -+ str_obj = Py_None; -+ Py_INCREF (Py_None); -+ } -+ -+ return str_obj; -+} -+ -+/* A Python function which is a wrapper for decode_line_1. */ -+ -+static PyObject * -+gdbpy_decode_line (PyObject *self, PyObject *args) -+{ -+ struct symtabs_and_lines sals = { NULL, 0 }; /* Initialize to appease gcc. */ -+ struct symtab_and_line sal; -+ char *arg = NULL; -+ int free_sals = 0, i; -+ PyObject *result = NULL; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "|s", &arg)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (arg) -+ { -+ char *copy; -+ -+ arg = strdup (arg); -+ copy = arg; -+ -+ sals = decode_line_1 (©, 0, 0, 0, 0, 0); -+ free_sals = 1; -+ } -+ else -+ { -+ set_default_source_symtab_and_line (); -+ sal = get_current_source_symtab_and_line (); -+ sals.sals = &sal; -+ sals.nelts = 1; -+ } -+ } -+ if (arg) -+ xfree (arg); -+ -+ if (except.reason < 0) -+ { -+ if (free_sals) -+ xfree (sals.sals); -+ /* We know this will always throw. */ -+ GDB_PY_HANDLE_EXCEPTION (except); -+ } -+ -+ if (sals.nelts) -+ { -+ result = PyTuple_New (sals.nelts); -+ for (i = 0; i < sals.nelts; ++i) -+ { -+ PyObject *obj; -+ char *str; -+ -+ obj = symtab_and_line_to_sal_object (sals.sals[i]); -+ if (! obj) -+ { -+ Py_DECREF (result); -+ result = NULL; -+ break; -+ } -+ -+ PyTuple_SetItem (result, i, obj); -+ } -+ } -+ -+ if (free_sals) -+ xfree (sals.sals); -+ -+ if (result) -+ return result; -+ Py_RETURN_NONE; -+} -+ - /* Parse a string and evaluate it as an expression. */ - static PyObject * - gdbpy_parse_and_eval (PyObject *self, PyObject *args) -@@ -361,6 +468,114 @@ source_python_script (FILE *stream, char *file) - - - -+/* Posting and handling events. */ -+ -+/* A single event. */ -+struct gdbpy_event -+{ -+ /* The Python event. This is just a callable object. */ -+ PyObject *event; -+ /* The next event. */ -+ struct gdbpy_event *next; -+}; -+ -+/* All pending events. */ -+static struct gdbpy_event *gdbpy_event_list; -+/* The final link of the event list. */ -+static struct gdbpy_event **gdbpy_event_list_end; -+ -+/* We use a file handler, and not an async handler, so that we can -+ wake up the main thread even when it is blocked in poll(). */ -+static int gdbpy_event_fds[2]; -+ -+/* The file handler callback. This reads from the internal pipe, and -+ then processes the Python event queue. This will always be run in -+ the main gdb thread. */ -+static void -+gdbpy_run_events (int err, gdb_client_data ignore) -+{ -+ struct cleanup *cleanup; -+ char buffer[100]; -+ int r; -+ -+ cleanup = ensure_python_env (get_current_arch (), current_language); -+ -+ /* Just read whatever is available on the fd. It is relatively -+ harmless if there are any bytes left over. */ -+ r = read (gdbpy_event_fds[0], buffer, sizeof (buffer)); -+ -+ while (gdbpy_event_list) -+ { -+ /* Dispatching the event might push a new element onto the event -+ loop, so we update here "atomically enough". */ -+ struct gdbpy_event *item = gdbpy_event_list; -+ gdbpy_event_list = gdbpy_event_list->next; -+ if (gdbpy_event_list == NULL) -+ gdbpy_event_list_end = &gdbpy_event_list; -+ -+ /* Ignore errors. */ -+ PyObject_CallObject (item->event, NULL); -+ -+ Py_DECREF (item->event); -+ xfree (item); -+ } -+ -+ do_cleanups (cleanup); -+} -+ -+/* Submit an event to the gdb thread. */ -+static PyObject * -+gdbpy_post_event (PyObject *self, PyObject *args) -+{ -+ struct gdbpy_event *event; -+ PyObject *func; -+ int wakeup; -+ -+ if (!PyArg_ParseTuple (args, "O", &func)) -+ return NULL; -+ -+ if (!PyCallable_Check (func)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "Posted event is not callable"); -+ return NULL; -+ } -+ -+ Py_INCREF (func); -+ -+ /* From here until the end of the function, we have the GIL, so we -+ can operate on our global data structures without worrying. */ -+ wakeup = gdbpy_event_list == NULL; -+ -+ event = XNEW (struct gdbpy_event); -+ event->event = func; -+ event->next = NULL; -+ *gdbpy_event_list_end = event; -+ gdbpy_event_list_end = &event->next; -+ -+ /* Wake up gdb when needed. */ -+ if (wakeup) -+ { -+ char c = 'q'; /* Anything. */ -+ if (write (gdbpy_event_fds[1], &c, 1) != 1) -+ return PyErr_SetFromErrno (PyExc_IOError); -+ } -+ -+ Py_RETURN_NONE; -+} -+ -+/* Initialize the Python event handler. */ -+static void -+gdbpy_initialize_events (void) -+{ -+ if (!pipe (gdbpy_event_fds)) -+ { -+ gdbpy_event_list_end = &gdbpy_event_list; -+ add_file_handler (gdbpy_event_fds[0], gdbpy_run_events, NULL); -+ } -+} -+ -+ -+ - /* Printing. */ - - /* A python function to write a single string using gdb's filtered -@@ -397,6 +612,55 @@ gdbpy_print_stack (void) - - - -+/* Script interface. */ -+ -+/* True if 'gdb -P' was used, false otherwise. */ -+static int running_python_script; -+ -+/* True if we are currently in a call to 'gdb.cli', false otherwise. */ -+static int in_cli; -+ -+/* Enter the command loop. */ -+ -+static PyObject * -+gdbpy_cli (PyObject *unused1, PyObject *unused2) -+{ -+ if (! running_python_script || in_cli) -+ return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively"); -+ -+ in_cli = 1; -+ cli_command_loop (); -+ in_cli = 0; -+ -+ Py_RETURN_NONE; -+} -+ -+/* Set up the Python argument vector and evaluate a script. This is -+ used to implement 'gdb -P'. */ -+ -+void -+run_python_script (int argc, char **argv) -+{ -+ FILE *input; -+ -+ /* We never free this, since we plan to exit at the end. */ -+ ensure_python_env (get_current_arch (), current_language); -+ -+ running_python_script = 1; -+ PySys_SetArgv (argc - 1, argv + 1); -+ input = fopen (argv[0], "r"); -+ if (! input) -+ { -+ fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno)); -+ exit (1); -+ } -+ PyRun_SimpleFile (input, argv[0]); -+ fclose (input); -+ exit (0); -+} -+ -+ -+ - /* The "current" objfile. This is set when gdb detects that a new - objfile has been loaded. It is only set for the duration of a call - to gdbpy_new_objfile; it is NULL at other times. */ -@@ -640,14 +904,28 @@ Enables or disables auto-loading of Python code when an object is opened."), - PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version); - PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", (char*) host_name); - PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", (char*) target_name); -+#ifdef PYTHONDIR -+ PyModule_AddStringConstant (gdb_module, "pythondir", PYTHONDIR); -+#else -+ if (gdb_datadir) -+ PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir); -+#endif - - gdbpy_initialize_values (); -+ gdbpy_initialize_breakpoints (); - gdbpy_initialize_frames (); -+ gdbpy_initialize_symtabs (); - gdbpy_initialize_commands (); -+ gdbpy_initialize_symbols (); -+ gdbpy_initialize_blocks (); - gdbpy_initialize_functions (); - gdbpy_initialize_types (); -+ gdbpy_initialize_parameters (); - gdbpy_initialize_objfile (); - gdbpy_initialize_lazy_string (); -+ gdbpy_initialize_thread (); -+ gdbpy_initialize_inferior (); -+ gdbpy_initialize_events (); - - PyRun_SimpleString ("import gdb"); - PyRun_SimpleString ("gdb.pretty_printers = []"); -@@ -683,6 +961,15 @@ class GdbOutputFile:\n\ - \n\ - sys.stderr = GdbOutputFile()\n\ - sys.stdout = GdbOutputFile()\n\ -+if hasattr (gdb, 'datadir'):\n\ -+ gdb.pythondir = gdb.datadir + '/python'\n\ -+if hasattr (gdb, 'pythondir'):\n\ -+ sys.path.insert(0, gdb.pythondir)\n\ -+ gdb.__path__ = [gdb.pythondir + '/gdb']\n\ -+ from os.path import exists\n\ -+ ipy = gdb.pythondir + '/gdb/__init__.py'\n\ -+ if exists (ipy):\n\ -+ execfile (ipy)\n\ - "); - - /* Release the GIL while gdb runs. */ -@@ -702,9 +989,14 @@ static PyMethodDef GdbMethods[] = - "Get a value from history" }, - { "execute", execute_gdb_command, METH_VARARGS, - "Execute a gdb command" }, -+ { "cli", gdbpy_cli, METH_NOARGS, -+ "Enter the gdb CLI" }, - { "parameter", gdbpy_parameter, METH_VARARGS, - "Return a gdb parameter's value" }, - -+ { "breakpoints", gdbpy_breakpoints, METH_NOARGS, -+ "Return a tuple of all breakpoint objects" }, -+ - { "default_visualizer", gdbpy_default_visualizer, METH_VARARGS, - "Find the default visualizer for a Value." }, - -@@ -725,11 +1017,39 @@ Return a string explaining unwind stop reason." }, - "lookup_type (name [, block]) -> type\n\ - Return a Type corresponding to the given name." }, - -+ { "lookup_symbol", (PyCFunction) gdbpy_lookup_symbol, -+ METH_VARARGS | METH_KEYWORDS, -+ "lookup_symbol (name [, block] [, domain]) -> (symbol, is_field_of_this)\n\ -+Return a tuple with the symbol corresponding to the given name (or None) and\n\ -+a boolean indicating if name is a field of the current implied argument\n\ -+`this' (when the current language is object-oriented)." }, -+ { "solib_address", gdbpy_solib_address, METH_VARARGS, -+ "solib_address (Long) -> String.\n\ -+Return the name of the shared library holding a given address, or None." }, -+ -+ { "block_for_pc", gdbpy_block_for_pc, METH_VARARGS, -+ "Return the block containing the given pc value, or None." }, -+ -+ { "decode_line", gdbpy_decode_line, METH_VARARGS, -+ "Decode a string argument the way that 'break' or 'edit' does.\n\ -+Return a tuple holding the file name (or None) and line number (or None).\n\ -+Note: may later change to return an object." }, -+ -+ { "selected_thread", gdbpy_selected_thread, METH_NOARGS, -+ "selected_thread () -> gdb.InferiorThread.\n\ -+Return the selected thread object." }, -+ { "inferiors", gdbpy_inferiors, METH_NOARGS, -+ "inferiors () -> (gdb.Inferior, ...).\n\ -+Return a tuple containing all inferiors." }, -+ - { "parse_and_eval", gdbpy_parse_and_eval, METH_VARARGS, - "parse_and_eval (String) -> Value.\n\ - Parse String as an expression, evaluate it, and return the result as a Value." - }, - -+ { "post_event", gdbpy_post_event, METH_VARARGS, -+ "Post an event into gdb's event loop." }, -+ - { "write", gdbpy_write, METH_VARARGS, - "Write a string using gdb's filtered stream." }, - { "flush", gdbpy_flush, METH_NOARGS, -diff --git a/gdb/python/python.h b/gdb/python/python.h -index 5d93f67..1a5b9a8 100644 ---- a/gdb/python/python.h -+++ b/gdb/python/python.h -@@ -26,6 +26,8 @@ void eval_python_from_control_command (struct command_line *); - - void source_python_script (FILE *stream, char *file); - -+void run_python_script (int argc, char **argv); -+ - int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, -diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c -index 5898aad..23e5f22 100644 ---- a/gdb/scm-lang.c -+++ b/gdb/scm-lang.c -@@ -231,6 +231,7 @@ const struct exp_descriptor exp_descriptor_scm = - { - print_subexp_standard, - operator_length_standard, -+ operator_check_standard, - op_name_standard, - dump_subexp_body_standard, - evaluate_exp -diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c -index 1e8d48e..95185d4 100644 ---- a/gdb/scm-valprint.c -+++ b/gdb/scm-valprint.c -@@ -62,9 +62,9 @@ scm_inferior_print (struct type *type, LONGEST value, struct ui_file *stream, - { - /* XXX: Should we cache these symbols? */ - gdb_output_sym = -- lookup_symbol_global ("gdb_output", NULL, NULL, VAR_DOMAIN); -+ lookup_symbol_global ("gdb_output", NULL, VAR_DOMAIN); - gdb_output_len_sym = -- lookup_symbol_global ("gdb_output_length", NULL, NULL, VAR_DOMAIN); -+ lookup_symbol_global ("gdb_output_length", NULL, VAR_DOMAIN); - - if ((gdb_output_sym == NULL) || (gdb_output_len_sym == NULL)) - ret = -1; -diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c -index da4137b..e3fcb1a 100644 ---- a/gdb/sh-linux-tdep.c -+++ b/gdb/sh-linux-tdep.c -@@ -25,6 +25,7 @@ - - #include "glibc-tdep.h" - #include "sh-tdep.h" -+#include "linux-tdep.h" - - #define REGSx16(base) \ - {(base), 0}, \ -@@ -89,6 +90,9 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - tdep->core_gregmap = (struct sh_corefile_regmap *)gregs_table; - tdep->core_fpregmap = (struct sh_corefile_regmap *)fpregs_table; - } -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c -index 3c70089..0ee7d85 100644 ---- a/gdb/solib-darwin.c -+++ b/gdb/solib-darwin.c -@@ -408,7 +408,6 @@ darwin_relocate_section_addresses (struct so_list *so, - static struct symbol * - darwin_lookup_lib_symbol (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain) - { - return NULL; -diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c -index 94a77fb..7ea68d2 100644 ---- a/gdb/solib-spu.c -+++ b/gdb/solib-spu.c -@@ -326,16 +326,13 @@ spu_bfd_open (char *pathname) - static struct symbol * - spu_lookup_lib_symbol (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain) - { - if (bfd_get_arch (objfile->obfd) == bfd_arch_spu) -- return lookup_global_symbol_from_objfile (objfile, name, linkage_name, -- domain); -+ return lookup_global_symbol_from_objfile (objfile, name, domain); - - if (svr4_so_ops.lookup_lib_global_symbol != NULL) -- return svr4_so_ops.lookup_lib_global_symbol (objfile, name, linkage_name, -- domain); -+ return svr4_so_ops.lookup_lib_global_symbol (objfile, name, domain); - return NULL; - } - diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c -index 8edc889..5ea1779 100644 +index 1f135d4..489838d 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c -@@ -1241,7 +1241,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc) +@@ -1278,7 +1278,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc) && pc < info->interp_text_sect_high) || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high) @@ -17012,269 +5971,11 @@ index 8edc889..5ea1779 100644 } /* Given an executable's ABFD and target, compute the entry-point -@@ -2038,7 +2039,6 @@ struct target_so_ops svr4_so_ops; - static struct symbol * - elf_lookup_lib_symbol (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain) - { - bfd *abfd; -@@ -2056,8 +2056,7 @@ elf_lookup_lib_symbol (const struct objfile *objfile, - if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1) - return NULL; - -- return lookup_global_symbol_from_objfile -- (objfile, name, linkage_name, domain); -+ return lookup_global_symbol_from_objfile (objfile, name, domain); - } - - extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */ -diff --git a/gdb/solib.c b/gdb/solib.c -index 842b27c..ac1c407 100644 ---- a/gdb/solib.c -+++ b/gdb/solib.c -@@ -1154,13 +1154,12 @@ show_auto_solib_add (struct ui_file *file, int from_tty, - struct symbol * - solib_global_lookup (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain) - { - struct target_so_ops *ops = solib_ops (target_gdbarch); - - if (ops->lookup_lib_global_symbol != NULL) -- return ops->lookup_lib_global_symbol (objfile, name, linkage_name, domain); -+ return ops->lookup_lib_global_symbol (objfile, name, domain); - return NULL; - } - -diff --git a/gdb/solist.h b/gdb/solist.h -index 573f736..51bfce9 100644 ---- a/gdb/solist.h -+++ b/gdb/solist.h -@@ -117,7 +117,6 @@ struct target_so_ops - /* Hook for looking up global symbols in a library-specific way. */ - struct symbol * (*lookup_lib_global_symbol) (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain); - - /* Given two so_list objects, one from the GDB thread list -@@ -157,7 +156,6 @@ extern struct target_so_ops *current_target_so_ops; - /* Handler for library-specific global symbol lookup in solib.c. */ - struct symbol *solib_global_lookup (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain); - - #endif -diff --git a/gdb/somread.c b/gdb/somread.c -index 3d93c5e..a943806 100644 ---- a/gdb/somread.c -+++ b/gdb/somread.c -@@ -432,6 +432,7 @@ static struct sym_fns som_sym_fns = - som_new_init, /* sym_new_init: init anything gbl to entire symtab */ - som_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - som_symfile_read, /* sym_read: read a symbol file into symtab */ -+ NULL, /* sym_read_psymbols */ - som_symfile_finish, /* sym_finish: finished with file, cleanup */ - som_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */ - default_symfile_segments, /* sym_segments: Get segment information from -diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c -index d65db6c..e91c0bf 100644 ---- a/gdb/sparc-linux-tdep.c -+++ b/gdb/sparc-linux-tdep.c -@@ -32,6 +32,7 @@ - #include "symtab.h" - #include "trad-frame.h" - #include "tramp-frame.h" -+#include "linux-tdep.h" - - #include "sparc-tdep.h" - -@@ -279,6 +280,9 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - dwarf2_append_unwinders (gdbarch); - - set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c -index 8b7e908..4de6d9c 100644 ---- a/gdb/sparc64-linux-tdep.c -+++ b/gdb/sparc64-linux-tdep.c -@@ -31,6 +31,7 @@ - #include "symtab.h" - #include "trad-frame.h" - #include "tramp-frame.h" -+#include "linux-tdep.h" - - #include "sparc64-tdep.h" - -@@ -244,6 +245,9 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - tdep->step_trap = sparc64_linux_step_trap; - - set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - -diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c -index c6db8dc..7359b50 100644 ---- a/gdb/spu-tdep.c -+++ b/gdb/spu-tdep.c -@@ -1841,7 +1841,7 @@ spu_catch_start (struct objfile *objfile) - struct symbol *sym; - struct symtab_and_line sal; - -- sym = lookup_block_symbol (block, "main", NULL, VAR_DOMAIN); -+ sym = lookup_block_symbol (block, "main", VAR_DOMAIN); - if (sym) - { - fixup_symbol_section (sym, objfile); -diff --git a/gdb/stack.c b/gdb/stack.c -index 2caf9d2..7adc399 100644 ---- a/gdb/stack.c -+++ b/gdb/stack.c -@@ -1309,24 +1309,24 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty) - else - count = -1; - -- if (info_verbose) -- { -- struct partial_symtab *ps; -- -- /* Read in symbols for all of the frames. Need to do this in a -- separate pass so that "Reading in symbols for xxx" messages -- don't screw up the appearance of the backtrace. Also if -- people have strong opinions against reading symbols for -- backtrace this may have to be an option. */ -- i = count; -- for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi)) -- { -- QUIT; -- ps = find_pc_psymtab (get_frame_address_in_block (fi)); -- if (ps) -- PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in. */ -- } -- } -+ { -+ struct partial_symtab *ps; -+ -+ /* Read in symbols for all of the frames. Need to do this -+ unconditionally to ensure that psymbols are read. Also need to -+ do this in a separate pass so that "Reading in symbols for xxx" -+ messages don't screw up the appearance of the backtrace. Also -+ if people have strong opinions against reading symbols for -+ backtrace this may have to be an option. */ -+ i = count; -+ for (fi = trailing; fi != NULL && i--; fi = get_prev_frame (fi)) -+ { -+ QUIT; -+ ps = find_pc_psymtab (get_frame_address_in_block (fi)); -+ if (info_verbose && ps) -+ PSYMTAB_TO_SYMTAB (ps); /* Force syms to come in. */ -+ } -+ } - - for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi)) - { -diff --git a/gdb/symfile.c b/gdb/symfile.c -index 8705420..16f96a1 100644 ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -968,13 +968,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - /* Give user a chance to burp if we'd be - interactively wiping out any existing symbols. */ - -- if ((have_full_symbols () || have_partial_symbols ()) -- && (add_flags & SYMFILE_MAINLINE) -+ if ((add_flags & SYMFILE_MAINLINE) -+ && (have_full_symbols () || have_partial_symbols ()) - && from_tty -+ && (have_full_symbols () || have_partial_symbols ()) - && !query (_("Load new symbol table from \"%s\"? "), name)) - error (_("Not confirmed.")); - - objfile = allocate_objfile (abfd, flags); -+ if (add_flags & SYMFILE_MAINLINE) -+ objfile->flags |= OBJF_MAIN; - discard_cleanups (my_cleanups); - - /* We either created a new mapped symbol table, mapped an existing -@@ -1001,6 +1004,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - - if ((flags & OBJF_READNOW) || readnow_symbol_files) - { -+ require_partial_symbols (objfile); -+ - if (from_tty || info_verbose) - { - printf_unfiltered (_("expanding to full symbols...")); -@@ -2323,6 +2328,7 @@ reread_symbols (void) - objfile->symtabs = NULL; - objfile->psymtabs = NULL; - objfile->psymtabs_addrmap = NULL; -+ objfile->quick_addrmap = NULL; - objfile->free_psymtabs = NULL; - objfile->cp_namespace_symtab = NULL; - objfile->msymbols = NULL; -@@ -2333,6 +2339,8 @@ reread_symbols (void) - memset (&objfile->msymbol_demangled_hash, 0, - sizeof (objfile->msymbol_demangled_hash)); - -+ objfile->flags &= ~OBJF_SYMTABS_READ; -+ - objfile->psymbol_cache = bcache_xmalloc (); - objfile->macro_cache = bcache_xmalloc (); - objfile->filename_cache = bcache_xmalloc (); -diff --git a/gdb/symfile.h b/gdb/symfile.h -index fe95255..075610b 100644 ---- a/gdb/symfile.h -+++ b/gdb/symfile.h -@@ -141,6 +141,12 @@ struct sym_fns - - void (*sym_read) (struct objfile *, int); - -+ /* Read the partial symbols for an objfile. This may be NULL, in -+ which case gdb assumes that sym_read already read the partial -+ symbols. */ -+ -+ void (*sym_read_psymbols) (struct objfile *); -+ - /* Called when we are finished with an objfile. Should do all - cleanup that is specific to the object file format for the - particular objfile. */ -@@ -330,8 +336,7 @@ extern int auto_solib_limit; - - extern void set_initial_language (void); - --extern struct partial_symtab *allocate_psymtab (const char *, -- struct objfile *); -+extern struct partial_symtab *allocate_psymtab (const char *, struct objfile *); - - extern void discard_psymtab (struct partial_symtab *); - -@@ -402,7 +407,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data); - /* From dwarf2read.c */ - - extern int dwarf2_has_info (struct objfile *); -- -+extern void dwarf2_create_quick_addrmap (struct objfile *); - extern void dwarf2_build_psymtabs (struct objfile *); - extern void dwarf2_build_frame_info (struct objfile *); - diff --git a/gdb/symmisc.c b/gdb/symmisc.c -index 1f3eb9e..3ff239a 100644 +index 62e6b97..00dc613 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c -@@ -294,6 +294,9 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) +@@ -262,6 +262,9 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) case mst_text: ms_type = 'T'; break; @@ -17284,848 +5985,62 @@ index 1f3eb9e..3ff239a 100644 case mst_solib_trampoline: ms_type = 'S'; break; -@@ -1143,7 +1146,7 @@ maintenance_check_symtabs (char *ignore, int from_tty) - while (length--) - { - sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym), -- NULL, SYMBOL_DOMAIN (*psym)); -+ SYMBOL_DOMAIN (*psym)); - if (!sym) - { - printf_filtered ("Static symbol `"); -@@ -1160,7 +1163,7 @@ maintenance_check_symtabs (char *ignore, int from_tty) - while (length--) - { - sym = lookup_block_symbol (b, SYMBOL_LINKAGE_NAME (*psym), -- NULL, SYMBOL_DOMAIN (*psym)); -+ SYMBOL_DOMAIN (*psym)); - if (!sym) - { - printf_filtered ("Global symbol `"); diff --git a/gdb/symtab.c b/gdb/symtab.c -index af4e501..9537dae 100644 +index 9472c24..561ee50 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c -@@ -42,6 +42,7 @@ - #include "ada-lang.h" - #include "p-lang.h" - #include "addrmap.h" -+#include "cp-support.h" - - #include "hashtab.h" - -@@ -85,7 +86,6 @@ static int find_line_common (struct linetable *, int, int *); - char *operator_chars (char *p, char **end); - - static struct symbol *lookup_symbol_aux (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain, - enum language language, -@@ -93,20 +93,19 @@ static struct symbol *lookup_symbol_aux (const char *name, - - static - struct symbol *lookup_symbol_aux_local (const char *name, -- const char *linkage_name, - const struct block *block, -- const domain_enum domain); -+ const domain_enum domain, -+ enum language language, -+ int *is_a_field_of_this); - - static - struct symbol *lookup_symbol_aux_symtabs (int block_index, - const char *name, -- const char *linkage_name, - const domain_enum domain); - - static - struct symbol *lookup_symbol_aux_psymtabs (int block_index, - const char *name, -- const char *linkage_name, - const domain_enum domain); - - static int file_matches (char *, char **, int); -@@ -271,7 +270,7 @@ lookup_partial_symtab (const char *name) - make_cleanup (xfree, real_path); - } - -- ALL_PSYMTABS (objfile, pst) -+ ALL_PSYMTABS_REQUIRED (objfile, pst) - { - if (FILENAME_CMP (name, pst->filename) == 0) - { -@@ -414,7 +413,8 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol, - gsymbol->language = language; - if (gsymbol->language == language_cplus - || gsymbol->language == language_java -- || gsymbol->language == language_objc) -+ || gsymbol->language == language_objc -+ || gsymbol->language == language_fortran) - { - gsymbol->language_specific.cplus_specific.demangled_name = NULL; - } -@@ -498,7 +498,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, - || gsymbol->language == language_auto) - { - demangled = -- cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI); -+ cplus_demangle (mangled, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE); - if (demangled != NULL) - { - gsymbol->language = language_cplus; -@@ -695,6 +695,7 @@ symbol_natural_name (const struct general_symbol_info *gsymbol) - case language_cplus: - case language_java: - case language_objc: -+ case language_fortran: - if (gsymbol->language_specific.cplus_specific.demangled_name != NULL) - return gsymbol->language_specific.cplus_specific.demangled_name; - break; -@@ -720,6 +721,7 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol) - case language_cplus: - case language_java: - case language_objc: -+ case language_fortran: - if (gsymbol->language_specific.cplus_specific.demangled_name != NULL) - return gsymbol->language_specific.cplus_specific.demangled_name; - break; -@@ -931,7 +933,13 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) - than the later used TEXTLOW/TEXTHIGH one. */ - - ALL_OBJFILES (objfile) -- if (objfile->psymtabs_addrmap != NULL) -+ { -+ if (objfile->quick_addrmap) -+ { -+ if (!addrmap_find (objfile->quick_addrmap, pc)) -+ continue; -+ } -+ if (require_partial_symbols (objfile)->psymtabs_addrmap != NULL) - { - struct partial_symtab *pst; - -@@ -964,6 +972,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) - return pst; - } - } -+ } - - /* Existing PSYMTABS_ADDRMAP mapping is present even for PARTIAL_SYMTABs - which still have no corresponding full SYMTABs read. But it is not -@@ -1231,6 +1240,22 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) - return psym; - } - -+/* Ensure that the partial symbols for OBJFILE have been loaded. This -+ function always returns its argument, as a convenience. */ -+ -+struct objfile * -+require_partial_symbols (struct objfile *objfile) -+{ -+ if ((objfile->flags & OBJF_SYMTABS_READ) == 0) -+ { -+ objfile->flags |= OBJF_SYMTABS_READ; -+ -+ if (objfile->sf->sym_read_psymbols) -+ (*objfile->sf->sym_read_psymbols) (objfile); -+ } -+ return objfile; -+} -+ - /* Find the definition for a specified symbol name NAME - in domain DOMAIN, visible from lexical block BLOCK. - Returns the struct symbol pointer, or zero if no symbol is found. -@@ -1257,10 +1282,14 @@ lookup_symbol_in_language (const char *name, const struct block *block, - { - char *demangled_name = NULL; - const char *modified_name = NULL; -- const char *mangled_name = NULL; - struct symbol *returnval; - struct cleanup *cleanup = make_cleanup (null_cleanup, 0); - -+ if(strncmp(name, "::", 2) == 0){/* this must be a global name */ -+ name = name+2; -+ block = NULL; -+ } -+ - modified_name = name; - - /* If we are using C++ or Java, demangle the name before doing a lookup, so -@@ -1270,7 +1299,6 @@ lookup_symbol_in_language (const char *name, const struct block *block, - demangled_name = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); - if (demangled_name) - { -- mangled_name = name; - modified_name = demangled_name; - make_cleanup (xfree, demangled_name); - } -@@ -1292,7 +1320,6 @@ lookup_symbol_in_language (const char *name, const struct block *block, - DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA); - if (demangled_name) - { -- mangled_name = name; - modified_name = demangled_name; - make_cleanup (xfree, demangled_name); - } -@@ -1311,8 +1338,8 @@ lookup_symbol_in_language (const char *name, const struct block *block, - modified_name = copy; - } - -- returnval = lookup_symbol_aux (modified_name, mangled_name, block, -- domain, lang, is_a_field_of_this); -+ returnval = lookup_symbol_aux (modified_name, block, domain, lang, -+ is_a_field_of_this); - do_cleanups (cleanup); - - return returnval; -@@ -1336,9 +1363,9 @@ lookup_symbol (const char *name, const struct block *block, - well. */ - - static struct symbol * --lookup_symbol_aux (const char *name, const char *linkage_name, -- const struct block *block, const domain_enum domain, -- enum language language, int *is_a_field_of_this) -+lookup_symbol_aux (const char *name, const struct block *block, -+ const domain_enum domain, enum language language, -+ int *is_a_field_of_this) - { - struct symbol *sym; - const struct language_defn *langdef; -@@ -1354,56 +1381,19 @@ lookup_symbol_aux (const char *name, const char *linkage_name, - /* Search specified block and its superiors. Don't search - STATIC_BLOCK or GLOBAL_BLOCK. */ - -- sym = lookup_symbol_aux_local (name, linkage_name, block, domain); -+ sym = lookup_symbol_aux_local (name, block, domain, language, is_a_field_of_this); - if (sym != NULL) - return sym; - -- /* If requested to do so by the caller and if appropriate for LANGUAGE, -- check to see if NAME is a field of `this'. */ -- -- langdef = language_def (language); -- -- if (langdef->la_name_of_this != NULL && is_a_field_of_this != NULL -- && block != NULL) -- { -- struct symbol *sym = NULL; -- const struct block *function_block = block; -- /* 'this' is only defined in the function's block, so find the -- enclosing function block. */ -- for (; function_block && !BLOCK_FUNCTION (function_block); -- function_block = BLOCK_SUPERBLOCK (function_block)); -- -- if (function_block && !dict_empty (BLOCK_DICT (function_block))) -- sym = lookup_block_symbol (function_block, langdef->la_name_of_this, -- NULL, VAR_DOMAIN); -- if (sym) -- { -- struct type *t = sym->type; -- -- /* I'm not really sure that type of this can ever -- be typedefed; just be safe. */ -- CHECK_TYPEDEF (t); -- if (TYPE_CODE (t) == TYPE_CODE_PTR -- || TYPE_CODE (t) == TYPE_CODE_REF) -- t = TYPE_TARGET_TYPE (t); -- -- if (TYPE_CODE (t) != TYPE_CODE_STRUCT -- && TYPE_CODE (t) != TYPE_CODE_UNION) -- error (_("Internal error: `%s' is not an aggregate"), -- langdef->la_name_of_this); -- -- if (check_field (t, name)) -- { -- *is_a_field_of_this = 1; -- return NULL; -- } -- } -- } -+ /* this symbol was found to be a member variable -+ do not perform the global search. */ -+ if (is_a_field_of_this && *is_a_field_of_this) -+ return NULL; - - /* Now do whatever is appropriate for LANGUAGE to look - up static and global variables. */ -- -- sym = langdef->la_lookup_symbol_nonlocal (name, linkage_name, block, domain); -+ langdef = language_def (language); -+ sym = langdef->la_lookup_symbol_nonlocal (name, block, domain); - if (sym != NULL) - return sym; - -@@ -1413,11 +1403,11 @@ lookup_symbol_aux (const char *name, const char *linkage_name, - desired name as a file-level static, then do psymtab-to-symtab - conversion on the fly and return the found symbol. */ - -- sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, linkage_name, domain); -+ sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain); - if (sym != NULL) - return sym; - -- sym = lookup_symbol_aux_psymtabs (STATIC_BLOCK, name, linkage_name, domain); -+ sym = lookup_symbol_aux_psymtabs (STATIC_BLOCK, name, domain); - if (sym != NULL) - return sym; - -@@ -1428,30 +1418,81 @@ lookup_symbol_aux (const char *name, const char *linkage_name, - Don't search STATIC_BLOCK or GLOBAL_BLOCK. */ - - static struct symbol * --lookup_symbol_aux_local (const char *name, const char *linkage_name, -- const struct block *block, -- const domain_enum domain) -+lookup_symbol_aux_local (const char *name, const struct block *block, -+ const domain_enum domain, enum language language, -+ int *is_a_field_of_this) - { - struct symbol *sym; -- const struct block *static_block = block_static_block (block); -+ const struct block *global_block = block_global_block (block); -+ const struct block *block_iterator = block; -+ const struct language_defn *langdef; -+ -+ langdef = language_def (language); - - /* Check if either no block is specified or it's a global block. */ - -- if (static_block == NULL) -+ if (global_block == NULL) - return NULL; - -- while (block != static_block) -+ while (block_iterator != global_block) - { -- sym = lookup_symbol_aux_block (name, linkage_name, block, domain); -+ -+ sym = lookup_symbol_aux_block (name, block_iterator, domain); -+ - if (sym != NULL) - return sym; -+ -+ if (language == language_cplus ) -+ { -+ sym = cp_lookup_symbol_imports (block_scope (block_iterator), name, -+ block_iterator, domain, 1, 1); - -- if (BLOCK_FUNCTION (block) != NULL && block_inlined_p (block)) -- break; -- block = BLOCK_SUPERBLOCK (block); -+ if (sym != NULL) -+ return sym; -+ } -+ -+ if (langdef->la_name_of_this != NULL && is_a_field_of_this != NULL -+ && BLOCK_FUNCTION (block_iterator)) -+ { -+ if (!dict_empty (BLOCK_DICT (block_iterator))) -+ { -+ sym = lookup_block_symbol (block_iterator, -+ langdef->la_name_of_this, -+ VAR_DOMAIN); -+ -+ -+ if (sym) -+ { -+ struct type *t = sym->type; -+ -+ /* I'm not really sure that type of this can ever -+ be typedefed; just be safe. */ -+ CHECK_TYPEDEF (t); -+ if (TYPE_CODE (t) == TYPE_CODE_PTR -+ || TYPE_CODE (t) == TYPE_CODE_REF) -+ t = TYPE_TARGET_TYPE (t); -+ -+ if (TYPE_CODE (t) != TYPE_CODE_STRUCT -+ && TYPE_CODE (t) != TYPE_CODE_UNION) -+ error (_("Internal error: `%s' is not an aggregate"), -+ langdef->la_name_of_this); -+ -+ if (check_field (t, name)) -+ { -+ *is_a_field_of_this = 1; -+ return NULL; -+ } -+ } -+ } -+ } -+ -+ if (BLOCK_FUNCTION (block_iterator) != NULL && block_inlined_p (block_iterator)) -+ break; -+ -+ block_iterator = BLOCK_SUPERBLOCK (block_iterator); - } - -- /* We've reached the edge of the function without finding a result. */ -+ /* We've reached the global block without finding a result. */ - - return NULL; - } -@@ -1485,13 +1526,12 @@ lookup_objfile_from_block (const struct block *block) - block_found appropriately. */ - - struct symbol * --lookup_symbol_aux_block (const char *name, const char *linkage_name, -- const struct block *block, -+lookup_symbol_aux_block (const char *name, const struct block *block, - const domain_enum domain) - { - struct symbol *sym; - -- sym = lookup_block_symbol (block, name, linkage_name, domain); -+ sym = lookup_block_symbol (block, name, domain); - if (sym) - { - block_found = block; -@@ -1507,7 +1547,6 @@ lookup_symbol_aux_block (const char *name, const char *linkage_name, - struct symbol * - lookup_global_symbol_from_objfile (const struct objfile *main_objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain) - { - const struct objfile *objfile; -@@ -1526,7 +1565,7 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile, - { - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -- sym = lookup_block_symbol (block, name, linkage_name, domain); -+ sym = lookup_block_symbol (block, name, domain); - if (sym) - { - block_found = block; -@@ -1535,16 +1574,16 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile, - } - - /* Now go through psymtabs. */ -+ require_partial_symbols ((struct objfile *) objfile); - ALL_OBJFILE_PSYMTABS (objfile, ps) - { - if (!ps->readin -- && lookup_partial_symbol (ps, name, linkage_name, -- 1, domain)) -+ && lookup_partial_symbol (ps, name, 1, domain)) - { - s = PSYMTAB_TO_SYMTAB (ps); - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -- sym = lookup_block_symbol (block, name, linkage_name, domain); -+ sym = lookup_block_symbol (block, name, domain); - return fixup_symbol_section (sym, (struct objfile *)objfile); - } - } -@@ -1559,8 +1598,7 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile, - static symbols. */ - - static struct symbol * --lookup_symbol_aux_symtabs (int block_index, -- const char *name, const char *linkage_name, -+lookup_symbol_aux_symtabs (int block_index, const char *name, - const domain_enum domain) - { - struct symbol *sym; -@@ -1573,7 +1611,7 @@ lookup_symbol_aux_symtabs (int block_index, - { - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, block_index); -- sym = lookup_block_symbol (block, name, linkage_name, domain); -+ sym = lookup_block_symbol (block, name, domain); - if (sym) - { - block_found = block; -@@ -1591,7 +1629,6 @@ lookup_symbol_aux_symtabs (int block_index, - - static struct symbol * - lookup_symbol_aux_psymtabs (int block_index, const char *name, -- const char *linkage_name, - const domain_enum domain) - { - struct symbol *sym; -@@ -1602,16 +1639,15 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, - struct symtab *s; - const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); - -- ALL_PSYMTABS (objfile, ps) -+ ALL_PSYMTABS_REQUIRED (objfile, ps) - { - if (!ps->readin -- && lookup_partial_symbol (ps, name, linkage_name, -- psymtab_index, domain)) -+ && lookup_partial_symbol (ps, name, psymtab_index, domain)) - { - s = PSYMTAB_TO_SYMTAB (ps); - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, block_index); -- sym = lookup_block_symbol (block, name, linkage_name, domain); -+ sym = lookup_block_symbol (block, name, domain); - if (!sym) - { - /* This shouldn't be necessary, but as a last resort try -@@ -1628,7 +1664,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, - block = BLOCKVECTOR_BLOCK (bv, - block_index == GLOBAL_BLOCK ? - STATIC_BLOCK : GLOBAL_BLOCK); -- sym = lookup_block_symbol (block, name, linkage_name, domain); -+ sym = lookup_block_symbol (block, name, domain); - if (!sym) - error (_("Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n%s may be an inlined function, or may be a template function\n(if a template, try specifying an instantiation: %s)."), - block_index == GLOBAL_BLOCK ? "global" : "static", -@@ -1647,7 +1683,6 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, - - struct symbol * - basic_lookup_symbol_nonlocal (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain) - { -@@ -1681,11 +1716,11 @@ basic_lookup_symbol_nonlocal (const char *name, - than that one, so I don't think we should worry about that for - now. */ - -- sym = lookup_symbol_static (name, linkage_name, block, domain); -+ sym = lookup_symbol_static (name, block, domain); - if (sym != NULL) - return sym; - -- return lookup_symbol_global (name, linkage_name, block, domain); -+ return lookup_symbol_global (name, block, domain); - } - - /* Lookup a symbol in the static block associated to BLOCK, if there -@@ -1693,14 +1728,13 @@ basic_lookup_symbol_nonlocal (const char *name, - - struct symbol * - lookup_symbol_static (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain) - { - const struct block *static_block = block_static_block (block); - - if (static_block != NULL) -- return lookup_symbol_aux_block (name, linkage_name, static_block, domain); -+ return lookup_symbol_aux_block (name, static_block, domain); - else - return NULL; - } -@@ -1710,7 +1744,6 @@ lookup_symbol_static (const char *name, - - struct symbol * - lookup_symbol_global (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain) - { -@@ -1720,15 +1753,15 @@ lookup_symbol_global (const char *name, - /* Call library-specific lookup procedure. */ - objfile = lookup_objfile_from_block (block); - if (objfile != NULL) -- sym = solib_global_lookup (objfile, name, linkage_name, domain); -+ sym = solib_global_lookup (objfile, name, domain); - if (sym != NULL) - return sym; - -- sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, linkage_name, domain); -+ sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain); - if (sym != NULL) - return sym; - -- return lookup_symbol_aux_psymtabs (GLOBAL_BLOCK, name, linkage_name, domain); -+ return lookup_symbol_aux_psymtabs (GLOBAL_BLOCK, name, domain); - } - - int -@@ -1752,14 +1785,11 @@ symbol_matches_domain (enum language symbol_language, - } - - /* Look, in partial_symtab PST, for symbol whose natural name is NAME. -- If LINKAGE_NAME is non-NULL, check in addition that the symbol's -- linkage name matches it. Check the global symbols if GLOBAL, the -- static symbols if not */ -+ Check the global symbols if GLOBAL, the static symbols if not. */ - - struct partial_symbol * - lookup_partial_symbol (struct partial_symtab *pst, const char *name, -- const char *linkage_name, int global, -- domain_enum domain) -+ int global, domain_enum domain) - { - struct partial_symbol *temp; - struct partial_symbol **start, **psym; -@@ -1811,9 +1841,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, - internal_error (__FILE__, __LINE__, _("failed internal consistency check")); - - while (top <= real_top -- && (linkage_name != NULL -- ? strcmp (SYMBOL_LINKAGE_NAME (*top), linkage_name) == 0 -- : SYMBOL_MATCHES_SEARCH_NAME (*top,name))) -+ && SYMBOL_MATCHES_SEARCH_NAME (*top, name)) - { - if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), - SYMBOL_DOMAIN (*top), domain)) -@@ -1830,15 +1858,9 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, - for (psym = start; psym < start + length; psym++) - { - if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym), -- SYMBOL_DOMAIN (*psym), domain)) -- { -- if (linkage_name != NULL -- ? strcmp (SYMBOL_LINKAGE_NAME (*psym), linkage_name) == 0 -- : SYMBOL_MATCHES_SEARCH_NAME (*psym, name)) -- { -- return (*psym); -- } -- } -+ SYMBOL_DOMAIN (*psym), domain) -+ && SYMBOL_MATCHES_SEARCH_NAME (*psym, name)) -+ return (*psym); - } - } - -@@ -1880,22 +1902,25 @@ basic_lookup_transparent_type (const char *name) - { - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -- sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN); -+ sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); - if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) - { - return SYMBOL_TYPE (sym); - } - } - -- ALL_PSYMTABS (objfile, ps) -+ /* FIXME: .debug_pubnames should be read in. -+ -+ One may also try to the first pass without the require_partial_symbols -+ call but that would behave nondeterministically. */ -+ ALL_PSYMTABS_REQUIRED (objfile, ps) - { -- if (!ps->readin && lookup_partial_symbol (ps, name, NULL, -- 1, STRUCT_DOMAIN)) -+ if (!ps->readin && lookup_partial_symbol (ps, name, 1, STRUCT_DOMAIN)) - { - s = PSYMTAB_TO_SYMTAB (ps); - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -- sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN); -+ sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); - if (!sym) - { - /* This shouldn't be necessary, but as a last resort -@@ -1904,7 +1929,7 @@ basic_lookup_transparent_type (const char *name) - * the psymtab gets it wrong in some cases. - */ - block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); -- sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN); -+ sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); - if (!sym) - error (_("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\ - %s may be an inlined function, or may be a template function\n\ -@@ -1928,21 +1953,26 @@ basic_lookup_transparent_type (const char *name) - { - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); -- sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN); -+ sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); - if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) - { - return SYMBOL_TYPE (sym); - } - } - -- ALL_PSYMTABS (objfile, ps) -+ /* FIXME: Something like .debug_pubnames containing also static symbols -+ should be read in. Compiler needs to be taught to generate it first. -+ -+ One may also try to the first pass without the require_partial_symbols -+ call but that would behave nondeterministically. */ -+ ALL_PSYMTABS_REQUIRED (objfile, ps) - { -- if (!ps->readin && lookup_partial_symbol (ps, name, NULL, 0, STRUCT_DOMAIN)) -+ if (!ps->readin && lookup_partial_symbol (ps, name, 0, STRUCT_DOMAIN)) - { - s = PSYMTAB_TO_SYMTAB (ps); - bv = BLOCKVECTOR (s); - block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); -- sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN); -+ sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); - if (!sym) - { - /* This shouldn't be necessary, but as a last resort -@@ -1951,7 +1981,7 @@ basic_lookup_transparent_type (const char *name) - * the psymtab gets it wrong in some cases. - */ - block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -- sym = lookup_block_symbol (block, name, NULL, STRUCT_DOMAIN); -+ sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); - if (!sym) - error (_("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\ - %s may be an inlined function, or may be a template function\n\ -@@ -1976,9 +2006,23 @@ find_main_psymtab (void) - struct partial_symtab *pst; - struct objfile *objfile; - -- ALL_PSYMTABS (objfile, pst) -+ ALL_OBJFILES (objfile) -+ { -+ if ((objfile->flags & OBJF_MAIN) == 0) -+ continue; -+ require_partial_symbols (objfile); -+ ALL_OBJFILE_PSYMTABS (objfile, pst) -+ { -+ if (lookup_partial_symbol (pst, main_name (), 1, VAR_DOMAIN)) -+ { -+ return pst; -+ } -+ } -+ } -+ -+ ALL_PSYMTABS_REQUIRED (objfile, pst) - { -- if (lookup_partial_symbol (pst, main_name (), NULL, 1, VAR_DOMAIN)) -+ if (lookup_partial_symbol (pst, main_name (), 1, VAR_DOMAIN)) - { - return (pst); - } -@@ -1996,14 +2040,10 @@ find_main_psymtab (void) - search on the symbols. Each symbol which is marked as being a ObjC/C++ - symbol (language_cplus or language_objc set) has both the encoded and - non-encoded names tested for a match. -- -- If LINKAGE_NAME is non-NULL, verify that any symbol we find has this -- particular mangled name. - */ - - struct symbol * - lookup_block_symbol (const struct block *block, const char *name, -- const char *linkage_name, - const domain_enum domain) - { - struct dict_iterator iter; -@@ -2016,9 +2056,7 @@ lookup_block_symbol (const struct block *block, const char *name, - sym = dict_iter_name_next (name, &iter)) - { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), -- SYMBOL_DOMAIN (sym), domain) -- && (linkage_name != NULL -- ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1)) -+ SYMBOL_DOMAIN (sym), domain)) - return sym; - } - return NULL; -@@ -2038,9 +2076,7 @@ lookup_block_symbol (const struct block *block, const char *name, - sym = dict_iter_name_next (name, &iter)) - { - if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), -- SYMBOL_DOMAIN (sym), domain) -- && (linkage_name != NULL -- ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1)) -+ SYMBOL_DOMAIN (sym), domain)) - { - sym_found = sym; - if (!SYMBOL_IS_ARGUMENT (sym)) -@@ -3201,7 +3237,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], - {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown}; +@@ -2914,7 +2914,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], + static enum minimal_symbol_type types3[] + = {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown}; static enum minimal_symbol_type types4[] - = -- {mst_file_bss, mst_text, mst_abs, mst_unknown}; -+ {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown}; +- = {mst_file_bss, mst_text, mst_abs, mst_unknown}; ++ = {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown}; enum minimal_symbol_type ourtype; enum minimal_symbol_type ourtype2; enum minimal_symbol_type ourtype3; -@@ -3262,7 +3298,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], - matching the regexp. That way we don't have to reproduce all of - the machinery below. */ - -- ALL_PSYMTABS (objfile, ps) -+ ALL_PSYMTABS_REQUIRED (objfile, ps) - { - struct partial_symbol **bound, **gbound, **sbound; - int keep_going = 1; diff --git a/gdb/symtab.h b/gdb/symtab.h -index 167dfe8..2f88e93 100644 +index bedc10a..f5ddcb1 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h -@@ -280,6 +280,8 @@ enum minimal_symbol_type +@@ -277,6 +277,9 @@ enum minimal_symbol_type { mst_unknown = 0, /* Unknown type, the default */ mst_text, /* Generally executable instructions */ + mst_text_gnu_ifunc, /* Executable code returning address + of executable code */ ++ mst_slot_got_plt, mst_data, /* Generally initialized data */ mst_bss, /* Generally uninitialized data */ mst_abs, /* Generally absolute (nonrelocatable) */ -@@ -396,7 +398,10 @@ typedef enum domain_enum_tag - FUNCTIONS_DOMAIN, +@@ -917,11 +920,25 @@ extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *); - /* All defined types */ -- TYPES_DOMAIN -+ TYPES_DOMAIN, + /* lookup function from address, return name, start addr and end addr */ + +-extern int find_pc_partial_function (CORE_ADDR, char **, CORE_ADDR *, +- CORE_ADDR *); ++extern enum find_pc_partial_function_type ++ { ++ FIND_PC_PARTIAL_FUNCTION_NOT_FOUND = 0, ++ FIND_PC_PARTIAL_FUNCTION_NORMAL, ++ FIND_PC_PARTIAL_FUNCTION_GNU_IFUNC ++ } find_pc_partial_function (CORE_ADDR, char **, CORE_ADDR *, CORE_ADDR *); + + extern void clear_pc_function_cache (void); + ++extern int resolve_gnu_ifunc (const char *function_name, ++ CORE_ADDR *function_addressp); + -+ /* Fortran module. Their naming must be separate. */ -+ MODULE_DOMAIN - } - domain_enum; - -@@ -994,7 +999,6 @@ extern struct symbol *lookup_symbol (const char *, const struct block *, - that can't think of anything better to do. */ - - extern struct symbol *basic_lookup_symbol_nonlocal (const char *, -- const char *, - const struct block *, - const domain_enum); - -@@ -1005,7 +1009,6 @@ extern struct symbol *basic_lookup_symbol_nonlocal (const char *, - is one; do nothing if BLOCK is NULL or a global block. */ - - extern struct symbol *lookup_symbol_static (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain); - -@@ -1013,7 +1016,6 @@ extern struct symbol *lookup_symbol_static (const char *name, - necessary). */ - - extern struct symbol *lookup_symbol_global (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain); - -@@ -1022,21 +1024,18 @@ extern struct symbol *lookup_symbol_global (const char *name, - will fix up the symbol if necessary. */ - - extern struct symbol *lookup_symbol_aux_block (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain); - - /* Lookup a partial symbol. */ - - extern struct partial_symbol *lookup_partial_symbol (struct partial_symtab *, -- const char *, - const char *, int, - domain_enum); - - /* lookup a symbol by name, within a specified block */ - - extern struct symbol *lookup_block_symbol (const struct block *, const char *, -- const char *, - const domain_enum); - - /* lookup a [struct, union, enum] by name, within a specified block */ -@@ -1066,6 +1065,8 @@ extern void clear_pc_function_cache (void); - - /* from symtab.c: */ - -+struct objfile *require_partial_symbols (struct objfile *); ++extern struct minimal_symbol *resolve_gnu_ifunc_by_cache ++ (const char *function_name); + - /* lookup partial symbol table by filename */ ++extern void gnu_ifunc_record_cache (struct gdbarch *gdbarch, ++ const char *function_name, ++ CORE_ADDR function_address); ++ + /* lookup partial symbol table by address and section */ - extern struct partial_symtab *lookup_partial_symtab (const char *); -@@ -1159,6 +1160,8 @@ extern struct minimal_symbol *lookup_minimal_symbol_by_pc_name + extern struct symtab *find_pc_sect_symtab_via_partial (CORE_ADDR, +@@ -996,6 +1013,8 @@ extern struct minimal_symbol *lookup_minimal_symbol_by_pc_name extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR); @@ -18134,28 +6049,20 @@ index 167dfe8..2f88e93 100644 extern struct minimal_symbol * lookup_minimal_symbol_and_objfile (const char *, struct objfile **); -@@ -1372,7 +1375,6 @@ extern /*const */ char *main_name (void); - /* Check global symbols in objfile. */ - struct symbol *lookup_global_symbol_from_objfile (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain); - - extern struct symtabs_and_lines diff --git a/gdb/target.c b/gdb/target.c -index e6659c9..eabd9fc 100644 +index 862df4e..a8f1bdd 100644 --- a/gdb/target.c +++ b/gdb/target.c -@@ -120,6 +120,8 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int); - - static int debug_to_remove_watchpoint (CORE_ADDR, int, int); +@@ -123,6 +123,8 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int, + static int debug_to_remove_watchpoint (CORE_ADDR, int, int, + struct expression *); +static int debug_to_detach_watchpoints (void); + static int debug_to_stopped_by_watchpoint (void); static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); -@@ -583,6 +585,7 @@ update_current_target (void) +@@ -606,6 +608,7 @@ update_current_target (void) INHERIT (to_remove_hw_breakpoint, t); INHERIT (to_insert_watchpoint, t); INHERIT (to_remove_watchpoint, t); @@ -18163,9 +6070,9 @@ index e6659c9..eabd9fc 100644 INHERIT (to_stopped_data_address, t); INHERIT (to_have_steppable_watchpoint, t); INHERIT (to_have_continuable_watchpoint, t); -@@ -710,6 +713,9 @@ update_current_target (void) +@@ -739,6 +742,9 @@ update_current_target (void) de_fault (to_remove_watchpoint, - (int (*) (CORE_ADDR, int, int)) + (int (*) (CORE_ADDR, int, int, struct expression *)) return_minus_one); + de_fault (to_detach_watchpoints, + (int (*) (void)) @@ -18173,7 +6080,7 @@ index e6659c9..eabd9fc 100644 de_fault (to_stopped_by_watchpoint, (int (*) (void)) return_zero); -@@ -3277,6 +3283,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type) +@@ -3441,6 +3447,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, return retval; } @@ -18193,7 +6100,7 @@ index e6659c9..eabd9fc 100644 static void debug_to_terminal_init (void) { -@@ -3524,6 +3543,7 @@ setup_target_debug (void) +@@ -3688,6 +3707,7 @@ setup_target_debug (void) current_target.to_remove_hw_breakpoint = debug_to_remove_hw_breakpoint; current_target.to_insert_watchpoint = debug_to_insert_watchpoint; current_target.to_remove_watchpoint = debug_to_remove_watchpoint; @@ -18202,20 +6109,20 @@ index e6659c9..eabd9fc 100644 current_target.to_stopped_data_address = debug_to_stopped_data_address; current_target.to_watchpoint_addr_within_range = debug_to_watchpoint_addr_within_range; diff --git a/gdb/target.h b/gdb/target.h -index 7103ab2..741b2e5 100644 +index 3c8c017..e9503de 100644 --- a/gdb/target.h +++ b/gdb/target.h -@@ -422,6 +422,7 @@ struct target_ops - int (*to_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); - int (*to_remove_watchpoint) (CORE_ADDR, int, int); - int (*to_insert_watchpoint) (CORE_ADDR, int, int); +@@ -433,6 +433,7 @@ struct target_ops + provided with the corresponding target_* macros. */ + int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *); + int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *); + int (*to_detach_watchpoints) (void); + int (*to_stopped_by_watchpoint) (void); int to_have_steppable_watchpoint; - int to_have_continuable_watchpoint; -@@ -1274,6 +1275,15 @@ extern char *normal_pid_to_str (ptid_t ptid); - #define target_remove_watchpoint(addr, len, type) \ - (*current_target.to_remove_watchpoint) (addr, len, type) +@@ -1316,6 +1317,15 @@ extern char *normal_pid_to_str (ptid_t ptid); + #define target_remove_watchpoint(addr, len, type, cond) \ + (*current_target.to_remove_watchpoint) (addr, len, type, cond) +/* Clear all debug registers without affecting any register caches. Function + acts on INFERIOR_PTID which should be the forked-off process, either the @@ -18229,27 +6136,6 @@ index 7103ab2..741b2e5 100644 #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) -@@ -1314,6 +1324,20 @@ extern int target_search_memory (CORE_ADDR start_addr, - ULONGEST pattern_len, - CORE_ADDR *found_addrp); - -+/* Utility functions which can be used by search_memory implementations. */ -+ -+void allocate_pattern_buffer (char **pattern_bufp, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size); -+ -+void increase_pattern_buffer (char **pattern_bufp, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size, int val_bytes); -+ -+int search_memory (CORE_ADDR *start_addr, ULONGEST *search_space_len, -+ const char *pattern_buf, ULONGEST pattern_len, -+ CORE_ADDR *found_addr); -+ -+void put_bits (bfd_uint64_t data, char *buf, int bits, bfd_boolean big_p); -+ - /* Tracepoint-related operations. */ - - #define target_trace_init() \ diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S new file mode 100644 index 0000000..83faaf6 @@ -19433,10 +7319,10 @@ index ecc3289..f79ad40 100644 main (void) { diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp -index 0ef6c4b..330ed87 100644 +index 3a33618..f2e11dd 100644 --- a/gdb/testsuite/gdb.base/arrayidx.exp +++ b/gdb/testsuite/gdb.base/arrayidx.exp -@@ -59,4 +59,12 @@ gdb_test "print array" \ +@@ -57,4 +57,12 @@ gdb_test "print array" \ "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ "Print array with array-indexes on" @@ -19452,13 +7338,52 @@ index 0ef6c4b..330ed87 100644 +} diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-lib.c b/gdb/testsuite/gdb.base/gnu-ifunc-lib.c new file mode 100644 -index 0000000..204ce99 +index 0000000..680530a --- /dev/null +++ b/gdb/testsuite/gdb.base/gnu-ifunc-lib.c -@@ -0,0 +1,54 @@ +@@ -0,0 +1,33 @@ +/* This testcase is part of GDB, the GNU debugger. + -+ Copyright 2009 Free Software Foundation, Inc. ++ Copyright 2009, 2010 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++extern volatile int gnu_ifunc_initialized; ++extern int init_stub (int arg); ++extern int final (int arg); ++ ++typedef int (*final_t) (int arg); ++ ++asm (".type gnu_ifunc, @gnu_indirect_function"); ++ ++final_t ++gnu_ifunc (void) ++{ ++ if (! gnu_ifunc_initialized) ++ return init_stub; ++ else ++ return final; ++} +diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.c b/gdb/testsuite/gdb.base/gnu-ifunc.c +new file mode 100644 +index 0000000..106271f +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gnu-ifunc.c +@@ -0,0 +1,61 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009, 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by @@ -19475,23 +7400,25 @@ index 0000000..204ce99 + +#include + -+typedef int (*final_t) (int arg); -+ -+static int ++int +init_stub (int arg) +{ + return 0; +} + -+static int ++int +final (int arg) +{ + return arg + 1; +} + -+static volatile int gnu_ifunc_initialized; ++/* Make differentiation of how the gnu_ifunc call resolves before and after ++ calling gnu_ifunc_pre. This ensures the resolved function address is not ++ being cached anywhere for the debugging purposes. */ + -+void ++volatile int gnu_ifunc_initialized; ++ ++static void +gnu_ifunc_pre (void) +{ + assert (!gnu_ifunc_initialized); @@ -19499,44 +7426,7 @@ index 0000000..204ce99 + gnu_ifunc_initialized = 1; +} + -+final_t gnu_ifuncX (void) asm ("gnu_ifunc"); -+asm (".type gnu_ifunc, @gnu_indirect_function"); -+ -+final_t -+gnu_ifuncX (void) -+{ -+ if (!gnu_ifunc_initialized) -+ return init_stub; -+ else -+ return final; -+} -diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.c b/gdb/testsuite/gdb.base/gnu-ifunc.c -new file mode 100644 -index 0000000..e4a823d ---- /dev/null -+++ b/gdb/testsuite/gdb.base/gnu-ifunc.c -@@ -0,0 +1,36 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ +extern int gnu_ifunc (int arg); -+extern void gnu_ifunc_pre (void); + +int +main (void) @@ -19554,11 +7444,11 @@ index 0000000..e4a823d +} diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp new file mode 100644 -index 0000000..4b3ac41 +index 0000000..8ecf558 --- /dev/null +++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp -@@ -0,0 +1,115 @@ -+# Copyright (C) 2009 Free Software Foundation, Inc. +@@ -0,0 +1,110 @@ ++# Copyright (C) 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -19585,14 +7475,21 @@ index 0000000..4b3ac41 +set libsrc ${libfile}.c +set lib_so ${objdir}/${subdir}/${libfile}.so + -+set lib_nodebug_so_base ${libfile}-nodebug.so -+set lib_nodebug_so ${objdir}/${subdir}/${lib_nodebug_so_base} ++# We need DWARF for the "final" function as we "step" into the function and GDB ++# would step-over the "final" function if there would be no line number debug ++# information (DWARF) available. ++# ++# We must not have DWARF for the "gnu_ifunc" function as DWARF has no way to ++# express the gnu-ifunc type and it would be considered as a regular function ++# due to DWARF by GDB. In ELF gnu-ifunc is expressed by the STT_GNU_IFUNC type. ++# ++# Both functions need to be in the same shared library file but ++# gdb_compile_shlib has no way to specify source-specific compilation options. ++# ++# Therefore $libfile contains only the gnu-ifunc function with no DWARF ++# referencing all the other parts from the main executable with DWARF. + -+# {debug} provides DWARF symbol gnu_ifuncX confusing the ELF symbol -+# gnu_ifunc during address->symbol resolution for printing the symbol. -+# Still we need it here for "step"ping into the function. -+set lib_opts [list debug] -+set lib_nodebug_opts [list] ++set lib_opts {} +set exec_opts [list debug shlib=$lib_so] + +if [get_compiler_info ${binfile}] { @@ -19615,7 +7512,7 @@ index 0000000..4b3ac41 + return 1; +} + -+# The "if" condition is artifical to test regression of a format patch. ++# The "if" condition is artifical to test regression of a former patch. +gdb_breakpoint "[gdb_get_line_number "break-at-nextcall"] if i && gnu_ifunc (i) != 42" + +gdb_breakpoint [gdb_get_line_number "break-at-call"] @@ -19631,7 +7528,7 @@ index 0000000..4b3ac41 + +# Test GDB will not break before the final chosen implementation. + -+# Also test a format patch regression: ++# Also test a former patch regression: +# Continuing. +# Error in testing breakpoint condition: +# Attempt to take address of value not located in memory. @@ -19648,10 +7545,11 @@ index 0000000..4b3ac41 +gdb_test "frame" "#0 +(0x\[0-9a-f\]+ in +)?final \\(.*" "nextcall gnu_ifunc skipped" + + -+# Compare the two different addresses: ++# Check any commands not doing an inferior call still compute with address of ++# the gnu-ifunc resolver. + -+gdb_test "p gnu_ifunc" " = {} 0x\[0-9a-f\]+ " "p gnu_ifunc executing" -+gdb_test "info sym gnu_ifunc" "final in section .*" "info sym gnu_ifunc executing" ++gdb_test "p gnu_ifunc" " = {} 0x\[0-9a-f\]+ " "p gnu_ifunc executing" ++gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc executing" + +set test "info addr gnu_ifunc" +gdb_test_multiple $test $test { @@ -19660,19 +7558,6 @@ index 0000000..4b3ac41 + } +} +gdb_test "info sym $expect_out(1,string)" "gnu_ifunc in section .*" "info sym " -+ -+# <*gnu_ifunc> would be an incorrect resolution from DW_AT_MIPS_linkage_name. -+# We do not use {debug} build option for this purpose. -+ -+if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_nodebug_so $lib_nodebug_opts] != ""} { -+ untested "Could not compile either $libsrc." -+ return -1 -+} -+ -+clean_restart $lib_nodebug_so_base -+ -+gdb_test "p gnu_ifunc" " = {} 0x\[0-9a-f\]+ " "p gnu_ifunc not executing without debug" -+gdb_test "info sym gnu_ifunc" "gnu_ifunc in section .*" "info sym gnu_ifunc not executing without debug" diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c new file mode 100644 index 0000000..eeb7b85 @@ -19769,10 +7654,10 @@ index 0000000..c5d5ee0 +} diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp new file mode 100644 -index 0000000..7203a48 +index 0000000..24a608f --- /dev/null +++ b/gdb/testsuite/gdb.base/vla-overflow.exp -@@ -0,0 +1,108 @@ +@@ -0,0 +1,109 @@ +# Copyright 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -19841,7 +7726,8 @@ index 0000000..7203a48 + +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] @@ -20010,1586 +7896,6 @@ index 0000000..5da7378 +gdb_test "p temp1" " = '1' " "second: print temp1" +gdb_test "p temp2" " = '2' " "second: print temp2" +gdb_test "p temp3" " = '3' " "second: print temp3" -diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in -index d78258e..1774244 100644 ---- a/gdb/testsuite/gdb.cp/Makefile.in -+++ b/gdb/testsuite/gdb.cp/Makefile.in -@@ -4,7 +4,7 @@ srcdir = @srcdir@ - EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \ - derivation inherit local member-ptr method misc \ - overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \ -- ref-types ref-params method2 pr9594 gdb2495 virtfunc2 pr9067 \ -+ ref-types ref-params method2 pr9594 gdb2495 gdb9593 virtfunc2 pr9067 \ - pr1072 - - all info install-info dvi install uninstall installcheck check: -diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp -index f81a212..30d362a 100644 ---- a/gdb/testsuite/gdb.cp/cp-relocate.exp -+++ b/gdb/testsuite/gdb.cp/cp-relocate.exp -@@ -30,7 +30,7 @@ proc get_func_address { func } { - global gdb_prompt hex - - set rfunc [string_to_regexp $func] -- gdb_test_multiple "print '${func}'" "get address of ${func}" { -+ gdb_test_multiple "print ${func}" "get address of ${func}" { - -re "\\\$\[0-9\]+ = \\{.*\\} (0|($hex) <${rfunc}>)\[\r\n\]+${gdb_prompt} $" { - # $1 = {int ()} 0x24 - # But if the function is at zero, the name may be omitted. -@@ -130,7 +130,7 @@ gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x10000 -s ${func2_sec} 0 - "y" - - # Make sure the function addresses were updated. --gdb_test "break *'$func1_name'" \ -+gdb_test "break *$func1_name" \ - "Breakpoint $decimal at 0x1....: file .*" --gdb_test "break *'$func2_name'" \ -+gdb_test "break *$func2_name" \ - "Breakpoint $decimal at 0x2....: file .*" -diff --git a/gdb/testsuite/gdb.cp/cpexprs.cc b/gdb/testsuite/gdb.cp/cpexprs.cc -new file mode 100644 -index 0000000..2bca4cd ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/cpexprs.cc -@@ -0,0 +1,431 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008, 2009, 2010 Free Software Foundation, Inc. -+ -+ Contributed by Red Hat, originally written by Keith Seitz. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+ -+ Please email any bugs, comments, and/or additions to this file to: -+ bug-gdb@gnu.org */ -+ -+#include -+#include -+ -+// Forward decls -+class base; -+class derived; -+ -+// A simple template with specializations -+template -+class tclass -+{ -+public: -+ void do_something () { } // tclass::do_something -+}; -+ -+template <> -+void tclass::do_something () { } // tclass::do_something -+ -+template <> -+void tclass::do_something () { } // tclass::do_something -+ -+template<> -+void tclass::do_something () { } // tclass::do_something -+ -+template<> -+void tclass::do_something () { } // tclass::do_something -+ -+// A simple template with multiple template parameters -+template -+void flubber (void) // flubber -+{ -+ A a; -+ B b; -+ C c; -+ D d; -+ E e; -+ -+ ++a; -+ ++b; -+ ++c; -+ ++d; -+ ++e; -+} -+ -+// Some contrived policies -+template -+struct operation_1 -+{ -+ static void function (void) { } // operation_1::function -+}; -+ -+template -+struct operation_2 -+{ -+ static void function (void) { } // operation_2::function -+}; -+ -+template -+struct operation_3 -+{ -+ static void function (void) { } // operation_3::function -+}; -+ -+template -+struct operation_4 -+{ -+ static void function (void) { } // operation_4::function -+}; -+ -+// A policy-based class w/ and w/o default policy -+template -+class policy : public Policy -+{ -+public: -+ policy (T obj) : obj_ (obj) { } // policy::policy -+ -+private: -+ T obj_; -+}; -+ -+template > -+class policyd : public Policy -+{ -+public: -+ policyd (T obj) : obj_ (obj) { } // policyd::policyd -+ ~policyd (void) { } // policyd::~policyd -+ -+private: -+ T obj_; -+}; -+ -+typedef policy > policy1; -+typedef policy > policy2; -+typedef policy > policy3; -+typedef policy > policy4; -+ -+typedef policyd policyd1; -+typedef policyd policyd2; -+typedef policyd policyd3; -+typedef policyd policyd4; -+typedef policyd > policyd5; -+ -+class fluff { }; -+static fluff *g_fluff = new fluff (); -+ -+class base -+{ -+protected: -+ int foo_; -+ -+public: -+ base (void) : foo_ (42) { } // base::base(void) -+ base (int foo) : foo_ (foo) { } // base::base(int) -+ ~base (void) { } // base::~base -+ -+ // Some overloaded methods -+ int overload (void) const { return 0; } // base::overload(void) const -+ int overload (int i) const { return 1; } // base::overload(int) const -+ int overload (short s) const { return 2; } // base::overload(short) const -+ int overload (long l) const { return 3; } // base::overload(long) const -+ int overload (char* a) const { return 4; } // base::overload(char*) const -+ int overload (base& b) const { return 5; } // base::overload(base&) const -+ -+ // Operators -+ int operator+ (base const& o) const // base::operator+ -+ { return foo_ + o.foo_; } -+ -+ base operator++ (void) // base::operator++ -+ { ++foo_; return *this; } -+ -+ base operator+=(base const& o) // base::operator+= -+ { foo_ += o.foo_; return *this; } -+ -+ int operator- (base const& o) const // base::operator- -+ { return foo_ - o.foo_; } -+ -+ base operator-- (void) // base::operator-- -+ { --foo_; return *this; } -+ -+ base operator-= (base const& o) // base::operator-= -+ { foo_ -= o.foo_; return *this; } -+ -+ int operator* (base const& o) const // base::operator* -+ { return foo_ * o.foo_; } -+ -+ base operator*= (base const& o) // base::operator*= -+ { foo_ *= o.foo_; return *this; } -+ -+ int operator/ (base const& o) const // base::operator/ -+ { return foo_ / o.foo_; } -+ -+ base operator/= (base const& o) // base::operator/= -+ { foo_ /= o.foo_; return *this; } -+ -+ int operator% (base const& o) const // base::operator% -+ { return foo_ % o.foo_; } -+ -+ base operator%= (base const& o) // base::operator%= -+ { foo_ %= o.foo_; return *this; } -+ -+ bool operator< (base const& o) const // base::operator< -+ { return foo_ < o.foo_; } -+ -+ bool operator<= (base const& o) const // base::operator<= -+ { return foo_ <= o.foo_; } -+ -+ bool operator> (base const& o) const // base::operator> -+ { return foo_ > o.foo_; } -+ -+ bool operator>= (base const& o) const // base::operator>= -+ { return foo_ >= o.foo_; } -+ -+ bool operator!= (base const& o) const // base::operator!= -+ { return foo_ != o.foo_; } -+ -+ bool operator== (base const& o) const // base::operator== -+ { return foo_ == o.foo_; } -+ -+ bool operator! (void) const // base::operator! -+ { return !foo_; } -+ -+ bool operator&& (base const& o) const // base::operator&& -+ { return foo_ && o.foo_; } -+ -+ bool operator|| (base const& o) const // base::operator|| -+ { return foo_ || o.foo_; } -+ -+ int operator<< (int value) const // base::operator<< -+ { return foo_ << value; } -+ -+ base operator<<= (int value) // base::operator<<= -+ { foo_ <<= value; return *this; } -+ -+ int operator>> (int value) const // base::operator>> -+ { return foo_ >> value; } -+ -+ base operator>>= (int value) // base::operator>>= -+ { foo_ >>= value; return *this; } -+ -+ int operator~ (void) const // base::operator~ -+ { return ~foo_; } -+ -+ int operator& (base const& o) const // base::operator& -+ { return foo_ & o.foo_; } -+ -+ base operator&= (base const& o) // base::operator&= -+ { foo_ &= o.foo_; return *this; } -+ -+ int operator| (base const& o) const // base::operator| -+ { return foo_ | o.foo_; } -+ -+ base operator|= (base const& o) // base::operator|= -+ { foo_ |= o.foo_; return *this; } -+ -+ int operator^ (base const& o) const // base::operator^ -+ { return foo_ ^ o.foo_; } -+ -+ base operator^= (base const& o) // base::operator^= -+ { foo_ ^= o.foo_; return *this; } -+ -+ base operator= (base const& o) // base::operator= -+ { foo_ = o.foo_; return *this; } -+ -+ void operator() (void) const // base::operator() -+ { return; } -+ -+ int operator[] (int idx) const // base::operator[] -+ { return idx; } -+ -+ void* operator new (size_t size) throw () // base::operator new -+ { return malloc (size); } -+ -+ void operator delete (void* ptr) // base::operator delete -+ { free (ptr); } -+ -+ void* operator new[] (size_t size) throw () // base::operator new[] -+ { return malloc (size); } -+ -+ void operator delete[] (void* ptr) // base::operator delete[] -+ { free (ptr); } -+ -+ base const* operator-> (void) const // base::opeartor-> -+ { return this; } -+ -+ int operator->* (base const& b) const // base::operator->* -+ { return foo_ * b.foo_; } -+ -+ operator char* () const { return const_cast ("hello"); } // base::operator char* -+ operator int () const { return 21; } // base::operator int -+ operator fluff* () const { return new fluff (); } // base::operator fluff* -+ operator fluff** () const { return &g_fluff; } // base::operator fluff** -+}; -+ -+class base1 : public virtual base -+{ -+public: -+ base1 (void) : foo_ (21) { } // base1::base1(void) -+ base1 (int a) : foo_(a) { } // base1::base1(int) -+ void a_function (void) const { } // base1::a_function -+ -+protected: -+ int foo_; -+}; -+ -+class base2 : public virtual base -+{ -+public: -+ base2 () : foo_ (3) { } // base2::base2 -+ -+protected: -+ void a_function (void) const { } // base2::a_function -+ int foo_; -+}; -+ -+class derived : public base1, public base2 -+{ -+ public: -+ derived(void) : foo_ (4) { } // derived::derived -+ void a_function (void) const // derived::a_function -+ { -+ this->base1::a_function (); -+ this->base2::a_function (); -+ } -+ -+ protected: -+ int foo_; -+}; -+ -+int -+main (int argc, char* argv[]) // main -+{ // main -+ derived d; -+ void (derived::*pfunc) (void) const = &derived::a_function; -+ (d.*pfunc) (); -+ -+ base a (1), b (3), c (8); -+ (void) a.overload (); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (a); -+ -+ int r; -+ r = b + c; -+ ++a; -+ a += b; -+ r = b - c; -+ --a; -+ a -= b; -+ r = b * c; -+ a *= b; -+ r = b / c; -+ a /= b; -+ r = b % c; -+ a %= b; -+ bool x = (b < c); -+ x = (b <= c); -+ x = (b > c); -+ x = (b >= c); -+ x = (b != c); -+ x = (b == c); -+ x = (!b); -+ x = (b && c); -+ x = (b || c); -+ r = b << 2; -+ a <<= 1; -+ r = b >> 2; -+ a >>= 1; -+ r = ~b; -+ r = b & c; -+ a &= c; -+ r = b | c; -+ a |= c; -+ r = b ^ c; -+ a ^= c; -+ a = c; -+ a (); -+ int i = a[3]; -+ derived* f = new derived (); -+ derived* g = new derived[3]; -+ delete f; -+ delete[] g; -+ a->overload (); -+ r = a->*b; -+ -+ tclass char_tclass; -+ tclass int_tclass; -+ tclass short_tclass; -+ tclass long_tclass; -+ tclass base_tclass; -+ char_tclass.do_something (); -+ int_tclass.do_something (); -+ short_tclass.do_something (); -+ long_tclass.do_something (); -+ base_tclass.do_something (); -+ -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ -+ policy1 p1 (1); -+ p1.function (); -+ policy2 p2 (2); -+ p2.function (); -+ policy3 p3 (3); -+ p3.function (); -+ policy4 p4 (4); -+ p4.function (); -+ -+ policyd1 pd1 (5); -+ pd1.function (); -+ policyd2 pd2 (6); -+ pd2.function (); -+ policyd3 pd3 (7); -+ pd3.function (); -+ policyd4 pd4 (d); -+ pd4.function (); -+ policyd5 pd5 (int_tclass); -+ pd5.function (); -+ -+ base1 b1 (3); -+ -+ r = a; -+ char* str = a; -+ fluff* flp = a; -+ fluff** flpp = a; -+} -+ -diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp -new file mode 100644 -index 0000000..6074763 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/cpexprs.exp -@@ -0,0 +1,724 @@ -+# cpexprs.exp - C++ expressions tests -+# -+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. -+# -+# Contributed by Red Hat, originally written by Keith Seitz. -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# This file is part of the gdb testsuite. -+ -+# A helper proc which sets a breakpoint at FUNC and attempts to -+# run to the breakpoint. -+proc test_breakpoint {func} { -+ global DEC -+ -+ # Restart every time -+ if {![runto_main]} { -+ perror "could not run to main when attempting to break at $func" -+ } else { -+ gdb_breakpoint "$func" -+ set i [expr {[string last : $func] + 1}] -+ set efunc [string_to_regexp [string range $func $i end]] -+ gdb_test "continue" \ -+ "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \ -+ "continue to $func" -+ } -+} -+ -+# Add a function to the list of tested functions -+# FUNC is the name of the function (which will be passed to gdb commands) -+# TYPE is the type of the function, as expected from the "print" command -+# PRINT is the name of the function, as expected result of the print command -+# *OR* "-", indicating that FUNC should be used (needed for virtual/inherited -+# funcs) -+# LST is either the expected result of the list command (the comment from -+# the source code) *OR* "-", in which case FUNC will be used -+# -+# Usage: -+# add NAME TYPE PRINT LST -+# add NAME TYPE PRINT - -+proc add {func type print lst} { -+ global all_functions CONVAR ADDR -+ -+ set all_functions($func,type) $type -+ if {$print == "-"} { -+ set print $func -+ } -+ -+ # An exception: since gdb canonicalizes C++ output, -+ # "(void)" must be mutated to "()". -+ regsub {\(void\)} $print {()} print -+ -+ set all_functions($func,print) \ -+ "$CONVAR = {[string_to_regexp $type]} $ADDR <[string_to_regexp $print].*>" -+ if {$lst == "-"} { -+ set lst "$func" -+ } -+ set all_functions($func,list) ".*// [string_to_regexp $lst]" -+} -+ -+proc get {func cmd} { -+ global all_functions -+ return $all_functions($func,$cmd) -+} -+ -+# Returns a list of function names for a given command -+proc get_functions {cmd} { -+ global all_functions -+ set result {} -+ foreach i [array names all_functions *,$cmd] { -+ if {$all_functions($i) != ""} { -+ set idx [string last , $i] -+ if {$idx != -1} { -+ lappend result [string range $i 0 [expr {$idx - 1}]] -+ } -+ } -+ } -+ -+ return [lsort $result] -+} -+ -+# Some convenience variables for this test -+set DEC {[0-9]}; # a decimal number -+set HEX {[0-9a-fA-F]}; # a hexidecimal number -+set CONVAR "\\\$$DEC+"; # convenience variable regexp -+set ADDR "0x$HEX+"; # address -+ -+# An array of functions/methods that we are testing... -+# Each element consists is indexed by NAME,COMMAND, where -+# NAME is the function name and COMMAND is the gdb command that -+# we are testing. The value of the array for any index pair is -+# the expected result of running COMMAND with the NAME as argument. -+ -+# The array holding all functions/methods to test. Valid subindexes -+# are (none need character escaping -- "add" will take care of that): -+ -+# add name type print_name list -+# NAME,type: value is type of function -+# NAME,print: value is print name of function (careful w/inherited/virtual!) -+# NAME,list: value is comment in source code on first line of function -+# (without the leading "//") -+array set all_functions {} -+ -+# "Normal" functions/methods -+add {main} \ -+ {int (int, char **)} \ -+ - \ -+ - -+add {derived::a_function} \ -+ {void (const derived * const)} \ -+ - \ -+ - -+add {base1::a_function} \ -+ {void (const base1 * const)} \ -+ - \ -+ - -+add {base2::a_function} \ -+ {void (const base2 * const)} \ -+ - \ -+ - -+ -+# Constructors -+ -+# On targets using the ARM EABI, the constructor is expected to return -+# "this". -+proc ctor { type arglist } { -+ if { [istarget arm*-*eabi*] } { -+ set ret "$type *" -+ } else { -+ set ret "void " -+ } -+ if { $arglist != "" } { -+ set arglist ", $arglist" -+ } -+ return "${ret}($type * const$arglist)" -+} -+ -+add {derived::derived} \ -+ [ctor derived ""] \ -+ - \ -+ - -+add {base1::base1(void)} \ -+ [ctor base1 "const void ** const"] \ -+ - \ -+ - -+add {base1::base1(int)} \ -+ [ctor base1 "int"] \ -+ - \ -+ - -+add {base2::base2} \ -+ [ctor base2 "const void ** const"] \ -+ - \ -+ - -+add {base::base(void)} \ -+ [ctor base ""] \ -+ - \ -+ - -+add {base::base(int)} \ -+ [ctor base "int"] \ -+ - \ -+ - -+ -+# Destructors -+ -+# On targets using the ARM EABI, some destructors are expected -+# to return "this". Others are void. For internal reasons, -+# GCC returns void * instead of $type *; RealView appears to do -+# the same. -+proc dtor { type } { -+ if { [istarget arm*-*eabi*] } { -+ set ret "void *" -+ } else { -+ set ret "void " -+ } -+ return "${ret}($type * const)" -+} -+ -+add {base::~base} \ -+ [dtor base] \ -+ - \ -+ - -+ -+# Overloaded methods (all are const -- we try to use the void -+# method with and without specifying "const") -+add {base::overload(void)} \ -+ {int (const base * const)} \ -+ - \ -+ {base::overload(void) const} -+add {base::overload(void) const} \ -+ {int (const base * const)} \ -+ - \ -+ {base::overload(void) const} -+add {base::overload(int) const} \ -+ {int (const base * const, int)} \ -+ - \ -+ - -+add {base::overload(short) const} \ -+ {int (const base * const, short)} \ -+ - \ -+ - -+add {base::overload(long) const} \ -+ {int (const base * const, long)} \ -+ - \ -+ - -+add {base::overload(char*) const} \ -+ {int (const base * const, char *)} \ -+ - \ -+ - -+add {base::overload(base&) const} \ -+ {int (const base * const, base &)} \ -+ - \ -+ - -+ -+# Operators -+add {base::operator+} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator++} \ -+ {base (base * const)} \ -+ - \ -+ - -+add {base::operator+=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator-} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator--} \ -+ {base (base * const)} \ -+ - \ -+ - -+add {base::operator-=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator*} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator*=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator/} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator/=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator%} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator%=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator<} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator<=} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator>} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator>=} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator!=} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator==} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator!} \ -+ {bool (const base * const)} \ -+ - \ -+ - -+add {base::operator&&} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator||} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator<<} \ -+ {int (const base * const, int)} \ -+ - \ -+ - -+add {base::operator<<=} \ -+ {base (base * const, int)} \ -+ - \ -+ - -+add {base::operator>>} \ -+ {int (const base * const, int)} \ -+ - \ -+ - -+add {base::operator>>=} \ -+ {base (base * const, int)} \ -+ - \ -+ - -+add {base::operator~} \ -+ {int (const base * const)} \ -+ - \ -+ - -+add {base::operator&} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator&=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator|} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator|=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator^} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - -+add {base::operator^=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - -+add {base::operator()} \ -+ {void (const base * const)} \ -+ - \ -+ - -+add {base::operator[]} \ -+ {int (const base * const, int)} \ -+ - \ -+ - -+add {base::operator new} \ -+ {void *(size_t)} \ -+ - \ -+ - -+add {base::operator delete} \ -+ {void (void *)} \ -+ - \ -+ - -+add {base::operator new[]} \ -+ {void *(size_t)} \ -+ - \ -+ - -+add {base::operator delete[]} \ -+ {void (void *)} \ -+ - \ -+ - -+add {base::operator char*} \ -+ {char *(const base * const)} \ -+ - \ -+ - -+add {base::operator fluff*} \ -+ {fluff *(const base * const)} \ -+ - \ -+ - -+add {base::operator fluff**} \ -+ {fluff **(const base * const)} \ -+ - \ -+ - -+add {base::operator int} \ -+ {int (const base * const)} \ -+ - \ -+ - -+ -+# Templates -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ {tclass::do_something} -+add {policy1::policy} \ -+ [ctor "policy >" "int"] \ -+ {policy >::policy} \ -+ {policy::policy} -+add {policy2::policy} \ -+ [ctor "policy >" int] \ -+ {policy >::policy} \ -+ {policy::policy} -+add {policy3::policy} \ -+ [ctor "policy >" "int"] \ -+ {policy >::policy} \ -+ {policy::policy} -+add {policy4::policy} \ -+ [ctor "policy >" "int"] \ -+ {policy >::policy} \ -+ {policy::policy} -+add {policy1::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} -+add {policy2::function} \ -+ {void (void)} \ -+ {operation_2::function} \ -+ {operation_2::function} -+add {policy3::function} \ -+ {void (void)} \ -+ {operation_3::function} \ -+ {operation_3::function} -+add {policy4::function} \ -+ {void (void)} \ -+ {operation_4::function} \ -+ {operation_4::function} -+add {policyd >::policyd} \ -+ [ctor "policyd >" "int"] \ -+ - \ -+ {policyd::policyd} -+add {policyd1::policyd} \ -+ [ctor "policyd >" "int"] \ -+ {policyd >::policyd} \ -+ {policyd::policyd} -+add {policyd >::~policyd} \ -+ [dtor "policyd >"] \ -+ - \ -+ {policyd::~policyd} -+add {policyd1::~policyd} \ -+ [dtor "policyd >"] \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} -+add {policyd >::policyd} \ -+ [ctor "policyd >" "long"] \ -+ - \ -+ {policyd::policyd} -+add {policyd2::policyd} \ -+ [ctor "policyd >" "long"] \ -+ {policyd >::policyd} \ -+ {policyd::policyd} -+add {policyd >::~policyd} \ -+ [dtor "policyd >"] \ -+ - \ -+ {policyd::~policyd} -+add {policyd2::~policyd} \ -+ [dtor "policyd >"] \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} -+add {policyd >::policyd} \ -+ [ctor "policyd >" "char"] \ -+ - \ -+ {policyd::policyd} -+add {policyd3::policyd} \ -+ [ctor "policyd >" "char"] \ -+ {policyd >::policyd} \ -+ {policyd::policyd} -+add {policyd >::~policyd} \ -+ [dtor "policyd >"] \ -+ - \ -+ {policyd::~policyd} -+add {policyd3::~policyd} \ -+ [dtor "policyd >"] \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} -+add {policyd >::policyd} \ -+ [ctor "policyd >" "base"] \ -+ - \ -+ {policyd::policyd} -+add {policyd4::policyd} \ -+ [ctor "policyd >" "base"] \ -+ {policyd >::policyd} \ -+ {policyd::policyd} -+add {policyd >::~policyd} \ -+ [dtor "policyd >"] \ -+ - \ -+ {policyd::~policyd} -+add {policyd4::~policyd} \ -+ [dtor "policyd >"] \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} -+add {policyd, operation_1 > >::policyd} \ -+ [ctor "policyd, operation_1 > >" "tclass"] \ -+ - \ -+ {policyd::policyd} -+add {policyd5::policyd} \ -+ [ctor "policyd, operation_1 > >" "tclass"] \ -+ {policyd, operation_1 > >::policyd} \ -+ {policyd::policyd} -+add {policyd, operation_1 > >::~policyd} \ -+ [dtor "policyd, operation_1 > >"] \ -+ - \ -+ {policyd::~policyd} -+add {policyd5::~policyd} \ -+ [dtor "policyd, operation_1 > >"] \ -+ {policyd, operation_1 > >::~policyd} \ -+ {policyd::~policyd} -+add {policyd >::function} \ -+ {void (void)} \ -+ {operation_1::function}\ -+ {operation_1::function} -+add {policyd1::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} -+add {policyd2::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} -+add {policyd >::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} -+add {policyd3::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} -+add {policyd >::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} -+add {policyd4::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} -+add {policyd, operation_1 > >::function} \ -+ {void (void)} \ -+ {operation_1 >::function} \ -+ {operation_1::function} -+add {policyd5::function} \ -+ {void (void)} \ -+ {operation_1 >::function} \ -+ {operation_1::function} -+ -+# Start the test -+if {$tracelevel} { -+ strace $tracelevel -+} -+ -+if {[skip_cplus_tests]} { continue } -+ -+# -+# test running programs -+# -+set prms_id 0 -+set bug_id 0 -+ -+set testfile "cpexprs" -+set srcfile "${testfile}.cc" -+set binfile [file join $objdir $subdir $testfile] -+ -+if {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \ -+ executable {debug c++}] != "" } { -+ untested "$testfile.exp" -+ return -1 -+} -+ -+if {[get_compiler_info $binfile "c++"]} { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir [file join $srcdir $subdir] -+gdb_load $binfile -+ -+if {![runto_main]} { -+ perror "couldn't run to breakpoint" -+ continue -+} -+ -+# Set the listsize to one. This will help with testing "list". -+gdb_test "set listsize 1" -+ -+# "print METHOD" -+foreach name [get_functions print] { -+ gdb_test "print $name" [get $name print] "print $name" -+} -+ -+# "list METHOD" -+foreach name [get_functions list] { -+ gdb_test "list $name" [get $name list] "list $name" -+} -+ -+# Running to breakpoint -- use any function we can "list" -+foreach name [get_functions list] { -+ # Skip "main", since test_breakpoint uses it -+ if {[string compare $name "main"] != 0} { -+ test_breakpoint $name -+ } -+} -+ -+gdb_exit -+return 0 -diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc -index f4f78a6..11dba06 100644 ---- a/gdb/testsuite/gdb.cp/cplusfuncs.cc -+++ b/gdb/testsuite/gdb.cp/cplusfuncs.cc -@@ -195,6 +195,12 @@ char * dm_type_char_star (char * p) { return p; } - int dm_type_foo_ref (foo & foo) { return foo.ifoo; } - int * dm_type_int_star (int * p) { return p; } - long * dm_type_long_star (long * p) { return p; } -+int dm_type_short (short i) { return i; } -+int dm_type_long (long i) { return i; } - int dm_type_unsigned_int (unsigned int i) { return i; } -+int dm_type_unsigned_short (unsigned short i) { return i; } -+int dm_type_unsigned_long (unsigned long i) { return i; } - int dm_type_void (void) { return 0; } - void * dm_type_void_star (void * p) { return p; } -+typedef int myint; -+int dm_type_typedef (myint i) { return i; } -diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp -index f322586..443af7a 100644 ---- a/gdb/testsuite/gdb.cp/cplusfuncs.exp -+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp -@@ -66,9 +66,25 @@ set dm_type_unsigned_int "unsigned" - set dm_type_void "void" - set dm_type_void_star "void*" - -+# Some other vagaries of GDB's type printing machinery. The integer types -+# may have unsigned before or after their length, and may have "int" -+# appended. The char* conversion operator may have name "char*" even if -+# the type is "char *", because the name comes from the debug information -+# and the type from GDB. Function types may not see through typedefs. -+ -+set dm_type_short "short" -+set dm_type_long "long" -+set dm_type_unsigned_short "unsigned short" -+set dm_type_unsigned_long "unsigned long" -+set dm_operator_char_star "char*" -+set dm_operator_char_star_quoted "char\\*" -+set dm_type_typedef 0 -+ - proc probe_demangler { } { - global gdb_prompt - global dm_operator_comma -+ global dm_operator_char_star -+ global dm_operator_char_star_quoted - global dm_type_char_star - global dm_type_char_star_quoted - global dm_type_foo_ref -@@ -77,6 +93,11 @@ proc probe_demangler { } { - global dm_type_unsigned_int - global dm_type_void - global dm_type_void_star -+ global dm_type_short -+ global dm_type_unsigned_short -+ global dm_type_long -+ global dm_type_unsigned_long -+ global dm_type_typedef - - send_gdb "print &foo::operator,(foo&)\n" - gdb_expect { -@@ -97,6 +118,26 @@ proc probe_demangler { } { - } - } - -+ send_gdb "print &foo::operator char*($dm_type_void)\n" -+ gdb_expect { -+ -re ".*foo::operator char \\*\\(void\\).*\r\n$gdb_prompt $" { -+ # v2 demangler or GDB type printer -+ set dm_operator_char_star "char *" -+ set dm_operator_char_star_quoted "char \\*" -+ pass "detect dm_operator_char_star" -+ } -+ -re ".*foo::operator char\\*\\(\\).*\r\n$gdb_prompt $" { -+ # v3 demangler -+ pass "detect dm_operator_char_star" -+ } -+ -re ".*$gdb_prompt $" { -+ fail "detect dm_operator_char_star" -+ } -+ timeout { -+ fail "detect dm_operator_char_star" -+ } -+ } -+ - send_gdb "print &dm_type_char_star\n" - gdb_expect { - -re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" { -@@ -166,6 +207,11 @@ proc probe_demangler { } { - # v3 demangler - pass "detect dm_type_long_star" - } -+ -re ".*dm_type_long_star\\(long int \\*\\).*\r\n$gdb_prompt $" { -+ # GCC v3 and GDB's type printer -+ set dm_type_long_star "long int *" -+ pass "detect dm_type_long_star" -+ } - -re ".*$gdb_prompt $" { - fail "detect dm_type_long_star" - } -@@ -230,6 +276,101 @@ proc probe_demangler { } { - fail "detect dm_type_void_star (timeout)" - } - } -+ -+ send_gdb "print &dm_type_short\n" -+ gdb_expect { -+ -re ".*dm_type_short\\(short\\).*\r\n$gdb_prompt $" { -+ # v2 and v3 demanglers -+ pass "detect dm_type_short" -+ } -+ -re ".*dm_type_short\\(short int\\).*\r\n$gdb_prompt $" { -+ # GDB type printer -+ set dm_type_short "short int" -+ pass "detect dm_type_short" -+ } -+ -re ".*$gdb_prompt $" { -+ fail "detect dm_type_short" -+ } -+ timeout { -+ fail "detect dm_type_short (timeout)" -+ } -+ } -+ -+ send_gdb "print &dm_type_unsigned_short\n" -+ gdb_expect { -+ -re ".*dm_type_unsigned_short\\(unsigned short\\).*\r\n$gdb_prompt $" { -+ # v2 and v3 demanglers -+ pass "detect dm_type_unsigned_short" -+ } -+ -re ".*dm_type_unsigned_short\\(short unsigned int\\).*\r\n$gdb_prompt $" { -+ # GDB type printer -+ set dm_type_unsigned_short "short unsigned int" -+ pass "detect dm_type_unsigned_short" -+ } -+ -re ".*$gdb_prompt $" { -+ fail "detect dm_type_unsigned_short" -+ } -+ timeout { -+ fail "detect dm_type_unsigned_short (timeout)" -+ } -+ } -+ -+ send_gdb "print &dm_type_long\n" -+ gdb_expect { -+ -re ".*dm_type_long\\(long\\).*\r\n$gdb_prompt $" { -+ # v2 and v3 demanglers -+ pass "detect dm_type_long" -+ } -+ -re ".*dm_type_long\\(long int\\).*\r\n$gdb_prompt $" { -+ # GDB type printer -+ set dm_type_long "long int" -+ pass "detect dm_type_long" -+ } -+ -re ".*$gdb_prompt $" { -+ fail "detect dm_type_long" -+ } -+ timeout { -+ fail "detect dm_type_long (timeout)" -+ } -+ } -+ -+ send_gdb "print &dm_type_unsigned_long\n" -+ gdb_expect { -+ -re ".*dm_type_unsigned_long\\(unsigned long\\).*\r\n$gdb_prompt $" { -+ # v2 and v3 demanglers -+ pass "detect dm_type_unsigned_long" -+ } -+ -re ".*dm_type_unsigned_long\\(long unsigned int\\).*\r\n$gdb_prompt $" { -+ # GDB type printer -+ set dm_type_unsigned_long "long unsigned int" -+ pass "detect dm_type_unsigned_long" -+ } -+ -re ".*$gdb_prompt $" { -+ fail "detect dm_type_unsigned_long" -+ } -+ timeout { -+ fail "detect dm_type_unsigned_long (timeout)" -+ } -+ } -+ -+ send_gdb "print &dm_type_typedef\n" -+ gdb_expect { -+ -re ".*dm_type_typedef\\(int\\).*\r\n$gdb_prompt $" { -+ # v2 and v3 demanglers -+ pass "detect dm_type_typedef" -+ } -+ -re ".*dm_type_typedef\\(myint\\).*\r\n$gdb_prompt $" { -+ # GDB type printer -+ set dm_type_typedef 1 -+ pass "detect dm_type_typedef" -+ } -+ -re ".*$gdb_prompt $" { -+ fail "detect dm_type_typedef" -+ } -+ timeout { -+ fail "detect dm_type_typedef (timeout)" -+ } -+ } - } - - # -@@ -351,8 +492,9 @@ proc print_addr { name } { - - proc test_lookup_operator_functions {} { - global dm_operator_comma -+ global dm_operator_char_star - global dm_type_char_star -- global dm_type_char_star_quoted -+ global dm_operator_char_star_quoted - global dm_type_foo_ref - global dm_type_void - global dm_type_void_star -@@ -410,8 +552,8 @@ proc test_lookup_operator_functions {} { - - info_func "operator int(" "int foo::operator int($dm_type_void);" - info_func "operator()(" "void foo::operator()($dm_type_foo_ref);" -- info_func "operator $dm_type_char_star_quoted\(" \ -- "char *foo::operator $dm_type_char_star\($dm_type_void);" -+ info_func "operator $dm_operator_char_star_quoted\(" \ -+ "char *foo::operator $dm_operator_char_star\($dm_type_void);" - - } - -@@ -426,6 +568,7 @@ proc test_paddr_operator_functions {} { - global dm_type_unsigned_int - global dm_type_void - global dm_type_void_star -+ global dm_operator_char_star - - print_addr "foo::operator*($dm_type_foo_ref)" - print_addr "foo::operator%($dm_type_foo_ref)" -@@ -479,7 +622,7 @@ proc test_paddr_operator_functions {} { - } - - print_addr "foo::operator int($dm_type_void)" -- print_addr "foo::operator $dm_type_char_star\($dm_type_void)" -+ print_addr "foo::operator $dm_operator_char_star\($dm_type_void)" - } - - # -@@ -489,17 +632,21 @@ proc test_paddr_operator_functions {} { - proc test_paddr_overloaded_functions {} { - global dm_type_unsigned_int - global dm_type_void -+ global dm_type_short -+ global dm_type_unsigned_short -+ global dm_type_long -+ global dm_type_unsigned_long - - print_addr "overload1arg($dm_type_void)" - print_addr "overload1arg(char)" - print_addr "overload1arg(signed char)" - print_addr "overload1arg(unsigned char)" -- print_addr "overload1arg(short)" -- print_addr "overload1arg(unsigned short)" -+ print_addr "overload1arg($dm_type_short)" -+ print_addr "overload1arg($dm_type_unsigned_short)" - print_addr "overload1arg(int)" - print_addr "overload1arg($dm_type_unsigned_int)" -- print_addr "overload1arg(long)" -- print_addr "overload1arg(unsigned long)" -+ print_addr "overload1arg($dm_type_long)" -+ print_addr "overload1arg($dm_type_unsigned_long)" - print_addr "overload1arg(float)" - print_addr "overload1arg(double)" - -@@ -522,17 +669,31 @@ proc test_paddr_hairy_functions {} { - global dm_type_char_star - global dm_type_int_star - global dm_type_long_star -+ global dm_type_typedef - - print_addr_2 "hairyfunc1" "hairyfunc1(int)" -- print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))" -- print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))" -- print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))" -- -- # gdb-gnats bug gdb/19: -- # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" -- print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19" -- print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19" -- print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19" -+ -+ if {$dm_type_typedef == 0} { -+ print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))" -+ print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))" -+ print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))" -+ -+ # gdb-gnats bug gdb/19: -+ # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" -+ print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19" -+ print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19" -+ print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19" -+ } else { -+ print_addr_2 "hairyfunc2" "hairyfunc2(PFPc_i)" -+ print_addr_2 "hairyfunc3" "hairyfunc3(PFPFPl_s_i)" -+ print_addr_2 "hairyfunc4" "hairyfunc4(PFPFPc_s_i)" -+ -+ # gdb-gnats bug gdb/19: -+ # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" -+ print_addr_2 "hairyfunc5" "hairyfunc5(PFPc_PFl_i)" -+ print_addr_2 "hairyfunc6" "hairyfunc6(PFPi_PFl_i)" -+ print_addr_2 "hairyfunc7" "hairyfunc7(PFPFPc_i_PFl_i)" -+ } - } - - proc do_tests {} { -diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp -index 454c6f4..8f88ad7 100644 ---- a/gdb/testsuite/gdb.cp/ctti.exp -+++ b/gdb/testsuite/gdb.cp/ctti.exp -@@ -85,11 +85,6 @@ gdb_test "print c" "\\$\[0-9\]+ = 194 .*" - gdb_test "print f" "\\$\[0-9\]+ = 9" - gdb_test "print i" "\\$\[0-9\]+ = 4" - --# TODO: this needs more work before actually deploying it. --# So bail out here. -- --if { [ test_compiler_info gcc-*] } then { continue } -- - gdb_test_multiple "print add(2,2)" "print add(2,2)" { - -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { - pass "print add(2,2)" -diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp -index 47890f1..03c8847 100644 ---- a/gdb/testsuite/gdb.cp/exception.exp -+++ b/gdb/testsuite/gdb.cp/exception.exp -@@ -146,7 +146,9 @@ gdb_test_multiple "continue" $name { - - set name "backtrace after first throw" - gdb_test_multiple "backtrace" $name { -- -re ".*#\[0-9\]+${ws}($hex in |)__cxa_throw.*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { -+ -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_throw\[\[:>:\]\].*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { -+ # Either __cxxabiv1::__cxa_throw or __cxa_throw can be printed -+ # depending on debug info presence. - pass $name - } - } -@@ -168,7 +170,7 @@ gdb_test_multiple "continue" $name { - - set name "backtrace after first catch" - gdb_test_multiple "backtrace" $name { -- -re ".*#\[0-9\]+${ws}($hex in |)__cxa_begin_catch.*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { -+ -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_begin_catch\[\[:>:\]\].*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { - pass $name - } - } -@@ -190,7 +192,7 @@ gdb_test_multiple "continue" $name { - - set name "backtrace after second throw" - gdb_test_multiple "backtrace" $name { -- -re ".*#\[0-9\]+${ws}($hex in |)__cxa_throw.*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { -+ -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_throw\[\[:>:\]\].*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { - pass $name - } - } -@@ -212,7 +214,7 @@ gdb_test_multiple "continue" $name { - - set name "backtrace after second catch" - gdb_test_multiple "backtrace" $name { -- -re ".*#\[0-9\]+${ws}($hex in |)__cxa_begin_catch.*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { -+ -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_begin_catch\[\[:>:\]\].*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { - pass $name - } - } -diff --git a/gdb/testsuite/gdb.cp/expand-sals.exp b/gdb/testsuite/gdb.cp/expand-sals.exp -index 25ec4a9..e4fd59b 100644 ---- a/gdb/testsuite/gdb.cp/expand-sals.exp -+++ b/gdb/testsuite/gdb.cp/expand-sals.exp -@@ -46,7 +46,7 @@ gdb_continue_to_breakpoint "caller" ".*caller-line.*" - - # Test GDB caught this return call and not the next one through B::B() - gdb_test "bt" \ -- "#0 \[^\r\n\]* A \[^\r\n\]*\r\n#1 \[^\r\n\]* main \[^\r\n\]*" \ -+ "#0 \[^\r\n\]* (A::)?A \[^\r\n\]*\r\n#1 \[^\r\n\]* main \[^\r\n\]*" \ - "bt from A" - - gdb_continue_to_breakpoint "next caller func" ".*func-line.*" diff --git a/gdb/testsuite/gdb.cp/gdb9593.cc b/gdb/testsuite/gdb.cp/gdb9593.cc new file mode 100644 index 0000000..783c962 @@ -21778,10 +8084,10 @@ index 0000000..783c962 + diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp new file mode 100644 -index 0000000..ee9aeff +index 0000000..3dad7ca --- /dev/null +++ b/gdb/testsuite/gdb.cp/gdb9593.exp -@@ -0,0 +1,185 @@ +@@ -0,0 +1,182 @@ +# Copyright 2008, 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -21804,9 +8110,6 @@ index 0000000..ee9aeff + +if { [skip_cplus_tests] } { continue } + -+set prms_id 9593 -+set bug_id 0 -+ +set testfile "gdb9593" +set srcfile ${testfile}.cc +set binfile $objdir/$subdir/$testfile @@ -21929,7 +8232,7 @@ index 0000000..ee9aeff + "step into finish, for until" + +gdb_test "until" \ -+ ".*catch .int x.*" \ ++ ".*function1 ().*" \ + "until with no argument 1" + +set line [gdb_get_line_number "marker for until" $testfile.cc] @@ -21967,3150 +8270,12 @@ index 0000000..ee9aeff +gdb_test "advance $line" \ + ".*catch (...).*" \ + "advance-over-throw" -diff --git a/gdb/testsuite/gdb.cp/m-static.cc b/gdb/testsuite/gdb.cp/m-static.cc -index 2a0b61c..7f997ef 100644 ---- a/gdb/testsuite/gdb.cp/m-static.cc -+++ b/gdb/testsuite/gdb.cp/m-static.cc -@@ -15,6 +15,12 @@ protected: - - public: - gnu_obj_1(antiquities a, long l) {} -+ -+ long method () -+ { -+ static bool svar = true; -+ return key2; -+ } - }; - - const bool gnu_obj_1::test; -@@ -70,5 +76,8 @@ int main() - - test4.dummy = test4.elsewhere; - test4.dummy = 0; -- return test4.dummy; // breakpoint: constructs-done -+ -+ test1.method (); // breakpoint: constructs-done -+ -+ return test4.dummy; - } -diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp -index f207462..7b4e0ca 100644 ---- a/gdb/testsuite/gdb.cp/m-static.exp -+++ b/gdb/testsuite/gdb.cp/m-static.exp -@@ -132,5 +132,10 @@ gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimis - # that GDB's current behavior in such situations is either consistent - # across platforms or optimal, so I'm not including one now. - -+# Step into test1.method and examine the method-scoped static. -+# This is a regression test for PR 9708. -+gdb_test "step" "gnu_obj_1::method.*" -+gdb_test "print svar" " = true" -+ - gdb_exit - return 0 -diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc -index ffffb4c..b406a59 100644 ---- a/gdb/testsuite/gdb.cp/member-ptr.cc -+++ b/gdb/testsuite/gdb.cp/member-ptr.cc -@@ -138,6 +138,7 @@ class Diamond : public Padding, public Left, public Right - { - public: - virtual int vget_base (); -+ int (*func_ptr) (int); - }; - - int Diamond::vget_base () -@@ -145,6 +146,12 @@ int Diamond::vget_base () - return this->Left::x + 2000; - } - -+int -+func (int x) -+{ -+ return 19 + x; -+} -+ - int main () - { - A a; -@@ -162,6 +169,7 @@ int main () - int (Diamond::*right_vpmf) (); - int (Base::*base_vpmf) (); - int Diamond::*diamond_pmi; -+ int (* Diamond::*diamond_pfunc_ptr) (int); - - PMI null_pmi; - PMF null_pmf; -@@ -179,6 +187,7 @@ int main () - - diamond.Left::x = 77; - diamond.Right::x = 88; -+ diamond.func_ptr = func; - - /* Some valid pointer to members from a base class. */ - left_pmf = (int (Diamond::*) ()) (int (Left::*) ()) (&Base::get_x); -@@ -193,11 +202,19 @@ int main () - /* A pointer to data member from a base class. */ - diamond_pmi = (int Diamond::*) (int Left::*) &Base::x; - -+ /* A pointer to data member, where the member is itself a pointer to -+ a function. */ -+ diamond_pfunc_ptr = (int (* Diamond::*) (int)) &Diamond::func_ptr; -+ - null_pmi = NULL; - null_pmf = NULL; - - pmi = NULL; /* Breakpoint 1 here. */ - -+ // Invalid (uses diamond_pfunc_ptr as a function): -+ // diamond.*diamond_pfunc_ptr (20); -+ (diamond.*diamond_pfunc_ptr) (20); -+ - k = (a.*pmf)(3); - - pmi = &A::jj; -diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp -index 6832f3b..baf08d7 100644 ---- a/gdb/testsuite/gdb.cp/member-ptr.exp -+++ b/gdb/testsuite/gdb.cp/member-ptr.exp -@@ -390,6 +390,33 @@ gdb_test_multiple "print ((int) pmi) == ((char *) &a.j - (char *) & a)" $name { - } - } - -+# Check pointers to data members, which are themselves pointers to -+# functions. These behave like data members, not like pointers to -+# member functions. -+ -+gdb_test "ptype diamond_pfunc_ptr" \ -+ "type = int \\(\\*Diamond::\\*\\)\\(int\\)" -+ -+gdb_test "ptype diamond.*diamond_pfunc_ptr" \ -+ "type = int \\(\\*\\)\\(int\\)" -+ -+# This one is invalid; () binds more tightly than .*, so it tries to -+# call the member pointer as a normal pointer-to-function. -+ -+gdb_test "print diamond.*diamond_pfunc_ptr (20)" \ -+ "Invalid data type for function to be called." -+ -+# With parentheses, it is valid. -+ -+gdb_test "print (diamond.*diamond_pfunc_ptr) (20)" \ -+ "$vhn = 39" -+ -+# Make sure that we do not interpret this as either a member pointer -+# call or a member function call. -+ -+gdb_test "print diamond.func_ptr (20)" \ -+ "$vhn = 39" -+ - # ========================== - # pointer to member function - # ========================== -@@ -420,7 +447,7 @@ gdb_test_multiple "ptype pmf" $name { - - set name "print pmf" - gdb_test_multiple "print pmf" $name { -- -re "$vhn = $hex \r\n$gdb_prompt $" { -+ -re "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex \r\n$gdb_prompt $" { - pass $name - } - -re "$vhn = .*not supported with HP aCC.*\r\n$gdb_prompt $" { -@@ -608,6 +635,9 @@ gdb_test_multiple "print (a.*pmf)(3)" $name { - } - } - -+gdb_test "ptype a.*pmf" "type = int \\(A \\*, int\\)" -+gdb_test "ptype (a.*pmf)(3)" "type = int" -+ - # Print out a pointer to data member which requires looking into - # a base class. - gdb_test "print diamond_pmi" "$vhn = &Base::x" -@@ -658,5 +688,5 @@ gdb_test "print null_pmi = &A::j" "$vhn = &A::j" - gdb_test "print null_pmi = 0" "$vhn = NULL" - - gdb_test "print null_pmf" "$vhn = NULL" --gdb_test "print null_pmf = &A::foo" "$vhn = $hex " -+gdb_test "print null_pmf = &A::foo" "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex " - gdb_test "print null_pmf = 0" "$vhn = NULL" -diff --git a/gdb/testsuite/gdb.cp/namespace-koenig.cc b/gdb/testsuite/gdb.cp/namespace-koenig.cc -new file mode 100644 -index 0000000..3c30cb2 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-koenig.cc -@@ -0,0 +1,232 @@ -+namespace A -+{ -+ class C -+ { -+ public: -+ static const int x = 11; -+ }; -+ -+ int -+ first (C c) -+ { -+ return 11; -+ } -+ -+ int -+ first (int a, C c) -+ { -+ return 22; -+ } -+ -+ int -+ second (int a, int b, C cc, int c, int d) -+ { -+ return 33; -+ } -+ -+} -+ -+struct B -+{ -+ A::C c; -+}; -+ -+//------------ -+ -+namespace E -+{ -+ class O{}; -+ int foo (O o){return 1; } -+ int foo (O o, O o2){return 2; } -+ int foo (O o, O o2, int i){return 3; } -+} -+ -+namespace F -+{ -+ class O{}; -+ int foo ( O fo, ::E::O eo){ return 4;} -+ int foo (int i, O fo, ::E::O eo){ return 5;} -+} -+ -+namespace G -+{ -+ class O{}; -+ int foo (O go, ::F::O fo, ::E::O eo){ return 6; } -+} -+ -+//------------ -+ -+namespace H -+{ -+ class O{}; -+ int foo (O){ return 7;} -+} -+ -+namespace I -+{ -+ class O: public H::O {}; -+ class X: H::O{}; -+} -+ -+//------------ -+ -+namespace J -+{ -+ union U{}; -+ struct S{}; -+ enum E{}; -+ -+ class A{ -+ public: -+ class B{}; -+ }; -+ -+ class C{}; -+ -+ int foo (U){ return 8;} -+ int foo (S){ return 9;} -+ int foo (E){ return 10;} -+ int foo (A::B){ return 11;} -+ int foo (A*){ return 12;} -+ int foo (A**){ return 13;} -+ int foo (C[]){ return 14;} -+ -+} -+//------------ -+ -+namespace K{ -+ class O{}; -+ -+ int foo(O, int){ -+ return 15; -+ } -+ -+ int bar(O, int){ -+ return 15; -+ } -+} -+ -+int foo(K::O, float){ -+ return 16; -+} -+ -+int bar(K::O, int){ -+ return 16; -+} -+//------------ -+ -+namespace L { -+ namespace A{ -+ namespace B{ -+ class O {}; -+ -+ int foo (O){ -+ return 17; -+ } -+ -+ } -+ } -+} -+ -+//------------ -+ -+namespace M { -+ class O{ -+ public: -+ int operator== (int){ -+ return 18; -+ } -+ -+ int operator== (float){ -+ return 19; -+ } -+ -+ int operator+ (float){ -+ return 22; -+ } -+ -+ }; -+ -+ int operator!= (O, int){ -+ return 20; -+ } -+ -+ int operator!= (O, double){ -+ return 21; -+ } -+ -+ int operator+ (O, int){ -+ return 23; -+ } -+ -+ int operator++ (O){ -+ return 24; -+ } -+ -+} -+//------------ -+int -+main () -+{ -+ A::C c; -+ B b; -+ -+ A::first (c); -+ first (0, c); -+ second (0, 0, c, 0, 0); -+ A::first (b.c); -+ -+ E::O eo; -+ F::O fo; -+ G::O go; -+ -+ foo (eo); -+ foo (eo, eo); -+ foo (eo, eo, 1); -+ foo (fo, eo); -+ foo (1 ,fo, eo); -+ foo (go, fo, eo); -+ -+ I::O io; -+ I::X ix; -+ -+ foo (io); -+//foo (ix); -+ -+ J::U ju; -+ J::S js; -+ J::E je; -+ J::A::B jab; -+ J::A *jap; -+ J::A **japp; -+ J::C jca[3]; -+ -+ foo (ju); -+ foo (js); -+ foo (je); -+ foo (jab); -+ foo (jap); -+ foo (japp); -+ foo (jca); -+ -+ K::O ko; -+ foo (ko, 1); -+ foo (ko, 1.0f); -+ //bar(ko,1); -+ -+ L::A::B::O labo; -+ foo (labo); -+ -+ M::O o; -+ o == 5; -+ o == 5.0f; -+ o != 5; -+ o != 5.0f; -+ o + 5; -+ o + 5.0f; -+ -+ return first (0, c) + foo (eo) + -+ foo (eo, eo) + foo (eo, eo, 1) + -+ foo (fo, eo) + foo (1 ,fo, eo) + -+ foo (go, fo, eo); -+} -diff --git a/gdb/testsuite/gdb.cp/namespace-koenig.exp b/gdb/testsuite/gdb.cp/namespace-koenig.exp -new file mode 100644 -index 0000000..c73e239 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-koenig.exp -@@ -0,0 +1,112 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile namespace-koenig -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+############################################ -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+# Test that koenig lookup finds correct function -+gdb_test "p first(c)" "= 11" -+ -+# Change the number of parameters and position of -+# the qualifying parameter -+gdb_test "p second(0,0,c,0,0)" "= 33" -+ -+# Test that koenig lookup finds correct function -+# even if it is overloaded -+gdb_test "p first(0,c)" "= 22" -+ -+# Test that koenig lookup finds correct function -+# when the argument is an expression -+gdb_test "p first(b.c)" "= 11" -+ -+# test that resolutions can be made across namespaces -+gdb_test "p foo(eo)" "= 1" -+gdb_test "p foo(eo, eo)" "= 2" -+gdb_test "p foo(eo, eo, 1)" "= 3" -+gdb_test "p foo(fo, eo)" "= 4" -+gdb_test "p foo(1 ,fo, eo)" "= 5" -+gdb_test "p foo(go, fo, eo)" "= 6" -+ -+#test that gdb fails gracefully -+gdb_test "p fake(eo)" "No symbol \"fake\" in current context." -+ -+#test that namespaces of base classes are searched -+gdb_test "p foo(io)" "= 7" -+gdb_test "p foo(ix)" "Cannot resolve function foo to any overloaded instance" -+ -+#test for other types -+gdb_test "p foo(ju)" "= 8" -+gdb_test "p foo(js)" "= 9" -+gdb_test "p foo(je)" "= 10" -+ -+#test for class members -+setup_xfail "*-*-*" -+gdb_test "p foo(jab)" "= 11" -+ -+gdb_test "p foo(jap)" "= 12" -+gdb_test "p foo(japp)" "= 13" -+gdb_test "p foo(jca)" "= 14" -+ -+#test overload resolution -+gdb_test "p foo(ko,1)" "= 15" -+gdb_test "p foo(ko,1.0f)" "= 16" -+setup_xfail "*-*-*" -+gdb_test "p bar(ko,1)" "= -1" -+ -+#test lookup of objects belonging to nested namespaces -+gdb_test "p foo(labo)" "= 17" -+ -+# test lookup of namespace user-defined operators -+# and overload resolution: -+ -+# within class -+gdb_test "p o == 5" "= 18" -+gdb_test "p o == 5.0f" "= 19" -+ -+# within namespace -+gdb_test "p o != 5" "= 20" -+gdb_test "p o != 5.0f" "= 21" -+ -+# across namespace and class -+gdb_test "p o + 5.0f" "= 22" -+gdb_test "p o + 5" "= 23" -+ -+gdb_test "p o++" "= 24" -diff --git a/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc b/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc -new file mode 100644 -index 0000000..6b180d6 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc -@@ -0,0 +1,20 @@ -+namespace A { -+ int x = 11; -+ namespace{ -+ int xx = 22; -+ } -+} -+ -+using namespace A; -+ -+namespace{ -+ int xxx = 33; -+}; -+ -+int main() -+{ -+ x; -+ xx; -+ xxx; -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.cp/namespace-multiple-imports.exp b/gdb/testsuite/gdb.cp/namespace-multiple-imports.exp -new file mode 100644 -index 0000000..e4bb9f8 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-multiple-imports.exp -@@ -0,0 +1,49 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile namespace-multiple-imports -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+############################################ -+# test printing of namespace imported within -+# the function. -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_test "print x" "\\$\[0-9\].* = 11" -+gdb_test "print xx" "\\$\[0-9\].* = 22" -+gdb_test "print xxx" "\\$\[0-9\].* = 33" -diff --git a/gdb/testsuite/gdb.cp/namespace-nested-imports.cc b/gdb/testsuite/gdb.cp/namespace-nested-imports.cc -new file mode 100644 -index 0000000..9723f87 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-nested-imports.cc -@@ -0,0 +1,36 @@ -+namespace A -+{ -+ namespace B -+ { -+ int ab = 11; -+ } -+} -+ -+namespace C -+{ -+ namespace D -+ { -+ using namespace A::B; -+ -+ int -+ second() -+ { -+ ab; -+ return 0; -+ } -+ } -+ -+ int -+ first() -+ { -+ //ab; -+ return D::second(); -+ } -+} -+ -+int -+main() -+{ -+ //ab; -+ return C::first(); -+} -diff --git a/gdb/testsuite/gdb.cp/namespace-nested-imports.exp b/gdb/testsuite/gdb.cp/namespace-nested-imports.exp -new file mode 100644 -index 0000000..d279fb5 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-nested-imports.exp -@@ -0,0 +1,57 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile namespace-nested-imports -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+############################################ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_test "print ab" "No symbol .* in current context." -+ -+############################################ -+gdb_breakpoint C::first -+gdb_continue_to_breakpoint "C::first" -+ -+gdb_test "print ab" "No symbol .* in current context." -+gdb_test "print C::D::ab" "= 11" -+ -+############################################ -+gdb_breakpoint C::D::second -+gdb_continue_to_breakpoint "C::D::second" -+ -+gdb_test "print ab" "= 11" -diff --git a/gdb/testsuite/gdb.cp/namespace-no-imports.cc b/gdb/testsuite/gdb.cp/namespace-no-imports.cc -new file mode 100644 -index 0000000..d1c68ab ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-no-imports.cc -@@ -0,0 +1,37 @@ -+ -+namespace A -+{ -+ int _a = 11; -+ -+ namespace B{ -+ -+ int ab = 22; -+ -+ namespace C{ -+ -+ int abc = 33; -+ -+ int second(){ -+ return 0; -+ } -+ -+ } -+ -+ int first(){ -+ _a; -+ ab; -+ C::abc; -+ return C::second(); -+ } -+ } -+} -+ -+ -+int -+main() -+{ -+ A::_a; -+ A::B::ab; -+ A::B::C::abc; -+ return A::B::first(); -+} -diff --git a/gdb/testsuite/gdb.cp/namespace-no-imports.exp b/gdb/testsuite/gdb.cp/namespace-no-imports.exp -new file mode 100644 -index 0000000..e508103 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-no-imports.exp -@@ -0,0 +1,76 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile namespace-no-imports -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+############################################ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_test "print A::_a" "= 11" -+gdb_test "print A::B::ab" "= 22" -+gdb_test "print A::B::C::abc" "= 33" -+ -+gdb_test "print _a" "No symbol .* in current context." -+gdb_test "print ab" "No symbol .* in current context." -+gdb_test "print abc" "No symbol .* in current context." -+ -+############################################ -+gdb_breakpoint A::B::first -+gdb_continue_to_breakpoint "A::B::first" -+ -+gdb_test "print A::_a" "= 11" -+gdb_test "print A::B::ab" "= 22" -+gdb_test "print A::B::C::abc" "= 33" -+ -+gdb_test "print _a" "= 11" -+gdb_test "print ab" "= 22" -+gdb_test "print C::abc" "= 33" -+ -+gdb_test "print abc" "No symbol .* in current context." -+ -+############################################ -+gdb_breakpoint A::B::C::second -+gdb_continue_to_breakpoint "A::B::C::second" -+ -+gdb_test "print A::_a" "= 11" -+gdb_test "print A::B::ab" "= 22" -+gdb_test "print A::B::C::abc" "= 33" -+ -+gdb_test "print _a" "= 11" -+gdb_test "print ab" "= 22" -+gdb_test "print abc" "= 33" -diff --git a/gdb/testsuite/gdb.cp/namespace-recursive.cc b/gdb/testsuite/gdb.cp/namespace-recursive.cc -new file mode 100644 -index 0000000..46d4c18 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-recursive.cc -@@ -0,0 +1,47 @@ -+namespace A{ -+ int ax = 9; -+} -+ -+namespace B{ -+ using namespace A; -+} -+ -+namespace C{ -+ using namespace B; -+} -+ -+using namespace C; -+ -+//--------------- -+namespace D{ -+ using namespace D; -+ int dx = 99; -+} -+using namespace D; -+ -+//--------------- -+namespace{ -+ namespace{ -+ int xx = 999; -+ } -+} -+ -+//--------------- -+namespace E{ -+ int ex = 9999; -+} -+ -+namespace F{ -+ namespace FE = E; -+} -+ -+namespace G{ -+ namespace GF = F; -+} -+ -+//---------------- -+int main(){ -+ using namespace D; -+ namespace GX = G; -+ return ax + dx + xx + G::GF::FE::ex; -+} -diff --git a/gdb/testsuite/gdb.cp/namespace-recursive.exp b/gdb/testsuite/gdb.cp/namespace-recursive.exp -new file mode 100644 -index 0000000..5543757 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-recursive.exp -@@ -0,0 +1,75 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile namespace-recursive -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+############################################ -+# test printing from namespace imported into -+# imported namespace -+ -+gdb_test "print ax" "= 9" -+ -+############################################ -+# test that gdb can print without falling -+# into search loop -+ -+gdb_test "print dx" "= 99" -+ -+############################################ -+# test printing from namespace imported into -+# imported namespace where imports are implicit -+# anonymous namespace imports. -+ -+gdb_test "print xx" "= 999" -+ -+############################################ -+# Test printing using recursive namespace -+# aliases. -+ -+setup_kfail "gdb/10541" "*-*-*" -+gdb_test "ptype G::GF" "= namespace F" -+ -+setup_kfail "gdb/10541" "*-*-*" -+gdb_test "print G::GF::FE::ex" "= 9999" -diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc -new file mode 100644 -index 0000000..173e49b ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc -@@ -0,0 +1,93 @@ -+int a; -+int b; -+int c; -+int d; -+int e; -+int f; -+int g; -+int h; -+int i; -+int j; -+int k; -+int l; -+int m; -+int n; -+int o; -+int p; -+int q; -+int r; -+int s; -+int t; -+int u; -+int v; -+int w; -+int x; -+int y; -+int z; -+ -+namespace A -+{ -+ int xyz; -+ -+ using ::a; -+ using ::b; -+ using ::c; -+ using ::d; -+ using ::e; -+ using ::f; -+ using ::g; -+ using ::h; -+ using ::i; -+ using ::j; -+ using ::k; -+ using ::l; -+ using ::m; -+ using ::n; -+ using ::o; -+ using ::p; -+ using ::q; -+ using ::r; -+ using ::s; -+ using ::t; -+ using ::u; -+ using ::v; -+ using ::w; -+ using ::x; -+ using ::y; -+ using ::z; -+ -+} -+ -+using A::a; -+using A::b; -+using A::c; -+using A::d; -+using A::e; -+using A::f; -+using A::g; -+using A::h; -+using A::i; -+using A::j; -+using A::k; -+using A::l; -+using A::m; -+using A::n; -+using A::o; -+using A::p; -+using A::q; -+using A::r; -+using A::s; -+using A::t; -+using A::u; -+using A::v; -+using A::w; -+using A::x; -+using A::y; -+using A::z; -+ -+using namespace A; -+ -+int main () -+{ -+ return 0; -+} -\ No newline at end of file -diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp -new file mode 100644 -index 0000000..f22a14e ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp -@@ -0,0 +1,50 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile namespace-stress-declarations -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+############################################ -+# Test that the search can fail efficiently -+ -+gdb_test "print fakex" "No symbol \"fakex\" in current context." -diff --git a/gdb/testsuite/gdb.cp/namespace-stress.cc b/gdb/testsuite/gdb.cp/namespace-stress.cc -new file mode 100644 -index 0000000..f34083e ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-stress.cc -@@ -0,0 +1,60 @@ -+ -+namespace A{ int x; } -+namespace B{ int x; } -+namespace C{ int x; } -+namespace D{ int x; } -+namespace E{ int x; } -+namespace F{ int x; } -+namespace G{ int x; } -+namespace H{ int x; } -+namespace I{ int x; } -+namespace J{ int x; } -+namespace K{ int x; } -+namespace L{ int x; } -+namespace M{ int x; } -+namespace N{ int x; } -+namespace O{ int x; } -+namespace P{ int x; } -+namespace Q{ int x; } -+namespace R{ int x; } -+namespace S{ int x; } -+namespace T{ int x; } -+namespace U{ int x; } -+namespace V{ int x; } -+namespace W{ int x; } -+namespace X{ int x; } -+namespace Y{ int x; } -+namespace Z{ int x; } -+ -+ -+int main(){ -+ -+ using namespace A; -+ using namespace B; -+ using namespace C; -+ using namespace D; -+ using namespace E; -+ using namespace F; -+ using namespace G; -+ using namespace H; -+ using namespace I; -+ using namespace J; -+ using namespace K; -+ using namespace L; -+ using namespace M; -+ using namespace N; -+ using namespace O; -+ using namespace P; -+ using namespace Q; -+ using namespace R; -+ using namespace S; -+ using namespace T; -+ using namespace U; -+ using namespace V; -+ using namespace W; -+ using namespace X; -+ using namespace Y; -+ using namespace Z; -+ -+ return 0; -+} -\ No newline at end of file -diff --git a/gdb/testsuite/gdb.cp/namespace-stress.exp b/gdb/testsuite/gdb.cp/namespace-stress.exp -new file mode 100644 -index 0000000..1806523 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/namespace-stress.exp -@@ -0,0 +1,50 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile namespace-stress -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+############################################ -+# Test that the search can fail efficiently -+ -+gdb_test "print y" "No symbol \"y\" in current context." -diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp -index 4362fd8..f7cfd57 100644 ---- a/gdb/testsuite/gdb.cp/namespace.exp -+++ b/gdb/testsuite/gdb.cp/namespace.exp -@@ -24,6 +24,7 @@ - # for namespaces. - # Note: As of 2000-06-03, they passed under g++ - djb - -+load_lib "cp-support.exp" - - if $tracelevel then { - strace $tracelevel -@@ -241,11 +242,16 @@ gdb_test "ptype E" "type = namespace C::D::E" - gdb_test "ptype CClass" "type = (class C::CClass \{\r\n public:|struct C::CClass \{)\r\n int x;\r\n\}" - gdb_test "ptype CClass::NestedClass" "type = (class C::CClass::NestedClass \{\r\n public:|struct C::CClass::NestedClass \{)\r\n int y;\r\n\}" - gdb_test "ptype NestedClass" "No symbol \"NestedClass\" in current context." --setup_kfail "gdb/1448" "*-*-*" --gdb_test "ptype ::C::CClass" "type = class C::CClass \{\r\n public:\r\n int x;\r\n\}" --setup_kfail "gdb/1448" "*-*-*" --gdb_test "ptype ::C::CClass::NestedClass" "type = class C::CClass::NestedClass \{\r\n public:\r\n int y;\r\n\}" --setup_kfail "gdb/1448" "*-*-*" -+cp_test_ptype_class \ -+ "ptype ::C::CClass" "" "class" "C::CClass" \ -+ { -+ { field public "int x;" } -+ } -+cp_test_ptype_class \ -+ "ptype ::C::CClass::NestedClass" "" "class" "C::CClass::NestedClass" \ -+ { -+ { field public "int y;" } -+ } - gdb_test "ptype ::C::NestedClass" "No symbol \"NestedClass\" in namespace \"C\"." - gdb_test "ptype C::CClass" "No symbol \"CClass\" in namespace \"C::C\"." - gdb_test "ptype C::CClass::NestedClass" "No type \"CClass\" within class or namespace \"C::C\"." -@@ -255,8 +261,11 @@ gdb_test "ptype C::NestedClass" "No symbol \"NestedClass\" in namespace \"C::C\" - - 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\}" --setup_kfail "gdb/1448" "*-*-*" --gdb_test "ptype ::C::OtherFileClass" "type = class C::OtherFileClass \{\r\n public:\r\n int z;\r\n\}" -+cp_test_ptype_class \ -+ "ptype ::C::OtherFileClass" "" "class" "C::OtherFileClass" \ -+ { -+ { field public "int z;" } -+ } - gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"." - - # Some anonymous namespace tests. -diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp -index 72a616e..fd99f87 100644 ---- a/gdb/testsuite/gdb.cp/nsusing.exp -+++ b/gdb/testsuite/gdb.cp/nsusing.exp -@@ -30,7 +30,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ - } - - if [get_compiler_info ${binfile}] { -- return -1 -+ return -1; - } - - -diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp -index ae8fd26..8291022 100644 ---- a/gdb/testsuite/gdb.cp/overload.exp -+++ b/gdb/testsuite/gdb.cp/overload.exp -@@ -74,12 +74,12 @@ set re_methods "${re_methods}${ws}int overload1arg\\((void|)\\);" - set re_methods "${re_methods}${ws}int overload1arg\\(char\\);" - set re_methods "${re_methods}${ws}int overload1arg\\(signed char\\);" - set re_methods "${re_methods}${ws}int overload1arg\\(unsigned char\\);" --set re_methods "${re_methods}${ws}int overload1arg\\(short\\);" --set re_methods "${re_methods}${ws}int overload1arg\\(unsigned short\\);" -+set re_methods "${re_methods}${ws}int overload1arg\\(short( int)?\\);" -+set re_methods "${re_methods}${ws}int overload1arg\\((unsigned short|short unsigned)( int)?\\);" - set re_methods "${re_methods}${ws}int overload1arg\\(int\\);" - set re_methods "${re_methods}${ws}int overload1arg\\(unsigned int\\);" --set re_methods "${re_methods}${ws}int overload1arg\\(long\\);" --set re_methods "${re_methods}${ws}int overload1arg\\(unsigned long\\);" -+set re_methods "${re_methods}${ws}int overload1arg\\(long( int)?\\);" -+set re_methods "${re_methods}${ws}int overload1arg\\((unsigned long|long unsigned)( int)?\\);" - set re_methods "${re_methods}${ws}int overload1arg\\(float\\);" - set re_methods "${re_methods}${ws}int overload1arg\\(double\\);" - set re_methods "${re_methods}${ws}int overloadfnarg\\((void|)\\);" -diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp -index 5b06b31..3e47c77 100644 ---- a/gdb/testsuite/gdb.cp/ovldbreak.exp -+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp -@@ -127,10 +127,24 @@ proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} { - } - - # This is the expected menu for overload1arg. --# Note the arg type variations on lines 6 and 13. -+# Note the arg type variations for void and integer types. - # This accommodates different versions of g++. - --set menu_overload1arg "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n> $" -+set menu_overload1arg "\\\[0\\\] cancel\r\n" -+append menu_overload1arg "\\\[1\\\] all\r\n" -+append menu_overload1arg "\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n" -+append menu_overload1arg "\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n" -+append menu_overload1arg "\\\[4\\\] foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r\n" -+append menu_overload1arg "\\\[5\\\] foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r\n" -+append menu_overload1arg "\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n" -+append menu_overload1arg "\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n" -+append menu_overload1arg "\\\[8\\\] foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r\n" -+append menu_overload1arg "\\\[9\\\] foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r\n" -+append menu_overload1arg "\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n" -+append menu_overload1arg "\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n" -+append menu_overload1arg "\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n" -+append menu_overload1arg "\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n" -+append menu_overload1arg "> $" - - # Set multiple-symbols to "ask", to allow us to test the use - # of the multiple-choice menu when breaking on an overloaded method. -@@ -157,17 +171,17 @@ set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 13 13 110 - - gdb_test "info break" \ - "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r - \[\t \]+breakpoint already hit 1 time\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ -@@ -215,17 +229,17 @@ gdb_expect { - - gdb_test "info break" \ - "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r - \[\t \]+breakpoint already hit 1 time\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ -@@ -296,12 +310,12 @@ gdb_test "info break" \ - "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r --\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r -+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r - \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r -diff --git a/gdb/testsuite/gdb.cp/realcpp.cc b/gdb/testsuite/gdb.cp/realcpp.cc -new file mode 100644 -index 0000000..8e4f72a ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/realcpp.cc -@@ -0,0 +1,409 @@ -+#include -+#include -+ -+// Forward decls -+class base; -+class derived; -+ -+// A simple template with specializations -+template -+class tclass -+{ -+public: -+ void do_something () { } // tclass::do_something -+}; -+ -+template <> -+void tclass::do_something () { } // tclass::do_something -+ -+template <> -+void tclass::do_something () { } // tclass::do_something -+ -+template<> -+void tclass::do_something () { } // tclass::do_something -+ -+template<> -+void tclass::do_something () { } // tclass::do_something -+ -+// A simple template with multiple template parameters -+template -+void flubber (void) // flubber -+{ -+ A a; -+ B b; -+ C c; -+ D d; -+ E e; -+ -+ ++a; -+ ++b; -+ ++c; -+ ++d; -+ ++e; -+} -+ -+// Some contrived policies -+template -+struct operation_1 -+{ -+ static void function (void) { } // operation_1::function -+}; -+ -+template -+struct operation_2 -+{ -+ static void function (void) { } // operation_2::function -+}; -+ -+template -+struct operation_3 -+{ -+ static void function (void) { } // operation_3::function -+}; -+ -+template -+struct operation_4 -+{ -+ static void function (void) { } // operation_4::function -+}; -+ -+// A policy-based class w/ and w/o default policy -+template -+class policy : public Policy -+{ -+public: -+ policy (T obj) : obj_ (obj) { } // policy::policy -+ -+private: -+ T obj_; -+}; -+ -+template > -+class policyd : public Policy -+{ -+public: -+ policyd (T obj) : obj_ (obj) { } // policyd::policyd -+ ~policyd (void) { } // policyd::~policyd -+ -+private: -+ T obj_; -+}; -+ -+typedef policy > policy1; -+typedef policy > policy2; -+typedef policy > policy3; -+typedef policy > policy4; -+ -+typedef policyd policyd1; -+typedef policyd policyd2; -+typedef policyd policyd3; -+typedef policyd policyd4; -+typedef policyd > policyd5; -+ -+class fluff { }; -+static fluff *g_fluff = new fluff (); -+ -+class base -+{ -+protected: -+ int foo_; -+ -+public: -+ base (void) : foo_ (42) { } // base::base(void) -+ base (int foo) : foo_ (foo) { } // base::base(int) -+ ~base (void) { } // base::~base -+ -+ // Some overloaded methods -+ int overload (void) const { return 0; } // base::overload(void) const -+ int overload (int i) const { return 1; } // base::overload(int) const -+ int overload (short s) const { return 2; } // base::overload(short) const -+ int overload (long l) const { return 3; } // base::overload(long) const -+ int overload (char* a) const { return 4; } // base::overload(char*) const -+ int overload (base& b) const { return 5; } // base::overload(base&) const -+ -+ // Operators -+ int operator+ (base const& o) const // base::operator+ -+ { return foo_ + o.foo_; } -+ -+ base operator++ (void) // base::operator++ -+ { ++foo_; return *this; } -+ -+ base operator+=(base const& o) // base::operator+= -+ { foo_ += o.foo_; return *this; } -+ -+ int operator- (base const& o) const // base::operator- -+ { return foo_ - o.foo_; } -+ -+ base operator-- (void) // base::operator-- -+ { --foo_; return *this; } -+ -+ base operator-= (base const& o) // base::operator-= -+ { foo_ -= o.foo_; return *this; } -+ -+ int operator* (base const& o) const // base::operator* -+ { return foo_ * o.foo_; } -+ -+ base operator*= (base const& o) // base::operator*= -+ { foo_ *= o.foo_; return *this; } -+ -+ int operator/ (base const& o) const // base::operator/ -+ { return foo_ / o.foo_; } -+ -+ base operator/= (base const& o) // base::operator/= -+ { foo_ /= o.foo_; return *this; } -+ -+ int operator% (base const& o) const // base::operator% -+ { return foo_ % o.foo_; } -+ -+ base operator%= (base const& o) // base::operator%= -+ { foo_ %= o.foo_; return *this; } -+ -+ bool operator< (base const& o) const // base::operator< -+ { return foo_ < o.foo_; } -+ -+ bool operator<= (base const& o) const // base::operator<= -+ { return foo_ <= o.foo_; } -+ -+ bool operator> (base const& o) const // base::operator> -+ { return foo_ > o.foo_; } -+ -+ bool operator>= (base const& o) const // base::operator>= -+ { return foo_ >= o.foo_; } -+ -+ bool operator!= (base const& o) const // base::operator!= -+ { return foo_ != o.foo_; } -+ -+ bool operator== (base const& o) const // base::operator== -+ { return foo_ == o.foo_; } -+ -+ bool operator! (void) const // base::operator! -+ { return !foo_; } -+ -+ bool operator&& (base const& o) const // base::operator&& -+ { return foo_ && o.foo_; } -+ -+ bool operator|| (base const& o) const // base::operator|| -+ { return foo_ || o.foo_; } -+ -+ int operator<< (int value) const // base::operator<< -+ { return foo_ << value; } -+ -+ base operator<<= (int value) // base::operator<<= -+ { foo_ <<= value; return *this; } -+ -+ int operator>> (int value) const // base::operator>> -+ { return foo_ >> value; } -+ -+ base operator>>= (int value) // base::operator>>= -+ { foo_ >>= value; return *this; } -+ -+ int operator~ (void) const // base::operator~ -+ { return ~foo_; } -+ -+ int operator& (base const& o) const // base::operator& -+ { return foo_ & o.foo_; } -+ -+ base operator&= (base const& o) // base::operator&= -+ { foo_ &= o.foo_; return *this; } -+ -+ int operator| (base const& o) const // base::operator| -+ { return foo_ | o.foo_; } -+ -+ base operator|= (base const& o) // base::operator|= -+ { foo_ |= o.foo_; return *this; } -+ -+ int operator^ (base const& o) const // base::operator^ -+ { return foo_ ^ o.foo_; } -+ -+ base operator^= (base const& o) // base::operator^= -+ { foo_ ^= o.foo_; return *this; } -+ -+ base operator= (base const& o) // base::operator= -+ { foo_ = o.foo_; return *this; } -+ -+ void operator() (void) const // base::operator() -+ { return; } -+ -+ int operator[] (int idx) const // base::operator[] -+ { return idx; } -+ -+ void* operator new (size_t size) throw () // base::operator new -+ { return malloc (size); } -+ -+ void operator delete (void* ptr) // base::operator delete -+ { free (ptr); } -+ -+ void* operator new[] (size_t size) throw () // base::operator new[] -+ { return malloc (size); } -+ -+ void operator delete[] (void* ptr) // base::operator delete[] -+ { free (ptr); } -+ -+ base const* operator-> (void) const // base::opeartor-> -+ { return this; } -+ -+ int operator->* (base const& b) const // base::operator->* -+ { return foo_ * b.foo_; } -+ -+ operator char* () const { return const_cast ("hello"); } // base::operator char* -+ operator int () const { return 21; } // base::operator int -+ operator fluff* () const { return new fluff (); } // base::operator fluff* -+ operator fluff** () const { return &g_fluff; } // base::operator fluff** -+}; -+ -+class base1 : public virtual base -+{ -+public: -+ base1 (void) : foo_ (21) { } // base1::base1(void) -+ base1 (int a) : foo_(a) { } // base1::base1(int) -+ void a_function (void) const { } // base1::a_function -+ -+protected: -+ int foo_; -+}; -+ -+class base2 : public virtual base -+{ -+public: -+ base2 () : foo_ (3) { } // base2::base2 -+ -+protected: -+ void a_function (void) const { } // base2::a_function -+ int foo_; -+}; -+ -+class derived : public base1, public base2 -+{ -+ public: -+ derived(void) : foo_ (4) { } // derived::derived -+ void a_function (void) const // derived::a_function -+ { -+ this->base1::a_function (); -+ this->base2::a_function (); -+ } -+ -+ protected: -+ int foo_; -+}; -+ -+int -+main (int argc, char* argv[]) // main -+{ // main -+ derived d; -+ void (derived::*pfunc) (void) const = &derived::a_function; -+ (d.*pfunc) (); -+ -+ base a (1), b (3), c (8); -+ (void) a.overload (); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (static_cast (0)); -+ (void) a.overload (a); -+ -+ int r; -+ r = b + c; -+ ++a; -+ a += b; -+ r = b - c; -+ --a; -+ a -= b; -+ r = b * c; -+ a *= b; -+ r = b / c; -+ a /= b; -+ r = b % c; -+ a %= b; -+ bool x = (b < c); -+ x = (b <= c); -+ x = (b > c); -+ x = (b >= c); -+ x = (b != c); -+ x = (b == c); -+ x = (!b); -+ x = (b && c); -+ x = (b || c); -+ r = b << 2; -+ a <<= 1; -+ r = b >> 2; -+ a >>= 1; -+ r = ~b; -+ r = b & c; -+ a &= c; -+ r = b | c; -+ a |= c; -+ r = b ^ c; -+ a ^= c; -+ a = c; -+ a (); -+ int i = a[3]; -+ derived* f = new derived (); -+ derived* g = new derived[3]; -+ delete f; -+ delete[] g; -+ a->overload (); -+ r = a->*b; -+ -+ tclass char_tclass; -+ tclass int_tclass; -+ tclass short_tclass; -+ tclass long_tclass; -+ tclass base_tclass; -+ char_tclass.do_something (); -+ int_tclass.do_something (); -+ short_tclass.do_something (); -+ long_tclass.do_something (); -+ base_tclass.do_something (); -+ -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ flubber (); -+ -+ policy1 p1 (1); -+ p1.function (); -+ policy2 p2 (2); -+ p2.function (); -+ policy3 p3 (3); -+ p3.function (); -+ policy4 p4 (4); -+ p4.function (); -+ -+ policyd1 pd1 (5); -+ pd1.function (); -+ policyd2 pd2 (6); -+ pd2.function (); -+ policyd3 pd3 (7); -+ pd3.function (); -+ policyd4 pd4 (d); -+ pd4.function (); -+ policyd5 pd5 (int_tclass); -+ pd5.function (); -+ -+ base1 b1 (3); -+ -+ r = a; -+ char* str = a; -+ fluff* flp = a; -+ fluff** flpp = a; -+} -+ -diff --git a/gdb/testsuite/gdb.cp/realcpp.exp b/gdb/testsuite/gdb.cp/realcpp.exp -new file mode 100644 -index 0000000..4e92e75 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/realcpp.exp -@@ -0,0 +1,891 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# This file is part of the gdb testsuite. -+ -+### -+# -+# SOME IMPORTANT NOTES -+# -+### -+ -+# The "info func" tests here aren't complete. I've commented them -+# out for now. -+ -+# A helper proc which sets a breakpoint at FUNC and attempts to -+# run to the breakpoint. -+proc test_breakpoint {func} { -+ global DEC -+ -+ # Restart every time -+ if {![runto_main]} { -+ perror "could not run to main when attempting to break at $func" -+ continue -+ } else { -+ gdb_breakpoint "$func" -+ set i [expr {[string last : $func] + 1}] -+ set efunc [escape [string range $func $i end]] -+ gdb_test "continue" \ -+ "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \ -+ "continue to $func" -+ } -+} -+ -+# Escape expect-reserved characters in the string -+proc escape {string} { -+ regsub -all {\*} $string {\*} string -+ regsub -all {\(} $string {\(} string -+ regsub -all {\)} $string {\)} string -+ regsub -all {\]} $string {\]} string -+ regsub -all {\[} $string {\[} string -+ regsub -all {\+} $string {\+} string -+ regsub -all {\^} $string {\^} string -+ regsub -all {\!} $string {\!} string -+ return $string -+} -+ -+# Add a function to the list of tested functions -+# FUNC is the name of the function (which will be passed to gdb commands) -+# TYPE is the type of the function, as expected from the "print" command -+# PRINT is the name of the function, as expected result of the print command -+# *OR* "-", indicating that FUNC should be used (needed for virtual/inherited -+# funcs) -+# LST is either the expected result of the list command (the comment from -+# the source code) *OR* "-", in which case FUNC will be used -+# INF is the expected result of "info func" -+# -+# If any of PRINT, LST, or INF is "", the test will be skipped -+# -+# Usage: -+# add NAME TYPE PRINT LST INFO -+# add NAME TYPE PRINT - INFO -+proc add {func type print lst inf} { -+ global all_functions CONVAR ADDR -+ -+ set all_functions($func,type) $type -+ if {$print == "-"} { -+ set print $func -+ } -+ -+ # An exception: since gdb canonicalizes C++ output, -+ # "(void)" must be mutated to "()". -+ set print [regsub {\(void\)} $print {()}] -+ -+ set all_functions($func,print) \ -+ "$CONVAR = {[escape $type]} $ADDR <[escape $print].*>" -+ if {$lst == "-"} { -+ set lst "$func" -+ } -+ set all_functions($func,list) ".*// [escape $lst]" -+ set all_functions($func,info_func) $inf -+} -+ -+proc get {func cmd} { -+ global all_functions -+ return $all_functions($func,$cmd) -+} -+ -+# Returns a list of function names for a given command -+proc get_functions {cmd} { -+ global all_functions -+ set result {} -+ foreach i [array names all_functions *,$cmd] { -+ if {$all_functions($i) != ""} { -+ set idx [string last , $i] -+ if {$idx != -1} { -+ lappend result [string range $i 0 [expr {$idx - 1}]] -+ } -+ } -+ } -+ -+ return [lsort $result] -+} -+ -+# Some convenience variables for this test -+set DEC {[0-9]}; # a decimal number -+set HEX {[0-9a-fA-F]}; # a hexidecimal number -+set CONVAR "\\\$$DEC+"; # convenience variable regexp -+set ADDR "0x$HEX+"; # address -+ -+# An array of functions/methods that we are testing... -+# Each element consists is indexed by NAME,COMMAND, where -+# NAME is the function name and COMMAND is the gdb command that -+# we are testing. The value of the array for any index pair is -+# the expected result of running COMMAND with the NAME as argument. -+# If the value is blank, the test will be skipped for the given function. -+ -+# The array holding all functions/methods to test. Valid subindexes -+# are (none need character escaping -- "add" will take care of that): -+ -+# add name type print_name list info_func -+# NAME,type: value is type of function -+# NAME,print: value is print name of function (careful w/inherited/virtual!) -+# NAME,list: value is comment in source code on first line of function -+# (without the leading "//") -+# NAME,info_func: value is the expected result of "info func" -+array set all_functions {} -+ -+# "Normal" functions/methods -+add {main} \ -+ {int (int, char **)} \ -+ - \ -+ - \ -+ {int main(int, char **);} -+add {derived::a_function} \ -+ {void (const derived * const)} \ -+ - \ -+ - \ -+ {void derived::a_function();} -+add {base1::a_function} \ -+ {void (const base1 * const)} \ -+ - \ -+ - \ -+ {void base1::a_function();} -+add {base2::a_function} \ -+ {void (const base2 * const)} \ -+ - \ -+ - \ -+ {void base2::a_function();} -+ -+# Constructors -+add {derived::derived} \ -+ {void (derived * const)} \ -+ - \ -+ - \ -+ {void derived::derived();} -+add {base1::base1(void)} \ -+ {void (base1 * const, const void ** const)} \ -+ - \ -+ - \ -+ {void base1::base1();} -+add {base1::base1(int)} \ -+ {void (base1 * const, int)} \ -+ - \ -+ - \ -+ {void base1::base1(int);} -+add {base2::base2} \ -+ {void (base2 * const, const void ** const)} \ -+ - \ -+ - \ -+ {void base2::base2();} -+add {base::base(void)} \ -+ {void (base * const)} \ -+ - \ -+ - \ -+ {void base::base();} -+add {base::base(int)} \ -+ {void (base * const, int)} \ -+ - \ -+ - \ -+ {void base::base();} -+ -+# Destructors -+add {base::~base} \ -+ {void (base * const)} \ -+ - \ -+ - \ -+ {void base::~base();} -+ -+# Overloaded methods (all are const -- we try to use the void -+# method with and without specifying "const") -+add {base::overload(void)} \ -+ {int (const base * const)} \ -+ - \ -+ {base::overload(void) const} \ -+ {int base::overload() const;} -+add {base::overload(void) const} \ -+ {int (const base * const)} \ -+ - \ -+ {base::overload(void) const} \ -+ {int base::overload() const;} -+add {base::overload(int) const} \ -+ {int (const base * const, int)} \ -+ - \ -+ - \ -+ {int base::overload(int) const;} -+add {base::overload(short) const} \ -+ {int (const base * const, short)} \ -+ - \ -+ - \ -+ {int base::overload(short) const;} -+add {base::overload(long) const} \ -+ {int (const base * const, long)} \ -+ - \ -+ - \ -+ {int base::overload(long) const;} -+add {base::overload(char*) const} \ -+ {int (const base * const, char *)} \ -+ - \ -+ - \ -+ {int base::overload(char *) const;} -+add {base::overload(base&) const} \ -+ {int (const base * const, base &)} \ -+ - \ -+ - \ -+ {int base::overload(base &) const;} -+ -+# Operators -+add {base::operator+} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator++} \ -+ {base (base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator+=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator-} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator--} \ -+ {base (base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator-=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator*} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator*=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator/} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator/=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator%} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator%=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator<} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator<=} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator>} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator>=} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator!=} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator==} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator!} \ -+ {bool (const base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator&&} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator||} \ -+ {bool (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator<<} \ -+ {int (const base * const, int)} \ -+ - \ -+ - \ -+ - -+add {base::operator<<=} \ -+ {base (base * const, int)} \ -+ - \ -+ - \ -+ - -+add {base::operator>>} \ -+ {int (const base * const, int)} \ -+ - \ -+ - \ -+ - -+add {base::operator>>=} \ -+ {base (base * const, int)} \ -+ - \ -+ - \ -+ - -+add {base::operator~} \ -+ {int (const base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator&} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator&=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator|} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator|=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator^} \ -+ {int (const base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator^=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator=} \ -+ {base (base * const, const base &)} \ -+ - \ -+ - \ -+ - -+add {base::operator()} \ -+ {void (const base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator[]} \ -+ {int (const base * const, int)} \ -+ - \ -+ - \ -+ - -+add {base::operator new} \ -+ {void *(size_t)} \ -+ - \ -+ - \ -+ - -+add {base::operator delete} \ -+ {void (void *)} \ -+ - \ -+ - \ -+ - -+add {base::operator new[]} \ -+ {void *(size_t)} \ -+ - \ -+ - \ -+ - -+add {base::operator delete[]} \ -+ {void (void *)} \ -+ - \ -+ - \ -+ - -+add {base::operator char*} \ -+ {char *(const base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator fluff*} \ -+ {fluff *(const base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator fluff**} \ -+ {fluff **(const base * const)} \ -+ - \ -+ - \ -+ - -+add {base::operator int} \ -+ {int (const base * const)} \ -+ - \ -+ - \ -+ - -+ -+# Templates -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ - \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {flubber} \ -+ {void (void)} \ -+ - \ -+ flubber \ -+ - -+add {tclass::do_something} \ -+ {void (tclass * const)} \ -+ - \ -+ {tclass::do_something} \ -+ - -+add {policy1::policy} \ -+ {void (policy > * const, int)} \ -+ {policy >::policy} \ -+ {policy::policy} \ -+ - -+add {policy2::policy} \ -+ {void (policy > * const, int)} \ -+ {policy >::policy} \ -+ {policy::policy} \ -+ - -+add {policy3::policy} \ -+ {void (policy > * const, int)} \ -+ {policy >::policy} \ -+ {policy::policy} \ -+ - -+add {policy4::policy} \ -+ {void (policy > * const, int)} \ -+ {policy >::policy} \ -+ {policy::policy} \ -+ - -+add {policy1::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} \ -+ - -+add {policy2::function} \ -+ {void (void)} \ -+ {operation_2::function} \ -+ {operation_2::function} \ -+ - -+add {policy3::function} \ -+ {void (void)} \ -+ {operation_3::function} \ -+ {operation_3::function} \ -+ - -+add {policy4::function} \ -+ {void (void)} \ -+ {operation_4::function} \ -+ {operation_4::function} \ -+ - -+add {policyd >::policyd} \ -+ {void (policyd > * const, int)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd1::policyd} \ -+ {void (policyd > * const, int)} \ -+ {policyd >::policyd} \ -+ {policyd::policyd} \ -+ - -+add {policyd >::~policyd} \ -+ {void (policyd > * const)} \ -+ - \ -+ {policyd::~policyd} \ -+ - -+add {policyd1::~policyd} \ -+ {void (policyd > * const)} \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} \ -+ - -+add {policyd >::policyd} \ -+ {void (policyd > * const, long)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd2::policyd} \ -+ {void (policyd > * const, long)} \ -+ {policyd >::policyd} \ -+ {policyd::policyd} \ -+ - -+add {policyd >::~policyd} \ -+ {void (policyd > * const)} \ -+ - \ -+ {policyd::~policyd} \ -+ - -+add {policyd2::~policyd} \ -+ {void (policyd > * const)} \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} \ -+ - -+add {policyd >::policyd} \ -+ {void (policyd > * const, char)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd3::policyd} \ -+ {void (policyd > * const, char)} \ -+ {policyd >::policyd} \ -+ {policyd::policyd} \ -+ - -+add {policyd >::~policyd} \ -+ {void (policyd > * const)} \ -+ - \ -+ {policyd::~policyd} \ -+ - -+add {policyd3::~policyd} \ -+ {void (policyd > * const)} \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} \ -+ - -+add {policyd >::policyd} \ -+ {void (policyd > * const, base)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd4::policyd} \ -+ {void (policyd > * const, base)} \ -+ {policyd >::policyd} \ -+ {policyd::policyd} \ -+ - -+add {policyd >::~policyd} \ -+ {void (policyd > * const)} \ -+ - \ -+ {policyd::~policyd} \ -+ - -+add {policyd4::~policyd} \ -+ {void (policyd > * const)} \ -+ {policyd >::~policyd} \ -+ {policyd::~policyd} \ -+ - -+add {policyd, operation_1 > >::policyd} \ -+ {void (policyd, operation_1 > > * const, tclass)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd5::policyd} \ -+ {void (policyd, operation_1 > > * const, tclass)} \ -+ {policyd, operation_1 > >::policyd} \ -+ {policyd::policyd} \ -+ - -+add {policyd, operation_1 > >::~policyd} \ -+ {void (policyd, operation_1 > > * const)} \ -+ - \ -+ {policyd::~policyd} \ -+ - -+add {policyd5::~policyd} \ -+ {void (policyd, operation_1 > > * const)} \ -+ {policyd, operation_1 > >::~policyd} \ -+ {policyd::~policyd} \ -+ - -+add {policyd >::function} \ -+ {void (void)} \ -+ {operation_1::function}\ -+ {operation_1::function} \ -+ - -+add {policyd1::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} \ -+ - -+add {policyd2::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} \ -+ - -+add {policyd >::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} \ -+ - -+add {policyd3::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} \ -+ - -+add {policyd >::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} \ -+ - -+add {policyd4::function} \ -+ {void (void)} \ -+ {operation_1::function} \ -+ {operation_1::function} \ -+ - -+add {policyd, operation_1 > >::function} \ -+ {void (void)} \ -+ {operation_1 >::function} \ -+ {operation_1::function} \ -+ - -+add {policyd5::function} \ -+ {void (void)} \ -+ {operation_1 >::function} \ -+ {operation_1::function} \ -+ - -+# The below test default template arguments -+add {policyd::policyd} \ -+ {void (policyd > * const, int)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd::policyd} \ -+ {void (policyd > * const, long)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd::policyd} \ -+ {void (policyd > * const, char)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd::policyd} \ -+ {void (policyd > * const, base)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+add {policyd >::policyd} \ -+ {void (policyd >, operation_1 > > * const, int)} \ -+ - \ -+ {policyd::policyd} \ -+ - -+ -+# Start the test -+if {$tracelevel} { -+ strace $tracelevel -+} -+ -+if {[skip_cplus_tests]} { continue } -+ -+# -+# test running programs -+# -+set prms_id 0 -+set bug_id 0 -+ -+set testfile "realcpp" -+set srcfile "${testfile}.cc" -+set binfile [file join $objdir $subdir $testfile] -+ -+if {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \ -+ executable {debug c++}] != "" } { -+ untested "$testfile.exp" -+ return -1 -+} -+ -+if {[get_compiler_info $binfile "c++"]} { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir [file join $srcdir $subdir] -+gdb_load $binfile -+ -+# Set the listsize to one. This will help with testing "list". -+gdb_test "set listsize 1" -+ -+# "print METHOD" -+foreach name [get_functions print] { -+ gdb_test "print $name" [get $name print] "print $name" -+} -+ -+# "list METHOD" -+foreach name [get_functions list] { -+ gdb_test "list $name" [get $name list] "list $name" -+} -+ -+# Running to breakpoint -- use any function we can "list" -+foreach name [get_functions list] { -+ # Skip "main", since test_breakpoint uses it -+ if {[string compare $name "main"] != 0} { -+ test_breakpoint $name -+ } -+} -+ -+# "info func METHOD" -+if {false} { -+foreach name [get_functions "info_func"] { -+ regsub -all {\*} $name {\*} n -+ regsub -all {\^} $n {\^} n -+ regsub -all {\]} $n {\]} n -+ regsub -all {\[} $n {\[} n -+ gdb_test "info func $n" [get $name info_func] "info func $name" -+} -+} -+ -+# What of these is not covered by above? -+# operator-specific tests ('p a + b', 'print cout << "hello"', etc) -+# overloaded operators & ctors -+# operator names with spaces in them (other than delete and new) -+# ptype of classes/templates -+# backtraces -+# printing data members -+# catching, throwing exceptions -+# STL (esp containers and iterators) -+# inheritance tests -+# completion scoping -+ -+gdb_exit -+return 0 -diff --git a/gdb/testsuite/gdb.cp/shadow.exp b/gdb/testsuite/gdb.cp/shadow.exp -index 1e5e80b..40c35a4 100644 ---- a/gdb/testsuite/gdb.cp/shadow.exp -+++ b/gdb/testsuite/gdb.cp/shadow.exp -@@ -85,5 +85,4 @@ gdb_test "print x" "= 55" "Print local x not namespace x" - gdb_breakpoint [gdb_get_line_number "marker5"] - gdb_continue_to_breakpoint "marker5" - --setup_kfail "gdb/7936" "*-*-*" - gdb_test "print x" "= 11" "Print imported namespace x" -diff --git a/gdb/testsuite/gdb.cp/shadowing.cc b/gdb/testsuite/gdb.cp/shadowing.cc -new file mode 100644 -index 0000000..6d9c2f1 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/shadowing.cc -@@ -0,0 +1,48 @@ -+namespace A -+{ -+ int x = 11; -+} -+ -+int x = 22; -+int y = 0; -+ -+class B -+{ -+public: -+ int x; -+ -+ int -+ func() -+ { -+ x = 33; -+ y+=x; // marker1 -+ -+ { -+ int x = 44; -+ y+=x; // marker2 -+ -+ { -+ int x = 55; -+ y+=x; // marker3 -+ -+ { -+ int z = x; //prevent gcc from optimizing away this scope -+ using namespace A; -+ y+=x; // marker4 -+ -+ using A::x; -+ y+=x; // marker5 -+ -+ return this->x; -+ } -+ } -+ } -+ } -+}; -+ -+int -+main() -+{ -+ B theB; -+ return theB.func(); -+} -diff --git a/gdb/testsuite/gdb.cp/shadowing.exp b/gdb/testsuite/gdb.cp/shadowing.exp -new file mode 100644 -index 0000000..6922eed ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/shadowing.exp -@@ -0,0 +1,91 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+set testfile shadowing -+set srcfile ${testfile}.cc -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+############################################ -+# Test printing of class variable is not shadowed -+# by global variable -+ -+gdb_breakpoint [gdb_get_line_number "marker1"] -+gdb_continue_to_breakpoint "marker1" -+ -+gdb_test "print x" "= 33" "Print class x shadowing global x" -+ -+ -+############################################ -+# Test printing local variable is not shadowed -+# by class variable -+ -+gdb_breakpoint [gdb_get_line_number "marker2"] -+gdb_continue_to_breakpoint "marker2" -+ -+gdb_test "print x" "= 44" "Print local x shadowing class x" -+ -+############################################ -+# Test inner scope x is printed not outer scope -+ -+gdb_breakpoint [gdb_get_line_number "marker3"] -+gdb_continue_to_breakpoint "marker3" -+ -+gdb_test "print x" "= 55" "Print inner scope x" -+ -+############################################ -+# Test printing local variable is not shadowed -+# by namespace variable -+ -+gdb_breakpoint [gdb_get_line_number "marker4"] -+gdb_continue_to_breakpoint "marker4" -+ -+gdb_test "print x" "= 55" "Print local x not namespace x" -+ -+############################################ -+# Test imported namespace element is printed -+ -+gdb_breakpoint [gdb_get_line_number "marker5"] -+gdb_continue_to_breakpoint "marker5" -+ -+if [test_compiler_info gcc-4-3-*] then { setup_xfail *-*-* } -+ -+gdb_test "print x" "= 11" "Print imported namespace x" -diff --git a/gdb/testsuite/gdb.cp/userdef.cc b/gdb/testsuite/gdb.cp/userdef.cc -index 338c58a..56a735f 100644 ---- a/gdb/testsuite/gdb.cp/userdef.cc -+++ b/gdb/testsuite/gdb.cp/userdef.cc -@@ -311,6 +311,11 @@ public: - int z; - }; - -+bool operator== (const Member &m1, const Member &m2) -+{ -+ return m1.z == m2.z; -+} -+ - class Container - { - public: -@@ -330,8 +335,12 @@ int main (void) - A1 two(4,5); - A1 three(0,0); - Container c; -+ Member mem1, mem2; - int val; - -+ mem1.z = 5; -+ mem2.z = 7; -+ - marker1(); // marker1-returns-here - cout << one; // marker1-returns-here - cout << two; -diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp -index 2bbf95e..25cade7 100644 ---- a/gdb/testsuite/gdb.cp/userdef.exp -+++ b/gdb/testsuite/gdb.cp/userdef.exp -@@ -113,6 +113,7 @@ gdb_test "print one > two" "\\\$\[0-9\]* = 0\[\r\n\]" - gdb_test "print one >= two" "\\\$\[0-9\]* = 0\[\r\n\]" - - gdb_test "print one == two" "\\\$\[0-9\]* = 0\[\r\n\]" -+gdb_test "print one.operator== (two)" "\\\$\[0-9\]* = 0\[\r\n\]" - - gdb_test "print one != two" "\\\$\[0-9\]* = 1\[\r\n\]" - -@@ -155,5 +156,8 @@ 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 "print operator== (mem1, mem2)" " = false" -+gdb_test "print operator== (mem1, mem1)" " = true" -+ - gdb_exit - return 0 -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S -new file mode 100644 -index 0000000..d5b9ca5 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S -@@ -0,0 +1,140 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Test .debug_aranges containing zero address_size. */ -+ -+/* Dummy function to provide debug information for. */ -+ -+ .text -+.Lbegin_text1: -+ .globl main -+ .type main, %function -+main: -+.Lbegin_main: -+ .int 0 -+.Lend_main: -+ .size main, .-main -+.Lend_text1: -+ -+/* Debug information */ -+ -+ .section .debug_info -+.Lcu1_begin: -+ /* CU header */ -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .4byte .Lend_text1 /* DW_AT_high_pc */ -+ .4byte .Lbegin_text1 /* DW_AT_low_pc */ -+ .ascii "file1.txt\0" /* DW_AT_name */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 1 /* DW_AT_language (C) */ -+ -+ /* main */ -+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */ -+ .byte 1 /* DW_AT_external */ -+ .byte 1 /* DW_AT_decl_file */ -+ .byte 2 /* DW_AT_decl_line */ -+ .ascii "main\0" /* DW_AT_name */ -+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */ -+ .4byte .Lbegin_main /* DW_AT_low_pc */ -+ .4byte .Lend_main /* DW_AT_high_pc */ -+ .byte 1 /* DW_AT_frame_base: length */ -+ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */ -+ -+.Ltype_int: -+ .uleb128 3 /* Abbrev: DW_TAG_base_type */ -+ .ascii "int\0" /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ .byte 5 /* DW_AT_encoding */ -+ -+ .byte 0 /* End of children of CU */ -+ -+.Lcu1_end: -+ -+/* Abbrev table */ -+ .section .debug_abbrev -+.Labbrev1_begin: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3a /* DW_AT_decl_file */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3b /* DW_AT_decl_line */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x40 /* DW_AT_frame_base */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+/* aranges table */ -+ .section .debug_aranges -+ .long .Laranges_end - 1f -+1: -+ .2byte 2 /* aranges Version */ -+ .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */ -+ /* The GDB crasher is this zero value. */ -+ .byte 0 /* aranges address_size */ -+ .byte 0 /* aranges segment_size */ -+ -+.Laranges_end: -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp -new file mode 100644 -index 0000000..39632d5 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp -@@ -0,0 +1,40 @@ -+# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Test .debug_aranges containing zero address_size. -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-aranges" -+set srcfile ${testfile}.S -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } { -+ return -1 -+} -+ -+clean_restart $testfile -+ -+# Failed gdb_load would abort the testcase execution earlier. -+pass "file loaded" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S new file mode 100644 -index 0000000..9353698 +index 0000000..7fb00ea --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -@@ -0,0 +1,176 @@ +@@ -0,0 +1,212 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. @@ -25164,6 +8329,17 @@ index 0000000..9353698 + .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 */ @@ -25182,9 +8358,24 @@ index 0000000..9353698 + .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 /* */ ++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 /* */ @@ -25277,6 +8468,16 @@ index 0000000..9353698 + .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 */ @@ -25289,10 +8490,10 @@ index 0000000..9353698 + .string "unsigned int" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp new file mode 100644 -index 0000000..28db005 +index 0000000..5dbed3f --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -@@ -0,0 +1,48 @@ +@@ -0,0 +1,51 @@ +# Copyright 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -25341,169 +8542,9 @@ index 0000000..28db005 + +gdb_test "p a_string" { = "seen"} +gdb_test "ptype a_string" {type = char \[4\]} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S -new file mode 100644 -index 0000000..7b03ff1 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S -@@ -0,0 +1,108 @@ -+/* This testcase is part of GDB, the GNU debugger. + -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::". */ -+ -+ .data -+var: .4byte 1 -+ -+ .section .debug_info -+.Lcu1_begin: -+ /* CU header */ -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "file1.txt\0" /* DW_AT_name */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 4 /* DW_LANG_C_plus_plus (C++) */ -+ -+.Ltype_int: -+ .uleb128 2 /* Abbrev: DW_TAG_base_type */ -+ .ascii "int\0" /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ .byte 5 /* DW_AT_encoding */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_namespace */ -+ .ascii "::\0" /* DW_AT_name */ -+ -+ .uleb128 7 /* Abbrev: DW_TAG_variable (location) */ -+ .ascii "var\0" /* DW_AT_name */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte var /* */ -+2: .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */ -+ -+ .byte 0 /* End of children of DW_TAG_namespace */ -+ -+ .byte 0 /* End of children of CU */ -+ -+.Lcu1_end: -+ -+/* Abbrev table */ -+ .section .debug_abbrev -+.Labbrev1_begin: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x39 /* DW_TAG_namespace */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 7 /* Abbrev code (location) */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp -new file mode 100644 -index 0000000..1a8da16 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp -@@ -0,0 +1,43 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::". -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-empty-namespace" -+set srcfile ${testfile}.S -+set executable ${testfile}.x -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } { -+ return -1 -+} -+ -+clean_restart $executable -+ -+# `p var' below can work without identified DWARF DIE just based on its ELF symbol. -+# Catch it here as `type = '. -+gdb_test "ptype var" "type = int" -+ -+gdb_test "p var" " = 1" ++gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"} ++gdb_test "ptype b_string" {type = char \[\]} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c new file mode 100644 index 0000000..1f02d90 @@ -26118,232 +9159,6 @@ index 0000000..0f43564 + if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort + if (x (3, 1) .ne. 10) call abort +end -diff --git a/gdb/testsuite/gdb.fortran/library-module-lib.f90 b/gdb/testsuite/gdb.fortran/library-module-lib.f90 -new file mode 100644 -index 0000000..6369d34 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/library-module-lib.f90 -@@ -0,0 +1,28 @@ -+! Copyright 2009 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 3 of the License, or -+! (at your option) any later version. -+! -+! This program is distributed in the hope that it will be useful, -+! but WITHOUT ANY WARRANTY; without even the implied warranty of -+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+! GNU General Public License for more details. -+! -+! You should have received a copy of the GNU General Public License -+! along with this program. If not, see . -+ -+module lib -+ integer :: var_i = 1 -+contains -+ subroutine lib_func -+ if (var_i .ne. 1) call abort -+ var_i = 2 -+ end subroutine lib_func -+end module lib -+ -+module libmany -+ integer :: var_j = 3 -+ integer :: var_k = 4 -+end module libmany -diff --git a/gdb/testsuite/gdb.fortran/library-module-main.f90 b/gdb/testsuite/gdb.fortran/library-module-main.f90 -new file mode 100644 -index 0000000..de63a65 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/library-module-main.f90 -@@ -0,0 +1,23 @@ -+! Copyright 2009 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 3 of the License, or -+! (at your option) any later version. -+! -+! This program is distributed in the hope that it will be useful, -+! but WITHOUT ANY WARRANTY; without even the implied warranty of -+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+! GNU General Public License for more details. -+! -+! You should have received a copy of the GNU General Public License -+! along with this program. If not, see . -+ -+ use lib -+ use libmany, only: var_j -+ if (var_i .ne. 1) call abort -+ call lib_func -+ if (var_i .ne. 2) call abort -+ if (var_j .ne. 3) call abort -+ var_i = var_i ! i-is-2 -+end -diff --git a/gdb/testsuite/gdb.fortran/library-module.exp b/gdb/testsuite/gdb.fortran/library-module.exp -new file mode 100644 -index 0000000..4b4ea4c ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/library-module.exp -@@ -0,0 +1,53 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile "library-module" -+set srcfile ${testfile}-main.f90 -+set srclibfile ${testfile}-lib.f90 -+set libfile ${testfile}-lib.so -+set binfile ${testfile} -+ -+# Required for -fPIC by gdb_compile_shlib. -+if [get_compiler_info not-used] { -+ warning "Could not get compiler info" -+ return -1 -+} -+ -+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}] != "" } { -+ untested "Couldn't compile ${srclibfile}" -+ return -1 -+} -+ -+# prepare_for_testing cannot be used as linking with $libfile cannot be passed -+# just for the linking phase (and not the source compilation phase). And any -+# warnings on ignored $libfile abort the process. -+ -+if { [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} -+ -+clean_restart $binfile -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_breakpoint [gdb_get_line_number "i-is-2"] -+gdb_continue_to_breakpoint "i-is-2" ".*i-is-2.*" -+gdb_test "print var_i" " = 2" -+gdb_test "print var_j" " = 3" -+gdb_test "print var_k" "No symbol \"var_k\" in current context\\." -diff --git a/gdb/testsuite/gdb.fortran/module.exp b/gdb/testsuite/gdb.fortran/module.exp -index 0acce4f..5e1034f 100644 ---- a/gdb/testsuite/gdb.fortran/module.exp -+++ b/gdb/testsuite/gdb.fortran/module.exp -@@ -15,21 +15,41 @@ - - set testfile "module" - 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}" -+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } { - 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_test "print i" " = 42" -+# Do not use simple single-letter names as GDB would pick up for expectedly -+# nonexisting symbols some static variables from system libraries debuginfos. -+ -+gdb_breakpoint [gdb_get_line_number "i-is-1"] -+gdb_continue_to_breakpoint "i-is-1" ".*i-is-1.*" -+gdb_test "print var_i" " = 1" "print var_i value 1" -+ -+gdb_breakpoint [gdb_get_line_number "i-is-2"] -+gdb_continue_to_breakpoint "i-is-2" ".*i-is-2.*" -+gdb_test "print var_i" " = 2" "print var_i value 2" -+ -+gdb_breakpoint [gdb_get_line_number "a-b-c-d"] -+gdb_continue_to_breakpoint "a-b-c-d" ".*a-b-c-d.*" -+gdb_test "print var_a" "No symbol \"var_a\" in current context\\." -+gdb_test "print var_b" " = 11" -+gdb_test "print var_c" "No symbol \"var_c\" in current context\\." -+gdb_test "print var_d" " = 12" -+gdb_test "print var_i" " = 14" "print var_i value 14" -+ -+# Breakpoint would work in language "c". -+gdb_test "show language" {The current source language is "(auto; currently )?fortran".} -+ -+# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above -+# works. But DWARF DW_TAG_subprogram contains the name specified by -+# the "program" Fortran statement. -+if [gdb_breakpoint "module"] { -+ pass "setting breakpoint at module" -+} -diff --git a/gdb/testsuite/gdb.fortran/module.f90 b/gdb/testsuite/gdb.fortran/module.f90 -index 81ef376..a8428cb 100644 ---- a/gdb/testsuite/gdb.fortran/module.f90 -+++ b/gdb/testsuite/gdb.fortran/module.f90 -@@ -13,10 +13,39 @@ - ! You should have received a copy of the GNU General Public License - ! along with this program. If not, see . - --module mod -- integer :: i = 42 --end module mod -+module mod1 -+ integer :: var_i = 1 -+end module mod1 - -- use mod -- print *, i -+module mod2 -+ integer :: var_i = 2 -+end module mod2 -+ -+module modmany -+ integer :: var_a = 10, var_b = 11, var_c = 12, var_i = 14 -+end module modmany -+ -+ subroutine sub1 -+ use mod1 -+ if (var_i .ne. 1) call abort -+ var_i = var_i ! i-is-1 -+ end -+ -+ subroutine sub2 -+ use mod2 -+ if (var_i .ne. 2) call abort -+ var_i = var_i ! i-is-2 -+ end -+ -+ program module -+ -+ use modmany, only: var_b, var_d => var_c, var_i -+ -+ call sub1 -+ call sub2 -+ -+ if (var_b .ne. 11) call abort -+ if (var_d .ne. 12) call abort -+ if (var_i .ne. 14) call abort -+ var_b = var_b ! a-b-c-d - end diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp new file mode 100644 index 0000000..b1120c3 @@ -26452,64 +9267,12 @@ index 0000000..226dc5d + h = 'h' + call foo (g, h) +end -diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index 9e787f0..5ca15d5 100644 ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -95,6 +95,10 @@ proc do_steps_and_nexts {} { - set description "step over ttyarg initialization" - set command "step" - } -+ -re ".*python_script = 0.*$gdb_prompt $" { -+ set description "step over python_script initialization" -+ set command "step" -+ } - -re ".*time_at_startup = get_run_time.*$gdb_prompt $" { - set description "next over get_run_time and everything it calls" - set command "next" -diff --git a/gdb/testsuite/gdb.java/jmain.exp b/gdb/testsuite/gdb.java/jmain.exp -index ab95247..9814921 100644 ---- a/gdb/testsuite/gdb.java/jmain.exp -+++ b/gdb/testsuite/gdb.java/jmain.exp -@@ -65,7 +65,7 @@ gdb_test "break jmain.main" "${bpmain}" - - # Check that a fully qualified "main" works. - gdb_load "${binfile}" --set cmd "break \'${testfile}.main(java.lang.String\[\])\'" -+set cmd "break ${testfile}.main(java.lang.String\[\])" - set msg $cmd - gdb_test_multiple $cmd $msg { - -re "${bpmain}\r\n$gdb_prompt $" { -@@ -79,7 +79,7 @@ gdb_test_multiple $cmd $msg { - gdb_test "n" "" "" - - # Check again with a method signature at the end. -- set cmd "break \'${testfile}.main(java.lang.String\[\])void\'" -+ set cmd "break ${testfile}.main(java.lang.String\[\])void" - set msg $cmd - gdb_test_multiple $cmd $msg { - -re "${bpmain}\r\n$gdb_prompt $" { -diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp -index 6f7188d..e3ab657 100644 ---- a/gdb/testsuite/gdb.java/jmisc.exp -+++ b/gdb/testsuite/gdb.java/jmisc.exp -@@ -71,8 +71,8 @@ if ![set_lang_java] then { - # signature. - runto_main - set function "${testfile}.main(java.lang.String\[\])" -- gdb_breakpoint "\'$function\'" { allow-pending } -- gdb_breakpoint "\'${function}void\'" { allow-pending } -+ gdb_breakpoint "$function" { allow-pending } -+ gdb_breakpoint "${function}void" { allow-pending } - gdb_continue_to_breakpoint $function - - send_gdb "ptype jmisc\n" diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp new file mode 100644 -index 0000000..e71391e +index 0000000..55aa80d --- /dev/null +++ b/gdb/testsuite/gdb.java/jnpe.exp -@@ -0,0 +1,77 @@ +@@ -0,0 +1,74 @@ +# Copyright 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -26539,9 +9302,6 @@ index 0000000..e71391e + return -1 +} + -+set prms_id 0 -+set bug_id 0 -+ +# Start with a fresh gdb. + +gdb_exit @@ -26631,21 +9391,6 @@ index 0000000..3524830 + } + } +} -diff --git a/gdb/testsuite/gdb.java/jprint.exp b/gdb/testsuite/gdb.java/jprint.exp -index 29dbf4b..447ca73 100644 ---- a/gdb/testsuite/gdb.java/jprint.exp -+++ b/gdb/testsuite/gdb.java/jprint.exp -@@ -70,8 +70,8 @@ if ![set_lang_java] then { - # signature. - runto_main - set function "${testfile}.main(java.lang.String\[\])" -- gdb_breakpoint "\'$function\'" { allow-pending } -- gdb_breakpoint "\'${function}void\'" { allow-pending } -+ gdb_breakpoint "$function" { allow-pending } -+ gdb_breakpoint "${function}void" { allow-pending } - gdb_continue_to_breakpoint $function - - gdb_test "p jvclass.addprint(4,5,6)" "sum is 15\r\n.*" "unambiguous static call" diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c new file mode 100644 index 0000000..729f457 @@ -26828,247 +9573,14 @@ index 0000000..e48d520 + program main + call f ('foo') + end -diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp -index 2a3ed0d..ff5de33 100644 ---- a/gdb/testsuite/gdb.python/py-cmd.exp -+++ b/gdb/testsuite/gdb.python/py-cmd.exp -@@ -20,36 +20,15 @@ if $tracelevel then { - strace $tracelevel - } - --# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}... --# Run a test named NAME, consisting of multiple lines of input. --# After each input line INPUT, search for result line RESULT. --# Succeed if all results are seen; fail otherwise. --proc gdb_py_test_multiple {name args} { -- global gdb_prompt -- foreach {input result} $args { -- if {[gdb_test_multiple $input "$name - $input" { -- -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" { -- pass "$name - $input" -- } -- }]} { -- return 1 -- } -- } -- return 0 --} -- - # Start with a fresh gdb. - - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - --gdb_test_multiple "python print 'hello, world!'" "verify python support" { -- -re "not supported.*$gdb_prompt $" { -- unsupported "python support is disabled" -- return -1 -- } -- -re "$gdb_prompt $" {} -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 - } - - # Test a simple command. -diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp -index 86fe660..4c7295f 100644 ---- a/gdb/testsuite/gdb.python/py-frame.exp -+++ b/gdb/testsuite/gdb.python/py-frame.exp -@@ -20,40 +20,28 @@ if $tracelevel then { - strace $tracelevel - } - -+# Start with a fresh gdb. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 -+} -+ - set testfile "py-frame" - set srcfile ${testfile}.c - set binfile ${objdir}/${subdir}/${testfile} -+ - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested "Couldn't compile ${srcfile}" - return -1 - } - --# Run a command in GDB, and report a failure if a Python exception is thrown. --# If report_pass is true, report a pass if no exception is thrown. --proc gdb_py_test_silent_cmd {cmd name report_pass} { -- global gdb_prompt -- -- gdb_test_multiple $cmd $name { -- -re "Traceback.*$gdb_prompt $" { fail $name } -- -re "$gdb_prompt $" { if $report_pass { pass $name } } -- } --} -- --# Start with a fresh gdb. -- --gdb_exit --gdb_start --gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - --gdb_test_multiple "python print 'hello, world!'" "verify python support" { -- -re "not supported.*$gdb_prompt $" { -- unsupported "python support is disabled" -- return -1 -- } -- -re "$gdb_prompt $" {} --} -- - # The following tests require execution. - - if ![runto_main] then { -@@ -65,19 +53,20 @@ gdb_breakpoint "f2" - gdb_continue_to_breakpoint "breakpoint at f2" - gdb_test "up" "" "" - --gdb_py_test_silent_cmd "python f1 = gdb.selected_frame ()" "get second frame" 0 --gdb_py_test_silent_cmd "python f0 = f1.newer ()" "get first frame" 0 -+gdb_py_test_silent_cmd "python frames = gdb.selected_thread ().frames ()" "get frames list" 1 -+gdb_test "python print frames" "\\(, , \\)" "verify frames list" -+gdb_py_test_silent_cmd "python f0 = frames\[0\]" "get first frame" 0 -+gdb_py_test_silent_cmd "python f1 = frames\[1\]" "get second frame" 0 - - gdb_test "python print 'result =', f0 == f1" " = False" "test equality comparison (false)" - gdb_test "python print 'result =', f0 == f0" " = True" "test equality comparison (true)" --gdb_test "python print 'result =', f0 != f1" " = True" "test inequality comparison (true)" --gdb_test "python print 'result =', f0 != f0" " = False" "test inequality comparison (false)" - gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_valid" - gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name" - gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type" - gdb_test "python print 'result =', f0.unwind_stop_reason () == gdb.FRAME_UNWIND_NO_REASON" " = True" "test Frame.type" - gdb_test "python print 'result =', gdb.frame_stop_reason_string (gdb.FRAME_UNWIND_INNER_ID)" " = previous frame inner to this frame \\(corrupt stack\\?\\)" "test gdb.frame_stop_reason_string" - gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc" -+gdb_test "python print 'result =', f0.function ()" " = symbol for f2" "test Frame.function" - gdb_test "python print 'result =', f0.older () == f1" " = True" "test Frame.older" - gdb_test "python print 'result =', f1.newer () == f0" " = True" "test Frame.newer" - gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_exist')" \ -@@ -85,4 +74,7 @@ gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_ex - "test Frame.read_var - error" - gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success" - -+gdb_test "python print 'result =', gdb.selected_thread ().newest_frame () == f0" " = True" "test gdb.newest_frame" - gdb_test "python print 'result =', gdb.selected_frame () == f1" " = True" "test gdb.selected_frame" -+ -+gdb_test "python print 'result =', f0.block ()" "" "test Frame.block" -diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp -index 461295d..ea33596 100644 ---- a/gdb/testsuite/gdb.python/py-function.exp -+++ b/gdb/testsuite/gdb.python/py-function.exp -@@ -20,36 +20,15 @@ if $tracelevel then { - strace $tracelevel - } - --# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}... --# Run a test named NAME, consisting of multiple lines of input. --# After each input line INPUT, search for result line RESULT. --# Succeed if all results are seen; fail otherwise. --proc gdb_py_test_multiple {name args} { -- global gdb_prompt -- foreach {input result} $args { -- if {[gdb_test_multiple $input "$name - $input" { -- -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" { -- pass "$name - $input" -- } -- }]} { -- return 1 -- } -- } -- return 0 --} -- - # Start with a fresh gdb. - - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir - --gdb_test_multiple "python print 'hello, world!'" "verify python support" { -- -re "not supported.*$gdb_prompt $" { -- unsupported "python support is disabled" -- return -1 -- } -- -re "$gdb_prompt $" {} -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 - } - - gdb_py_test_multiple "input convenience function" \ -diff --git a/gdb/testsuite/gdb.python/py-inferior.c b/gdb/testsuite/gdb.python/py-inferior.c +diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp new file mode 100644 -index 0000000..0b48299 +index 0000000..ccc6e1e --- /dev/null -+++ b/gdb/testsuite/gdb.python/py-inferior.c -@@ -0,0 +1,49 @@ -+#include -+#include -+#include -+#include -+ -+#define CHUNK_SIZE 16000 /* same as findcmd.c's */ -+#define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */ -+ -+static int8_t int8_search_buf[100]; -+static int16_t int16_search_buf[100]; -+static int32_t int32_search_buf[100]; -+static int64_t int64_search_buf[100]; -+ -+static char *search_buf; -+static int search_buf_size; -+ -+static int x; -+ -+ -+int f2 (int a) -+{ -+ char *str = "hello, testsuite"; -+ -+ puts (str); /* Break here. */ -+ -+ return ++a; -+} -+ -+int f1 (int a, int b) -+{ -+ return f2(a) + b; -+} -+ -+static void -+init_bufs () -+{ -+ search_buf_size = BUF_SIZE; -+ search_buf = malloc (search_buf_size); -+ if (search_buf == NULL) -+ exit (1); -+ memset (search_buf, 'x', search_buf_size); -+} -+ -+int main (int argc, char *argv[]) -+{ -+ init_bufs (); -+ -+ return f1 (1, 2); -+} -diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp -new file mode 100644 -index 0000000..719b178 ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-inferior.exp -@@ -0,0 +1,201 @@ -+# Copyright (C) 2009 Free Software Foundation, Inc. -+ ++++ b/gdb/testsuite/gdb.pascal/arrays.exp +@@ -0,0 +1,104 @@ ++# Copyright 2008, 2009 Free Software Foundation, Inc. ++# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or @@ -27082,418 +9594,183 @@ index 0000000..719b178 +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + -+# This file is part of the GDB testsuite. It tests the mechanism -+# exposing inferiors to Python. -+ +if $tracelevel then { + strace $tracelevel +} + -+# Start with a fresh gdb. ++load_lib "pascal.exp" ++ ++set testfile "arrays" ++set srcfile ${testfile}.pas ++set binfile ${objdir}/${subdir}/${testfile}$EXEEXT ++ ++# These tests only work with fpc, using the -gw3 compile-option ++pascal_init ++if { $pascal_compiler_is_fpc != 1 } { ++ return -1 ++} ++ ++# Detect if the fpc version is below 2.3.0 ++set fpc_generates_dwarf_for_dynamic_arrays 1 ++if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))} { ++ set fpc_generates_dwarf_for_dynamic_arrays 0 ++} ++ ++ ++if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } { ++ return -1 ++} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] ++set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] + -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 ++ ++if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { ++ pass "setting breakpoint 1" ++} ++if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { ++ pass "setting breakpoint 2" +} + -+set testfile "py-inferior" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile ${srcfile}" ++# Verify that "start" lands inside the right procedure. ++if { [gdb_start_cmd] < 0 } { ++ untested start + return -1 +} + -+gdb_load ${binfile} ++gdb_test "" ".* at .*${srcfile}.*" "start" + -+# The following tests require execution. ++gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint" + -+if ![runto_main] then { -+ fail "Can't run to main" -+ return 0 ++gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type" ++gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer" ++ ++gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint" ++ ++gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char" ++gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" +} -+ -+runto [gdb_get_line_number "Break here."] -+ -+# Test basic gdb.Inferior attributes and methods. -+ -+gdb_py_test_silent_cmd "python inferiors = gdb.inferiors ()" "get inferiors list" 1 -+gdb_test "python print inferiors" "\\(,\\)" "verify inferiors list" -+gdb_py_test_silent_cmd "python i0 = inferiors\[0\]" "get first inferior" 0 -+ -+gdb_test "python print 'result =', i0 == inferiors\[0\]" " = True" "test equality comparison (true)" -+gdb_test "python print 'result =', i0.num" " = \[0-9\]+" "test Inferior.num" -+gdb_test "python print 'result =', i0.pid" " = \[0-9\]+" "test Inferior.pid" -+gdb_test "python print 'result =', i0.was_attached" " = False" "test Inferior.was_attached" -+gdb_test "python print i0.threads ()" "\\(,\\)" "test Inferior.threads" -+ -+# Test memory read and write operations. -+ -+gdb_py_test_silent_cmd "python addr = gdb.selected_frame ().read_var ('str')" \ -+ "read str address" 0 -+gdb_py_test_silent_cmd "python str = gdb.inferiors()\[0\].read_memory (addr, 5)" \ -+ "read str contents" 1 -+gdb_py_test_silent_cmd "python str\[1\] = 'a'" "change str" 0 -+gdb_py_test_silent_cmd "python gdb.inferiors()\[0\].write_memory (addr, str)" \ -+ "write str" 1 -+gdb_test "print str" " = 0x\[\[:xdigit:\]\]+ \"hallo, testsuite\"" \ -+ "ensure str was changed in the inferior" -+ -+# Test memory search. -+ -+set hex_number {0x[0-9a-fA-F][0-9a-fA-F]*} -+set dec_number {[0-9]+} -+set history_prefix {[$][0-9]* = } -+set newline {[\r\n]+} -+set pattern_not_found "${newline}.]" -+set one_pattern_found "${newline}.${dec_number}L]" -+set two_patterns_found "${newline}.${dec_number}L, ${dec_number}L]" -+ -+# Test string pattern. -+ -+gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161" "" "" -+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')" "" "" -+gdb_test "py start_addr = search_buf.address" "" "" -+gdb_test "py length = search_buf.type.sizeof" "" "" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, 'aaa')" \ -+ "${two_patterns_found}" "find string pattern" -+ -+# Test not finding pattern because search range too small, with -+# potential find at the edge of the range. -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, 10+3, 'aaaa')" \ -+ "${pattern_not_found}" "pattern not found at end of range" -+ -+# Increase the search range by 1 and we should find the pattern. -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, 10+3+1, \['a', 'a', 'a', 'a'\])" \ -+ "${one_pattern_found}" "pattern found at end of range" -+ -+# Test max-count with size, with different parameter position -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, \[0x61, 0x61\], 1, 1)" \ -+ "${one_pattern_found}" "size = 1, max_count = 1" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, \[0x61, 0x61\], 1, 2)" \ -+ "${two_patterns_found}" "size = 1, max_count = 2, normal ordering" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, \[0x61, 0x61\], size = 1, max_count = 2)" \ -+ "${two_patterns_found}" "size = 1, max_count = 2, normal ordering, with keywords" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, \[0x61, 0x61\], max_count = 2, size = 1)" \ -+ "${two_patterns_found}" "size = 1, max_count = 2, inverted ordering" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, \['a', 'a'\], max_count = 2)" \ -+ "${two_patterns_found}" "max_count = 2, with keyword" -+ -+# Test 16-bit pattern. -+ -+gdb_test "set int16_search_buf\[10\] = 0x1234" "" "" -+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')" "" "" -+gdb_test "py start_addr = search_buf.address" "" "" -+gdb_test "py length = search_buf.type.sizeof" "" "" -+gdb_test "py pattern = gdb.parse_and_eval ('(int16_t) 0x1234')" "" "" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, 0x1234, 2)" \ -+ "${one_pattern_found}" "find 16-bit pattern, with python pattern" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ -+ "${one_pattern_found}" "find 16-bit pattern, with value pattern" -+ -+# Test 32-bit pattern. -+ -+gdb_test "set int32_search_buf\[10\] = 0x12345678" "" "" -+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')" "" "" -+gdb_test "py start_addr = search_buf.address" "" "" -+gdb_test "py length = search_buf.type.sizeof" "" "" -+gdb_test "py pattern = gdb.parse_and_eval ('(int32_t) 0x12345678')" "" "" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, 0x12345678, 4)" \ -+ "${one_pattern_found}" "find 32-bit pattern, with python pattern" -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ -+ "${one_pattern_found}" "find 32-bit pattern, with value pattern" -+ -+# Test 64-bit pattern. -+ -+gdb_test "set int64_search_buf\[10\] = 0xfedcba9876543210LL" "" "" -+gdb_test "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')" "" "" -+gdb_test "py start_addr = search_buf.address" "" "" -+gdb_test "py length = search_buf.type.sizeof" "" "" -+gdb_test "py pattern = gdb.parse_and_eval ('(int64_t) 0xfedcba9876543210LL')" "" "" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, 0xfedcba9876543210, 8)" \ -+ "${one_pattern_found}" "find 64-bit pattern, with python pattern" -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, pattern)" \ -+ "${one_pattern_found}" "find 64-bit pattern, with value pattern" -+ -+# Test mixed-sized patterns. -+ -+gdb_test "set *(int8_t*) &search_buf\[10\] = 0x62" "" "" -+gdb_test "set *(int16_t*) &search_buf\[11\] = 0x6363" "" "" -+gdb_test "set *(int32_t*) &search_buf\[13\] = 0x64646464" "" "" -+gdb_test "py search_buf = gdb.selected_frame ().read_var ('search_buf')" "" "" -+gdb_test "py start_addr = search_buf\[0\].address" "" "" -+gdb_test "py pattern1 = gdb.parse_and_eval ('(int8_t) 0x62')" "" "" -+gdb_test "py pattern2 = gdb.parse_and_eval ('(int16_t) 0x6363')" "" "" -+gdb_test "py pattern3 = gdb.parse_and_eval ('(int32_t) 0x64646464')" "" "" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, 100, \[pattern1, pattern2, pattern3\])" \ -+ "${one_pattern_found}" "find mixed-sized pattern" -+ -+# Test search spanning a large range, in the particular case of native -+# targets, test the search spanning multiple chunks. -+# Remote targets may implement the search differently. -+ -+set CHUNK_SIZE 16000 ; -+ -+gdb_test "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678" "" "" -+gdb_test "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678" "" "" -+gdb_test "py start_addr = gdb.selected_frame ().read_var ('search_buf')" "" "" -+gdb_test "py length = gdb.selected_frame ().read_var ('search_buf_size')" "" "" -+ -+gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, 0x12345678, 4)" \ -+ "${two_patterns_found}" "search spanning large range" -+ -+# For native targets, test a pattern straddling a chunk boundary. -+ -+if [isnative] { -+ gdb_test "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531" "" "" -+ -+ gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, 0xfdb97531, 4)" \ -+ "${one_pattern_found}" "find pattern straddling chunk boundary" ++gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type" ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" +} -diff --git a/gdb/testsuite/gdb.python/py-infthread.c b/gdb/testsuite/gdb.python/py-infthread.c ++gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char" ++ +diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas new file mode 100644 -index 0000000..22eb9f2 +index 0000000..295602d --- /dev/null -+++ b/gdb/testsuite/gdb.python/py-infthread.c -@@ -0,0 +1,14 @@ -+int f2 (int a) ++++ b/gdb/testsuite/gdb.pascal/arrays.pas +@@ -0,0 +1,82 @@ +{ -+ return ++a; ++ Copyright 2008, 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . +} + -+int f1 (int a, int b) -+{ -+ return f2(a) + b; -+} ++program arrays; + -+int main (int argc, char *argv[]) -+{ -+ return f1 (1, 2); -+} -diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp -new file mode 100644 -index 0000000..e9d18b7 ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-infthread.exp -@@ -0,0 +1,58 @@ -+# Copyright (C) 2009 Free Software Foundation, Inc. ++{$mode objfpc}{$h+} + -+# 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 . ++uses sysutils; + -+# This file is part of the GDB testsuite. It tests the mechanism -+# exposing inferior threads to Python. ++type TStatArrInt= array[0..11] of integer; ++ TDynArrInt= array of integer; ++ TStatArrStr= array[0..12] of string; ++ TDynArrStr= array of string; ++ TDynArrChar = array of char; ++ TStatArrChar = array [0..11] of char; + -+if $tracelevel then { -+ strace $tracelevel -+} ++ TStat2dArrInt = array[0..11,0..4] of integer; + -+# Start with a fresh gdb. ++var StatArrInt: TStatArrInt; ++ StatArrInt_: Array[0..11] of integer; ++ DynArrInt: TDynArrInt; ++ DynArrInt_: Array of integer; ++ StatArrStr: TStatArrStr; ++ DynArrStr: TDynArrStr; ++ StatArrChar: TStatArrChar; ++ DynArrChar: TDynArrChar; + -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir ++ Stat2dArrInt: TStat2dArrInt; + -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 -+} ++ s: string; ++ ++ i,j : integer; + -+set testfile "py-infthread" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} ++begin ++ for i := 0 to 11 do ++ begin ++ StatArrInt[i]:= i+50; ++ StatArrInt_[i]:= i+50; ++ StatArrChar[i]:= chr(ord('a')+i); ++ for j := 0 to 4 do ++ Stat2dArrInt[i,j]:=i+j; ++ end; ++ writeln(StatArrInt_[0]); ++ writeln(StatArrInt[0]); { set breakpoint 1 here } ++ writeln(StatArrChar[0]); ++ writeln(Stat2dArrInt[0,0]); + -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} ++ setlength(DynArrInt,13); ++ setlength(DynArrInt_,13); ++ setlength(DynArrStr,13); ++ setlength(DynArrChar,13); ++ for i := 0 to 12 do ++ begin ++ DynArrInt[i]:= i+50; ++ DynArrInt_[i]:= i+50; ++ DynArrChar[i]:= chr(ord('a')+i); ++ StatArrStr[i]:='str'+inttostr(i); ++ DynArrStr[i]:='dstr'+inttostr(i); ++ end; ++ writeln(DynArrInt_[1]); ++ writeln(DynArrInt[1]); ++ writeln(DynArrStr[1]); ++ writeln(StatArrStr[1]); ++ writeln(DynArrChar[1]); + -+gdb_load ${binfile} -+ -+# The following tests require execution. -+ -+if ![runto_main] then { -+ fail "Can't run to main" -+ return 0 -+} -+ -+runto [gdb_get_line_number "Break here."] -+ -+# Test basic gdb.Inferior attributes and methods. -+ -+gdb_py_test_silent_cmd "python t0 = gdb.selected_thread ()" "test gdb.selected_thread" 1 -+gdb_test "python print t0" "\\" "verify InferiorThread object" -+gdb_test "python print 'result =', t0.num" " = \[0-9\]+" "test Inferior.num" -diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp -index 2626895..cd0d7e7 100644 ---- a/gdb/testsuite/gdb.python/py-prettyprint.exp -+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp -@@ -27,12 +27,20 @@ set binfile ${objdir}/${subdir}/${testfile} - # Start with a fresh gdb. - gdb_exit - gdb_start --gdb_test_multiple "python print 'hello, world!'" "verify python support" { -- -re "not supported.*$gdb_prompt $" { -- unsupported "python support is disabled" -- return -1 -- } -- -re "$gdb_prompt $" {} -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 -+} -+ -+# Run a command in GDB, and report a failure if a Python exception is thrown. -+# If report_pass is true, report a pass if no exception is thrown. -+proc gdb_py_test_silent_cmd {cmd name report_pass} { -+ global gdb_prompt -+ -+ gdb_test_multiple $cmd $name { -+ -re "Traceback.*$gdb_prompt $" { fail $name } -+ -re "$gdb_prompt $" { if $report_pass { pass $name } } -+ } - } - - # Run a command in GDB, and report a failure if a Python exception is thrown. -@@ -105,6 +113,8 @@ proc run_lang_tests {lang} { - gdb_test "print estring" "\"embedded x\\\\201\\\\202\\\\203\\\\204\"" - gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" - -+ gdb_test "print nullstr" "RuntimeError: Error reading string from inferior.*" -+ - gdb_test "continue" "Program exited normally\." - - remote_file host delete ${remote_python_file} -diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp -index 713ad5f..5d17b26 100644 ---- a/gdb/testsuite/gdb.python/py-template.exp -+++ b/gdb/testsuite/gdb.python/py-template.exp -@@ -20,6 +20,17 @@ if $tracelevel then { - strace $tracelevel - } - -+# Start with a fresh gdb. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+ -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 -+} -+ - set testfile "py-template" - set srcfile ${testfile}.cc - set binfile ${objdir}/${subdir}/${testfile} -@@ -29,20 +40,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ - return -1 - } - --# Start with a fresh gdb. -- --gdb_exit --gdb_start --gdb_reinitialize_dir $srcdir/$subdir -- --gdb_test_multiple "python print 23" "verify python support" { -- -re "not supported.*$gdb_prompt $" { -- unsupported "python support is disabled" -- return -1 -- } -- -re "$gdb_prompt $" {} --} -- - proc test_template_arg {type} { - global testfile srcdir subdir srcfile binfile - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ -diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp -index d980a3d..6a75595 100644 ---- a/gdb/testsuite/gdb.python/py-value.exp -+++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -307,6 +307,15 @@ proc test_value_after_death {} { - "print value's type" - } - -+# Regression test for a cast failure. The bug was that if we cast a -+# value to its own type, gdb could crash. This happened because we -+# could end up double-freeing a struct value. -+proc test_cast_regression {} { -+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test" -+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test" -+ gdb_test "python print v" "5" "print value for cast test" -+} -+ - # Regression test for invalid subscript operations. The bug was that - # the type of the value was not being checked before allowing a - # subscript operation to proceed. -@@ -392,16 +401,23 @@ proc test_parse_and_eval {} { - gdb_exit - gdb_start - gdb_reinitialize_dir $srcdir/$subdir --gdb_load ${binfile} - --gdb_test_multiple "python print 'hello, world!'" "verify python support" { -- -re "not supported.*$gdb_prompt $" { -- unsupported "python support is disabled" -- return -1 -- } -- -re "$gdb_prompt $" {} -+if ![python_supported] then { -+ unsupported "python support is disabled" -+ return -1 - } - -+set testfile "py-value" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} -+ -+gdb_load ${binfile} -+ - test_value_creation - test_value_numeric_ops - test_value_boolean -@@ -419,6 +435,7 @@ if ![runto_main] then { - test_value_in_inferior - test_lazy_strings - test_value_after_death -+test_cast_regression - - # The following test recompiles the binary to test either C or C++ - # values. ++ s := 'test'#0'string'; ++ writeln(s); { set breakpoint 2 here } ++end. diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c b/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c new file mode 100644 index 0000000..4dc308b @@ -28037,121 +10314,77 @@ index 0000000..1dc93ab +if {[istarget "*-*-linux*"]} { + test child FOLLOW_CHILD +} -diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp -index 6fbee84..1189cfd 100644 ---- a/gdb/testsuite/lib/cp-support.exp -+++ b/gdb/testsuite/lib/cp-support.exp -@@ -222,7 +222,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { - - set parse_okay 0 - gdb_test_multiple "$in_command" "$in_testname // parse failed" { -- -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" { -+ -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_:\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" { - set parse_okay 1 - set actual_key $expect_out(1,string) - set actual_tag $expect_out(2,string) -@@ -231,6 +231,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { - set actual_tail $expect_out(6,string) +diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp +index 9691bc1..13ea8b5 100644 +--- a/gdb/testsuite/lib/pascal.exp ++++ b/gdb/testsuite/lib/pascal.exp +@@ -37,6 +37,9 @@ proc pascal_init {} { + global pascal_compiler_is_fpc + global gpc_compiler + global fpc_compiler ++ global fpcversion_major ++ global fpcversion_minor ++ global fpcversion_release + global env + + if { $pascal_init_done == 1 } { +@@ -64,6 +67,20 @@ proc pascal_init {} { + set pascal_compiler_is_fpc 1 + verbose -log "Free Pascal compiler found" } - } -+ - if { ! $parse_okay } then { return } - - # Check the actual key. It would be nice to require that it match -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 627941d..1f9b228 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -27,6 +27,7 @@ if {$tool == ""} { - } - - load_lib libgloss.exp -+load_lib python-support.exp - - global GDB - -diff --git a/gdb/testsuite/lib/python-support.exp b/gdb/testsuite/lib/python-support.exp -new file mode 100644 -index 0000000..b8e9836 ---- /dev/null -+++ b/gdb/testsuite/lib/python-support.exp -@@ -0,0 +1,53 @@ -+global python_supported_saved + -+# Return 1 if Python scripting is supported in GDB, 0 if not. -+proc python_supported { } { -+ global gdb_prompt -+ global python_supported_saved -+ -+ if [info exists python_supported_saved] { -+ verbose "python_supported: returning saved $python_supported_saved" 2 -+ return $python_supported_saved -+ } -+ -+ gdb_test_multiple "python print 'hello, world!'" "verify python support" { -+ -re "not supported.*$gdb_prompt $" { -+ return [set python_supported_saved 0] -+ } -+ -re "$gdb_prompt $" { -+ return [set python_supported_saved 1] -+ } -+ } -+ -+ return [set python_supported_saved 0] -+} -+ -+# Run a command in GDB, and report a failure if a Python exception is thrown. -+# If report_pass is true, report a pass if no exception is thrown. -+proc gdb_py_test_silent_cmd {cmd name report_pass} { -+ global gdb_prompt -+ -+ gdb_test_multiple $cmd $name { -+ -re "Traceback.*$gdb_prompt $" { fail $name } -+ -re "$gdb_prompt $" { if $report_pass { pass $name } } -+ } -+} -+ -+# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}... -+# Run a test named NAME, consisting of multiple lines of input. -+# After each input line INPUT, search for result line RESULT. -+# Succeed if all results are seen; fail otherwise. -+proc gdb_py_test_multiple {name args} { -+ global gdb_prompt -+ -+ foreach {input result} $args { -+ if {[gdb_test_multiple $input "$name - $input" { -+ -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" { -+ pass "$name - $input" ++ # Detect the fpc-version ++ if { $pascal_compiler_is_fpc == 1 } { ++ set fpcversion_major 1 ++ set fpcversion_minor 0 ++ set fpcversion_release 0 ++ set fpcversion [ remote_exec host $fpc_compiler "-iV" ] ++ if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] { ++ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major ++ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor ++ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release + } -+ }]} { -+ return 1 ++ verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release" + } -+ } -+ return 0 -+} + } + set pascal_init_done 1 + } diff --git a/gdb/thread.c b/gdb/thread.c -index 16a207c..c3cff06 100644 +index 2fdc7f9..2a5d0f1 100644 --- a/gdb/thread.c +++ b/gdb/thread.c -@@ -61,7 +61,6 @@ static int thread_alive (struct thread_info *); - static void info_threads_command (char *, int); - static void thread_apply_command (char *, int); - static void restore_current_thread (ptid_t); --static void prune_threads (void); - - /* Frontend view of the thread state. Possible extensions: stepping, - finishing, until(ling),... */ -@@ -517,7 +516,7 @@ thread_alive (struct thread_info *tp) - return 1; +@@ -90,6 +90,16 @@ delete_step_resume_breakpoint (struct thread_info *tp) + } } --static void +void - prune_threads (void) ++delete_exception_resume_breakpoint (struct thread_info *tp) ++{ ++ if (tp && tp->exception_resume_breakpoint) ++ { ++ delete_breakpoint (tp->exception_resume_breakpoint); ++ tp->exception_resume_breakpoint = NULL; ++ } ++} ++ + static void + clear_thread_inferior_resources (struct thread_info *tp) { - struct thread_info *tp, *next; +@@ -103,6 +113,12 @@ clear_thread_inferior_resources (struct thread_info *tp) + tp->step_resume_breakpoint = NULL; + } + ++ if (tp->exception_resume_breakpoint) ++ { ++ tp->exception_resume_breakpoint->disposition = disp_del_at_next_stop; ++ tp->exception_resume_breakpoint = NULL; ++ } ++ + bpstat_clear (&tp->stop_bpstat); + + discard_all_intermediate_continuations_thread (tp); diff --git a/gdb/top.c b/gdb/top.c -index 90e8f1e..489e24a 100644 +index 93447fe..d6875a7 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -337,6 +337,7 @@ void @@ -28219,116 +10452,13 @@ index ce9f551..5f9d739 100644 } static void -diff --git a/gdb/typeprint.h b/gdb/typeprint.h -index 7d7e6bc..6ee65cf 100644 ---- a/gdb/typeprint.h -+++ b/gdb/typeprint.h -@@ -20,10 +20,13 @@ - #ifndef TYPEPRINT_H - #define TYPEPRINT_H - -+enum language; - struct ui_file; - - void print_type_scalar (struct type * type, LONGEST, struct ui_file *); - - void c_type_print_varspec_suffix (struct type *, struct ui_file *, int, - int, int); -+ -+void c_type_print_args (struct type *, struct ui_file *, int, enum language); - #endif -diff --git a/gdb/ui-file.c b/gdb/ui-file.c -index e6aaf93..1760b4c 100644 ---- a/gdb/ui-file.c -+++ b/gdb/ui-file.c -@@ -22,6 +22,7 @@ - - #include "defs.h" - #include "ui-file.h" -+#include "gdb_obstack.h" - #include "gdb_string.h" - #include "gdb_select.h" - -@@ -264,7 +265,7 @@ set_ui_file_data (struct ui_file *file, void *data, - } - - /* ui_file utility function for converting a ``struct ui_file'' into -- a memory buffer''. */ -+ a memory buffer. */ - - struct accumulated_ui_file - { -@@ -298,6 +299,23 @@ ui_file_xstrdup (struct ui_file *file, long *length) - *length = acc.length; - return acc.buffer; - } -+ -+static void -+do_ui_file_obsavestring (void *context, const char *buffer, long length) -+{ -+ struct obstack *obstack = (struct obstack *) context; -+ obstack_grow (obstack, buffer, length); -+} -+ -+char * -+ui_file_obsavestring (struct ui_file *file, struct obstack *obstack, -+ long *length) -+{ -+ ui_file_put (file, do_ui_file_obsavestring, obstack); -+ *length = obstack_object_size (obstack); -+ obstack_1grow (obstack, '\0'); -+ return obstack_finish (obstack); -+} - - /* A pure memory based ``struct ui_file'' that can be used an output - buffer. The buffers accumulated contents are available via -diff --git a/gdb/ui-file.h b/gdb/ui-file.h -index 6155699..bb94f4b 100644 ---- a/gdb/ui-file.h -+++ b/gdb/ui-file.h -@@ -20,6 +20,7 @@ - #ifndef UI_FILE_H - #define UI_FILE_H - -+struct obstack; - struct ui_file; - - /* Create a generic ui_file object with null methods. */ -@@ -78,7 +79,10 @@ extern void ui_file_put (struct ui_file *src, ui_file_put_method_ftype *write, v - minus that appended NUL. */ - extern char *ui_file_xstrdup (struct ui_file *file, long *length); - -- -+/* Similar to ui_file_xstrdup, but return a new string allocated on -+ OBSTACK. */ -+extern char *ui_file_obsavestring (struct ui_file *file, -+ struct obstack *obstack, long *length); - - extern long ui_file_read (struct ui_file *file, char *buf, long length_buf); - diff --git a/gdb/valarith.c b/gdb/valarith.c -index 9f91f4e..753927f 100644 +index 0c40905..a781636 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c -@@ -31,6 +31,7 @@ - #include "dfp.h" - #include - #include "infcall.h" -+#include "exceptions.h" - - /* Define whether or not the C operator '/' truncates towards zero for - differently signed operands (truncation direction is undefined in C). */ -@@ -146,7 +147,6 @@ an integer nor a pointer of the same type.")); - struct value * - value_subscript (struct value *array, LONGEST index) - { -- struct value *bound; - int c_style = current_language->c_style_arrays; - struct type *tarray; - @@ -161,12 +161,26 @@ value_subscript (struct value *array, LONGEST index) - get_discrete_bounds (range_type, &lowerbound, &upperbound); + get_discrete_bounds (range_type, &lowerbound, &upperbound); if (VALUE_LVAL (array) != lval_memory) - return value_subscripted_rvalue (array, index, lowerbound); + { @@ -28355,7 +10485,7 @@ index 9f91f4e..753927f 100644 /* Emit warning unless we have an array of unknown size. An array of unknown size has lowerbound 0 and upperbound -1. */ if (upperbound > -1) -@@ -185,33 +199,37 @@ value_subscript (struct value *array, LONGEST index) +@@ -185,34 +199,37 @@ value_subscript (struct value *array, LONGEST index) error (_("not an array or string")); } @@ -28378,7 +10508,8 @@ index 9f91f4e..753927f 100644 - unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound); struct value *v; -- if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type)) +- if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) +- && elt_offs >= TYPE_LENGTH (array_type))) - error (_("no such vector element")); + /* Do not check TYPE_LENGTH (array_type) as we may have been given the + innermost dimension of a multi-dimensional Fortran array where its length @@ -28404,97 +10535,19 @@ index 9f91f4e..753927f 100644 return v; } -@@ -318,6 +336,68 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1) - } +@@ -292,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)); } -+/* Try to find OPERATOR as through argument dependent lookup. */ -+ -+static struct value * -+value_user_defined_adl_op (struct value **args, int nargs, char *operator) -+{ -+ -+ struct symbol *symp; -+ struct type **arg_types; -+ int i; -+ -+ /* This function, if found, will not be a member function -+ and does not expect a pointer as its first argument -+ rather the explicit structure. */ -+ args[0] = value_ind (args[0]); -+ -+ arg_types = (struct type **)alloca (nargs * (sizeof (struct type *))); -+ /* Prepare list of argument types for overload resolution */ -+ for (i = 0; i < nargs; i++) -+ arg_types [i] = value_type (args [i]); -+ -+ find_overload_match (arg_types, nargs, operator, 0 /* not method */, -+ 0 /* strict match */, NULL, -+ NULL /* pass NULL symbol since symbol is unknown */, -+ NULL, &symp, NULL); -+ -+ if (symp) -+ return value_of_variable (symp, 0); -+ -+ return NULL; -+} -+ -+/* Lookup user defined operator NAME. First try to find it as a member -+ of the struct ARGP[0]. If not found try to find the operator through -+ argument dependent lookup. */ -+ -+static struct value * -+value_user_defined_op (struct value **argp, struct value **args, char *name, -+ int *static_memfuncp, int nargs) -+{ -+ struct value *result = NULL; -+ volatile struct gdb_exception except; -+ -+ TRY_CATCH (except, RETURN_MASK_ERROR) -+ { -+ result = value_struct_elt (argp, args, name, static_memfuncp, -+ "structure"); -+ } -+ -+ if (except.reason < 0) -+ { -+ -+ if (current_language->la_language == language_cplus) -+ /* Try ADL. */ -+ result = value_user_defined_adl_op (args, nargs, name); -+ -+ if (!result) -+ error ("%s", except.message); -+ } -+ -+ return result; -+} -+ - /* We know either arg1 or arg2 is a structure, so try to find the right - user defined function. Create an argument vector that calls - arg1.operator @ (arg1,arg2) and return that value (where '@' is any -@@ -458,7 +538,8 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, - error (_("Invalid binary operation specified.")); - } - -- argvec[0] = value_struct_elt (&arg1, argvec + 1, tstr, &static_memfuncp, "structure"); -+ argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr, -+ &static_memfuncp, 2); - - if (argvec[0]) - { -@@ -555,7 +636,8 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) - error (_("Invalid unary operation specified.")); - } - -- argvec[0] = value_struct_elt (&arg1, argvec + 1, tstr, &static_memfuncp, "structure"); -+ argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr, -+ &static_memfuncp, 1); - - if (argvec[0]) - { diff --git a/gdb/valops.c b/gdb/valops.c -index b94c411..9875f96 100644 +index 7fbad10..8e32405 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -38,6 +38,7 @@ @@ -28505,16 +10558,7 @@ index b94c411..9875f96 100644 #include #include "gdb_string.h" -@@ -397,8 +398,6 @@ value_cast (struct type *type, struct value *arg2) - new_length = val_length / element_length; - if (val_length % element_length != 0) - warning (_("array element type size does not divide object size in cast")); -- /* FIXME-type-allocation: need a way to free this type when -- we are done with it. */ - range_type = create_range_type ((struct type *) NULL, - TYPE_TARGET_TYPE (range_type), - low_bound, -@@ -845,6 +844,64 @@ value_one (struct type *type, enum lval_type lv) +@@ -858,6 +859,65 @@ value_one (struct type *type, enum lval_type lv) return val; } @@ -28542,14 +10586,15 @@ index b94c411..9875f96 100644 + return NULL; +} + -+/* Return non-zero if the variable is valid. If it is valid the function -+ may store the data address (DW_AT_DATA_LOCATION) of TYPE at *ADDRESS_RETURN. -+ You must set *ADDRESS_RETURN from value_raw_address (VAL) before calling this -+ function. If no DW_AT_DATA_LOCATION is present for TYPE the address at -+ *ADDRESS_RETURN is left unchanged. ADDRESS_RETURN must not be NULL, use ++/* Return non-NULL check_typedef result on TYPE if the variable is valid. If ++ it is valid the function may store the data address (DW_AT_DATA_LOCATION) of ++ TYPE at *ADDRESS_RETURN. You must set *ADDRESS_RETURN from ++ value_raw_address (VAL) before calling this function. If no ++ DW_AT_DATA_LOCATION is present for TYPE the address at *ADDRESS_RETURN is ++ left unchanged. ADDRESS_RETURN must not be NULL, use + object_address_data_not_valid () for just the data validity check. */ + -+int ++struct type * +object_address_get_data (struct type *type, CORE_ADDR *address_return) +{ + gdb_assert (address_return != NULL); @@ -28564,7 +10609,7 @@ index b94c411..9875f96 100644 + { + /* Do not try to evaluate DW_AT_data_location as it may even crash + (it would just return the value zero in the gfortran case). */ -+ return 0; ++ return NULL; + } + + if (TYPE_DATA_LOCATION_IS_ADDR (type)) @@ -28573,13 +10618,13 @@ index b94c411..9875f96 100644 + *address_return + = dwarf_locexpr_baton_eval (TYPE_DATA_LOCATION_DWARF_BLOCK (type)); + -+ return 1; ++ return type; +} + /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */ static struct value * -@@ -936,15 +993,21 @@ value_fetch_lazy (struct value *val) +@@ -956,15 +1016,21 @@ value_fetch_lazy (struct value *val) } else if (VALUE_LVAL (val) == lval_memory) { @@ -28608,7 +10653,7 @@ index b94c411..9875f96 100644 } } else if (VALUE_LVAL (val) == lval_register) -@@ -1352,7 +1415,18 @@ address_of_variable (struct symbol *var, struct block *b) +@@ -1374,7 +1440,18 @@ address_of_variable (struct symbol *var, struct block *b) if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) || TYPE_CODE (type) == TYPE_CODE_FUNC) { @@ -28625,10 +10670,10 @@ index b94c411..9875f96 100644 + } + + addr = value_address (val); + return value_from_pointer (lookup_pointer_type (type), addr); } - -@@ -1458,6 +1532,7 @@ struct value * +@@ -1481,6 +1558,7 @@ struct value * value_coerce_array (struct value *arg1) { struct type *type = check_typedef (value_type (arg1)); @@ -28636,7 +10681,7 @@ index b94c411..9875f96 100644 /* If the user tries to do something requiring a pointer with an array that has not yet been pushed to the target, then this would -@@ -1467,8 +1542,12 @@ value_coerce_array (struct value *arg1) +@@ -1490,8 +1568,12 @@ value_coerce_array (struct value *arg1) if (VALUE_LVAL (arg1) != lval_memory) error (_("Attempt to take address of value not located in memory.")); @@ -28650,183 +10695,19 @@ index b94c411..9875f96 100644 } /* Given a value which is a function, return a value which is a pointer -@@ -2336,7 +2415,7 @@ find_overload_match (struct type **arg_types, int nargs, - int boffset; - int ix; - int static_offset; -- struct cleanup *old_cleanups = NULL; -+ struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL); - - const char *obj_type_name = NULL; - char *func_name = NULL; -@@ -2346,12 +2425,25 @@ find_overload_match (struct type **arg_types, int nargs, - if (method) - { - gdb_assert (obj); -+ -+ /* OBJ may be a pointer value rather than the object itself. */ -+ obj = coerce_ref (obj); -+ while (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_PTR) -+ obj = coerce_ref (value_ind (obj)); - obj_type_name = TYPE_NAME (value_type (obj)); -- /* Hack: evaluate_subexp_standard often passes in a pointer -- value rather than the object itself, so try again. */ -- if ((!obj_type_name || !*obj_type_name) -- && (TYPE_CODE (value_type (obj)) == TYPE_CODE_PTR)) -- obj_type_name = TYPE_NAME (TYPE_TARGET_TYPE (value_type (obj))); -+ -+ /* First check whether this is a data member, e.g. a pointer to -+ a function. */ -+ if (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_STRUCT) -+ { -+ *valp = search_struct_field (name, obj, 0, -+ check_typedef (value_type (obj)), 0); -+ if (*valp) -+ { -+ *staticp = 1; -+ return 0; -+ } -+ } - - fns_ptr = value_find_oload_method_list (&temp, name, - 0, &num_fns, -@@ -2371,23 +2463,45 @@ find_overload_match (struct type **arg_types, int nargs, - } - else - { -- const char *qualified_name = SYMBOL_CPLUS_DEMANGLED_NAME (fsym); -+ const char *qualified_name = NULL; - -- /* If we have a C++ name, try to extract just the function -- part. */ -- if (qualified_name) -- func_name = cp_func_name (qualified_name); -- -- /* If there was no C++ name, this must be a C-style function. -- Just return the same symbol. Do the same if cp_func_name -- fails for some reason. */ -+ if (fsym) -+ { -+ qualified_name = SYMBOL_NATURAL_NAME (fsym); -+ -+ /* If we have a function with a C++ name, try to extract just -+ the function part. Do not try this for non-functions (e.g. -+ function pointers). */ -+ if (qualified_name -+ && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) == TYPE_CODE_FUNC) -+ { -+ func_name = cp_func_name (qualified_name); -+ -+ /* If cp_func_name did not remove anything, the name of the -+ symbol did not include scope or argument types - it was -+ probably a C-style function. */ -+ if (func_name && strcmp (func_name, qualified_name) == 0) -+ { -+ xfree (func_name); -+ func_name = NULL; -+ } -+ } -+ } -+ else -+ { -+ func_name = (char *) name; -+ qualified_name = name; -+ } -+ -+ /* If there was no C++ name, this must be a C-style function or -+ not a function at all. Just return the same symbol. Do the -+ same if cp_func_name fails for some reason. */ - if (func_name == NULL) - { - *symp = fsym; - return 0; - } - -- old_cleanups = make_cleanup (xfree, func_name); - make_cleanup (xfree, oload_syms); - make_cleanup (xfree, oload_champ_bv); - -@@ -2398,8 +2512,11 @@ find_overload_match (struct type **arg_types, int nargs, - &oload_champ_bv); - } - -- /* Check how bad the best match is. */ -+ /* Did we find a match ? */ -+ if (oload_champ == -1) -+ error ("No symbol \"%s\" in current context.", name); - -+ /* Check how bad the best match is. */ - match_quality = - classify_oload_match (oload_champ_bv, nargs, - oload_method_static (method, fns_ptr, -@@ -2456,8 +2573,8 @@ find_overload_match (struct type **arg_types, int nargs, - } - *objp = temp; - } -- if (old_cleanups != NULL) -- do_cleanups (old_cleanups); -+ -+ do_cleanups (old_cleanups); - - switch (match_quality) - { -@@ -2565,6 +2682,12 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs, - new_namespace[namespace_len] = '\0'; - new_oload_syms = make_symbol_overload_list (func_name, - new_namespace); -+ -+ /* If we have reached the deepesst level perform argument -+ determined lookup. */ -+ if (!searched_deeper) -+ make_symbol_overload_list_adl (arg_types, nargs, func_name); -+ - while (new_oload_syms[num_fns]) - ++num_fns; - -@@ -2597,7 +2720,6 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs, - } - else - { -- gdb_assert (new_oload_champ != -1); - *oload_syms = new_oload_syms; - *oload_champ = new_oload_champ; - *oload_champ_bv = new_oload_champ_bv; -@@ -3117,9 +3239,9 @@ value_maybe_namespace_elt (const struct type *curtype, - struct symbol *sym; - struct value *result; - -- sym = cp_lookup_symbol_namespace (namespace_name, name, NULL, -- get_selected_block (0), -- VAR_DOMAIN, 1); -+ sym = cp_lookup_symbol_namespace(namespace_name, name, -+ get_selected_block (0), -+ VAR_DOMAIN); - - if (sym == NULL) - return NULL; -@@ -3261,7 +3383,7 @@ value_of_local (const char *name, int complain) - - /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER - symbol instead of the LOC_ARG one (if both exist). */ -- sym = lookup_block_symbol (b, name, NULL, VAR_DOMAIN); -+ sym = lookup_block_symbol (b, name, VAR_DOMAIN); - if (sym == NULL) - { - if (complain) -@@ -3315,8 +3437,6 @@ value_slice (struct value *array, int lowbound, int length) - || lowbound + length - 1 > upperbound) - error (_("slice out of range")); - -- /* FIXME-type-allocation: need a way to free this type when we are -- done with it. */ - slice_range_type = create_range_type ((struct type *) NULL, - TYPE_TARGET_TYPE (range_type), - lowbound, diff --git a/gdb/valprint.c b/gdb/valprint.c -index 3f21ae4..9b15b1a 100644 +index ad6268e..fb0ef7a 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c -@@ -236,7 +236,6 @@ scalar_type_p (struct type *type) +@@ -36,6 +36,7 @@ + #include "dfp.h" + #include "python/python.h" + #include "ada-lang.h" ++#include "dwarf2loc.h" + + #include + +@@ -237,7 +238,6 @@ scalar_type_p (struct type *type) case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: case TYPE_CODE_SET: @@ -28834,92 +10715,98 @@ index 3f21ae4..9b15b1a 100644 case TYPE_CODE_BITSTRING: return 0; default: -@@ -1154,6 +1153,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, +@@ -1142,6 +1142,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, + { + unsigned int things_printed = 0; + unsigned len; ++ struct type *saved_type = type; + struct type *elttype, *index_type; + unsigned eltlen; + /* Position of the array element we are examining to see +@@ -1150,9 +1151,33 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, + /* Number of repetitions we have detected so far. */ + unsigned int reps; + LONGEST low_bound_index = 0; ++ struct cleanup *back_to; ++ CORE_ADDR saved_address = address; ++ ++ back_to = make_cleanup (null_cleanup, 0); ++ type = object_address_get_data (type, &address); ++ if (!type) ++ { ++ fputs_filtered (object_address_data_not_valid (type), stream); ++ do_cleanups (back_to); ++ return; ++ } ++ if (address != saved_address) ++ { ++ size_t length = TYPE_LENGTH (type); - for (; i < len && things_printed < options->print_max; i++) +- elttype = TYPE_TARGET_TYPE (type); +- eltlen = TYPE_LENGTH (check_typedef (elttype)); ++ valaddr = xmalloc (length); ++ make_cleanup (xfree, (gdb_byte *) valaddr); ++ read_memory (address, (gdb_byte *) valaddr, length); ++ } ++ ++ /* Skip typedefs but do not resolve TYPE_DYNAMIC. */ ++ elttype = saved_type; ++ while (TYPE_CODE (elttype) == TYPE_CODE_TYPEDEF) ++ elttype = TYPE_TARGET_TYPE (elttype); ++ elttype = TYPE_TARGET_TYPE (elttype); ++ ++ eltlen = TYPE_ARRAY_BYTE_STRIDE_VALUE (type); + index_type = TYPE_INDEX_TYPE (type); + + /* Compute the number of elements in the array. On most arrays, +@@ -1160,9 +1185,6 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, + is simply the size of the array divided by the size of the elements. + But for arrays of elements whose size is zero, we need to look at + the bounds. */ +- if (eltlen != 0) +- len = TYPE_LENGTH (type) / eltlen; +- else { -+ size_t elt_offset = i * eltlen; - if (i != 0) - { - if (options->prettyprint_arrays) -@@ -1173,7 +1173,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, - rep1 = i + 1; - reps = 1; - while ((rep1 < len) && -- !memcmp (valaddr + i * eltlen, valaddr + rep1 * eltlen, eltlen)) -+ !memcmp (valaddr + elt_offset, valaddr + rep1 * eltlen, eltlen)) - { - ++reps; - ++rep1; + LONGEST low, hi; + +@@ -1236,6 +1258,8 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, + { + fprintf_filtered (stream, "..."); + } ++ ++ do_cleanups (back_to); + } + + /* Read LEN bytes of target memory at address MEMADDR, placing the diff --git a/gdb/value.c b/gdb/value.c -index a462ee4..968cdf4 100644 +index d552402..b10269c 100644 --- a/gdb/value.c +++ b/gdb/value.c -@@ -37,8 +37,10 @@ - #include "block.h" - #include "dfp.h" +@@ -39,6 +39,7 @@ #include "objfiles.h" -+#include "cli/cli-decode.h" #include "valprint.h" #include "cli/cli-decode.h" +#include "observer.h" #include "python/python.h" -@@ -170,6 +172,14 @@ struct value - taken off this list. */ - struct value *next; - -+ /* The reference count. A value that is still on the `all_values' -+ list will have a reference count of 0. A call to `release_value' -+ will increment the reference count (and remove the value from the -+ list, the first time). A call to `value_free' will decrement the -+ reference count, and will free the value when there are no more -+ references. */ -+ int refcount; -+ - /* Register number if the value is from a register. */ - short regnum; - -@@ -631,6 +641,13 @@ value_free (struct value *val) - if (val->parent != NULL) - value_free (val->parent); - -+#if 0 -+ /* We need type GC instead. This can fail when an objfile is -+ reclaimed and then a value is later freed. */ -+ type_decref (val->type); -+ type_decref (val->enclosing_type); -+#endif -+ - if (VALUE_LVAL (val) == lval_computed) - { - struct lval_funcs *funcs = val->location.computed.funcs; -@@ -735,6 +752,7 @@ value_copy (struct value *arg) - val = allocate_value_lazy (encl_type); - else - val = allocate_value (encl_type); -+ - val->type = arg->type; - VALUE_LVAL (val) = VALUE_LVAL (arg); - val->location = arg->location; -@@ -770,12 +788,15 @@ value_copy (struct value *arg) - void - set_value_component_location (struct value *component, struct value *whole) +@@ -828,12 +829,15 @@ void + set_value_component_location (struct value *component, + const struct value *whole) { + CORE_ADDR addr; + - if (VALUE_LVAL (whole) == lval_internalvar) + if (whole->lval == lval_internalvar) VALUE_LVAL (component) = lval_internalvar_component; else - VALUE_LVAL (component) = VALUE_LVAL (whole); + VALUE_LVAL (component) = whole->lval; component->location = whole->location; + - if (VALUE_LVAL (whole) == lval_computed) + if (whole->lval == lval_computed) { struct lval_funcs *funcs = whole->location.computed.funcs; -@@ -783,6 +804,12 @@ set_value_component_location (struct value *component, struct value *whole) +@@ -841,6 +845,12 @@ set_value_component_location (struct value *component, if (funcs->copy_closure) component->location.computed.closure = funcs->copy_closure (whole); } @@ -28932,7 +10819,7 @@ index a462ee4..968cdf4 100644 } -@@ -913,6 +940,29 @@ show_values (char *num_exp, int from_tty) +@@ -973,6 +983,29 @@ show_values (char *num_exp, int from_tty) num_exp[1] = '\0'; } } @@ -28962,7 +10849,7 @@ index a462ee4..968cdf4 100644 /* Internal variables. These are variables within the debugger that hold values assigned by debugger commands. -@@ -1388,6 +1438,40 @@ call_internal_function (struct gdbarch *gdbarch, +@@ -1451,6 +1484,40 @@ call_internal_function (struct gdbarch *gdbarch, return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); } @@ -29003,7 +10890,7 @@ index a462ee4..968cdf4 100644 /* The 'function' command. This does nothing -- it is just a placeholder to let "help function NAME" work. This is also used as the implementation of the sub-command that is created when -@@ -1435,11 +1519,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, +@@ -1498,11 +1565,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, htab_t copied_types) { if (TYPE_OBJFILE (value->type) == objfile) @@ -29017,7 +10904,7 @@ index a462ee4..968cdf4 100644 copied_types); } -@@ -1454,13 +1537,13 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, +@@ -1517,13 +1583,13 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, case INTERNALVAR_INTEGER: if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile) var->u.integer.type @@ -29033,70 +10920,33 @@ index a462ee4..968cdf4 100644 break; case INTERNALVAR_VALUE: -@@ -2192,6 +2275,42 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num) - } - - -+/* Pack NUM into BUF using a target format of TYPE. */ +@@ -2387,7 +2453,24 @@ value_from_decfloat (struct type *type, const gdb_byte *dec) + struct value * + coerce_ref (struct value *arg) + { +- struct type *value_type_arg_tmp = check_typedef (value_type (arg)); ++ struct type *value_type_arg_tmp; + -+void -+pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num) -+{ -+ enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); -+ int len; -+ -+ type = check_typedef (type); -+ len = TYPE_LENGTH (type); -+ -+ switch (TYPE_CODE (type)) ++ if (TYPE_DYNAMIC (value_type (arg))) + { -+ case TYPE_CODE_INT: -+ case TYPE_CODE_CHAR: -+ case TYPE_CODE_ENUM: -+ case TYPE_CODE_FLAGS: -+ case TYPE_CODE_BOOL: -+ case TYPE_CODE_RANGE: -+ case TYPE_CODE_MEMBERPTR: -+ store_unsigned_integer (buf, len, byte_order, num); -+ break; ++ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); ++ CORE_ADDR address; + -+ case TYPE_CODE_REF: -+ case TYPE_CODE_PTR: -+ store_typed_address (buf, type, (CORE_ADDR) num); -+ break; -+ -+ default: -+ error (_("\ -+Unexpected type (%d) encountered for unsigned integer constant."), -+ TYPE_CODE (type)); ++ value_type_arg_tmp = value_type (arg); ++ address = value_raw_address (arg); ++ value_type_arg_tmp = object_address_get_data (value_type_arg_tmp, ++ &address); ++ if (! value_type_arg_tmp) ++ error (_("Attempt to coerce non-valid value.")); ++ arg = value_at_lazy (value_type_arg_tmp, address); ++ do_cleanups (cleanups); + } -+} -+ -+ - /* Convert C numbers into newly allocated values. */ ++ else ++ value_type_arg_tmp = check_typedef (value_type (arg)); - struct value * -@@ -2205,6 +2324,19 @@ value_from_longest (struct type *type, LONGEST num) - } - - -+/* Convert C unsigned numbers into newly allocated values. */ -+ -+struct value * -+value_from_ulongest (struct type *type, ULONGEST num) -+{ -+ struct value *val = allocate_value (type); -+ -+ pack_unsigned_long (value_contents_raw (val), type, num); -+ -+ return val; -+} -+ -+ - /* Create a value representing a pointer of type TYPE to the address - ADDR. */ - struct value * -@@ -2363,4 +2495,8 @@ VARIABLE is already initialized.")); + if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF) + arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp), +@@ -2485,4 +2568,8 @@ VARIABLE is already initialized.")); add_prefix_cmd ("function", no_class, function_command, _("\ Placeholder command for showing help on convenience functions."), &functionlist, "function ", 0, &cmdlist); @@ -29106,27 +10956,21 @@ index a462ee4..968cdf4 100644 + observer_attach_mark_used (value_types_mark_used); } diff --git a/gdb/value.h b/gdb/value.h -index 1f2086e..dd503ad 100644 +index 12cbc0a..a508bf6 100644 --- a/gdb/value.h +++ b/gdb/value.h -@@ -342,11 +342,16 @@ extern LONGEST unpack_field_as_long (struct type *type, - extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num); - - extern struct value *value_from_longest (struct type *type, LONGEST num); -+extern struct value *value_from_ulongest (struct type *type, ULONGEST num); - extern struct value *value_from_pointer (struct type *type, CORE_ADDR addr); - extern struct value *value_from_double (struct type *type, DOUBLEST num); +@@ -372,6 +372,10 @@ extern struct value *value_from_double (struct type *type, DOUBLEST num); extern struct value *value_from_decfloat (struct type *type, const gdb_byte *decbytes); +extern const char *object_address_data_not_valid (struct type *type); -+extern int object_address_get_data (struct type *type, -+ CORE_ADDR *address_return); ++extern struct type *object_address_get_data (struct type *type, ++ CORE_ADDR *address_return); + extern struct value *value_at (struct type *type, CORE_ADDR addr); extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); -@@ -694,7 +699,7 @@ extern struct value *value_allocate_space_in_inferior (int); +@@ -729,7 +733,7 @@ extern struct value *value_allocate_space_in_inferior (int); extern struct value *value_of_local (const char *name, int complain); extern struct value *value_subscripted_rvalue (struct value *array, @@ -29136,7 +10980,7 @@ index 1f2086e..dd503ad 100644 /* User function handler. */ diff --git a/gdb/varobj.c b/gdb/varobj.c -index b4b2461..3a7a884 100644 +index b9b8e91..a81d25c 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -26,6 +26,8 @@ @@ -29148,37 +10992,3 @@ index b4b2461..3a7a884 100644 #include "gdb_assert.h" #include "gdb_string.h" -diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c -index acd7b50..0929a33 100644 ---- a/gdb/xcoffread.c -+++ b/gdb/xcoffread.c -@@ -3030,6 +3030,7 @@ static struct sym_fns xcoff_sym_fns = - xcoff_new_init, /* sym_new_init: init anything gbl to entire symtab */ - xcoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - xcoff_initial_scan, /* sym_read: read a symbol file into symtab */ -+ NULL, /* sym_read_psymbols */ - xcoff_symfile_finish, /* sym_finish: finished with file, cleanup */ - xcoff_symfile_offsets, /* sym_offsets: xlate offsets ext->int form */ - default_symfile_segments, /* sym_segments: Get segment information from -diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c -index 667d9b3..0d86219 100644 ---- a/gdb/xtensa-linux-tdep.c -+++ b/gdb/xtensa-linux-tdep.c -@@ -22,6 +22,7 @@ - - #include "solib-svr4.h" - #include "symtab.h" -+#include "linux-tdep.h" - - /* OS specific initialization of gdbarch. */ - -@@ -30,6 +31,9 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - { - set_solib_svr4_fetch_link_map_offsets - (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ -+ set_gdbarch_convert_from_func_ptr_addr (gdbarch, -+ linux_convert_from_func_ptr_addr); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch index 37bd001..f485b2f 100644 --- a/gdb-bz541866-rwatch-before-run.patch +++ b/gdb-bz541866-rwatch-before-run.patch @@ -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. + diff --git a/gdb-bz562763-pretty-print-2d-vectors-prereq.patch b/gdb-bz562763-pretty-print-2d-vectors-prereq.patch deleted file mode 100644 index 3cc1e17..0000000 --- a/gdb-bz562763-pretty-print-2d-vectors-prereq.patch +++ /dev/null @@ -1,427 +0,0 @@ -commit e5ea8d026015c2a0c7774788b425914857de1ffb -Author: pmuldoon -Date: Wed Apr 14 12:02:42 2010 +0000 - - 2010-04-14 Phil Muldoon - - 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 - - * 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 - - * 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 -+ -+ 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 - - PR corefiles/11481 -### a/gdb/doc/ChangeLog -### b/gdb/doc/ChangeLog -## -1,3 +1,8 @@ -+2010-04-14 Phil Muldoon -+ -+ * gdb.texinfo (Pretty Printing): Document behaviour when to_string -+ returns None. -+ - 2010-04-09 Stan Shebs - - * 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 diff --git a/gdb-bz562975-std-terminate-double-free.patch b/gdb-bz562975-std-terminate-double-free.patch deleted file mode 100644 index a54c550..0000000 --- a/gdb-bz562975-std-terminate-double-free.patch +++ /dev/null @@ -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 - - * 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, diff --git a/gdb-bz570635-prettyprint-doc1.patch b/gdb-bz570635-prettyprint-doc1.patch deleted file mode 100644 index df910f4..0000000 --- a/gdb-bz570635-prettyprint-doc1.patch +++ /dev/null @@ -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 -+ -+ * gdb.texinfo (Data): Link to pretty-printing. -+ (Output Formats): Likewise. Correct text. -+ - 2010-03-01 Daniel Jacobowitz - - * gdb.texinfo (Types): Describe and . ---- 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 diff --git a/gdb-bz570635-prettyprint-doc2.patch b/gdb-bz570635-prettyprint-doc2.patch deleted file mode 100644 index aa76fe1..0000000 --- a/gdb-bz570635-prettyprint-doc2.patch +++ /dev/null @@ -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 -+ -+ * 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 - - * 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 = @{ -+ > = @{ -+ <__gnu_cxx::new_allocator> = @{ -+ @}, -+ @}, -+ members of std::basic_string, -+ std::allocator >::_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 = @{ -- > = @{ -- <__gnu_cxx::new_allocator> = @{@}, @}, -- members of std::basic_string, std::allocator >::_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 diff --git a/gdb-bz574483-display-sepdebug.patch b/gdb-bz574483-display-sepdebug.patch deleted file mode 100644 index 64ddfa7..0000000 --- a/gdb-bz574483-display-sepdebug.patch +++ /dev/null @@ -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 - - * printcmd.c (display_uses_solib_p): Check also - SEPARATE_DEBUG_OBJFILE. - -gdb/testsuite/ -2010-04-03 Jan Kratochvil - - * 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 - diff --git a/gdb-bz575292-delayed-physname.patch b/gdb-bz575292-delayed-physname.patch index 770d52d..5e65974 100644 --- a/gdb-bz575292-delayed-physname.patch +++ b/gdb-bz575292-delayed-physname.patch @@ -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. + diff --git a/gdb-bz575292-void-workaround.patch b/gdb-bz575292-void-workaround.patch deleted file mode 100644 index 4d5a934..0000000 --- a/gdb-bz575292-void-workaround.patch +++ /dev/null @@ -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 - - 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 - - * 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 . */ -+ -+ .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 . -+ -+# 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" - diff --git a/gdb-bz578250-avx-01of10.patch b/gdb-bz578250-avx-01of10.patch deleted file mode 100644 index 90fdc0d..0000000 --- a/gdb-bz578250-avx-01of10.patch +++ /dev/null @@ -1,1733 +0,0 @@ -[ Backported. ] - -commit d454b7529a5e6134ace8541b341d079534f2062a -Author: H.J. Lu -Date: Mon Mar 1 15:33:29 2010 +0000 - - Enable XML target descriptions for x86. - - gdb/ - - 2010-03-01 H.J. Lu - - * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. - (amd64_linux_read_description): Likewise. - (_initialize_amd64_linux_nat): Set to_read_description to - amd64_linux_read_description. - - * amd64-linux-tdep.c: Include "features/i386/amd64-linux.c". - (amd64_linux_register_name): Removed. - (amd64_linux_register_type): Likewise. - (amd64_linux_core_read_description): New. - (amd64_linux_init_abi): Set target description to - tdesc_amd64_linux if needed. Support orig_rax in target - description. Don't call set_gdbarch_register_name nor - set_gdbarch_register_type. Call - set_gdbarch_core_read_description. - (_initialize_amd64_linux_tdep): Call - initialize_tdesc_amd64_linux. - - * amd64-linux-tdep.h (tdesc_amd64_linux): New. - - * amd64-tdep.c: Include "features/i386/amd64.c". - (amd64_register_names): Removed. - (amd64_register_name): Likewise. - (amd64_register_type): Likewise. - (amd64_init_abi): Set num_core_regs and register_names. Set - target description to tdesc_amd64 if needed. Don't call - set_gdbarch_register_name nor set_gdbarch_register_type. - (_initialize_amd64_tdep): New. - - * i386-linux-nat.c (i386_linux_read_description): New. - (_initialize_i386_linux_nat): Set to_read_description to - i386_linux_read_description. - - * i386-linux-tdep.c: Include "features/i386/i386-linux.c". - (i386_linux_register_name): Removed. - (i386_linux_core_read_description): New. - (i386_linux_read_description): Likewise. - (i386_linux_init_abi): Don't call set_gdbarch_register_name. - Set target description to tdesc_i386_linux if needed. Support - orig_eax. Set register_reggroup_p. Call - set_gdbarch_core_read_description. - (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux. - - * i386-linux-tdep.h (tdesc_i386_linux): New. - - * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS - with I387_NUM_REGS. - - * i386-tdep.c: Include "features/i386/i386.c". - (i386_register_names): Make it const. - (i386_mmx_names): Likewise. - (i386_num_register_names): Removed. - (i386_register_name): Likewise. - (i386_eflags_type): Likewise. - (i386_mxcsr_type): Likewise. - (i386_sse_type): Likewise. - (i386_register_type): Likewise. - (i387_ext_type): Call tdesc_find_type instead of arch_float_type. - (i386_pseudo_register_name): New. - (i386_pseudo_register_type): Likewise. - (i386_mmx_type): Make it static. - (i386_gdbarch_init): Check arch. Replace I386_NUM_FREGS with - I387_NUM_REGS. Set num_core_regs and register_names. Don't - call set_gdbarch_register_name nor set_gdbarch_register_type. - Set register_reggroup_p. Set target description to tdesc_i386 - if needed. Call set_tdesc_pseudo_register_type, - set_tdesc_pseudo_register_name and tdesc_use_registers. - (_initialize_i386_tdep): Call initialize_tdesc_i386. - initialize_tdesc_x86_64. - - * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, - i386_mxcsr_type and i386_sse_type. Add num_core_regs, - register_names, tdesc and register_reggroup_p. - (I386_NUM_FREGS): Removed. - (i386_eflags_type): Likewise. - (i386_mxcsr_type): Likewise. - (i386_mmx_type): Likewise. - (i386_sse_type): Likewise. - (i386_register_name): Likewise. - (i386_regnum): Add I386_MXCSR_REGNUM. - (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. - - * i387-tdep.h (I387_NUM_REGS): New. - - * regformats/i386/i386-linux.dat: Generated. - * regformats/i386/i386.dat: Likewise. - * regformats/i386/amd64-linux.dat: Likewise. - * regformats/i386/amd64.dat: Likewise. - - * regformats/reg-i386-linux.dat: Removed. - * regformats/reg-i386.dat: Likewise. - * regformats/reg-x86-64-linux.dat: Likewise. - * regformats/reg-x86-64.dat: Likewise. - - gdb/gdbserver/ - - 2010-03-01 H.J. Lu - - * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, - reg-i386-linux.c and reg-x86-64-linux.c with i386.c, amd64.c, - i386-linux.c and amd64-linux.c. - (reg-i386.o): Removed. - (reg-i386.c): Likewise. - (reg-i386-linux.o): Likewise. - (reg-i386-linux.c): Likewise. - (reg-x86-64.o): Likewise. - (reg-x86-64.c): Likewise. - (reg-x86-64-linux.o): Likewise. - (reg-x86-64-linux.c): Likewise. - (i386.o): New. - (i386.c): Likewise. - (i386-linux.o): Likewise. - (i386-linux.c): Likewise. - (amd64.o): Likewise. - (amd64.c): Likewise. - (amd64-linux.o): Likewise. - (amd64-linux.c): Likewise. - - * configure.srv (srv_i386_regobj): New. - (srv_i386_linux_regobj): Likewise. - (srv_amd64_regobj): Likewise. - (srv_amd64_linux_regobj): Likewise. - (srv_i386_32bit_xmlfiles): Likewise. - (srv_i386_64bit_xmlfiles): Likewise. - (srv_i386_xmlfiles): Likewise. - (srv_amd64_xmlfiles): Likewise. - (srv_i386_linux_xmlfiles): Likewise. - (srv_amd64_linux_xmlfiles): Likewise. - (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. Set - srv_xmlfiles to $srv_i386_xmlfiles. - (i[34567]86-*-mingw32ce*): Likewise. - (i[34567]86-*-mingw*): Likewise. - (i[34567]86-*-nto*): Likewise. - (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj - and $srv_amd64_linux_regobj. Set srv_xmlfiles to - $srv_i386_linux_xmlfiles and $srv_amd64_linux_xmlfiles. - (x86_64-*-linux*): Likewise. - - * linux-x86-low.c (init_registers_x86_64_linux): Removed. - (init_registers_amd64_linux): New. - (x86_arch_setup): Replace init_registers_x86_64_linux with - init_registers_amd64_linux. - - gdb/testsuite/ - - 2010-03-01 H.J. Lu - - * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. - (load_description): Set architecture if defined. - ---- ./gdb/amd64-linux-nat.c 2010-04-03 20:24:51.000000000 +0200 -+++ ./gdb/amd64-linux-nat.c 2010-04-03 20:59:52.000000000 +0200 -@@ -817,6 +817,39 @@ amd64_linux_siginfo_fixup (struct siginf - return 0; - } - -+/* Get Linux/x86 target description from running target. -+ -+ Value of CS segment register: -+ 1. 64bit process: 0x33. -+ 2. 32bit process: 0x23. -+ */ -+ -+#define AMD64_LINUX_USER64_CS 0x33 -+ -+static const struct target_desc * -+amd64_linux_read_description (struct target_ops *ops) -+{ -+ unsigned long cs; -+ int tid; -+ -+ /* GNU/Linux LWP ID's are process ID's. */ -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */ -+ -+ /* Get CS register. */ -+ errno = 0; -+ cs = ptrace (PTRACE_PEEKUSER, tid, -+ offsetof (struct user_regs_struct, cs), 0); -+ if (errno != 0) -+ perror_with_name (_("Couldn't get CS register")); -+ -+ if (cs == AMD64_LINUX_USER64_CS) -+ return tdesc_amd64_linux; -+ else -+ return tdesc_i386_linux; -+} -+ - /* Provide a prototype to silence -Wmissing-prototypes. */ - void _initialize_amd64_linux_nat (void); - -@@ -861,6 +894,8 @@ _initialize_amd64_linux_nat (void) - linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus; - linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg; - -+ t->to_read_description = amd64_linux_read_description; -+ - /* Register the target. */ - linux_nat_add_target (t); - linux_nat_set_new_thread (t, amd64_linux_new_thread); ---- ./gdb/amd64-linux-tdep.c 2010-04-03 20:24:51.000000000 +0200 -+++ ./gdb/amd64-linux-tdep.c 2010-04-03 20:59:52.000000000 +0200 -@@ -37,6 +37,8 @@ - #include "solib-svr4.h" - #include "xml-syscall.h" - -+#include "features/i386/amd64-linux.c" -+ - /* The syscall's XML filename for i386. */ - #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" - -@@ -234,26 +236,6 @@ static int amd64_linux_sc_reg_offset[] = - -1 /* %gs */ - }; - --/* Replacement register functions which know about %orig_rax. */ -- --static const char * --amd64_linux_register_name (struct gdbarch *gdbarch, int reg) --{ -- if (reg == AMD64_LINUX_ORIG_RAX_REGNUM) -- return "orig_rax"; -- -- return amd64_register_name (gdbarch, reg); --} -- --static struct type * --amd64_linux_register_type (struct gdbarch *gdbarch, int reg) --{ -- if (reg == AMD64_LINUX_ORIG_RAX_REGNUM) -- return builtin_type (gdbarch)->builtin_int64; -- -- return amd64_register_type (gdbarch, reg); --} -- - static int - amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) -@@ -1334,10 +1316,32 @@ amd64_linux_record_signal (struct gdbarc - return 0; - } - -+/* Get Linux/x86 target description from core dump. */ -+ -+static const struct target_desc * -+amd64_linux_core_read_description (struct gdbarch *gdbarch, -+ struct target_ops *target, -+ bfd *abfd) -+{ -+ asection *section = bfd_get_section_by_name (abfd, ".reg2"); -+ -+ if (section == NULL) -+ return NULL; -+ -+ /* Linux/x86-64. */ -+ return tdesc_amd64_linux; -+} -+ - static void - amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ const struct target_desc *tdesc = info.target_desc; -+ struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info; -+ const struct tdesc_feature *feature; -+ int valid_p; -+ -+ gdb_assert (tdesc_data); - - tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset; - tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset); -@@ -1345,6 +1349,23 @@ amd64_linux_init_abi (struct gdbarch_inf - - amd64_init_abi (info, gdbarch); - -+ /* Reserve a number for orig_rax. */ -+ set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS); -+ -+ if (! tdesc_has_registers (tdesc)) -+ tdesc = tdesc_amd64_linux; -+ tdep->tdesc = tdesc; -+ -+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux"); -+ if (feature == NULL) -+ return; -+ -+ valid_p = tdesc_numbered_register (feature, tdesc_data, -+ AMD64_LINUX_ORIG_RAX_REGNUM, -+ "orig_rax"); -+ if (!valid_p) -+ return; -+ - tdep->sigtramp_p = amd64_linux_sigtramp_p; - tdep->sigcontext_addr = amd64_linux_sigcontext_addr; - tdep->sc_reg_offset = amd64_linux_sc_reg_offset; -@@ -1358,10 +1379,8 @@ amd64_linux_init_abi (struct gdbarch_inf - - /* Add the %orig_rax register used for syscall restarting. */ - set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc); -- set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS); -- set_gdbarch_register_name (gdbarch, amd64_linux_register_name); -- set_gdbarch_register_type (gdbarch, amd64_linux_register_type); -- set_gdbarch_register_reggroup_p (gdbarch, amd64_linux_register_reggroup_p); -+ -+ tdep->register_reggroup_p = amd64_linux_register_reggroup_p; - - /* Functions for 'catch syscall'. */ - set_xml_syscall_file_name (XML_SYSCALL_FILENAME_AMD64); -@@ -1375,6 +1394,9 @@ amd64_linux_init_abi (struct gdbarch_inf - /* GNU/Linux uses SVR4-style shared libraries. */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - -+ set_gdbarch_core_read_description (gdbarch, -+ amd64_linux_core_read_description); -+ - /* Displaced stepping. */ - set_gdbarch_displaced_step_copy_insn (gdbarch, - amd64_displaced_step_copy_insn); -@@ -1571,4 +1593,7 @@ _initialize_amd64_linux_tdep (void) - { - gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, - GDB_OSABI_LINUX, amd64_linux_init_abi); -+ -+ /* Initialize the Linux target description */ -+ initialize_tdesc_amd64_linux (); - } ---- ./gdb/amd64-linux-tdep.h 2010-01-01 08:31:29.000000000 +0100 -+++ ./gdb/amd64-linux-tdep.h 2010-04-03 20:59:52.000000000 +0200 -@@ -31,6 +31,9 @@ - /* Total number of registers for GNU/Linux. */ - #define AMD64_LINUX_NUM_REGS (AMD64_LINUX_ORIG_RAX_REGNUM + 1) - -+/* Linux target description. */ -+extern struct target_desc *tdesc_amd64_linux; -+ - /* Enum that defines the syscall identifiers for amd64 linux. - Used for process record/replay, these will be translated into - a gdb-canonical set of syscall ids in linux-record.c. */ ---- ./gdb/amd64-tdep.c 2010-04-03 20:24:51.000000000 +0200 -+++ ./gdb/amd64-tdep.c 2010-04-03 20:59:52.000000000 +0200 -@@ -42,6 +42,8 @@ - #include "amd64-tdep.h" - #include "i387-tdep.h" - -+#include "features/i386/amd64.c" -+ - /* Note that the AMD64 architecture was previously known as x86-64. - The latter is (forever) engraved into the canonical system name as - returned by config.guess, and used as the name for the AMD64 port -@@ -83,47 +85,6 @@ static int amd64_dummy_call_integer_regs - 9 /* %r9 */ - }; - --/* Return the name of register REGNUM. */ -- --const char * --amd64_register_name (struct gdbarch *gdbarch, int regnum) --{ -- if (regnum >= 0 && regnum < AMD64_NUM_REGS) -- return amd64_register_names[regnum]; -- -- return NULL; --} -- --/* Return the GDB type object for the "standard" data type of data in -- register REGNUM. */ -- --struct type * --amd64_register_type (struct gdbarch *gdbarch, int regnum) --{ -- if (regnum >= AMD64_RAX_REGNUM && regnum <= AMD64_RDI_REGNUM) -- return builtin_type (gdbarch)->builtin_int64; -- if (regnum == AMD64_RBP_REGNUM || regnum == AMD64_RSP_REGNUM) -- return builtin_type (gdbarch)->builtin_data_ptr; -- if (regnum >= AMD64_R8_REGNUM && regnum <= AMD64_R15_REGNUM) -- return builtin_type (gdbarch)->builtin_int64; -- if (regnum == AMD64_RIP_REGNUM) -- return builtin_type (gdbarch)->builtin_func_ptr; -- if (regnum == AMD64_EFLAGS_REGNUM) -- return i386_eflags_type (gdbarch); -- if (regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM) -- return builtin_type (gdbarch)->builtin_int32; -- if (regnum >= AMD64_ST0_REGNUM && regnum <= AMD64_ST0_REGNUM + 7) -- return i387_ext_type (gdbarch); -- if (regnum >= AMD64_FCTRL_REGNUM && regnum <= AMD64_FCTRL_REGNUM + 7) -- return builtin_type (gdbarch)->builtin_int32; -- if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15) -- return i386_sse_type (gdbarch); -- if (regnum == AMD64_MXCSR_REGNUM) -- return i386_mxcsr_type (gdbarch); -- -- internal_error (__FILE__, __LINE__, _("invalid regnum")); --} -- - /* DWARF Register Number Mapping as defined in the System V psABI, - section 3.6. */ - -@@ -2158,11 +2119,19 @@ void - amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ const struct target_desc *tdesc = info.target_desc; - - /* AMD64 generally uses `fxsave' instead of `fsave' for saving its - floating-point registers. */ - tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE; - -+ if (! tdesc_has_registers (tdesc)) -+ tdesc = tdesc_amd64; -+ tdep->tdesc = tdesc; -+ -+ tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS; -+ tdep->register_names = amd64_register_names; -+ - /* AMD64 has an FPU and 16 SSE registers. */ - tdep->st0_regnum = AMD64_ST0_REGNUM; - tdep->num_xmm_regs = 16; -@@ -2178,8 +2147,6 @@ amd64_init_abi (struct gdbarch_info info - set_gdbarch_long_double_bit (gdbarch, 128); - - set_gdbarch_num_regs (gdbarch, AMD64_NUM_REGS); -- set_gdbarch_register_name (gdbarch, amd64_register_name); -- set_gdbarch_register_type (gdbarch, amd64_register_type); - - /* Register numbers of various important registers. */ - set_gdbarch_sp_regnum (gdbarch, AMD64_RSP_REGNUM); /* %rsp */ -@@ -2241,6 +2208,15 @@ amd64_init_abi (struct gdbarch_info info - - set_gdbarch_get_longjmp_target (gdbarch, amd64_get_longjmp_target); - } -+ -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+void _initialize_amd64_tdep (void); -+ -+void -+_initialize_amd64_tdep (void) -+{ -+ initialize_tdesc_amd64 (); -+} - - - /* The 64-bit FXSAVE format differs from the 32-bit format in the ---- ./gdb/gdbserver/Makefile.in 2010-01-04 16:03:00.000000000 +0100 -+++ ./gdb/gdbserver/Makefile.in 2010-04-03 20:59:52.000000000 +0200 -@@ -203,9 +203,9 @@ clean: - rm -f *.o ${ADD_FILES} *~ - rm -f version.c - rm -f gdbserver$(EXEEXT) gdbreplay$(EXEEXT) core make.log -- rm -f reg-arm.c reg-i386.c reg-ia64.c reg-m32r.c reg-m68k.c -- rm -f reg-sh.c reg-sparc.c reg-spu.c reg-x86-64.c reg-i386-linux.c -- rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c reg-xtensa.c -+ rm -f reg-arm.c i386.c reg-ia64.c reg-m32r.c reg-m68k.c -+ rm -f reg-sh.c reg-sparc.c reg-spu.c amd64.c i386-linux.c -+ rm -f reg-cris.c reg-crisv32.c amd64-linux.c reg-xtensa.c - rm -f arm-with-iwmmxt.c - rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c - rm -f mips-linux.c mips64-linux.c -@@ -345,12 +345,12 @@ reg-cris.c : $(srcdir)/../regformats/reg - reg-crisv32.o : reg-crisv32.c $(regdef_h) - reg-crisv32.c : $(srcdir)/../regformats/reg-crisv32.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-crisv32.dat reg-crisv32.c --reg-i386.o : reg-i386.c $(regdef_h) --reg-i386.c : $(srcdir)/../regformats/reg-i386.dat $(regdat_sh) -- $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-i386.dat reg-i386.c --reg-i386-linux.o : reg-i386-linux.c $(regdef_h) --reg-i386-linux.c : $(srcdir)/../regformats/reg-i386-linux.dat $(regdat_sh) -- $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-i386-linux.dat reg-i386-linux.c -+i386.o : i386.c $(regdef_h) -+i386.c : $(srcdir)/../regformats/i386/i386.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386.dat i386.c -+i386-linux.o : i386-linux.c $(regdef_h) -+i386-linux.c : $(srcdir)/../regformats/i386/i386-linux.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-linux.dat i386-linux.c - reg-ia64.o : reg-ia64.c $(regdef_h) - reg-ia64.c : $(srcdir)/../regformats/reg-ia64.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-ia64.dat reg-ia64.c -@@ -432,12 +432,12 @@ reg-sparc64.c : $(srcdir)/../regformats/ - reg-spu.o : reg-spu.c $(regdef_h) - reg-spu.c : $(srcdir)/../regformats/reg-spu.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-spu.dat reg-spu.c --reg-x86-64.o : reg-x86-64.c $(regdef_h) --reg-x86-64.c : $(srcdir)/../regformats/reg-x86-64.dat $(regdat_sh) -- $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-x86-64.dat reg-x86-64.c --reg-x86-64-linux.o : reg-x86-64-linux.c $(regdef_h) --reg-x86-64-linux.c : $(srcdir)/../regformats/reg-x86-64-linux.dat $(regdat_sh) -- $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-x86-64-linux.dat reg-x86-64-linux.c -+amd64.o : amd64.c $(regdef_h) -+amd64.c : $(srcdir)/../regformats/i386/amd64.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64.dat amd64.c -+amd64-linux.o : amd64-linux.c $(regdef_h) -+amd64-linux.c : $(srcdir)/../regformats/i386/amd64-linux.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-linux.dat amd64-linux.c - reg-xtensa.o : reg-xtensa.c $(regdef_h) - reg-xtensa.c : $(srcdir)/../regformats/reg-xtensa.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-xtensa.dat reg-xtensa.c ---- ./gdb/gdbserver/configure.srv 2010-01-04 16:03:00.000000000 +0100 -+++ ./gdb/gdbserver/configure.srv 2010-04-03 20:59:52.000000000 +0200 -@@ -22,6 +22,18 @@ - # Default hostio_last_error implementation - srv_hostio_err_objs="hostio-errno.o" - -+srv_i386_regobj=i386.o -+srv_i386_linux_regobj=i386-linux.o -+srv_amd64_regobj=amd64.o -+srv_amd64_linux_regobj=amd64-linux.o -+ -+srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml" -+srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml" -+srv_i386_xmlfiles="i386/i386.xml $srv_i386_32bit_xmlfiles" -+srv_amd64_xmlfiles="i386/amd64.xml $srv_i386_64bit_xmlfiles" -+srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles" -+srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles" -+ - # Input is taken from the "${target}" variable. - - case "${target}" in -@@ -60,12 +72,15 @@ case "${target}" in - srv_linux_usrregs=yes - srv_linux_thread_db=yes - ;; -- i[34567]86-*-cygwin*) srv_regobj=reg-i386.o -+ i[34567]86-*-cygwin*) srv_regobj="$srv_i386_regobj" - srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o" -+ srv_xmlfiles="$srv_i386_xmlfiles" - ;; -- i[34567]86-*-linux*) srv_regobj=reg-i386-linux.o -+ i[34567]86-*-linux*) srv_regobj="$srv_i386_linux_regobj" -+ srv_xmlfiles="$srv_i386_linux_xmlfiles" - if test "$gdb_cv_i386_is_x86_64" = yes ; then -- srv_regobj="reg-x86-64-linux.o $srv_regobj" -+ srv_regobj="$srv_regobj $srv_amd64_linux_regobj" -+ srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles" - fi - srv_tgtobj="linux-low.o linux-x86-low.o i386-low.o i387-fp.o" - srv_linux_usrregs=yes -@@ -73,20 +88,23 @@ case "${target}" in - srv_linux_thread_db=yes - ;; - i[34567]86-*-mingw32ce*) -- srv_regobj=reg-i386.o -+ srv_regobj="$srv_i386_regobj" - srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o" - srv_tgtobj="${srv_tgtobj} wincecompat.o" -+ srv_xmlfiles="$srv_i386_xmlfiles" - # hostio_last_error implementation is in win32-low.c - srv_hostio_err_objs="" - srv_mingw=yes - srv_mingwce=yes - ;; -- i[34567]86-*-mingw*) srv_regobj=reg-i386.o -+ i[34567]86-*-mingw*) srv_regobj="$srv_i386_regobj" - srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o" -+ srv_xmlfiles="$srv_i386_xmlfiles" - srv_mingw=yes - ;; -- i[34567]86-*-nto*) srv_regobj=reg-i386.o -+ i[34567]86-*-nto*) srv_regobj="$srv_i386_regobj" - srv_tgtobj="nto-low.o nto-x86-low.o" -+ srv_xmlfiles="$srv_i386_xmlfiles" - srv_qnx="yes" - ;; - ia64-*-linux*) srv_regobj=reg-ia64.o -@@ -206,8 +224,9 @@ case "${target}" in - spu*-*-*) srv_regobj=reg-spu.o - srv_tgtobj="spu-low.o" - ;; -- x86_64-*-linux*) srv_regobj="reg-x86-64-linux.o reg-i386-linux.o" -+ x86_64-*-linux*) srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj" - srv_tgtobj="linux-low.o linux-x86-low.o i386-low.o i387-fp.o" -+ srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles" - srv_linux_usrregs=yes # This is for i386 progs. - srv_linux_regsets=yes - srv_linux_thread_db=yes ---- ./gdb/gdbserver/linux-x86-low.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-x86-low.c 2010-04-03 20:59:52.000000000 +0200 -@@ -27,10 +27,10 @@ - - #include "gdb_proc_service.h" - --/* Defined in auto-generated file reg-i386-linux.c. */ -+/* Defined in auto-generated file i386-linux.c. */ - void init_registers_i386_linux (void); --/* Defined in auto-generated file reg-x86-64-linux.c. */ --void init_registers_x86_64_linux (void); -+/* Defined in auto-generated file amd64-linux.c. */ -+void init_registers_amd64_linux (void); - - #include - #include -@@ -792,7 +792,7 @@ x86_arch_setup (void) - } - else if (use_64bit) - { -- init_registers_x86_64_linux (); -+ init_registers_amd64_linux (); - - /* Amd64 doesn't have HAVE_LINUX_USRREGS. */ - the_low_target.num_regs = -1; ---- ./gdb/i386-linux-nat.c 2010-04-03 20:24:51.000000000 +0200 -+++ ./gdb/i386-linux-nat.c 2010-04-03 20:59:52.000000000 +0200 -@@ -868,6 +868,14 @@ i386_linux_child_post_startup_inferior ( - super_post_startup_inferior (ptid); - } - -+/* Get Linux/x86 target description from running target. */ -+ -+static const struct target_desc * -+i386_linux_read_description (struct target_ops *ops) -+{ -+ return tdesc_i386_linux; -+} -+ - void - _initialize_i386_linux_nat (void) - { -@@ -897,6 +905,8 @@ _initialize_i386_linux_nat (void) - t->to_fetch_registers = i386_linux_fetch_inferior_registers; - t->to_store_registers = i386_linux_store_inferior_registers; - -+ t->to_read_description = i386_linux_read_description; -+ - /* Register the target. */ - linux_nat_add_target (t); - linux_nat_set_new_thread (t, i386_linux_new_thread); ---- ./gdb/i386-linux-tdep.c 2010-04-03 20:24:51.000000000 +0200 -+++ ./gdb/i386-linux-tdep.c 2010-04-03 20:59:52.000000000 +0200 -@@ -46,6 +46,8 @@ - #include "linux-record.h" - #include - -+#include "features/i386/i386-linux.c" -+ - /* Supported register note sections. */ - static struct core_regset_section i386_linux_regset_sections[] = - { -@@ -55,18 +57,6 @@ static struct core_regset_section i386_l - { NULL, 0 } - }; - --/* Return the name of register REG. */ -- --static const char * --i386_linux_register_name (struct gdbarch *gdbarch, int reg) --{ -- /* Deal with the extra "orig_eax" pseudo register. */ -- if (reg == I386_LINUX_ORIG_EAX_REGNUM) -- return "orig_eax"; -- -- return i386_register_name (gdbarch, reg); --} -- - /* Return non-zero, when the register is in the corresponding register - group. Put the LINUX_ORIG_EAX register in the system group. */ - static int -@@ -570,21 +560,57 @@ static int i386_linux_sc_reg_offset[] = - 0 * 4 /* %gs */ - }; - -+/* Get Linux/x86 target description from core dump. */ -+ -+static const struct target_desc * -+i386_linux_core_read_description (struct gdbarch *gdbarch, -+ struct target_ops *target, -+ bfd *abfd) -+{ -+ asection *section = bfd_get_section_by_name (abfd, ".reg2"); -+ -+ if (section == NULL) -+ return NULL; -+ -+ /* Linux/i386. */ -+ return tdesc_i386_linux; -+} -+ - static void - i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ const struct target_desc *tdesc = info.target_desc; -+ struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info; -+ const struct tdesc_feature *feature; -+ int valid_p; -+ -+ gdb_assert (tdesc_data); - - /* GNU/Linux uses ELF. */ - i386_elf_init_abi (info, gdbarch); - -- /* Since we have the extra "orig_eax" register on GNU/Linux, we have -- to adjust a few things. */ -+ /* Reserve a number for orig_eax. */ -+ set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS); -+ -+ if (! tdesc_has_registers (tdesc)) -+ tdesc = tdesc_i386_linux; -+ tdep->tdesc = tdesc; -+ -+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux"); -+ if (feature == NULL) -+ return; -+ -+ valid_p = tdesc_numbered_register (feature, tdesc_data, -+ I386_LINUX_ORIG_EAX_REGNUM, -+ "orig_eax"); -+ if (!valid_p) -+ return; - -+ /* Add the %orig_eax register used for syscall restarting. */ - set_gdbarch_write_pc (gdbarch, i386_linux_write_pc); -- set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS); -- set_gdbarch_register_name (gdbarch, i386_linux_register_name); -- set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p); -+ -+ tdep->register_reggroup_p = i386_linux_register_reggroup_p; - - tdep->gregset_reg_offset = i386_linux_gregset_reg_offset; - tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset); -@@ -783,6 +809,9 @@ i386_linux_init_abi (struct gdbarch_info - /* Install supported register note sections. */ - set_gdbarch_core_regset_sections (gdbarch, i386_linux_regset_sections); - -+ set_gdbarch_core_read_description (gdbarch, -+ i386_linux_core_read_description); -+ - /* Displaced stepping. */ - set_gdbarch_displaced_step_copy_insn (gdbarch, - simple_displaced_step_copy_insn); -@@ -811,4 +840,7 @@ _initialize_i386_linux_tdep (void) - { - gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX, - i386_linux_init_abi); -+ -+ /* Initialize the Linux target description */ -+ initialize_tdesc_i386_linux (); - } ---- ./gdb/i386-linux-tdep.h 2010-01-01 08:31:34.000000000 +0100 -+++ ./gdb/i386-linux-tdep.h 2010-04-03 20:59:52.000000000 +0200 -@@ -35,4 +35,7 @@ - /* Total number of registers for GNU/Linux. */ - #define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1) - -+/* Linux target description. */ -+extern struct target_desc *tdesc_i386_linux; -+ - #endif /* i386-linux-tdep.h */ ---- ./gdb/i386-nto-tdep.c 2010-01-01 08:31:34.000000000 +0100 -+++ ./gdb/i386-nto-tdep.c 2010-04-03 20:59:52.000000000 +0200 -@@ -122,7 +122,7 @@ i386nto_regset_id (int regno) - return NTO_REG_END; - else if (regno < I386_NUM_GREGS) - return NTO_REG_GENERAL; -- else if (regno < I386_NUM_GREGS + I386_NUM_FREGS) -+ else if (regno < I386_NUM_GREGS + I387_NUM_REGS) - return NTO_REG_FLOAT; - else if (regno < I386_SSE_NUM_REGS) - return NTO_REG_FLOAT; /* We store xmm registers in fxsave_area. */ ---- ./gdb/i386-tdep.c 2010-04-03 20:24:51.000000000 +0200 -+++ ./gdb/i386-tdep.c 2010-04-03 20:59:52.000000000 +0200 -@@ -54,9 +54,11 @@ - #include "record.h" - #include - -+#include "features/i386/i386.c" -+ - /* Register names. */ - --static char *i386_register_names[] = -+static const char *i386_register_names[] = - { - "eax", "ecx", "edx", "ebx", - "esp", "ebp", "esi", "edi", -@@ -71,11 +73,9 @@ static char *i386_register_names[] = - "mxcsr" - }; - --static const int i386_num_register_names = ARRAY_SIZE (i386_register_names); -- - /* Register names for MMX pseudo-registers. */ - --static char *i386_mmx_names[] = -+static const char *i386_mmx_names[] = - { - "mm0", "mm1", "mm2", "mm3", - "mm4", "mm5", "mm6", "mm7" -@@ -147,16 +147,11 @@ i386_fpc_regnum_p (struct gdbarch *gdbar - - /* Return the name of register REGNUM. */ - --const char * --i386_register_name (struct gdbarch *gdbarch, int regnum) -+static const char * -+i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum) - { -- if (i386_mmx_regnum_p (gdbarch, regnum)) -- return i386_mmx_names[regnum - I387_MM0_REGNUM (gdbarch_tdep (gdbarch))]; -- -- if (regnum >= 0 && regnum < i386_num_register_names) -- return i386_register_names[regnum]; -- -- return NULL; -+ gdb_assert (i386_mmx_regnum_p (gdbarch, regnum)); -+ return i386_mmx_names[regnum - I387_MM0_REGNUM (gdbarch_tdep (gdbarch))]; - } - - /* Convert a dbx register number REG to the appropriate register -@@ -2112,87 +2107,22 @@ i386_return_value (struct gdbarch *gdbar - } - - --/* Construct types for ISA-specific registers. */ --struct type * --i386_eflags_type (struct gdbarch *gdbarch) --{ -- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -- -- if (!tdep->i386_eflags_type) -- { -- 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"); -- -- tdep->i386_eflags_type = type; -- } -- -- return tdep->i386_eflags_type; --} -- --struct type * --i386_mxcsr_type (struct gdbarch *gdbarch) --{ -- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -- -- if (!tdep->i386_mxcsr_type) -- { -- 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"); -- -- tdep->i386_mxcsr_type = type; -- } -- -- return tdep->i386_mxcsr_type; --} -- - struct type * - i387_ext_type (struct gdbarch *gdbarch) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - if (!tdep->i387_ext_type) -- tdep->i387_ext_type -- = arch_float_type (gdbarch, -1, "builtin_type_i387_ext", -- floatformats_i387_ext); -+ { -+ tdep->i387_ext_type = tdesc_find_type (gdbarch, "i387_ext"); -+ gdb_assert (tdep->i387_ext_type != NULL); -+ } - - return tdep->i387_ext_type; - } - - /* Construct vector type for MMX registers. */ --struct type * -+static struct type * - i386_mmx_type (struct gdbarch *gdbarch) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -@@ -2233,84 +2163,14 @@ i386_mmx_type (struct gdbarch *gdbarch) - return tdep->i386_mmx_type; - } - --struct type * --i386_sse_type (struct gdbarch *gdbarch) --{ -- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -- -- if (!tdep->i386_sse_type) -- { -- const struct builtin_type *bt = builtin_type (gdbarch); -- -- /* The type we're building is this: */ --#if 0 -- union __gdb_builtin_type_vec128i -- { -- int128_t uint128; -- int64_t v2_int64[2]; -- int32_t v4_int32[4]; -- int16_t v8_int16[8]; -- int8_t v16_int8[16]; -- double v2_double[2]; -- float v4_float[4]; -- }; --#endif -- -- struct type *t; -- -- t = arch_composite_type (gdbarch, -- "__gdb_builtin_type_vec128i", TYPE_CODE_UNION); -- append_composite_type_field (t, "v4_float", -- init_vector_type (bt->builtin_float, 4)); -- append_composite_type_field (t, "v2_double", -- init_vector_type (bt->builtin_double, 2)); -- append_composite_type_field (t, "v16_int8", -- init_vector_type (bt->builtin_int8, 16)); -- append_composite_type_field (t, "v8_int16", -- init_vector_type (bt->builtin_int16, 8)); -- append_composite_type_field (t, "v4_int32", -- init_vector_type (bt->builtin_int32, 4)); -- append_composite_type_field (t, "v2_int64", -- init_vector_type (bt->builtin_int64, 2)); -- append_composite_type_field (t, "uint128", bt->builtin_int128); -- -- TYPE_VECTOR (t) = 1; -- TYPE_NAME (t) = "builtin_type_vec128i"; -- tdep->i386_sse_type = t; -- } -- -- return tdep->i386_sse_type; --} -- - /* Return the GDB type object for the "standard" data type of data in -- register REGNUM. Perhaps %esi and %edi should go here, but -- potentially they could be used for things other than address. */ -+ register REGNUM. */ - - static struct type * --i386_register_type (struct gdbarch *gdbarch, int regnum) -+i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum) - { -- if (regnum == I386_EIP_REGNUM) -- return builtin_type (gdbarch)->builtin_func_ptr; -- -- if (regnum == I386_EFLAGS_REGNUM) -- return i386_eflags_type (gdbarch); -- -- if (regnum == I386_EBP_REGNUM || regnum == I386_ESP_REGNUM) -- return builtin_type (gdbarch)->builtin_data_ptr; -- -- if (i386_fp_regnum_p (gdbarch, regnum)) -- return i387_ext_type (gdbarch); -- -- if (i386_mmx_regnum_p (gdbarch, regnum)) -- return i386_mmx_type (gdbarch); -- -- if (i386_sse_regnum_p (gdbarch, regnum)) -- return i386_sse_type (gdbarch); -- -- if (regnum == I387_MXCSR_REGNUM (gdbarch_tdep (gdbarch))) -- return i386_mxcsr_type (gdbarch); -- -- return builtin_type (gdbarch)->builtin_int; -+ gdb_assert (i386_mmx_regnum_p (gdbarch, regnum)); -+ return i386_mmx_type (gdbarch); - } - - /* Map a cooked register onto a raw register or memory. For the i386, -@@ -2761,7 +2621,7 @@ i386_go32_init_abi (struct gdbarch_info - - /* DJGPP does not support the SSE registers. */ - tdep->num_xmm_regs = 0; -- set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS); -+ set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I387_NUM_REGS); - - /* Native compiler is GCC, which uses the SVR4 register numbering - even in COFF and STABS. See the comment in i386_gdbarch_init, -@@ -5623,12 +5483,50 @@ i386_fast_tracepoint_valid_at (struct gd - return 1; - } - -+static int -+i386_validate_tdesc_p (struct gdbarch_tdep *tdep, -+ struct tdesc_arch_data *tdesc_data) -+{ -+ const struct target_desc *tdesc = tdep->tdesc; -+ const struct tdesc_feature *feature_core, *feature_vector; -+ int i, num_regs, valid_p; -+ -+ if (! tdesc_has_registers (tdesc)) -+ return 0; -+ -+ /* Get core registers. */ -+ feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core"); -+ -+ /* Get SSE registers. */ -+ feature_vector = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"); -+ -+ if (feature_core == NULL || feature_vector == NULL) -+ return 0; -+ -+ valid_p = 1; -+ -+ num_regs = tdep->num_core_regs; -+ for (i = 0; i < num_regs; i++) -+ valid_p &= tdesc_numbered_register (feature_core, tdesc_data, i, -+ tdep->register_names[i]); -+ -+ /* Need to include %mxcsr, so add one. */ -+ num_regs += tdep->num_xmm_regs + 1; -+ for (; i < num_regs; i++) -+ valid_p &= tdesc_numbered_register (feature_vector, tdesc_data, i, -+ tdep->register_names[i]); -+ -+ return valid_p; -+} -+ - - static struct gdbarch * - i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - { - struct gdbarch_tdep *tdep; - struct gdbarch *gdbarch; -+ struct tdesc_arch_data *tdesc_data; -+ const struct target_desc *tdesc; - - /* If there is already a candidate, use it. */ - arches = gdbarch_list_lookup_by_info (arches, &info); -@@ -5699,12 +5597,6 @@ i386_gdbarch_init (struct gdbarch_info i - alignment. */ - set_gdbarch_long_double_bit (gdbarch, 96); - -- /* The default ABI includes general-purpose registers, -- floating-point registers, and the SSE registers. */ -- set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); -- set_gdbarch_register_name (gdbarch, i386_register_name); -- set_gdbarch_register_type (gdbarch, i386_register_type); -- - /* Register numbers of various important registers. */ - set_gdbarch_sp_regnum (gdbarch, I386_ESP_REGNUM); /* %esp */ - set_gdbarch_pc_regnum (gdbarch, I386_EIP_REGNUM); /* %eip */ -@@ -5775,11 +5667,6 @@ i386_gdbarch_init (struct gdbarch_info i - - set_gdbarch_frame_args_skip (gdbarch, 8); - -- /* Wire in the MMX registers. */ -- set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs); -- set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read); -- set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write); -- - set_gdbarch_print_insn (gdbarch, i386_print_insn); - - set_gdbarch_dummy_id (gdbarch, i386_dummy_id); -@@ -5788,7 +5675,7 @@ i386_gdbarch_init (struct gdbarch_info i - - /* Add the i386 register groups. */ - i386_add_reggroups (gdbarch); -- set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p); -+ tdep->register_reggroup_p = i386_register_reggroup_p; - - /* Helper for function argument information. */ - set_gdbarch_fetch_pointer_argument (gdbarch, i386_fetch_pointer_argument); -@@ -5806,9 +5693,49 @@ i386_gdbarch_init (struct gdbarch_info i - - frame_base_set_default (gdbarch, &i386_frame_base); - -+ /* Wire in the MMX registers. */ -+ set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs); -+ set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read); -+ set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write); -+ -+ set_tdesc_pseudo_register_type (gdbarch, i386_pseudo_register_type); -+ set_tdesc_pseudo_register_name (gdbarch, i386_pseudo_register_name); -+ -+ /* The default ABI includes general-purpose registers, -+ floating-point registers, and the SSE registers. */ -+ set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); -+ -+ /* Get the x86 target description from INFO. */ -+ tdesc = info.target_desc; -+ if (! tdesc_has_registers (tdesc)) -+ tdesc = tdesc_i386; -+ tdep->tdesc = tdesc; -+ -+ tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS; -+ tdep->register_names = i386_register_names; -+ -+ tdesc_data = tdesc_data_alloc (); -+ - /* Hook in ABI-specific overrides, if they have been registered. */ -+ info.tdep_info = (void *) tdesc_data; - gdbarch_init_osabi (info, gdbarch); - -+ /* Target description may be changed. */ -+ tdesc = tdep->tdesc; -+ -+ if (!i386_validate_tdesc_p (tdep, tdesc_data)) -+ { -+ tdesc_data_cleanup (tdesc_data); -+ xfree (tdep); -+ gdbarch_free (gdbarch); -+ return NULL; -+ } -+ -+ tdesc_use_registers (gdbarch, tdesc, tdesc_data); -+ -+ /* Override gdbarch_register_reggroup_p set in tdesc_use_registers. */ -+ set_gdbarch_register_reggroup_p (gdbarch, tdep->register_reggroup_p); -+ - /* Hook in the legacy prologue-based unwinders last (fallback). */ - frame_unwind_append_unwinder (gdbarch, &i386_sigtramp_frame_unwind); - frame_unwind_append_unwinder (gdbarch, &i386_frame_unwind); -@@ -5885,4 +5812,7 @@ is \"default\"."), - - /* Initialize the i386-specific register groups. */ - i386_init_reggroups (); -+ -+ /* Initialize the standard target descriptions. */ -+ initialize_tdesc_i386 (); - } ---- ./gdb/i386-tdep.h 2010-04-03 20:24:51.000000000 +0200 -+++ ./gdb/i386-tdep.h 2010-04-03 20:59:52.000000000 +0200 -@@ -118,9 +118,21 @@ struct gdbarch_tdep - of MMX support. */ - int mm0_regnum; - -+ /* Number of core registers. */ -+ int num_core_regs; -+ - /* Number of SSE registers. */ - int num_xmm_regs; - -+ /* Register names. */ -+ const char **register_names; -+ -+ /* Target description. */ -+ const struct target_desc *tdesc; -+ -+ /* Register group function. */ -+ const void *register_reggroup_p; -+ - /* Offset of saved PC in jmp_buf. */ - int jb_pc_offset; - -@@ -147,10 +159,7 @@ struct gdbarch_tdep - int sc_sp_offset; - - /* ISA-specific data types. */ -- struct type *i386_eflags_type; -- struct type *i386_mxcsr_type; - struct type *i386_mmx_type; -- struct type *i386_sse_type; - struct type *i387_ext_type; - - /* Process record/replay target. */ -@@ -199,7 +208,8 @@ enum i386_regnum - I386_ES_REGNUM, /* %es */ - I386_FS_REGNUM, /* %fs */ - I386_GS_REGNUM, /* %gs */ -- I386_ST0_REGNUM /* %st(0) */ -+ I386_ST0_REGNUM, /* %st(0) */ -+ I386_MXCSR_REGNUM = 40 /* %mxcsr */ - }; - - /* Register numbers of RECORD_REGMAP. */ -@@ -233,20 +243,14 @@ enum record_i386_regnum - }; - - #define I386_NUM_GREGS 16 --#define I386_NUM_FREGS 16 - #define I386_NUM_XREGS 9 - --#define I386_SSE_NUM_REGS (I386_NUM_GREGS + I386_NUM_FREGS \ -- + I386_NUM_XREGS) -+#define I386_SSE_NUM_REGS (I386_MXCSR_REGNUM + 1) - - /* Size of the largest register. */ - #define I386_MAX_REGISTER_SIZE 16 - - /* Types for i386-specific registers. */ --extern struct type *i386_eflags_type (struct gdbarch *gdbarch); --extern struct type *i386_mxcsr_type (struct gdbarch *gdbarch); --extern struct type *i386_mmx_type (struct gdbarch *gdbarch); --extern struct type *i386_sse_type (struct gdbarch *gdbarch); - extern struct type *i387_ext_type (struct gdbarch *gdbarch); - - /* Segment selectors. */ -@@ -266,9 +270,6 @@ extern CORE_ADDR i386_skip_main_prologue - /* Return whether the THIS_FRAME corresponds to a sigtramp routine. */ - extern int i386_sigtramp_p (struct frame_info *this_frame); - --/* Return the name of register REGNUM. */ --extern char const *i386_register_name (struct gdbarch * gdbarch, int regnum); -- - /* Return non-zero if REGNUM is a member of the specified group. */ - extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group); ---- ./gdb/i387-tdep.h 2010-01-01 08:31:36.000000000 +0100 -+++ ./gdb/i387-tdep.h 2010-04-03 20:59:52.000000000 +0200 -@@ -27,6 +27,9 @@ struct regcache; - struct type; - struct ui_file; - -+/* Number of i387 floating point registers. */ -+#define I387_NUM_REGS 16 -+ - #define I387_ST0_REGNUM(tdep) ((tdep)->st0_regnum) - #define I387_NUM_XMM_REGS(tdep) ((tdep)->num_xmm_regs) - #define I387_MM0_REGNUM(tdep) ((tdep)->mm0_regnum) ---- ./gdb/regformats/i386/amd64-linux.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/amd64-linux.dat 2010-04-03 20:59:52.000000000 +0200 -@@ -0,0 +1,62 @@ -+# DO NOT EDIT: generated from i386/amd64-linux.xml -+name:amd64_linux -+xmltarget:amd64-linux.xml -+expedite:rbp,rsp,rip -+64:rax -+64:rbx -+64:rcx -+64:rdx -+64:rsi -+64:rdi -+64:rbp -+64:rsp -+64:r8 -+64:r9 -+64:r10 -+64:r11 -+64:r12 -+64:r13 -+64:r14 -+64:r15 -+64:rip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+128:xmm8 -+128:xmm9 -+128:xmm10 -+128:xmm11 -+128:xmm12 -+128:xmm13 -+128:xmm14 -+128:xmm15 -+32:mxcsr -+64:orig_rax ---- ./gdb/regformats/i386/amd64.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/amd64.dat 2010-04-03 20:59:52.000000000 +0200 -@@ -0,0 +1,61 @@ -+# DO NOT EDIT: generated from i386/amd64.xml -+name:amd64 -+xmltarget:amd64.xml -+expedite:rbp,rsp,rip -+64:rax -+64:rbx -+64:rcx -+64:rdx -+64:rsi -+64:rdi -+64:rbp -+64:rsp -+64:r8 -+64:r9 -+64:r10 -+64:r11 -+64:r12 -+64:r13 -+64:r14 -+64:r15 -+64:rip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+128:xmm8 -+128:xmm9 -+128:xmm10 -+128:xmm11 -+128:xmm12 -+128:xmm13 -+128:xmm14 -+128:xmm15 -+32:mxcsr ---- ./gdb/regformats/i386/i386-linux.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/i386-linux.dat 2010-04-03 20:59:52.000000000 +0200 -@@ -0,0 +1,46 @@ -+# DO NOT EDIT: generated from i386/i386-linux.xml -+name:i386_linux -+xmltarget:i386-linux.xml -+expedite:ebp,esp,eip -+32:eax -+32:ecx -+32:edx -+32:ebx -+32:esp -+32:ebp -+32:esi -+32:edi -+32:eip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+32:mxcsr -+32:orig_eax ---- ./gdb/regformats/i386/i386.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/i386.dat 2010-04-03 20:59:52.000000000 +0200 -@@ -0,0 +1,45 @@ -+# DO NOT EDIT: generated from i386/i386.xml -+name:i386 -+xmltarget:i386.xml -+expedite:ebp,esp,eip -+32:eax -+32:ecx -+32:edx -+32:ebx -+32:esp -+32:ebp -+32:esi -+32:edi -+32:eip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+32:mxcsr ---- ./gdb/regformats/reg-i386-linux.dat 2009-07-20 20:51:42.000000000 +0200 -+++ ./gdb/regformats/reg-i386-linux.dat 1970-01-01 01:00:00.000000000 +0100 -@@ -1,46 +0,0 @@ --name:i386_linux --xmlarch:i386 --osabi:GNU/Linux --expedite:ebp,esp,eip --32:eax --32:ecx --32:edx --32:ebx --32:esp --32:ebp --32:esi --32:edi --32:eip --32:eflags --32:cs --32:ss --32:ds --32:es --32:fs --32:gs --80:st0 --80:st1 --80:st2 --80:st3 --80:st4 --80:st5 --80:st6 --80:st7 --32:fctrl --32:fstat --32:ftag --32:fiseg --32:fioff --32:foseg --32:fooff --32:fop --128:xmm0 --128:xmm1 --128:xmm2 --128:xmm3 --128:xmm4 --128:xmm5 --128:xmm6 --128:xmm7 --32:mxcsr --32:orig_eax ---- ./gdb/regformats/reg-i386.dat 2008-02-28 06:54:10.000000000 +0100 -+++ ./gdb/regformats/reg-i386.dat 1970-01-01 01:00:00.000000000 +0100 -@@ -1,44 +0,0 @@ --name:i386 --xmlarch:i386 --expedite:ebp,esp,eip --32:eax --32:ecx --32:edx --32:ebx --32:esp --32:ebp --32:esi --32:edi --32:eip --32:eflags --32:cs --32:ss --32:ds --32:es --32:fs --32:gs --80:st0 --80:st1 --80:st2 --80:st3 --80:st4 --80:st5 --80:st6 --80:st7 --32:fctrl --32:fstat --32:ftag --32:fiseg --32:fioff --32:foseg --32:fooff --32:fop --128:xmm0 --128:xmm1 --128:xmm2 --128:xmm3 --128:xmm4 --128:xmm5 --128:xmm6 --128:xmm7 --32:mxcsr ---- ./gdb/regformats/reg-x86-64-linux.dat 2009-07-20 20:51:42.000000000 +0200 -+++ ./gdb/regformats/reg-x86-64-linux.dat 1970-01-01 01:00:00.000000000 +0100 -@@ -1,62 +0,0 @@ --name:x86_64_linux --xmlarch:i386:x86-64 --osabi:GNU/Linux --expedite:rbp,rsp,rip --64:rax --64:rbx --64:rcx --64:rdx --64:rsi --64:rdi --64:rbp --64:rsp --64:r8 --64:r9 --64:r10 --64:r11 --64:r12 --64:r13 --64:r14 --64:r15 --64:rip --32:eflags --32:cs --32:ss --32:ds --32:es --32:fs --32:gs --80:st0 --80:st1 --80:st2 --80:st3 --80:st4 --80:st5 --80:st6 --80:st7 --32:fctrl --32:fstat --32:ftag --32:fiseg --32:fioff --32:foseg --32:fooff --32:fop --128:xmm0 --128:xmm1 --128:xmm2 --128:xmm3 --128:xmm4 --128:xmm5 --128:xmm6 --128:xmm7 --128:xmm8 --128:xmm9 --128:xmm10 --128:xmm11 --128:xmm12 --128:xmm13 --128:xmm14 --128:xmm15 --32:mxcsr --64:orig_rax ---- ./gdb/regformats/reg-x86-64.dat 2004-01-10 13:52:41.000000000 +0100 -+++ ./gdb/regformats/reg-x86-64.dat 1970-01-01 01:00:00.000000000 +0100 -@@ -1,59 +0,0 @@ --name:x86_64 --expedite:rbp,rsp,rip --64:rax --64:rbx --64:rcx --64:rdx --64:rsi --64:rdi --64:rbp --64:rsp --64:r8 --64:r9 --64:r10 --64:r11 --64:r12 --64:r13 --64:r14 --64:r15 --64:rip --32:eflags --32:cs --32:ss --32:ds --32:es --32:fs --32:gs --80:st0 --80:st1 --80:st2 --80:st3 --80:st4 --80:st5 --80:st6 --80:st7 --32:fctrl --32:fstat --32:ftag --32:fiseg --32:fioff --32:foseg --32:fooff --32:fop --128:xmm0 --128:xmm1 --128:xmm2 --128:xmm3 --128:xmm4 --128:xmm5 --128:xmm6 --128:xmm7 --128:xmm8 --128:xmm9 --128:xmm10 --128:xmm11 --128:xmm12 --128:xmm13 --128:xmm14 --128:xmm15 --32:mxcsr ---- ./gdb/testsuite/gdb.xml/tdesc-regs.exp 2010-02-16 22:26:48.000000000 +0100 -+++ ./gdb/testsuite/gdb.xml/tdesc-regs.exp 2010-04-03 20:59:52.000000000 +0200 -@@ -25,6 +25,7 @@ gdb_start - - set core-regs "" - set regdir "" -+set architecture "" - switch -glob -- [istarget] { - "*arm-*-*" { - set core-regs {arm-core.xml} -@@ -55,6 +56,16 @@ switch -glob -- [istarget] { - unsupported "register tests" - return 0 - } -+ "i?86-*-*" { -+ set architecture "i386" -+ set regdir "i386/" -+ set core-regs {32bit-core.xml 32bit-sse.xml} -+ } -+ "x86_64-*-*" { -+ set architecture "i386:x86-64" -+ set regdir "i386/" -+ set core-regs {64bit-core.xml 64bit-sse.xml} -+ } - } - - # If no core registers were specified, assume this target does not -@@ -89,12 +100,16 @@ proc load_description { file errmsg } { - global subdir - global gdb_prompt - global core-regs -+ global architecture - - file delete "$subdir/regs.xml" - set ifd [open "$srcdir/$subdir/$file" r] - set ofd [open "$subdir/regs.xml" w] - while {[gets $ifd line] >= 0} { - if {[regexp {} $line]} { -+ if {! [string equal ${architecture} ""]} { -+ puts $ofd " ${architecture}" -+ } - foreach src ${core-regs} { - puts $ofd " " - } diff --git a/gdb-bz578250-avx-02of10.patch b/gdb-bz578250-avx-02of10.patch deleted file mode 100644 index 52af055..0000000 --- a/gdb-bz578250-avx-02of10.patch +++ /dev/null @@ -1,751 +0,0 @@ -[ Backported. ] - -commit cb928c67c90cfb5bbb0636d91855b95e51ad275d -Author: Daniel Jacobowitz -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 and . - - 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 - - @end smallexample - -+@cindex -+If a register's value is composed from several separate values, define -+it with a structure type. There are two forms of the @samp{} -+element; a @samp{} 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 -+ -+ -+ @dots{} -+ -+@end smallexample -+ -+If the structure contains no bitfields, then each field has an -+explicit type, and no implicit padding is added. -+ -+@smallexample -+ -+ -+ @dots{} -+ -+@end smallexample -+ -+@cindex -+If a register's value is a series of single-bit flags, define it with -+a flags type. The @samp{} element has an explicit @var{size} -+and contains one or more @samp{} elements. Each field has a -+@var{name}, a @var{start}, and an @var{end}. Only single-bit flags -+are supported. -+ -+@smallexample -+ -+ -+ @dots{} -+ -+@end smallexample -+ - @subsection Registers - @cindex - ---- 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 @@ - - - -- -+ - - -@@ -39,6 +40,16 @@ - type CDATA #REQUIRED - count CDATA #REQUIRED> - -+ -+ -+ -+ -+ -+ - - -@@ -46,7 +57,9 @@ - - -+ type CDATA #IMPLIED -+ start CDATA #IMPLIED -+ end CDATA #IMPLIED> - - - %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 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - - -+ -+ -+ - - ---- 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 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 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 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 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 }, diff --git a/gdb-bz578250-avx-03of10.patch b/gdb-bz578250-avx-03of10.patch deleted file mode 100644 index 7cfb551..0000000 --- a/gdb-bz578250-avx-03of10.patch +++ /dev/null @@ -1,457 +0,0 @@ -[ Backported. ] - -commit 0257d639d42f896a359993ae8adb5792e280f65f -Author: H.J. Lu -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 - - * 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 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - ---- 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 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - ---- 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 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - ---- 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 @@ - - - -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - ---- 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); - } diff --git a/gdb-bz578250-avx-04of10.patch b/gdb-bz578250-avx-04of10.patch deleted file mode 100644 index b3619dc..0000000 --- a/gdb-bz578250-avx-04of10.patch +++ /dev/null @@ -1,1366 +0,0 @@ -[ Backported. ] - -commit 9d625812f24608f99fd99e8591ef3c80d729f9b5 -Author: H.J. Lu -Date: Tue Mar 2 13:14:28 2010 +0000 - - Support x86 pseudo byte, word and dword registers. - - gdb/ - - 2010-03-02 H.J. Lu - - * amd64-tdep.c (amd64_byte_names): New. - (amd64_word_names): Likewise. - (amd64_dword_names): Likewise. - (amd64_pseudo_register_name): Likewise. - (amd64_pseudo_register_read): Likewise. - (amd64_pseudo_register_write): Likewise. - (amd64_init_abi): Set num_byte_regs, num_word_regs, num_dword_regs - and num_mmx_regs. Call set_gdbarch_pseudo_register_read, - set_gdbarch_pseudo_register_write and - set_tdesc_pseudo_register_name. Don't call - set_gdbarch_num_pseudo_regs. Don't set mm0_regnum. - - * i386-tdep.c (i386_num_mmx_regs): Removed. - (i386_num_pseudo_regs): Likewise. - (i386_byte_names): New. - (i386_word_names): Likewise. - (i386_byte_regnum_p): Likewise. - (i386_word_regnum_p): Likewise. - (i386_mmx_regnum_p): Updated. - (i386_pseudo_register_name): Make it global. Handle byte and - word pseudo-registers. - (i386_pseudo_register_read): Likewise. - (i386_pseudo_register_write): Likewise. - (i386_pseudo_register_type): Handle byte, word and dword - pseudo-registers - (i386_register_reggroup_p): Don't include pseudo - registers, except for MXX, in any register groups. Don't - include pseudo byte, word, dword registers in general_reggroup. - (i386_gdbarch_init): Set num_byte_regs, num_word_regs, - num_dword_regs, al_regnum, ax_regnum and eax_regnum. Put MMX - pseudo-registers after word pseudo-registers. Call - set_gdbarch_num_pseudo_regs after calling gdbarch_init_osabi. - - * i386-tdep.h (gdbarch_tdep): Add num_mmx_regs, num_byte_regs, - al_regnum, num_word_regs, ax_regnum, num_dword_regs and - eax_regnum. - (i386_byte_regnum_p): New. - (i386_word_regnum_p): Likewise. - (i386_dword_regnum_p): Likewise. - (i386_pseudo_register_name): Likewise. - (i386_pseudo_register_read): Likewise. - (i386_pseudo_register_write): Likewise. - - gdb/testsuite/ - - 2010-03-02 H.J. Lu - - * gdb.arch/amd64-byte.exp: New. - * gdb.arch/amd64-dword.exp: Likewise. - * gdb.arch/amd64-pseudo.c: Likewise. - * gdb.arch/amd64-word.exp: Likewise. - * gdb.arch/i386-byte.exp: Likewise. - * gdb.arch/i386-pseudo.c: Likewise. - * gdb.arch/i386-word.exp: Likewise. - ---- gdb-7.1-p2/gdb/amd64-tdep.c 2010-04-03 20:59:52.000000000 +0200 -+++ gdb-7.1/gdb/amd64-tdep.c 2010-04-03 21:06:52.000000000 +0200 -@@ -210,6 +210,107 @@ amd64_arch_reg_to_regnum (int reg) - return amd64_arch_regmap[reg]; - } - -+/* Register names for byte pseudo-registers. */ -+ -+static const char *amd64_byte_names[] = -+{ -+ "al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl", -+ "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l" -+}; -+ -+/* Register names for word pseudo-registers. */ -+ -+static const char *amd64_word_names[] = -+{ -+ "ax", "bx", "cx", "dx", "si", "di", "bp", "sp", -+ "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" -+}; -+ -+/* Register names for dword pseudo-registers. */ -+ -+static const char *amd64_dword_names[] = -+{ -+ "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", -+ "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" -+}; -+ -+/* Return the name of register REGNUM. */ -+ -+static const char * -+amd64_pseudo_register_name (struct gdbarch *gdbarch, int regnum) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ if (i386_byte_regnum_p (gdbarch, regnum)) -+ return amd64_byte_names[regnum - tdep->al_regnum]; -+ else if (i386_word_regnum_p (gdbarch, regnum)) -+ return amd64_word_names[regnum - tdep->ax_regnum]; -+ else if (i386_dword_regnum_p (gdbarch, regnum)) -+ return amd64_dword_names[regnum - tdep->eax_regnum]; -+ else -+ return i386_pseudo_register_name (gdbarch, regnum); -+} -+ -+static void -+amd64_pseudo_register_read (struct gdbarch *gdbarch, -+ struct regcache *regcache, -+ int regnum, gdb_byte *buf) -+{ -+ gdb_byte raw_buf[MAX_REGISTER_SIZE]; -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ if (i386_byte_regnum_p (gdbarch, regnum)) -+ { -+ int gpnum = regnum - tdep->al_regnum; -+ -+ /* Extract (always little endian). */ -+ regcache_raw_read (regcache, gpnum, raw_buf); -+ memcpy (buf, raw_buf, 1); -+ } -+ else if (i386_dword_regnum_p (gdbarch, regnum)) -+ { -+ int gpnum = regnum - tdep->eax_regnum; -+ /* Extract (always little endian). */ -+ regcache_raw_read (regcache, gpnum, raw_buf); -+ memcpy (buf, raw_buf, 4); -+ } -+ else -+ i386_pseudo_register_read (gdbarch, regcache, regnum, buf); -+} -+ -+static void -+amd64_pseudo_register_write (struct gdbarch *gdbarch, -+ struct regcache *regcache, -+ int regnum, const gdb_byte *buf) -+{ -+ gdb_byte raw_buf[MAX_REGISTER_SIZE]; -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ if (i386_byte_regnum_p (gdbarch, regnum)) -+ { -+ 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); -+ } -+ else if (i386_dword_regnum_p (gdbarch, regnum)) -+ { -+ int gpnum = regnum - tdep->eax_regnum; -+ -+ /* Read ... */ -+ regcache_raw_read (regcache, gpnum, raw_buf); -+ /* ... Modify ... (always little endian). */ -+ memcpy (raw_buf, buf, 4); -+ /* ... Write. */ -+ regcache_raw_write (regcache, gpnum, raw_buf); -+ } -+ else -+ i386_pseudo_register_write (gdbarch, regcache, regnum, buf); -+} -+ - - - /* Return the union class of CLASS1 and CLASS2. See the psABI for -@@ -2132,6 +2233,19 @@ 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_word_regs = 16; -+ tdep->num_dword_regs = 16; -+ /* Avoid wiring in the MMX registers for now. */ -+ tdep->num_mmx_regs = 0; -+ -+ set_gdbarch_pseudo_register_read (gdbarch, -+ amd64_pseudo_register_read); -+ set_gdbarch_pseudo_register_write (gdbarch, -+ amd64_pseudo_register_write); -+ -+ set_tdesc_pseudo_register_name (gdbarch, amd64_pseudo_register_name); -+ - /* AMD64 has an FPU and 16 SSE registers. */ - tdep->st0_regnum = AMD64_ST0_REGNUM; - tdep->num_xmm_regs = 16; -@@ -2183,10 +2297,6 @@ amd64_init_abi (struct gdbarch_info info - - set_gdbarch_skip_prologue (gdbarch, amd64_skip_prologue); - -- /* Avoid wiring in the MMX registers for now. */ -- set_gdbarch_num_pseudo_regs (gdbarch, 0); -- tdep->mm0_regnum = -1; -- - tdep->record_regmap = amd64_record_regmap; - - set_gdbarch_dummy_id (gdbarch, amd64_dummy_id); ---- gdb-7.1-p2/gdb/i386-tdep.c 2010-04-03 20:59:52.000000000 +0200 -+++ gdb-7.1/gdb/i386-tdep.c 2010-04-03 21:06:52.000000000 +0200 -@@ -81,17 +81,72 @@ static const char *i386_mmx_names[] = - "mm4", "mm5", "mm6", "mm7" - }; - --static const int i386_num_mmx_regs = ARRAY_SIZE (i386_mmx_names); -+/* Register names for byte pseudo-registers. */ -+ -+static const char *i386_byte_names[] = -+{ -+ "al", "cl", "dl", "bl", -+ "ah", "ch", "dh", "bh" -+}; -+ -+/* Register names for word pseudo-registers. */ -+ -+static const char *i386_word_names[] = -+{ -+ "ax", "cx", "dx", "bx", -+ "sp", "bp", "si", "di" -+}; -+ -+/* MMX register? */ - - static int - i386_mmx_regnum_p (struct gdbarch *gdbarch, int regnum) - { -- int mm0_regnum = gdbarch_tdep (gdbarch)->mm0_regnum; -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int mm0_regnum = tdep->mm0_regnum; - - if (mm0_regnum < 0) - return 0; - -- return (regnum >= mm0_regnum && regnum < mm0_regnum + i386_num_mmx_regs); -+ regnum -= mm0_regnum; -+ return regnum >= 0 && regnum < tdep->num_mmx_regs; -+} -+ -+/* Byte register? */ -+ -+int -+i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ regnum -= tdep->al_regnum; -+ return regnum >= 0 && regnum < tdep->num_byte_regs; -+} -+ -+/* Word register? */ -+ -+int -+i386_word_regnum_p (struct gdbarch *gdbarch, int regnum) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ regnum -= tdep->ax_regnum; -+ return regnum >= 0 && regnum < tdep->num_word_regs; -+} -+ -+/* Dword register? */ -+ -+int -+i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int eax_regnum = tdep->eax_regnum; -+ -+ if (eax_regnum < 0) -+ return 0; -+ -+ regnum -= eax_regnum; -+ return regnum >= 0 && regnum < tdep->num_dword_regs; - } - - /* SSE register? */ -@@ -147,11 +202,18 @@ i386_fpc_regnum_p (struct gdbarch *gdbar - - /* Return the name of register REGNUM. */ - --static const char * -+const char * - i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum) - { -- gdb_assert (i386_mmx_regnum_p (gdbarch, regnum)); -- return i386_mmx_names[regnum - I387_MM0_REGNUM (gdbarch_tdep (gdbarch))]; -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ if (i386_mmx_regnum_p (gdbarch, regnum)) -+ return i386_mmx_names[regnum - I387_MM0_REGNUM (tdep)]; -+ else if (i386_byte_regnum_p (gdbarch, regnum)) -+ return i386_byte_names[regnum - tdep->al_regnum]; -+ else if (i386_word_regnum_p (gdbarch, regnum)) -+ return i386_word_names[regnum - tdep->ax_regnum]; -+ -+ internal_error (__FILE__, __LINE__, _("invalid regnum")); - } - - /* Convert a dbx register number REG to the appropriate register -@@ -2169,8 +2231,20 @@ i386_mmx_type (struct gdbarch *gdbarch) - static struct type * - i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum) - { -- gdb_assert (i386_mmx_regnum_p (gdbarch, regnum)); -- return i386_mmx_type (gdbarch); -+ if (i386_mmx_regnum_p (gdbarch, regnum)) -+ return i386_mmx_type (gdbarch); -+ else -+ { -+ const struct builtin_type *bt = builtin_type (gdbarch); -+ if (i386_byte_regnum_p (gdbarch, regnum)) -+ return bt->builtin_int8; -+ else if (i386_word_regnum_p (gdbarch, regnum)) -+ return bt->builtin_int16; -+ else if (i386_dword_regnum_p (gdbarch, regnum)) -+ return bt->builtin_int32; -+ } -+ -+ internal_error (__FILE__, __LINE__, _("invalid regnum")); - } - - /* Map a cooked register onto a raw register or memory. For the i386, -@@ -2192,41 +2266,104 @@ i386_mmx_regnum_to_fp_regnum (struct reg - return (I387_ST0_REGNUM (tdep) + fpreg); - } - --static void -+void - i386_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, - int regnum, gdb_byte *buf) - { -+ gdb_byte raw_buf[MAX_REGISTER_SIZE]; -+ - if (i386_mmx_regnum_p (gdbarch, regnum)) - { -- gdb_byte mmx_buf[MAX_REGISTER_SIZE]; - int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum); - - /* Extract (always little endian). */ -- regcache_raw_read (regcache, fpnum, mmx_buf); -- memcpy (buf, mmx_buf, register_size (gdbarch, regnum)); -+ regcache_raw_read (regcache, fpnum, raw_buf); -+ memcpy (buf, raw_buf, register_size (gdbarch, regnum)); - } - else -- regcache_raw_read (regcache, regnum, buf); -+ { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ if (i386_word_regnum_p (gdbarch, regnum)) -+ { -+ int gpnum = regnum - tdep->ax_regnum; -+ -+ /* Extract (always little endian). */ -+ regcache_raw_read (regcache, gpnum, raw_buf); -+ memcpy (buf, raw_buf, 2); -+ } -+ else if (i386_byte_regnum_p (gdbarch, regnum)) -+ { -+ /* Check byte pseudo registers last since this function will -+ be called from amd64_pseudo_register_read, which handles -+ byte pseudo registers differently. */ -+ int gpnum = regnum - tdep->al_regnum; -+ -+ /* Extract (always little endian). We read both lower and -+ upper registers. */ -+ regcache_raw_read (regcache, gpnum % 4, raw_buf); -+ if (gpnum >= 4) -+ memcpy (buf, raw_buf + 1, 1); -+ else -+ memcpy (buf, raw_buf, 1); -+ } -+ else -+ internal_error (__FILE__, __LINE__, _("invalid regnum")); -+ } - } - --static void -+void - i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, - int regnum, const gdb_byte *buf) - { -+ gdb_byte raw_buf[MAX_REGISTER_SIZE]; -+ - if (i386_mmx_regnum_p (gdbarch, regnum)) - { -- gdb_byte mmx_buf[MAX_REGISTER_SIZE]; - int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum); - - /* Read ... */ -- regcache_raw_read (regcache, fpnum, mmx_buf); -+ regcache_raw_read (regcache, fpnum, raw_buf); - /* ... Modify ... (always little endian). */ -- memcpy (mmx_buf, buf, register_size (gdbarch, regnum)); -+ memcpy (raw_buf, buf, register_size (gdbarch, regnum)); - /* ... Write. */ -- regcache_raw_write (regcache, fpnum, mmx_buf); -+ regcache_raw_write (regcache, fpnum, raw_buf); - } - else -- regcache_raw_write (regcache, regnum, buf); -+ { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ if (i386_word_regnum_p (gdbarch, regnum)) -+ { -+ int gpnum = regnum - tdep->ax_regnum; -+ -+ /* Read ... */ -+ regcache_raw_read (regcache, gpnum, raw_buf); -+ /* ... Modify ... (always little endian). */ -+ memcpy (raw_buf, buf, 2); -+ /* ... Write. */ -+ regcache_raw_write (regcache, gpnum, raw_buf); -+ } -+ else if (i386_byte_regnum_p (gdbarch, regnum)) -+ { -+ /* Check byte pseudo registers last since this function will -+ be called from amd64_pseudo_register_read, which handles -+ byte pseudo registers differently. */ -+ int gpnum = regnum - tdep->al_regnum; -+ -+ /* Read ... We read both lower and upper registers. */ -+ regcache_raw_read (regcache, gpnum % 4, raw_buf); -+ /* ... Modify ... (always little endian). */ -+ if (gpnum >= 4) -+ memcpy (raw_buf + 1, buf, 1); -+ else -+ memcpy (raw_buf, buf, 1); -+ /* ... Write. */ -+ regcache_raw_write (regcache, gpnum % 4, raw_buf); -+ } -+ else -+ internal_error (__FILE__, __LINE__, _("invalid regnum")); -+ } - } - - -@@ -2663,22 +2800,46 @@ int - i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) - { -- int sse_regnum_p = (i386_sse_regnum_p (gdbarch, regnum) -- || i386_mxcsr_regnum_p (gdbarch, regnum)); -- int fp_regnum_p = (i386_fp_regnum_p (gdbarch, regnum) -- || i386_fpc_regnum_p (gdbarch, regnum)); -- int mmx_regnum_p = (i386_mmx_regnum_p (gdbarch, regnum)); -+ int sse_regnum_p, fp_regnum_p, mmx_regnum_p, byte_regnum_p, -+ word_regnum_p, dword_regnum_p; -+ -+ /* Don't include pseudo registers, except for MMX, in any register -+ groups. */ -+ byte_regnum_p = i386_byte_regnum_p (gdbarch, regnum); -+ if (byte_regnum_p) -+ return 0; - -+ word_regnum_p = i386_word_regnum_p (gdbarch, regnum); -+ if (word_regnum_p) -+ return 0; -+ -+ dword_regnum_p = i386_dword_regnum_p (gdbarch, regnum); -+ if (dword_regnum_p) -+ return 0; -+ -+ mmx_regnum_p = i386_mmx_regnum_p (gdbarch, regnum); - if (group == i386_mmx_reggroup) - return mmx_regnum_p; -+ -+ sse_regnum_p = (i386_sse_regnum_p (gdbarch, regnum) -+ || i386_mxcsr_regnum_p (gdbarch, regnum)); - if (group == i386_sse_reggroup) - return sse_regnum_p; - if (group == vector_reggroup) -- return (mmx_regnum_p || sse_regnum_p); -+ return mmx_regnum_p || sse_regnum_p; -+ -+ fp_regnum_p = (i386_fp_regnum_p (gdbarch, regnum) -+ || i386_fpc_regnum_p (gdbarch, regnum)); - if (group == float_reggroup) - return fp_regnum_p; -+ - if (group == general_reggroup) -- return (!fp_regnum_p && !mmx_regnum_p && !sse_regnum_p); -+ return (!fp_regnum_p -+ && !mmx_regnum_p -+ && !sse_regnum_p -+ && !byte_regnum_p -+ && !word_regnum_p -+ && !dword_regnum_p); - - return default_register_reggroup_p (gdbarch, regnum, group); - } -@@ -5527,6 +5688,7 @@ i386_gdbarch_init (struct gdbarch_info i - struct gdbarch *gdbarch; - struct tdesc_arch_data *tdesc_data; - const struct target_desc *tdesc; -+ int mm0_regnum; - - /* If there is already a candidate, use it. */ - arches = gdbarch_list_lookup_by_info (arches, &info); -@@ -5563,11 +5725,6 @@ i386_gdbarch_init (struct gdbarch_info i - - tdep->st0_regnum = I386_ST0_REGNUM; - -- /* The MMX registers are implemented as pseudo-registers. Put off -- calculating the register number for %mm0 until we know the number -- of raw registers. */ -- tdep->mm0_regnum = 0; -- - /* I386_NUM_XREGS includes %mxcsr, so substract one. */ - tdep->num_xmm_regs = I386_NUM_XREGS - 1; - -@@ -5693,8 +5850,7 @@ i386_gdbarch_init (struct gdbarch_info i - - frame_base_set_default (gdbarch, &i386_frame_base); - -- /* Wire in the MMX registers. */ -- set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs); -+ /* Pseudo registers may be changed by amd64_init_abi. */ - set_gdbarch_pseudo_register_read (gdbarch, i386_pseudo_register_read); - set_gdbarch_pseudo_register_write (gdbarch, i386_pseudo_register_write); - -@@ -5714,12 +5870,24 @@ i386_gdbarch_init (struct gdbarch_info i - tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS; - tdep->register_names = i386_register_names; - -+ tdep->num_byte_regs = 8; -+ tdep->num_word_regs = 8; -+ tdep->num_dword_regs = 0; -+ tdep->num_mmx_regs = 8; -+ - tdesc_data = tdesc_data_alloc (); - - /* Hook in ABI-specific overrides, if they have been registered. */ - info.tdep_info = (void *) tdesc_data; - gdbarch_init_osabi (info, gdbarch); - -+ /* Wire in pseudo registers. Number of pseudo registers may be -+ changed. */ -+ set_gdbarch_num_pseudo_regs (gdbarch, (tdep->num_byte_regs -+ + tdep->num_word_regs -+ + tdep->num_dword_regs -+ + tdep->num_mmx_regs)); -+ - /* Target description may be changed. */ - tdesc = tdep->tdesc; - -@@ -5736,6 +5904,28 @@ i386_gdbarch_init (struct gdbarch_info i - /* Override gdbarch_register_reggroup_p set in tdesc_use_registers. */ - set_gdbarch_register_reggroup_p (gdbarch, tdep->register_reggroup_p); - -+ /* Make %al the first pseudo-register. */ -+ tdep->al_regnum = gdbarch_num_regs (gdbarch); -+ tdep->ax_regnum = tdep->al_regnum + tdep->num_byte_regs; -+ -+ mm0_regnum = tdep->ax_regnum + tdep->num_word_regs; -+ if (tdep->num_dword_regs) -+ { -+ /* Support dword pseudo-registesr if it hasn't been disabled, */ -+ tdep->eax_regnum = mm0_regnum; -+ mm0_regnum = tdep->eax_regnum + tdep->num_dword_regs; -+ } -+ else -+ tdep->eax_regnum = -1; -+ -+ if (tdep->num_mmx_regs != 0) -+ { -+ /* Support MMX pseudo-registesr if MMX hasn't been disabled, */ -+ tdep->mm0_regnum = mm0_regnum; -+ } -+ else -+ tdep->mm0_regnum = -1; -+ - /* Hook in the legacy prologue-based unwinders last (fallback). */ - frame_unwind_append_unwinder (gdbarch, &i386_sigtramp_frame_unwind); - frame_unwind_append_unwinder (gdbarch, &i386_frame_unwind); -@@ -5747,11 +5937,6 @@ i386_gdbarch_init (struct gdbarch_info i - set_gdbarch_regset_from_core_section (gdbarch, - i386_regset_from_core_section); - -- /* Unless support for MMX has been disabled, make %mm0 the first -- pseudo-register. */ -- if (tdep->mm0_regnum == 0) -- tdep->mm0_regnum = gdbarch_num_regs (gdbarch); -- - set_gdbarch_skip_permanent_breakpoint (gdbarch, - i386_skip_permanent_breakpoint); - ---- gdb-7.1-p2/gdb/i386-tdep.h 2010-04-03 20:59:52.000000000 +0200 -+++ gdb-7.1/gdb/i386-tdep.h 2010-04-03 21:06:52.000000000 +0200 -@@ -114,10 +114,32 @@ struct gdbarch_tdep - absence of an FPU. */ - int st0_regnum; - -+ /* Number of MMX registers. */ -+ int num_mmx_regs; -+ - /* Register number for %mm0. Set this to -1 to indicate the absence - of MMX support. */ - int mm0_regnum; - -+ /* Number of byte registers. */ -+ int num_byte_regs; -+ -+ /* Register pseudo number for %al. */ -+ int al_regnum; -+ -+ /* Number of pseudo word registers. */ -+ int num_word_regs; -+ -+ /* Register number for %ax. */ -+ int ax_regnum; -+ -+ /* Number of pseudo dword registers. */ -+ int num_dword_regs; -+ -+ /* Register number for %eax. Set this to -1 to indicate the absence -+ of pseudo dword register support. */ -+ int eax_regnum; -+ - /* Number of core registers. */ - int num_core_regs; - -@@ -253,6 +275,21 @@ enum record_i386_regnum - /* Types for i386-specific registers. */ - extern struct type *i387_ext_type (struct gdbarch *gdbarch); - -+/* Checks of different pseudo-registers. */ -+extern int i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum); -+extern int i386_word_regnum_p (struct gdbarch *gdbarch, int regnum); -+extern int i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum); -+ -+extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch, -+ int regnum); -+ -+extern void i386_pseudo_register_read (struct gdbarch *gdbarch, -+ struct regcache *regcache, -+ int regnum, gdb_byte *buf); -+extern void i386_pseudo_register_write (struct gdbarch *gdbarch, -+ struct regcache *regcache, -+ int regnum, const gdb_byte *buf); -+ - /* Segment selectors. */ - #define I386_SEL_RPL 0x0003 /* Requester's Privilege Level mask. */ - #define I386_SEL_UPL 0x0003 /* User Privilige Level. */ ---- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-byte.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-byte.exp 2010-04-03 21:06:52.000000000 +0200 -@@ -0,0 +1,121 @@ -+# 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 . -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@gnu.org -+ -+# This file is part of the gdb testsuite. -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+if { ![istarget x86_64-*-* ] } { -+ verbose "Skipping amd64 byte register tests." -+ return -+} -+ -+set testfile "amd64-byte" -+set srcfile amd64-pseudo.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } { -+ untested ${testfile} -+ return -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+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 -+set byte_regs(4) dl -+set byte_regs(5) sil -+set byte_regs(6) dil -+set byte_regs(7) r8l -+set byte_regs(8) r9l -+set byte_regs(9) r10l -+set byte_regs(10) r11l -+set byte_regs(11) r12l -+set byte_regs(12) r13l -+set byte_regs(13) r14l -+set byte_regs(14) r15l -+ -+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set first breakpoint in main" -+gdb_continue_to_breakpoint "continue to first breakpoint in main" -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ gdb_test "print/x \$$byte_regs($r)" \ -+ ".. = 0x[format %x $r]1" \ -+ "check contents of %$byte_regs($r)" -+} -+ -+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 } { -+ gdb_test "print/x \$$byte_regs($r)" \ -+ ".. = 0x[format %x $r]1" \ -+ "check contents of %$byte_regs($r)" -+} -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" -+} -+ -+gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set third breakpoint in main" -+gdb_continue_to_breakpoint "continue to third breakpoint in main" -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ gdb_test "print \$$byte_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$byte_regs($r)" -+} -+ -+for { set r 7 } { $r <= $nr_regs } { incr r } { -+ gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" -+} -+ -+gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set forth breakpoint in main" -+gdb_continue_to_breakpoint "continue to forth breakpoint in main" -+ -+for { set r 7 } { $r <= $nr_regs } { incr r } { -+ gdb_test "print \$$byte_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$byte_regs($r)" -+} ---- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-dword.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-dword.exp 2010-04-03 21:06:52.000000000 +0200 -@@ -0,0 +1,123 @@ -+# 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 . -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@gnu.org -+ -+# This file is part of the gdb testsuite. -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+if { ![istarget x86_64-*-* ] } { -+ verbose "Skipping amd64 dword register tests." -+ return -+} -+ -+set testfile "amd64-dword" -+set srcfile amd64-pseudo.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } { -+ untested ${testfile} -+ return -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+set nr_regs 14 -+set dword_regs(1) eax -+set dword_regs(2) ebx -+set dword_regs(3) ecx -+set dword_regs(4) edx -+set dword_regs(5) esi -+set dword_regs(6) edi -+set dword_regs(7) r8d -+set dword_regs(8) r9d -+set dword_regs(9) r10d -+set dword_regs(10) r11d -+set dword_regs(11) r12d -+set dword_regs(12) r13d -+set dword_regs(13) r14d -+set dword_regs(14) r15d -+ -+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set first breakpoint in main" -+gdb_continue_to_breakpoint "continue to first breakpoint in main" -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ set hex [format %x $r] -+ gdb_test "print/x \$$dword_regs($r)" \ -+ ".. = 0x${hex}4${hex}3${hex}2${hex}1" \ -+ "check contents of %$dword_regs($r)" -+} -+ -+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 } { -+ set hex [format %x $r] -+ gdb_test "print/x \$$dword_regs($r)" \ -+ ".. = 0x${hex}4${hex}3${hex}2${hex}1" \ -+ "check contents of %$dword_regs($r)" -+} -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)" -+} -+ -+gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set third breakpoint in main" -+gdb_continue_to_breakpoint "continue to third breakpoint in main" -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ gdb_test "print \$$dword_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$dword_regs($r)" -+} -+ -+for { set r 7 } { $r <= $nr_regs } { incr r } { -+ gdb_test "set var \$$dword_regs($r) = $r" "" "set %$dword_regs($r)" -+} -+ -+gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set forth breakpoint in main" -+gdb_continue_to_breakpoint "continue to forth breakpoint in main" -+ -+for { set r 7 } { $r <= $nr_regs } { incr r } { -+ gdb_test "print \$$dword_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$dword_regs($r)" -+} ---- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-pseudo.c 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-pseudo.c 2010-04-03 21:06:52.000000000 +0200 -@@ -0,0 +1,91 @@ -+/* Test program for byte registers. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+int data[] = { -+ 0x14131211, -+ 0x24232221, -+ 0x34333231, -+ 0x44434241, -+ 0x54535251, -+ 0x64636261, -+ 0x74737271, -+ 0x84838281, -+ 0x94939291, -+ 0xa4a3a2a1, -+ 0xb4b3b2b1, -+ 0xc4c3c2c1, -+ 0xd4d3d2d1, -+ 0xe4e3e2e1, -+}; -+ -+int -+main (int argc, char **argv) -+{ -+ asm ("mov 0(%0), %%eax\n\t" -+ "mov 4(%0), %%ebx\n\t" -+ "mov 8(%0), %%ecx\n\t" -+ "mov 12(%0), %%edx\n\t" -+ "mov 16(%0), %%esi\n\t" -+ "mov 20(%0), %%edi\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "eax", "ebx", "ecx", "edx", "esi", "edi"); -+ asm ("nop"); /* first breakpoint here */ -+ -+ asm ("mov 24(%0), %%r8d\n\t" -+ "mov 28(%0), %%r9d\n\t" -+ "mov 32(%0), %%r10d\n\t" -+ "mov 36(%0), %%r11\n\t" -+ "mov 40(%0), %%r12d\n\t" -+ "mov 44(%0), %%r13d\n\t" -+ "mov 48(%0), %%r14d\n\t" -+ "mov 52(%0), %%r15d\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"); -+ asm ("nop"); /* second breakpoint here */ -+ -+ asm ("mov %%eax, 0(%0)\n\t" -+ "mov %%ebx, 4(%0)\n\t" -+ "mov %%ecx, 8(%0)\n\t" -+ "mov %%edx, 12(%0)\n\t" -+ "mov %%esi, 16(%0)\n\t" -+ "mov %%edi, 20(%0)\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "eax", "ebx", "ecx", "edx", "esi", "edi"); -+ asm ("nop"); /* third breakpoint here */ -+ -+ asm ("mov %%r8d, 24(%0)\n\t" -+ "mov %%r9d, 28(%0)\n\t" -+ "mov %%r10d, 32(%0)\n\t" -+ "mov %%r11d, 36(%0)\n\t" -+ "mov %%r12d, 40(%0)\n\t" -+ "mov %%r13d, 44(%0)\n\t" -+ "mov %%r14d, 48(%0)\n\t" -+ "mov %%r15d, 52(%0)\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"); -+ puts ("Bye!"); /* forth breakpoint here */ -+ -+ return 0; -+} ---- gdb-7.1-p2/gdb/testsuite/gdb.arch/amd64-word.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.1/gdb/testsuite/gdb.arch/amd64-word.exp 2010-04-03 21:06:52.000000000 +0200 -@@ -0,0 +1,123 @@ -+# 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 . -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@gnu.org -+ -+# This file is part of the gdb testsuite. -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+if { ![istarget x86_64-*-* ] } { -+ verbose "Skipping amd64 word register tests." -+ return -+} -+ -+set testfile "amd64-word" -+set srcfile amd64-pseudo.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } { -+ untested ${testfile} -+ return -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+set nr_regs 14 -+set word_regs(1) ax -+set word_regs(2) bx -+set word_regs(3) cx -+set word_regs(4) dx -+set word_regs(5) si -+set word_regs(6) di -+set word_regs(7) r8w -+set word_regs(8) r9w -+set word_regs(9) r10w -+set word_regs(10) r11w -+set word_regs(11) r12w -+set word_regs(12) r13w -+set word_regs(13) r14w -+set word_regs(14) r15w -+ -+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set first breakpoint in main" -+gdb_continue_to_breakpoint "continue to first breakpoint in main" -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ set hex [format %x $r] -+ gdb_test "print/x \$$word_regs($r)" \ -+ ".. = 0x${hex}2${hex}1" \ -+ "check contents of %$word_regs($r)" -+} -+ -+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 } { -+ set hex [format %x $r] -+ gdb_test "print/x \$$word_regs($r)" \ -+ ".. = 0x${hex}2${hex}1" \ -+ "check contents of %$word_regs($r)" -+} -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" -+} -+ -+gdb_test "break [gdb_get_line_number "third breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set third breakpoint in main" -+gdb_continue_to_breakpoint "continue to third breakpoint in main" -+ -+for { set r 1 } { $r <= 6 } { incr r } { -+ gdb_test "print \$$word_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$word_regs($r)" -+} -+ -+for { set r 7 } { $r <= $nr_regs } { incr r } { -+ gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" -+} -+ -+gdb_test "break [gdb_get_line_number "forth breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set forth breakpoint in main" -+gdb_continue_to_breakpoint "continue to forth breakpoint in main" -+ -+for { set r 7 } { $r <= $nr_regs } { incr r } { -+ gdb_test "print \$$word_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$word_regs($r)" -+} ---- gdb-7.1-p2/gdb/testsuite/gdb.arch/i386-byte.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.1/gdb/testsuite/gdb.arch/i386-byte.exp 2010-04-03 21:06:52.000000000 +0200 -@@ -0,0 +1,98 @@ -+# 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 . -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@gnu.org -+ -+# This file is part of the gdb testsuite. -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+if { ![istarget i?86-*-*] } { -+ verbose "Skipping i386 byte register tests." -+ return -+} -+ -+set testfile "i386-byte" -+set srcfile i386-pseudo.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } { -+ untested ${testfile} -+ return -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+set byte_regs(1) al -+set byte_regs(2) bl -+set byte_regs(3) cl -+set byte_regs(4) dl -+set byte_regs(5) ah -+set byte_regs(6) bh -+set byte_regs(7) ch -+set byte_regs(8) dh -+ -+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set first breakpoint in main" -+gdb_continue_to_breakpoint "continue to first breakpoint in main" -+ -+for { set r 1 } { $r <= 4 } { incr r } { -+ gdb_test "print/x \$$byte_regs($r)" \ -+ ".. = 0x[format %x $r]1" \ -+ "check contents of %$byte_regs($r)" -+ set h [expr $r + 4] -+ gdb_test "print/x \$$byte_regs($h)" \ -+ ".. = 0x[format %x $r]2" \ -+ "check contents of %$byte_regs($h)" -+} -+ -+for { set r 1 } { $r <= 4 } { incr r } { -+ gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)" -+ set h [expr $r + 4] -+ gdb_test "set var \$$byte_regs($h) = $h" "" "set %$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 1 } { $r <= 4 } { incr r } { -+ gdb_test "print \$$byte_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$byte_regs($r)" -+ set h [expr $r + 4] -+ gdb_test "print \$$byte_regs($h)" \ -+ ".. = $h" \ -+ "check contents of %$byte_regs($h)" -+} ---- gdb-7.1-p2/gdb/testsuite/gdb.arch/i386-pseudo.c 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.1/gdb/testsuite/gdb.arch/i386-pseudo.c 2010-04-03 21:06:52.000000000 +0200 -@@ -0,0 +1,51 @@ -+/* Test program for byte registers. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+ -+int data[] = { -+ 0x14131211, -+ 0x24232221, -+ 0x34333231, -+ 0x44434241, -+}; -+ -+int -+main (int argc, char **argv) -+{ -+ asm ("mov 0(%0), %%eax\n\t" -+ "mov 4(%0), %%ebx\n\t" -+ "mov 8(%0), %%ecx\n\t" -+ "mov 12(%0), %%edx\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "eax", "ebx", "ecx", "edx"); -+ asm ("nop"); /* first breakpoint here */ -+ -+ asm ("mov %%eax, 0(%0)\n\t" -+ "mov %%ebx, 4(%0)\n\t" -+ "mov %%ecx, 8(%0)\n\t" -+ "mov %%edx, 12(%0)\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "eax", "ebx", "ecx", "edx"); -+ puts ("Bye!"); /* second breakpoint here */ -+ -+ return 0; -+} ---- gdb-7.1-p2/gdb/testsuite/gdb.arch/i386-word.exp 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.1/gdb/testsuite/gdb.arch/i386-word.exp 2010-04-03 21:06:52.000000000 +0200 -@@ -0,0 +1,84 @@ -+# 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 . -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@gnu.org -+ -+# This file is part of the gdb testsuite. -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+if { ![istarget i?86-*-*] } { -+ verbose "Skipping i386 word register tests." -+ return -+} -+ -+set testfile "i386-word" -+set srcfile i386-pseudo.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug]] != "" } { -+ untested ${testfile} -+ return -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+set word_regs(1) ax -+set word_regs(2) bx -+set word_regs(3) cx -+set word_regs(4) dx -+ -+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -+ "Breakpoint .* at .*${srcfile}.*" \ -+ "set first breakpoint in main" -+gdb_continue_to_breakpoint "continue to first breakpoint in main" -+ -+for { set r 1 } { $r <= 4 } { incr r } { -+ gdb_test "print/x \$$word_regs($r)" \ -+ ".. = 0x[format %x $r]2[format %x $r]1" \ -+ "check contents of %$word_regs($r)" -+} -+ -+for { set r 1 } { $r <= 4 } { incr r } { -+ gdb_test "set var \$$word_regs($r) = $r" "" "set %$word_regs($r)" -+} -+ -+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 1 } { $r <= 4 } { incr r } { -+ gdb_test "print \$$word_regs($r)" \ -+ ".. = $r" \ -+ "check contents of %$word_regs($r)" -+} diff --git a/gdb-bz578250-avx-05of10.patch b/gdb-bz578250-avx-05of10.patch deleted file mode 100644 index a9f0908..0000000 --- a/gdb-bz578250-avx-05of10.patch +++ /dev/null @@ -1,30 +0,0 @@ -[ Backported. ] - -commit 6448aace637843e8e7c021d7f8c5d5d5fdd71974 -Author: H.J. Lu -Date: Wed Mar 3 20:19:48 2010 +0000 - - Mention improvement for X86 general purpose registers. - - 2010-03-03 H.J. Lu - Eli Zaretskii - - * 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 diff --git a/gdb-bz578250-avx-06of10.patch b/gdb-bz578250-avx-06of10.patch deleted file mode 100644 index c7e55f2..0000000 --- a/gdb-bz578250-avx-06of10.patch +++ /dev/null @@ -1,35 +0,0 @@ -[ Backported. ] - -commit 49f8d1c24c639d891f58a3b9feda425833b702fb -Author: H.J. Lu -Date: Fri Mar 12 15:12:34 2010 +0000 - - Restore sp for x86. - - 2010-03-12 H.J. Lu - - * 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? */ diff --git a/gdb-bz578250-avx-07of10.patch b/gdb-bz578250-avx-07of10.patch deleted file mode 100644 index c7029e0..0000000 --- a/gdb-bz578250-avx-07of10.patch +++ /dev/null @@ -1,183 +0,0 @@ -[ Backported. ] - -commit d5ea7042210f5ad319ad19910bce13fd5717c6d6 -Author: H.J. Lu -Date: Tue Mar 30 15:45:08 2010 +0000 - - Add xmlRegisters= to qSupported packet. - - gdb/ - - 2010-03-30 H.J. Lu - - * 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 - - * 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); diff --git a/gdb-bz578250-avx-08of10.patch b/gdb-bz578250-avx-08of10.patch deleted file mode 100644 index 4f1e4ab..0000000 --- a/gdb-bz578250-avx-08of10.patch +++ /dev/null @@ -1,32 +0,0 @@ -[ Backported. ] - -commit 684341392f3ca6703dc28dac548d3051811bff47 -Author: H.J. Lu -Date: Tue Mar 30 18:37:03 2010 +0000 - - Add org.gnu.gdb.i386.avx. - - 2010-03-30 H.J. Lu - - * 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}. - diff --git a/gdb-bz578250-avx-09of10.patch b/gdb-bz578250-avx-09of10.patch deleted file mode 100644 index d7a41b1..0000000 --- a/gdb-bz578250-avx-09of10.patch +++ /dev/null @@ -1,183 +0,0 @@ -[ Backported. ] - -commit 5362e5e1dc4cfac24fbd58773aaa7a82c615b662 -Author: H.J. Lu -Date: Thu Apr 1 20:02:07 2010 +0000 - - Support "ah", "bh", "ch", "dh" on amd64. - - gdb/ - - 2010-04-01 H.J. Lu - - * 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 - - * 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)" diff --git a/gdb-bz578250-avx-10of10-ppc.patch b/gdb-bz578250-avx-10of10-ppc.patch deleted file mode 100644 index c5ce275..0000000 --- a/gdb-bz578250-avx-10of10-ppc.patch +++ /dev/null @@ -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 }, diff --git a/gdb-bz578250-avx-10of10.patch b/gdb-bz578250-avx-10of10.patch deleted file mode 100644 index 41196c3..0000000 --- a/gdb-bz578250-avx-10of10.patch +++ /dev/null @@ -1,8271 +0,0 @@ -[ Backported. ] - -git://git.kernel.org/pub/scm/devel/gdb/hjl/avx.git -hjl/avxh -aebae36c2a8b73ae51319fff54fc39f220f0824a - ---- ./bfd/ChangeLog.xstate 1970-01-01 01:00:00.000000000 +0100 -+++ ./bfd/ChangeLog.xstate 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,14 @@ -+2010-01-27 H.J. Lu -+ -+ * elf.c (elfcore_grok_note): Replace NT_386_XSTATE with -+ NT_X86_XSTATE. -+ (elfcore_write_xstatereg): Likewise. -+ -+2010-01-27 H.J. Lu -+ -+ * elf-bfd.h (elfcore_write_xstatereg): New. -+ -+ * elf.c (elfcore_grok_xstatereg): New. -+ (elfcore_write_xstatereg): Likewise. -+ (elfcore_grok_note): Handle NT_386_XSTATE. -+ (elfcore_write_register_note): Handle .reg-xstate section. ---- ./gdb/ChangeLog.avx 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/ChangeLog.avx 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,306 @@ -+2010-03-04 H.J. Lu -+ -+ * common/i386-xstate.h (I386_XSTATE_SSE_MASK_STRING): Removed. -+ (I386_XSTATE_AVX_MASK_STRING): Likewise. -+ (I386_XSTATE_MAX_MASK_STRING): Likewise. -+ (I386_XSTATE_SSE_SIZE_STRING): Likewise. -+ (I386_XSTATE_AVX_SIZE_STRING): Likewise. -+ (I386_XSTATE_MAX_SIZE_STRING): Likewise. -+ -+ * i386-tdep.c (i386_gdbarch_init): Replace -+ I386_XSTATE_MAX_SIZE_STRING/I386_XSTATE_MAX_MASK_STRING with -+ I386_XSTATE_MAX_SIZE/I386_XSTATE_MAX_MASK. -+ -+2010-03-04 H.J. Lu -+ -+ * amd64-tdep.c (amd64_supply_xstateregset): Don't check -+ sizeof_xstateregset. -+ (amd64_collect_xstateregset): Likewise. -+ (amd64_regset_from_core_section): Likewise. -+ (amd64_init_abi): Don't set sizeof_xstateregset. -+ -+ * i386-tdep.c (i386_supply_xstateregset): Don't check -+ sizeof_xstateregset. -+ (i386_collect_xstateregset): Likewise. -+ (i386_regset_from_core_section): Likewise. -+ (i386_gdbarch_init): Don't set sizeof_xstateregset. -+ -+ * i386-tdep.h (gdbarch_tdep): Remove sizeof_xstateregset. -+ -+2010-03-04 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Call -+ i386_linux_update_xstateregset. -+ * i386-linux-nat.c (i386_linux_read_description): Likewise. -+ -+ * i386-linux-tdep.c (i386_linux_update_xstateregset): New. -+ * i386-linux-tdep.h (i386_linux_update_xstateregset): Likewise. -+ -+2010-03-03 H.J. Lu -+ -+ * amd64-linux-nat.c (xstate_size): New. -+ (xstate_size_n_of_int64): Likewise. -+ (amd64_linux_fetch_inferior_registers): Updated. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_read_description): Use I386_XSTATE_SSE_SIZE -+ instead of I386_XSTATE_MAX_SIZE. Set xstate_size and -+ xstate_size_n_of_int64. -+ -+ * i386-linux-nat.c (xstate_size): New. -+ (xstate_size_n_of_int64): Likewise. -+ (fetch_xstateregs): Updated. -+ (store_xstateregs): Likewise. -+ (i386_linux_read_description): Use I386_XSTATE_SSE_SIZE -+ instead of I386_XSTATE_MAX_SIZE. Set xstate_size and -+ xstate_size_n_of_int64. -+ -+ * common/i386-xstate.h (I386_XSTATE_SIZE): New. -+ -+2010-03-02 H.J. Lu -+ -+ * config/djgpp/fnchange.lst: Add x86 AVX XML files. -+ -+2010-03-02 H.J. Lu -+ -+ * amd64-linux-nat.c (XSTATE_MAX_SIZE_N_OF_INT64): New. -+ (amd64_linux_fetch_inferior_registers): Updated. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_read_description): Likewise. -+ * amd64-linux-tdep.c (amd64_linux_core_read_description): Likewise. -+ -+ * i386-linux-nat.c (XSTATE_MAX_SIZE_N_OF_INT64): New. -+ (fetch_xstateregs): Updated. -+ (store_xstateregs): Likewise. -+ (i386_linux_read_description): Likewise. -+ -+ * i386-linux-tdep.c (i386_linux_core_read_xcr0): Updated. -+ (i386_linux_core_read_xcr0): Likewise. -+ (i386_linux_core_read_description): Likewise. -+ -+ * i386-tdep.c (i386_register_reggroup_p): Updated. -+ (i386_validate_tdesc_p): Likewise. -+ (i386_gdbarch_init): Likewise. -+ -+ * i387-tdep.c (i387_supply_fxsave): Updated. -+ (i387_collect_xsave): Likewise. -+ -+ * common/i386-xstate.h: Change XSTATE to I386_XSTATE in macros. -+ -+2010-03-02 H.J. Lu -+ -+ * Makefile.in (i386-xstate.o): Removed. -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Use -+ XSTATE_MAX_SIZE_N_OF_INT64 and XSTATE_MAX_SIZE. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_read_description): Add static xcr0 and get it -+ from I386_LINUX_XSAVE_XCR0_OFFSET. Use XSTATE_MAX_SIZE_N_OF_INT64 -+ and XSTATE_MAX_SIZE. -+ (_initialize_amd64_linux_nat): Don't call i386_xstate_init. -+ -+ * configure.ac: Remove check for cpuid.h. -+ * config.in: Regenerated. -+ * configure: Likewise. -+ -+ * i386-linux-nat.c (fetch_xstateregs): Use -+ XSTATE_MAX_SIZE_N_OF_INT64 and XSTATE_MAX_SIZE. -+ (store_xstateregs): Likewise. -+ (i386_linux_read_description): Add static xcr0 and get it -+ from I386_LINUX_XSAVE_XCR0_OFFSET. Use XSTATE_MAX_SIZE_N_OF_INT64 -+ and XSTATE_MAX_SIZE. -+ (_initialize_i386_linux_nat): Don't call i386_xstate_init. -+ -+ * common/i386-cpuid.h: Removed. -+ * common/i386-xstate.c: Likewise. -+ -+ * common/i386-xstate.h (xstate_status): Removed. -+ (i386_xstate_type): Likewise. -+ (i386_xstate): Likewise. -+ (i386_xstate_init): Likewise. -+ (XSTATE_MAX_SIZE_N_OF_INT64): New. -+ -+ * config/i386/linux.mh (NATDEPFILES): Remove i386-xstate.o. -+ * config/i386/linux64.mh (NATDEPFILES): Likewise. -+ -+2010-02-01 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_g_packet_size): Make it const. -+ * amd64-tdep.c (amd64_g_packet_size): Likewise. -+ * i386-linux-tdep.c (i386_linux_g_packet_size): Likewise. -+ * i386-tdep.c (i386_g_packet_size): Likewise. -+ -+ * i386-linux-tdep.c (i386_linux_init_abi): Remove -+ i386_linux_g_packet_size. -+ -+ * i386-tdep.c (i386_register_g_packet_guesses): Updated. -+ * i386-tdep.h (i386_register_g_packet_guesses): Likewise. -+ -+2010-02-01 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_g_packet_size): Add key. -+ * i386-linux-tdep.c (i386_linux_g_packet_size): Likewise. -+ * i386-tdep.c (i386_g_packet_size): Likewise. -+ -+ * amd64-tdep.c (amd64_g_packet_size): New. -+ (amd64_init_abi): Call i386_register_g_packet_guesses. -+ -+ * i386-tdep.c (I386_PROPERTY_SSE): Removed. -+ (I386_PROPERTY_AVX): Likewise. -+ (i386_tdesc_sse): Likewise. -+ (i386_tdesc_avx): Likewise. -+ (i386_init_tdesc): Likewise. -+ (i386_register_g_packet_guesses): Updated. -+ (i386_gdbarch_vector_unit_init): Likewise. -+ -+ * i386-tdep.h (I386_PROPERTY_SSE): New. -+ (I386_PROPERTY_AVX): Likewise. -+ (AMD64_PROPERTY_SSE): Likewise. -+ (AMD64_PROPERTY_AVX): Likewise. -+ (i386_g_packet_size): Add key. -+ (i386_register_g_packet_guesses): Updated. -+ -+2010-01-31 H.J. Lu -+ -+ * regformats/reg-i386-avx-linux.dat: Add a comment for osabi. -+ * regformats/reg-x86-64-avx-linux.dat: Likewise. -+ -+2010-01-31 H.J. Lu -+ -+ * regformats/reg-i386-avx-linux.dat: Add a comment for xmlarch. -+ * regformats/reg-i386-avx.dat: Likewise. -+ * regformats/reg-x86-64-avx-linux.dat: Likewise. -+ * regformats/reg-x86-64-avx.dat: Likewise. -+ -+2010-01-31 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_g_packet_size): New. -+ (amd64_linux_init_abi): Pass amd64_linux_g_packet_size to -+ i386_register_g_packet_guesses. -+ -+ * i386-linux-tdep.c (i386_linux_g_packet_size): New. -+ (i386_linux_init_abi): Pass i386_linux_g_packet_size to -+ i386_register_g_packet_guesses. -+ -+ * i386-tdep.c (i386_register_g_packet_guesses): Updated to -+ take an array of the g/G packet sizes. -+ (i386_g_packet_size): New. -+ (i386_gdbarch_init): Pass i386_g_packet_size to -+ i386_register_g_packet_guesses. -+ -+ * i386-tdep.h (i386_g_packet_size_index): New. -+ (i386_register_g_packet_guesses): Updated. -+ -+2010-01-31 H.J. Lu -+ -+ * amd64-tdep.h (AMD64_G_PACKET_SIZE_AVX): Correct comments. -+ * i386-tdep.h (I386_G_PACKET_SIZE_AVX): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_fxsave): Remove vector unit check. -+ -+2010-01-22 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Remove the -+ duplicate. -+ -+2010-01-21 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Call -+ i386_xstate_init and initialize vector_unit properly. -+ -+2010-01-21 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Initialize -+ vector_unit only if target_desc isn't NULL. -+ -+2010-01-21 H.J. Lu -+ -+ * i386-tdep.c (i386_sse_type): Renamed to ... -+ (i386_vector_type): This. Updated. -+ (i386_register_type): Updated. -+ -+ * i386-tdep.h (i386_sse_type): Renamed to ... -+ (i386_vector_type): This. -+ -+ * amd64-tdep.c (amd64_register_type): Updated. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-tdep.c (amd64_register_name): Replace sse_unit with -+ vector_unit. -+ (amd64_init_abi): Likewise. -+ * i386-tdep.c (i386_register_name): Likewise. -+ (i386_sse_type): Likewise. -+ (i386_register_g_packet_guesses): Likewise. -+ (i386_gdbarch_sse_unit_init): Renamed to ... -+ (i386_gdbarch_vector_unit_init): This. -+ (i386_gdbarch_init): Updated. -+ -+ * i386-tdep.h (x86_sse_unit): Renamed to ... -+ (x86_vector_unit): This. -+ (i386_gdbarch_sse_unit_init): Renamed to ... -+ (i386_gdbarch_vector_unit_init): This. -+ -+ * i387-tdep.c (i387_supply_fxsave): Replace sse_unit with -+ vector_unit. -+ -+2009-10-14 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_init_abi): Call -+ register_remote_g_packet_guess. -+ -+ * amd64-tdep.c (amd64_register_names): Renamed to ... -+ (amd64_sse_register_names): This. Remove AVX registers. -+ (amd64_avx_register_names): New. -+ (AMD64_NUM_REGS): Updated. -+ (amd64_register_name): Handle sse_unit. -+ (amd64_register_type): Remove AVX registers. -+ (amd64_init_abi): Call i386_gdbarch_sse_unit_init to -+ initialize sse_unit. -+ -+ * amd64-tdep.h (AMD64_G_PACKET_SIZE_SSE): New. -+ (AMD64_G_PACKET_SIZE_AVX): Likewise. -+ -+ * defs.h (MAX_REGISTER_SIZE): Increase to 32. -+ -+ * i386-linux-tdep.c (i386_linux_init_abi): Call -+ i386_register_g_packet_guesses. -+ -+ * i386-tdep.c: Include "remote.h" and "target-descriptions.h". -+ (I386_PROPERTY_SSE): New. -+ (I386_PROPERTY_AVX): Likewise. -+ (i386_tdesc_sse): Likewise. -+ (i386_tdesc_avx): Likewise. -+ (i386_avx_register_names): Likewise. -+ (i386_vec128_type): Likewise. -+ (i386_vec256_type): Likewise. -+ (i386_init_tdesc): Likewise. -+ (i386_register_g_packet_guesses): Likewise. -+ (i386_gdbarch_sse_unit_init): Likewise. -+ (i386_register_names): Renamed to ... -+ (i386_sse_register_names): This. -+ (i386_num_register_names): Updated. -+ (i386_register_name): Handle sse_unit. -+ (i386_sse_type): Likewise. -+ (i386_gdbarch_init): Call i386_gdbarch_sse_unit_init to -+ initialize sse_unit. Call i386_register_g_packet_guesses. -+ (_initialize_i386_tdep): Call i386_tdesc_init. -+ -+ * i386-tdep.h (x86_sse_unit): New. -+ (I386_G_PACKET_SIZE_SSE): Likewise. -+ (I386_G_PACKET_SIZE_AVX): Likewise. -+ (i386_register_g_packet_guesses): Likewise. -+ (i386_gdbarch_sse_unit_init): Likewise. -+ (gdbarch_tdep): Add sse_unit. -+ (I386_MAX_REGISTER_SIZE): Increase to 32. -+ -+ * i387-tdep.c (i387_supply_fxsave): Assert sse_unit on SSE -+ registers. -+ -+ * regformats/reg-i386-avx-linux.dat: New. -+ * regformats/reg-i386-avx.dat: Likewise. -+ * regformats/reg-x86-64-avx-linux.dat: Likewise. -+ * regformats/reg-x86-64-avx.dat: Likewise. -+ -+ * regformats/reg-x86-64.dat: Add xmlarch. ---- ./gdb/ChangeLog.pseudo 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/ChangeLog.pseudo 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,189 @@ -+2010-02-25 H.J. Lu -+ -+ * i386-tdep.c (i386_mmx_regnum_p): Optimized. -+ (i386_byte_regnum_p): Likewise. -+ (i386_word_regnum_p): Likewise. -+ (i386_dword_regnum_p): Likewise. -+ -+2010-02-19 H.J. Lu -+ -+ * i386-tdep.c (i386_register_reggroup_p): Minimize function -+ calls. -+ -+2010-02-18 H.J. Lu -+ -+ * i386-tdep.c (i386_register_reggroup_p): Don't include pseudo -+ registers, except for MXX, in any register groups. -+ -+2010-02-18 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Set mm0_regnum only once. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-tdep.c (amd64_pseudo_register_name): Don't check MMX -+ pseudo registers. Call i386_pseudo_register_name. -+ (amd64_init_abi): Restore num_xmm_regs. -+ -+ * i386-tdep.c (i386_mmx_names): Make it static. -+ (i386_mmx_regnum_p): Likewise. -+ (i386_pseudo_register_name): Make it global. -+ -+ * i386-tdep.h (i386_mmx_regnum_p): Removed. -+ (i386_mmx_names): Likewise. -+ (i386_pseudo_register_name): New. -+ -+2010-02-18 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Call set_gdbarch_num_pseudo_regs -+ before tdesc_use_registers. -+ -+2010-02-18 H.J. Lu -+ -+ * i386-tdep.c (i386_pseudo_register_read): Check invalid -+ register number. -+ (i386_pseudo_register_write): Likewise. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-tdep.c (amd64_pseudo_register_read): New. -+ (amd64_pseudo_register_write): Likewise. -+ (amd64_init_abi): Call set_gdbarch_pseudo_register_read and -+ set_gdbarch_pseudo_register_write. -+ -+ * i386-tdep.c (i386_pseudo_register_read): Make it global. -+ Don't handle 64bit nor DWORD. -+ (i386_pseudo_register_write): Likewise. -+ -+ * i386-tdep.h (i386_pseudo_register_read): New. -+ (i386_pseudo_register_write): Likewise. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-tdep.c (amd64_byte_names): Make it static. -+ (amd64_word_names): Likewise. -+ (amd64_dword_names): Likewise. -+ (amd64_pseudo_register_name): New. -+ (amd64_init_abi): Set num_byte_regs, num_word_regs, num_dword_regs -+ and num_mmx_regs. Call set_tdesc_pseudo_register_name. -+ -+ * i386-tdep.c (i386_mmx_names): Make it global. -+ (i386_mmx_regnum_p): Likewise. -+ (i386_byte_regnum_p): Likewise. -+ (i386_word_regnum_p): Likewise. -+ (i386_dword_regnum_p): Likewise. -+ (i386_pseudo_register_name): Remove XBFD64. -+ (i386_pseudo_register_read): Remove BFD64. -+ (i386_pseudo_register_write): Likewise. -+ (i386_gdbarch_init): Move set_gdbarch_pseudo_register_read and -+ set_gdbarch_pseudo_register_write before gdbarch_init_osabi. -+ -+ * i386-tdep.h (i386_byte_regnum_p): New. -+ (i386_word_regnum_p): Likewise. -+ (i386_dword_regnum_p): Likewise. -+ (i386_mmx_regnum_p): Likewise. -+ (i386_mmx_names): Likewise. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-tdep.c (AMD64_NUM_REGS): Restored. -+ -+ * amd64-tdep.h (AMD64_NUM_GREGS): Removed. -+ -+2010-02-10 H.J. Lu -+ -+ * amd64-tdep.c (AMD64_NUM_REGS): Removed. -+ -+ * amd64-tdep.h (AMD64_NUM_GREGS): New. -+ -+ * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS -+ with I387_NUM_REGS. -+ * i386-tdep.c (i386_go32_init_abi): Likewise. -+ (i386_gdbarch_init): Likewise. -+ -+ * i386-tdep.h (i386_regnum): Add I386_MXCSR_REGNUM. -+ (I386_NUM_FREGS): Removed. -+ (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. -+ -+ * i387-tdep.h (I387_NUM_REGS): New. -+ -+2010-02-10 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Don't set num_xmm_regs. -+ -+2010-02-09 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_register_reggroup_p): Call -+ i386_register_reggroup_p instead of default_register_reggroup_p. -+ -+ * amd64-tdep.c (amd64_num_pseudo_regs): Removed. -+ (amd64_init_abi): Don't call set_gdbarch_num_pseudo_regs. Don't -+ set mm0_regnum. -+ -+ * i386-tdep.c (i386_num_mmx_regs): Removed. -+ (i386_num_pseudo_regs): Likewise. -+ (i386_mmx_regnum_p): Updated. -+ (i386_register_reggroup_p): Don't include pseudo byte, word, -+ dword registers in general_reggroup. -+ (i386_gdbarch_init): Updated. -+ -+ * i386-tdep.h (gdbarch_tdep): Add num_mmx_regs. -+ -+2010-02-08 H.J. Lu -+ -+ * amd64-tdep.c (amd64_word_names): Add a missing ','. -+ (amd64_dword_names): New. -+ (amd64_num_pseudo_regs): Updated. -+ -+ * amd64-tdep.h (amd64_dword_names): New. -+ -+ * i386-tdep.c (i386_dword_regnum_p): New. -+ (i386_pseudo_register_name): Use i386_dword_regnum_p. -+ (i386_pseudo_register_type): Likewise. -+ (i386_pseudo_register_read): Likewise. -+ (i386_pseudo_register_write): Likewise. -+ (i386_gdbarch_init): Set num_dword_regs and eax_regnum. -+ -+2010-02-08 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Optimized. -+ -+2010-02-08 H.J. Lu -+ -+ * amd64-tdep.c (amd64_byte_names): New. -+ (amd64_word_names): Likewise. -+ (amd64_num_pseudo_regs): Likewise. -+ (amd64_init_abi): Call set_gdbarch_num_pseudo_regs with -+ amd64_num_pseudo_regs, -+ -+ * amd64-tdep.h (amd64_byte_names): New. -+ (amd64_word_names): Likewise. -+ -+ * i386-tdep.c (i386_num_byte_regs): Removed. -+ (i386_num_word_regs): Likewise. -+ (i386_byte_regnum_p): Updated. -+ (i386_word_regnum_p): Likewise. -+ (i386_pseudo_register_name): Support 64bit. -+ (i386_pseudo_register_read): Likewise. -+ (i386_pseudo_register_write): Likewise. -+ -+2010-02-08 H.J. Lu -+ -+ * i386-tdep.c (i386_byte_names): New. -+ (i386_word_names): Likewise. -+ (i386_num_byte_regs): Likewise. -+ (i386_num_word_regs): Likewise. -+ (i386_num_pseudo_regs): Likewise. -+ (i386_byte_regnum_p): Likewise. -+ (i386_word_regnum_p): Likewise. -+ (i386_pseudo_register_name): Handle byte and word pseudo-registers. -+ (i386_pseudo_register_type): Likewise. -+ (i386_pseudo_register_read): Likewise. -+ (i386_pseudo_register_write): Likewise. -+ (i386_gdbarch_init): Call set_gdbarch_num_pseudo_regs with -+ i386_num_pseudo_regs. Set num_byte_regs, num_word_regs, -+ al_regnum, ax_regnum. Put MMX pseudo-registers after word -+ pseudo-registers. -+ -+ * i386-tdep.h (gdbarch_tdep): Add num_byte_regs, al_regnum, -+ num_word_regs, ax_regnum, num_dword_regs and eax_regnum. ---- ./gdb/ChangeLog.xcr 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/ChangeLog.xcr 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,1304 @@ -+2010-04-02 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Call -+ i386_linux_update_xstateregset. -+ -+2010-04-02 H.J. Lu -+ -+ * i386-tdep.c (i386_process_record): Replace i386_sse_regnum_p -+ with i386_xmm_regnum_p. -+ -+2010-03-28 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Call -+ amd64_linux_update_xstateregset instead of -+ i386_linux_update_xstateregset. -+ -+ * amd64-linux-tdep.c (amd64_linux_regset_sections): Make it -+ static. -+ (amd64_linux_update_xstateregset): New. -+ -+ * amd64-linux-tdep.h (amd64_linux_regset_sections): Removed. -+ (amd64_linux_update_xstateregset): New. -+ -+ * i386-linux-nat.c (i386_linux_read_description): Remove -+ i386_linux_regset_sections from i386_linux_update_xstateregset. -+ -+ * i386-linux-tdep.c (i386_linux_regset_sections): Make it -+ static. -+ (i386_linux_update_xstateregset): Remove regset_sections. Use -+ i386_linux_regset_sections. -+ -+ * i386-linux-tdep.h (i386_linux_regset_sections): Removed. -+ (i386_linux_update_xstateregset): Remove regset_sections. -+ i386_linux_regset_sections. -+ -+2010-03-28 H.J. Lu -+ -+ * i386-linux-nat.c (fetch_xstateregs): Don't cast &iov to int. -+ (store_xstateregs): Likewise. -+ (i386_linux_read_description): Don't cast &iov to long. -+ -+2010-03-28 H.J. Lu -+ -+ * i386-linux-tdep.h (I386_LINUX_XSAVE_XCR0_OFFSET): Update -+ comments. -+ -+2010-03-28 H.J. Lu -+ -+ * amd64-linux-nat.c (xstate_size): Removed. -+ (amd64_linux_fetch_inferior_registers): Replace xstate_size -+ with I386_XSTATE_MAX_SIZE. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_read_description): Updated. -+ -+ * i386-linux-nat.c (xstate_size): Removed. -+ (fetch_xstateregs): Replace xstate_size with -+ I386_XSTATE_MAX_SIZE. -+ (fetch_xstateregs): Likewise. -+ (i386_linux_read_description): Updated. -+ -+ * common/i386-xstate.h (I386_XSTATE_MAX_SIZE): New. -+ -+2010-03-28 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Replace -+ unsigned long long with uint64_t. -+ * amd64-linux-tdep.c (amd64_linux_core_read_description): -+ Likewise. -+ * i386-linux-nat.c (i386_linux_read_description): Likewise. -+ * i386-linux-tdep.h (i386_linux_core_read_xcr0): Likewise. -+ -+ * i386-linux-tdep.c (i386_linux_core_read_xcr0): Replace -+ unsigned long long with uint64_t. Don't assert section size. -+ (i386_linux_core_read_description): Replace unsigned long long -+ with uint64_t. -+ -+ * i386-tdep.c (i386_ymm_type): Fix typos in comments. -+ (i386_pseudo_register_read): Change 16byte to 128bits in -+ comments. -+ (i386_validate_tdesc_p): Update comments. -+ (i386_gdbarch_init): Likewise. -+ -+ * i386-tdep.h (gdbarch_tdep): Replace unsigned long long with -+ uint64_t. Replace gdb with GDB in comments. -+ -+2010-03-27 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Replace "x86=xml" with -+ "xmlRegisters+". -+ -+2010-03-12 H.J. Lu -+ -+ * amd64-linux-nat.c (xstate_size_n_of_int64): Removed. -+ (amd64_linux_fetch_inferior_registers): Updated. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_read_description): Likewise. -+ -+ * i386-linux-nat.c (xstate_size_n_of_int64): Removed. -+ (fetch_xstateregs): Updated. -+ (store_xstateregs): Likewise. -+ (i386_linux_read_description): Likewise. -+ -+2010-03-12 H.J. Lu -+ -+ * amd64-linux-nat.c: Include "i386-xstate.h". -+ (PTRACE_GETREGSET): New. -+ (PTRACE_SETREGSET): Likewise. -+ * i386-linux-nat.c: Likewise. -+ -+ * amd64-linux-tdep.c: Include "i386-xstate.h". -+ -+ * config/i386/linux64.mh (NAT_FILE): Set to config/nm-linux.h. -+ -+ * config/i386/nm-linux.h: Don't include -+ "config/i386/nm-linux-xstate.h". -+ -+ * config/i386/nm-linux-xstate.h: Removed. -+ * config/i386/nm-linux64.h: Likewise. -+ -+2010-03-12 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_xsave): Replace I386_XSTATE_MAX_MASK -+ with I386_XSTATE_AVX_MASK. -+ -+ * common/i386-xstate.h (I386_XSTATE_MAX_MASK): Removed. -+ (I386_XSTATE_MAX_SIZE): Likewise. -+ -+2010-03-12 H.J. Lu -+ -+ * i386-tdep.c (i386_register_reggroup_p): Replace -+ bit_I386_XSTATE_XXX with I386_XSTATE_XXX. -+ * i387-tdep.c (i387_supply_xsave): Likewise. -+ (i387_collect_xsave): Likewise. -+ -+ * common/i386-xstate.h (bit_I386_XSTATE_XXX): Renamed to ... -+ (I386_XSTATE_XXX): This. -+ (I386_XSTATE_XXX_MASK): Replace bit_I386_XSTATE_XXX with -+ I386_XSTATE_XXX. -+ (I386_XSTATE_SIZE): Likewise. -+ -+2010-03-07 H.J. Lu -+ -+ * amd64-tdep.c (amd64_dwarf_reg_to_regnum): Return %ymmN -+ register number for %xmmN if AVX is available. -+ -+ * i386-tdep.c (i386_xmm_regnum_p): Make it global. -+ (i386_dbx_reg_to_regnum): Return %ymmN register number for -+ %xmmN if AVX is available. -+ -+ * i386-tdep.h (i386_xmm_regnum_p): New. -+ -+2010-03-06 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Replace AMD64_AVX_NUM_REGS -+ with AMD64_NUM_REGS. -+ -+ * amd64-tdep.h (AMD64_AVX_NUM_REGS): Renamed to ... -+ (AMD64_NUM_REGS): This. -+ -+ * i386-linux-nat.c (GETFPXREGS_SUPPLIES): Replace -+ I386_AVX_NUM_REGS with I386_SSE_NUM_REGS. -+ (GETXSTATEREGS_SUPPLIES): New. -+ (i386_linux_fetch_inferior_registers): Use GETXSTATEREGS_SUPPLIES. -+ (i386_linux_store_inferior_registers): Likewise. -+ -+2010-03-06 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_gregset_reg_offset): Count 8 -+ upper YMM registers. -+ -+2010-03-06 H.J. Lu -+ -+ * i386-tdep.c (i386_register_reggroup_p): For all_group, don't -+ include upper YMM registers nor XMM registers when AVX is -+ supported. -+ -+2010-03-05 H.J. Lu -+ -+ * i387-tdep.c (i387_collect_xsave): Replace regcache_raw_read -+ with regcache_raw_collect. -+ -+2010-03-05 H.J. Lu -+ -+ * i386-tdep.c (i386_register_reggroup_p): Don't return 0 -+ for uppper YMM nor XMM registers. -+ -+ * i387-tdep.c (xsave_sse_offset): Removed. -+ (XSAVE_SSE_ADDR): Likewise. -+ (i387_supply_xsave): Replace XSAVE_SSE_ADDR with FXSAVE_ADDR. -+ (i387_collect_xsave): Likewise. Replace the second -+ regcache_raw_collect with memcpy. -+ -+2010-03-05 H.J. Lu -+ -+ * i387-tdep.c (xsave_offset): Removed. -+ (XSAVE_ADDR): Likewise. -+ (xsave_sse_offset): New. -+ (XSAVE_SSE_ADDR): Likewise. -+ (xsave_avxh_offset): Likewise. -+ (XSAVE_AVXH_ADDR): Likewise. -+ (i387_supply_xsave): Updated. -+ (i387_collect_xsave): Likewise. -+ -+2010-03-05 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_xsave): Fix typos. -+ (i387_collect_xsave): Properly handle gcore. -+ -+2010-03-05 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Count -+ 16 upper YMM registers. -+ (amd64_linux_gregset32_reg_offset): Count 8 upper YMM registers. -+ -+ * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace -+ AMD64_MXCSR_REGNUM with AMD64_YMM15H_REGNUM. -+ -+ * amd64-tdep.c (amd64_sse_register_names): Renamed to ... -+ (amd64_register_names): This. -+ (amd64_avx_register_names): Removed. -+ (amd64_xmm_names): Likewise. -+ (AMD64_NUM_REGS): Likewise. -+ (amd64_ymm_names): New. -+ (amd64_ymmh_names): Likewise. -+ (amd64_register_name): Likewise. -+ (amd64_pseudo_register_name): Remove i386_xmm_regnum_p. Add -+ i386_ymm_regnum_p. -+ (amd64_init_abi): Set ymmh_register_names, num_ymm_regs -+ and ymm0h_regnum. Call set_gdbarch_register_name. Replace -+ num_vector_regs with num_xmm_regs. Replace AMD64_NUM_REGS -+ with AMD64_AVX_NUM_REGS. -+ -+ * amd64-tdep.h (amd64_regnum): Add AMD64_YMM0H_REGNUM and -+ AMD64_YMM15H_REGNUM. -+ (AMD64_AVX_NUM_REGS): New. -+ (amd64_register_name): Removed. -+ (amd64_register_type): Likewise. -+ -+ * i386-darwin-tdep.c (i386_darwin_init_abi): Replace -+ num_vector_regs with num_xmm_regs. -+ -+ * i386-linux-nat.c (regmap): Count 8 upper YMM registers. -+ (GETFPXREGS_SUPPLIES): Replace I386_SSE_NUM_REGS with -+ I386_AVX_NUM_REGS. -+ * i386-linux-tdep.h (I386_LINUX_ORIG_EAX_REGNUM): Likewise. -+ -+ * i386-nto-tdep.c (i386nto_register_area): Replace -+ I387_VECTOR0_REGNUM with I387_XMM0_REGNUM. -+ -+ * i386-tdep.c (i386_sse_register_names): Renamed to ... -+ (i386_register_names): This. -+ (i386_avx_register_names): Removed. -+ (i386_xmm_names): Likewise. -+ (i386_vector_regnum_p): Likewise. -+ (i386_xmm_type): Likewise. -+ (): Likewise. -+ (): Likewise. -+ (i386_ymm_names): New. -+ (i386_ymmh_names): Likewise. -+ (i386_ymmh_regnum_p): Likewise. -+ (i386_ymm_regnum_p): Likewise. -+ (i386_register_name): Likewise. -+ (i386_ymm_type): Likewise. -+ (): Likewise. -+ (i386_mxcsr_regnum_p): Replace I387_VECTOR0_REGNUM with -+ I387_XMM0_REGNUM. -+ (i386_dbx_reg_to_regnum): Likewise. -+ (i386_pseudo_register_name): Remove i386_xmm_regnum_p. Add -+ i386_ymm_regnum_p. -+ (i386_pseudo_register_type): Likewise. -+ (i386_pseudo_register_read): Likewise. -+ (i386_pseudo_register_write): Likewise. -+ (i386_go32_init_abi): Replace num_vector_regs with num_xmm_regs. -+ (i386_register_reggroup_p): Replace i386_vector_regnum_p. Add -+ i386_ymm_regnum_p. -+ (i386_validate_tdesc_p): Get SSE registers. Try AVX registers. -+ (i386_gdbarch_init): Replace num_vector_regs with num_xmm_regs. -+ Call set_gdbarch_register_name. Replace I386_SSE_NUM_REGS -+ with I386_AVX_NUM_REGS. Set ymmh_register_names, ymm0h_regnum, -+ num_ymm_regs and ymm0_regnum. Call set_gdbarch_qsupported -+ with "x86=xml". -+ -+ * i386-tdep.h (gdbarch_tdep): Add num_ymm_regs, ymm0_regnum, -+ ymm0h_regnum, ymmh_register_names and i386_ymm_type. Remove -+ xmm0_regnum, num_vector_regs and i386_xmm_type. -+ (i386_regnum): Add I386_YMM0H_REGNUM and I386_YMM7H_REGNUM. -+ (I386_AVX_NUM_REGS): New. -+ (i386_ymm_regnum_p): Likewise. -+ (i386_ymmh_regnum_p): Likewise. -+ (I386_MAX_REGISTER_SIZE): Changed to 16. -+ (i386_xmm_regnum_p): Removed. -+ -+ * i387-tdep.c (i387_supply_fsave): Replace I387_VECTOR0_REGNUM -+ with I387_XMM0_REGNUM. -+ (i387_collect_fsave): Likewise. -+ (i387_supply_fxsave): Replace I387_VECTOR0_REGNUM/num_vector_regs -+ with I387_XMM0_REGNUM/num_vector_regs. -+ (i387_collect_fxsave): Likewise. -+ (xsave_sse_offset): Removed. -+ (XSAVE_SSE_ADDR): Likewise. -+ (xsave_avxh_offset): Likewise. -+ (XSAVE_AVXH_ADDR): Likewise. -+ (xsave_offset): New. -+ (XSAVE_ADDR): Likewise. -+ (i387_supply_xsave): Rewrite. -+ (i387_collect_xsave): Likewise. -+ -+ * i387-tdep.h (I387_NUM_VECTOR_REGS): Renamed to ... -+ (I387_NUM_XMM_REGS): This. -+ (I387_NUM_YMM_REGS): New. -+ (I387_YMM0H_REGNUM): Likewise. -+ (I387_VECTOR0_REGNUM): Renamed to ... -+ (I387_XMM0_REGNUM): This. -+ (I387_MXCSR_REGNUM): Updated. -+ (I387_YMMENDH_REGNUM): New. -+ -+2010-03-05 H.J. Lu -+ -+ * features/i386/32bit-avx.xml: Only define upper YMM registers. -+ * features/i386/64bit-avx.xml: Likewise. -+ -+ * features/i386/amd64-avx-linux.xml: Include 64bit-sse.xml. -+ * features/i386/amd64-avx.xml: Likewise. -+ -+ * features/i386/i386-avx-linux.xml: Include 32bit-sse.xml. -+ * features/i386/i386-avx.xml: Likewise. -+ -+ * features/i386/amd64-avx-linux.c: Regenerated. -+ * features/i386/amd64-avx.c: Likewise. -+ * features/i386/i386-avx-linux.c: Likewise. -+ * features/i386/i386-avx.c: Likewise. -+ * regformats/i386/amd64-avx-linux.dat: Likewise. -+ * regformats/i386/amd64-avx.dat: Likewise. -+ * regformats/i386/i386-avx-linux.dat: Likewise. -+ * regformats/i386/i386-avx.dat: Likewise. -+ -+2010-03-02 H.J. Lu -+ -+ * i386-linux-tdep.h (XSAVE_XCR0_OFFSET): Renamed to ... -+ (I386_LINUX_XSAVE_XCR0_OFFSET): This. -+ * amd64-linux-tdep.c (amd64_linux_init_abi): Updated. -+ * i386-linux-tdep.c (i386_linux_core_read_xcr0): Likewise. -+ (i386_linux_init_abi): Likewise. -+ -+2010-03-02 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_init_abi): Set xsave_xcr0_offset. -+ * i386-linux-tdep.c (i386_linux_init_abi): Likewise. -+ -+ * i386-tdep.c (i386_gdbarch_init): Set xsave_xcr0_offset to -1. -+ -+ * i387-tdep.c (i387_collect_xsave): Updated. -+ -+ * i387-tdep.h (XSAVE_XCR0_OFFSET): Moved to ... -+ * i386-linux-tdep.h (XSAVE_XCR0_OFFSET): Here. -+ -+2010-03-01 H.J. Lu -+ -+ * features/i386/32bit-avx.xml: Define i386_mxcsr. -+ * features/i386/64bit-avx.xml: Likewise. -+ -+ * features/i386/amd64-avx-linux.c: Regenerated. -+ * features/i386/amd64-avx.c: Likewise. -+ * features/i386/i386-avx-linux.c: Likewise. -+ * features/i386/i386-avx.c: Likewise. -+ -+2010-02-25 H.J. Lu -+ -+ * i386-tdep.c (i386_xmm_regnum_p): Optimized. -+ (i386_vector_regnum_p): Likewise. -+ -+2010-02-24 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_store_inferior_registers): Pass -+ 0 to amd64_collect_xsave. -+ -+ * amd64-tdep.c (amd64_collect_xstateregset): Pass 1 to -+ amd64_collect_xsave. -+ (amd64_collect_xsave): Add an integer argument and pass it to -+ i387_collect_xsave. -+ -+ * amd64-tdep.h (amd64_collect_xsave): Add an integer argument. -+ * i387-tdep.h (i387_collect_xsave): Likewise. -+ -+ * i386-linux-nat.c (store_xstateregs): Pass 1 to -+ i387_collect_xsave. -+ * i386-tdep.c (i386_collect_xstateregset): Likewise. -+ -+ * i387-tdep.c (i387_collect_xsave): Add an integer argument -+ to indicate gcore. Update the first 8 bytes of the -+ sw_usable_bytes[464..467] and `xstate_bv' with XCR0 for gcore. -+ -+2010-02-24 H.J. Lu -+ -+ * i387-tdep.c (i387_collect_xsave): Fix more typos. -+ -+2010-02-24 H.J. Lu -+ -+ * i387-tdep.c (i387_collect_xsave): Fix a typo. -+ -+2010-02-24 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Fix a typo. -+ -+ * i386-tdep.c (i386_register_reggroup_p): Return 0 for pseudo -+ XMM registers if group isn't SSE. -+ -+2010-02-24 H.J. Lu -+ -+ * amd64-linux-nat.c: Include "regset.h". -+ (amd64_linux_read_description): Set .reg-xstate section size if -+ it is supported. -+ (_initialize_amd64_linux_nat): Call i386_xstate_init. -+ -+ * amd64-linux-tdep.c: Include "regset.h" before -+ "amd64-linux-tdep.h". -+ (amd64_linux_regset_sections): Make it global. -+ (_initialize_amd64_linux_tdep): Don't call i386_xstate_init. -+ -+ * amd64-linux-tdep.h (amd64_linux_regset_sections): New. -+ -+ * config/i386/nm-linux-xstate.h (FILL_XSTATEREGSET): Removed. -+ -+ * i386-linux-nat.c: Include "regset.h". -+ (i386_linux_read_description): Set .reg-xstate section size if -+ it is supported. -+ (_initialize_i386_linux_nat): Call i386_xstate_init. -+ -+ * i386-linux-tdep.c: Include "regset.h" before "inferior.h". -+ (i386_linux_regset_sections): Make it global. -+ (_initialize_i386_linux_tdep): Don't call i386_xstate_init. -+ -+ * i386-linux-tdep.h (i386_linux_regset_sections): New. -+ -+2010-02-22 H.J. Lu -+ -+ * i386-tdep.c (i386_validate_tdesc_p): Use num_vector_regs instead -+ of num_xmm_regs to check vector registers. -+ -+2010-02-20 H.J. Lu -+ -+ * features/i386/Makefile: New. -+ -+2010-02-19 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_xsave): Remove one regcache_raw_supply -+ for x87. -+ -+2010-02-19 H.J. Lu -+ -+ * amd64-linux-nat.c (have_ptrace_getregset): Make it static -+ and initialized to -1. -+ (amd64_linux_fetch_inferior_registers): Error if PTRACE_GETREGSET -+ fails. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_read_description): Set have_ptrace_getregset. -+ Check the native XCR0 only if PTRACE_GETREGSET is available. -+ (_initialize_amd64_linux_nat): Don't set have_ptrace_getregset. -+ -+ * i386-linux-nat.c (have_ptrace_getregset): Make it static -+ and initialized to -1. -+ (fetch_xstateregs): Error if PTRACE_GETREGSET fails. -+ (store_xstateregs): Likewise. -+ (i386_linux_read_description): Set have_ptrace_getregset. -+ Check the native XCR0 only if PTRACE_GETREGSET is available. -+ (_initialize_i386_linux_nat): Don't set have_ptrace_getregset. -+ -+2010-02-19 H.J. Lu -+ -+ * common/i386-xstate.h (XSTATE_SSE_MASK): Add bit_XSTATE_X87. -+ (XSTATE_MAX_MASK): Defined with XSTATE_AVX_MASK only. -+ (XSTATE_SSE_MASK_STRING): Updated. -+ (XSTATE_AVX_MASK_STRING): Likewise. -+ -+ * i387-tdep.c (i387_supply_xsave): Also check x87 registers. -+ (i387_collect_xsave): Likewise. -+ -+2010-02-19 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Use num_vector_regs instead -+ of num_xmm_regs to check vector registers. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Set num_xmm_regs based on -+ vector feature. -+ * i386-tdep.c (i386_gdbarch_init): Likewise. -+ -+ * i386-darwin-tdep.c (i386_darwin_init_abi): Replace num_xmm_regs -+ with num_vector_regs. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Set num_vector_regs to 16. -+ -+ * i386-tdep.c (i386_gdbarch_init): Add num_xmm_regs to -+ set_gdbarch_num_pseudo_regs. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Check the -+ native XCR0. -+ -+ * amd64-linux-tdep.c: Include "features/i386/amd64-avx-linux.c". -+ (amd64_linux_core_read_description): Check XCR0 from core dump. -+ (_initialize_amd64_linux_tdep): Call -+ initialize_tdesc_amd64_avx_linux. -+ -+ * amd64-tdep.c: Include "features/i386/amd64-avx.c". -+ (AMD64_NUM_REGS): Use amd64_sse_register_names. -+ (amd64_xmm_names): Make it static. -+ (amd64_pseudo_register_name): Handle XMM pseud registers. -+ (amd64_init_abi): Set register_names based on target description. -+ (_initialize_amd64_tdep): Call initialize_tdesc_amd64_avx. -+ -+ * i386-linux-nat.c (i386_linux_read_description): Check the -+ native XCR0. -+ -+ * i386-linux-tdep.c (i386_linux_core_read_xcr0): New. -+ (i386_linux_core_read_description): Use it. Remove BFD64. -+ (i386_linux_read_description): Removed. -+ (_initialize_i386_linux_tdep): Call -+ initialize_tdesc_i386_avx_linux. -+ -+ * i386-tdep.c (i386_xmm_regnum_p): Make it global. -+ (i386_pseudo_register_name): Remove BFD64. -+ (i386_pseudo_register_read): Likewise. -+ (i386_pseudo_register_write): Likewise. -+ (i386_gdbarch_init): Set register_names based on target -+ description. -+ -+2010-02-13 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Properly -+ check extended state size. -+ (i386_linux_read_description): Properly check the native XCR0. -+ -+2010-02-13 H.J. Lu -+ -+ * common/i386-xstate.h (XSTATE_SSE_MASK): Defined with -+ bit_XSTATE_SSE. -+ (XSTATE_AVX_MASK): Defined with XSTATE_SSE_MASK and bit_XSTATE_AVX. -+ (XSTATE_MAX_MASK): Defined with XSTATE_AVX_MASK and bit_XSTATE_X87. -+ (XSTATE_SSE_MASK_STRING): Updated. -+ (XSTATE_AVX_MASK_STRING): Likewise. -+ -+ * 386-linux-tdep.c (i386_linux_core_read_description): Use -+ XSTATE_XXX_MASK. -+ (i386_linux_core_read_description): Likewise. -+ -+ * i386-tdep.c (i386_register_reggroup_p): Check xcr0 instead -+ of vector_unit. -+ (i386_gdbarch_init): Set xcr0 instead of vector_unit. -+ -+ * i386-tdep.h (x86_vector_unit): Removed. -+ (gdbarch_tdep): Remove vector_unit. Add xcr0. -+ -+ * i387-tdep.c (i387_supply_fxsave): Check xcr0 instead of -+ vector_unit. -+ (i387_supply_xsave): Likewise. -+ (i387_collect_xsave): Likewise. -+ -+2010-02-11 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Don't set xcr0 on x86 host. -+ (_initialize_i386_tdep): Don't call i386_xstate_init on x86 host. -+ -+ * i386-tdep.h (gdbarch_tdep): Remove xcr0. -+ -+ * i387-tdep.c (i387_supply_xsave): Replace tdep->xcr0 with -+ i386_xstate.xcr0. -+ (i387_collect_xsave): Likewise. -+ -+2010-02-11 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Don't -+ set xcr0 here. -+ -+2010-02-11 H.J. Lu -+ -+ * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Re-indent. -+ -+ * i386-linux-tdep.c (i386_linux_read_description): Don't set -+ xcr0 here. -+ (_initialize_i386_linux_tdep): Re-indent. -+ -+ * i386-tdep.c (i386_gdbarch_init): Set xcr0 on x86 host. -+ (_initialize_i386_tdep): Call i386_xstate_init on x86 host. -+ -+ * i386-tdep.h (gdbarch_tdep): Mention xcr0 is used only for -+ native debug. -+ -+2010-02-11 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Cast -+ NT_X86_XSTATE to unsigned int. -+ (amd64_linux_store_inferior_registers): Likewise. -+ * i386-linux-nat.c (fetch_xstateregs): Likewise. -+ (store_xstateregs): Likewise. -+ -+2010-02-10 H.J. Lu -+ -+ * amd64-linux-nat.c: Include "elf/common.h" and . -+ (amd64_linux_fetch_inferior_registers): Use iovec. -+ (amd64_linux_store_inferior_registers): Likewise. -+ -+ * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Don't -+ check i386_xstate.size. -+ * i386-linux-tdep.c (_initialize_i386_linux_tdep): Likewise. -+ -+ * config/i386/nm-linux-xstate.h: Don't include "elf/common.h". -+ (PTRACE_REGSET_NT_SHIFT): Removed. -+ (PTRACE_REGSET_MAX_SIZE): Likewise. -+ (PTRACE_REGSET_XSTATE_ADDR): Likewise. -+ -+ * i386-linux-nat.c: Include "elf/common.h" and . -+ (fetch_xstateregs): Use iovec. -+ (store_xstateregs): Likewise. -+ -+2010-02-09 H.J. Lu -+ -+ * i386-tdep.c (i386_pseudo_register_read): Properly convert -+ XMM pseudo register to vector register. -+ (i386_pseudo_register_write): Likewise. -+ -+2010-02-09 H.J. Lu -+ -+ * features/i386/32bit-avx.xml: Fix typos. -+ * features/i386/64bit-avx.xml: Likewise. -+ -+ * features/i386/amd64-avx-linux.c: Regenerated. -+ * features/i386/amd64-avx.c: Likewise. -+ * features/i386/i386-avx-linux.c: Likewise. -+ * features/i386/i386-avx.c: Likewise. -+ -+2010-02-09 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Count XMM pseudo registers. -+ -+2010-02-09 H.J. Lu -+ -+ * i387-tdep.h (I387_XMM0_REGNUM): Renamed to ... -+ (I387_VECTOR0_REGNUM): This. -+ (I387_MXCSR_REGNUM): Updated. -+ -+ * i386-nto-tdep.c (i386nto_register_area): Replace -+ I387_XMM0_REGNUM with I387_VECTOR0_REGNUM. -+ -+ * i386-tdep.c (i386_sse_regnum_p): Renamed to ... -+ (i386_vector_regnum_p): This. Replace I387_XMM0_REGNUM -+ with I387_VECTOR0_REGNUM. -+ (i386_fpc_regnum_p): Replace I387_XMM0_REGNUM with -+ I387_VECTOR0_REGNUM. -+ (i386_register_reggroup_p): Updated. Handle XMM pseudo -+ registers. -+ -+ * i387-tdep.c (i386_fpc_regnum_p): Replace I387_XMM0_REGNUM -+ with I387_VECTOR0_REGNUM. -+ (i387_supply_fxsave): Likewise. -+ (i387_collect_fxsave): Likewise. -+ (XSAVE_SSE_ADDR): Likewise. -+ (XSAVE_AVXH_ADDR): Likewise. -+ (i387_supply_xsave): Likewise. -+ (i387_collect_xsave): Likewise. -+ -+2010-02-09 H.J. Lu -+ -+ * i386-tdep.c (i386_pseudo_register_name): Handle XMM pseudo -+ registers. -+ (i386_pseudo_register_type): Likewise. -+ (i386_pseudo_register_read): Likewise. -+ (i386_pseudo_register_write): Likewise. -+ (i386_gdbarch_init): Likewise. -+ (i386_xmm_type): New. -+ -+ * 386-tdep.h (gdbarch_tdep): Add num_xmm_regs, xmm0_regnum -+ and i386_xmm_type. -+ -+2010-02-09 H.J. Lu -+ -+ * amd64-tdep.c (amd64_xmm_names): New. -+ (amd64_num_pseudo_regs): Updated. -+ -+ * amd64-tdep.h (amd64_xmm_names): New. -+ -+ * i386-tdep.c (i386_xmm_names): New. -+ (i386_xmm_regnum_p): Likewise. -+ (i386_num_pseudo_regs): Updated. -+ -+2010-02-09 H.J. Lu -+ -+ * i386-tdep.h (gdbarch_tdep): Rename num_xmm_regs to -+ num_vector_regs. -+ -+ * i387-tdep.h (I387_NUM_XMM_REGS): Removed. -+ (I387_NUM_VECTOR_REGS): New. -+ (I387_MXCSR_REGNUM): Updated. -+ -+ * amd64-tdep.c (amd64_init_abi): Updated. -+ * i386-tdep.c (i386_sse_regnum_p): Likewise. -+ (i386_mxcsr_regnum_p): Likewise. -+ (i386_go32_init_abi): Likewise. -+ (i386_gdbarch_init): Likewise. -+ * i387-tdep.c (i387_supply_fxsave): Likewise. -+ (i387_collect_fxsave): Likewise. -+ (i387_supply_xsave): Likewise. -+ (i387_collect_xsave): Likewise. -+ -+2010-02-09 H.J. Lu -+ -+ * amd64-linux-nat.c: Replace PTRACE_GETXSTATEREGS with -+ PTRACE_GETREGSET in comments. -+ (have_ptrace_getxstateregs): Renamed to ... -+ (have_ptrace_getregset): This. -+ (amd64_linux_fetch_inferior_registers): Updated to use -+ PTRACE_GETREGSET. -+ (amd64_linux_store_inferior_registers): Updated to use -+ PTRACE_GETREGSET and PTRACE_SETREGSET. -+ -+ * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Assert -+ the XSAVE extended state size. -+ -+ * i386-linux-nat.c: Replace PTRACE_GETXSTATEREGS with -+ PTRACE_GETREGSET in comments. -+ (have_ptrace_getxstateregs): Renamed to ... -+ (have_ptrace_getregset): This. -+ (fetch_xstateregs): Updated to use PTRACE_GETREGSET. -+ (store_xstateregs): Updated to use PTRACE_GETREGSET and -+ PTRACE_SETREGSET. -+ -+ * i386-linux-tdep.c (_initialize_i386_linux_tdep): Assert -+ the XSAVE extended state size. -+ -+ * config/i386/nm-linux-xstate.h: Include "elf/common.h". -+ (PTRACE_GETXSTATEREGS): Removed. -+ (PTRACE_SETXSTATEREGS): Likewise. -+ (PTRACE_GETREGSET): New. -+ (PTRACE_SETREGSET): Likewise. -+ (PTRACE_REGSET_NT_SHIFT): Likewise. -+ (PTRACE_REGSET_MAX_SIZE): Likewise. -+ (PTRACE_REGSET_XSTATE_ADDR): Likewise. -+ -+2010-02-08 H.J. Lu -+ -+ * i386-linux-tdep.c: Replace x86-64/x86_64 with amd64. -+ * i386-tdep.c: Likewise. -+ -+ * features/Makefile: Replace x86-64 with amd64. -+ * features/i386/*: Rename x86-64* to amd64*. -+ -+ * regformats/i386/*: Rename x86-64* to amd64*. -+ -+2010-02-07 H.J. Lu -+ -+ * common/i386-xstate.c: Don't include "config.h" if XSTATE_MAIN -+ is defined. -+ (main): Fix typo. -+ -+2010-02-06 H.J. Lu -+ -+ * common/i386-xstate.c (main): New. Defined only if XSTATE_MAIN -+ is defined. -+ -+2010-02-05 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Set vector_unit. -+ -+2010-02-05 H.J. Lu -+ -+ * config/i386/nm-linux-xstate.h: Don't include . -+ -+ * i386-linux-tdep.c (i386_linux_read_description): Don't use -+ ptrace. -+ -+2010-02-05 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Pass -+ i386_xstate.size to XSTATE ptrace. -+ (amd64_linux_store_inferior_registers): Likewise. -+ * i386-linux-nat.c (fetch_xstateregs): Likewise. -+ (store_xstateregs): Likewise. -+ -+2010-02-05 H.J. Lu -+ -+ * amd64-linux-nat.c (PTRACE_GETXSTATEREGS): Don't define. -+ (PTRACE_SETXSTATEREGS): Likewise. -+ * i386-linux-nat.c (PTRACE_GETXSTATEREGS): -+ (PTRACE_SETXSTATEREGS): Likewise. -+ -+ * config/i386/nm-linux.h: Include "config/i386/nm-linux-xstate.h". -+ * config/i386/nm-linux64.h: Likewise. -+ -+ * 386-linux-tdep.c (i386_linux_read_description): Define only if -+ FILL_XSTATEREGSET is defined. Use ptrace to get xcr0 from -+ kernel. -+ -+2010-02-05 H.J. Lu -+ -+ * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Update -+ comments. -+ -+ * i386-linux-tdep.c: Include features/i386/i386-avx-linux.c -+ and features/i386/x86-64-avx-linux.c. -+ (i386_linux_core_read_description): Handle AVX. -+ (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_avx_linux -+ and initialize_tdesc_x86_64_avx_linux. -+ -+ * i386-tdep.c: Include features/i386/i386-avx.c and -+ features/i386/x86-64-avx.c. -+ (_initialize_i386_tdep): Call initialize_tdesc_i386_avx and -+ initialize_tdesc_x86_64_avx. -+ -+2010-02-05 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Try org.gnu.gdb.i386.avx. -+ -+2010-02-05 H.J. Lu -+ -+ * features/i386/32bit-avx.xml: New. -+ * features/i386/64bit-avx.xml: Likewise. -+ * features/i386/i386-avx-linux.c: Likewise. -+ * features/i386/i386-avx-linux.xml: Likewise. -+ * features/i386/i386-avx.c: Likewise. -+ * features/i386/i386-avx.xml: Likewise. -+ * features/i386/x86-64-avx-linux.c: Likewise. -+ * features/i386/x86-64-avx-linux.xml: Likewise. -+ * features/i386/x86-64-avx.c: Likewise. -+ * features/i386/x86-64-avx.xml: Likewise. -+ -+ * features/Makefile (WHICH): Add i386/i386-avx, -+ i386/i386-avx-linux, i386/x86-64-avx and i386/x86-64-avx-linux. -+ (i386/i386-avx-expedite): New. -+ (i386/i386-avx-linux-expedite): Likewise. -+ (i386/x86-64-avx-expedite):Likewise. -+ (i386/x86-64-avx-linux-expedite): Likewise. -+ ($(outdir)/i386/i386-avx.dat): New dependency. -+ ($(outdir)/i386/i386-avx-linux.dat): Likewise. -+ ($(outdir)/i386/x86-avx-64.dat): Likewise. -+ ($(outdir)/i386/x86-64-avx-linux.dat): Likewise. -+ -+ * regformats/reg-i386-avx-linux.dat: Moved to .. -+ * regformats/i386/i386-avx-linux.dat: Here. -+ -+ * regformats/reg-i386-avx.dat: Moved to .. -+ * regformats/i386/i386-avx.dat: Here. -+ -+ * regformats/reg-x86-64-avx-linux.dat: Moved to ... -+ * regformats/i386/x86-64-avx-linux.dat: Here. -+ -+ * regformats/reg-x86-64-avx.dat: Moved to ... -+ * regformats/i386/x86-64-avx.dat: Here. -+ -+2010-02-05 H.J. Lu -+ -+ * amd64-tdep.c (amd64_sse_register_names): Make it global. -+ (amd64_avx_register_names): Likewise. -+ (amd64_init_abi): Don't call i386_gdbarch_vector_unit_init. -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Removed. -+ (i386_gdbarch_init): Don't call i386_gdbarch_vector_unit_init. -+ * i386-tdep.h (i386_gdbarch_vector_unit_init): Removed. -+ -+2010-02-04 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Check -+ core size for AVX support. -+ -+2010-02-03 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_fxsave): Optimize xstate_bv == 0. -+ -+2010-02-03 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_fxsave): Don't use -+ regcache_raw_supply_part. -+ (i387_supply_xsave): Likewise. -+ (i387_collect_fxsave): Don't use regcache_raw_collect_part. -+ (i387_collect_xsave): Likewise. -+ -+ * regcache.c (regcache_raw_supply_part): Removed. -+ (regcache_raw_collect_part): Likewise. -+ * regcache.h (regcache_raw_supply_part): Likewise. -+ (regcache_raw_collect_part): Likewise. -+ -+2010-02-03 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Update -+ warning message for xcr0. -+ -+ * i387-tdep.c (i387_collect_xsave): Move comments on xstate_bv. -+ -+2010-02-02 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Check -+ FILL_XSTATEREGSET instead of bit_XSTATE_AVX. -+ -+ * config/i386/nm-linux.h (FILL_XSTATEREGSET): Update comments. -+ * config/i386/nm-linux64.h (FILL_XSTATEREGSET): Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * i386-tdep.c: Include "i386-xstate.h". -+ * i387-tdep.c: Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Check if -+ bit_XSTATE_AVX is defined before using it. -+ -+2010-02-02 H.J. Lu -+ -+ * Makefile.in (xstate-nat.o): Renamed to ... -+ (i386-xstate.o): This. -+ -+ * i386-linux-tdep.c: Include "i386-xstate.h" instead of -+ "xstate-nat.h". -+ * config/i386/nm-linux.h: Likewise. -+ * config/i386/nm-linux64.h: Likewise. -+ -+ * common/xstate-nat.c: Moved to ... -+ * common/i386-xstate.c: This. -+ -+ * common/xstate-nat.h: Moved to ... -+ * common/i386-xstate.h: This. -+ -+ * config/i386/linux.mh (NATDEPFILES): Replace xstate-nat.o with -+ i386-xstate.o. -+ * config/i386/linux64.mh (NATDEPFILES): Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Remove -+ xstate_bv offset. -+ (amd64_linux_gregset32_reg_offset): Likewise. -+ -+ * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Updated. -+ -+ * amd64-tdep.c (amd64_sse_register_names): Remove xstate_bv. -+ (amd64_avx_register_names): Likewise. -+ (amd64_register_name): Remove AMD64_XSTATE_BV_REGNUM. -+ (amd64_register_type): Likewise. -+ -+ * amd64-tdep.h (AMD64_XSTATE_BV_REGNUM): Removed. -+ -+ * i386-linux-nat.c (regmap): Remove xstate_bv. -+ -+ * i386-tdep.c (i386_sse_register_names): Remove xstate_bv. -+ (i386_avx_register_names): Likewise. -+ (i386_xstate_regnum_p): Removed. -+ (i386_register_name): Remove I387_XSTATE_BV_REGNUM. -+ -+ * i386-tdep.h (I386_SSE_NUM_REGS): Remove xstate_bv. -+ -+ * i387-tdep.c (XSAVE_XSTATE_BV_ADDR): Update comments. -+ -+ * i387-tdep.h (I387_XSTATE_BV_REGNUM): Removed. -+ -+2010-02-02 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Update call to -+ i386_gdbarch_vector_unit_init. -+ -+ * gdbarch.c (gdbarch_qsupported_process_ack): Return void. -+ * gdbarch.h (gdbarch_qsupported_process_ack_ftype): Likewise. -+ (gdbarch_qsupported_process_ack): Likewise. -+ -+ * i386-tdep.c (remote_xcr0): New. -+ (i386_gdbarch_vector_unit_init): Use remote_xcr0 for remote -+ client. -+ (i386_qsupported_process_ack): Set remote_xcr0. -+ (i386_gdbarch_init): Update i386_gdbarch_vector_unit_init call. -+ -+ * i386-tdep.h (i386_gdbarch_vector_unit_init): Updated. -+ -+ * remote.c (remote_query_supported): Call -+ gdbarch_qsupported_process_ack with NULL to prepare qSupported -+ ACK processing. -+ -+2010-02-02 H.J. Lu -+ -+ * regformats/reg-i386-avx-linux.dat: Add xmlarch and osabi. -+ * regformats/reg-x86-64-avx-linux.dat: Likewise. -+ -+ * regformats/reg-i386-avx.dat: Add xmlarch. -+ * regformats/reg-x86-64-avx.dat: Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Use -+ XSTATE_SSE_SIZE instead of 576. -+ -+2010-02-02 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_g_packet_size): Removed. -+ (amd64_linux_init_abi): Remove i386_register_g_packet_guesses. -+ -+ * amd64-tdep.c (amd64_g_packet_size): Removed. -+ (amd64_init_abi): Update i386_gdbarch_vector_unit_init call. -+ Remove i386_register_g_packet_guesses. -+ -+ * amd64-tdep.h (AMD64_G_PACKET_SIZE_SSE): Removed. -+ (AMD64_G_PACKET_SIZE_AVX): Likewise. -+ -+ * gdbarch.c (gdbarch_qsupported_process_ack): Add value. -+ * gdbarch.h (gdbarch_qsupported_process_ack_ftype): Likewise. -+ (gdbarch_qsupported_process_ack): Likewise. -+ -+ * i386-linux-tdep.c (i386_linux_g_packet_size): Removed. -+ (i386_linux_init_abi): Remove i386_register_g_packet_guesses. -+ -+ * i386-tdep.c: Don't include "remote.h" nor -+ "target-descriptions.h". -+ (i386_register_g_packet_guesses): Removed. -+ (i386_g_packet_size): Likewise. -+ (386_gdbarch_vector_unit_init): Rewrite. -+ (i386_qsupported_process_ack): New. -+ (i386_gdbarch_init): Update i386_gdbarch_vector_unit_init call. -+ Remove i386_register_g_packet_guesses. Call -+ set_gdbarch_qsupported_process_ack. -+ -+ * i386-tdep.h (x86_vector_unit): Remove unknown. -+ (I386_G_PACKET_SIZE_SSE): Removed. -+ (I386_G_PACKET_SIZE_AVX): Likewise. -+ (I386_PROPERTY_SSE): Likewise. -+ (I386_PROPERTY_AVX): Likewise. -+ (AMD64_PROPERTY_SSE): Likewise. -+ (AMD64_PROPERTY_AVX): Likewise. -+ (i386_g_packet_size): Likewise. -+ (i386_register_g_packet_guesses): Likewise. -+ (i386_gdbarch_vector_unit_init): Updated. -+ -+ * remote.c (remote_query_supported): Pass value to -+ gdbarch_qsupported_process_ack. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-tdep.c (i387_collect_xsave): Optimized. -+ -+2010-02-02 H.J. Lu -+ -+ * regformats/reg-i386-avx-linux.dat: Remove xcr0. -+ * regformats/reg-i386-avx.dat: Likewise. -+ * regformats/reg-x86-64-avx-linux.dat: Likewise. -+ * regformats/reg-x86-64-avx.dat: Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * common/xstate-nat.h (XSTATE_SSE_MASK): New. -+ (XSTATE_AVX_MASK): Likewise. -+ (XSTATE_MAX_MASK): Likewise. -+ (XSTATE_SSE_MASK_STRING): Likewise. -+ (XSTATE_AVX_MASK_STRING): Likewise. -+ (XSTATE_MAX_MASK_STRING): Likewise. -+ (XSTATE_SSE_SIZE): Likewise. -+ (XSTATE_AVX_SIZE): Likewise. -+ (XSTATE_MAX_SIZE): Likewise. -+ (XSTATE_SSE_SIZE_STRING): Likewise. -+ (XSTATE_AVX_SIZE_STRING): Likewise. -+ (XSTATE_MAX_SIZE_STRING): Likewise. -+ -+ * i386-tdep.c (i386_gdbarch_init): Use XSTATE_MAX_SIZE_STRING -+ and XSTATE_MAX_MASK_STRING on set_gdbarch_qsupported. -+ -+2010-02-02 H.J. Lu -+ -+ * gdbarch.c (gdbarch): Add qsupported_process_ack. -+ (startup_gdbarch): Likewise. -+ (gdbarch_alloc): Likewise. -+ (verify_gdbarch): Likewise. -+ (gdbarch_dump): Likewise. -+ (gdbarch_qsupported_process_ack): New. -+ (set_gdbarch_qsupported_process_ack): Likewise. -+ -+ * gdbarch.h (gdbarch_qsupported_process_ack_ftype): New. -+ (gdbarch_qsupported_process_ack): Likewise. -+ (set_gdbarch_qsupported_process_ack): Likewise. -+ -+ * i386-tdep.c (i386_gdbarch_init): Update call to -+ set_gdbarch_qsupported. -+ -+ * remote.c (remote_state): Replace qsupported with gdbarch. -+ (init_remote_state): Set gdbarch instead of qsupported. -+ (remote_query_supported): Replace qsupported with -+ gdbarch_qsupported. Call gdbarch_qsupported_process_ack on -+ unprocessed ACKs. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_xsave): Apply XCR0 mask to clear_bv. -+ (i387_collect_xsave): Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Remove -+ xcr0 offset. -+ (amd64_linux_gregset32_reg_offset): Likewise. -+ -+ * amd64-tdep.c (amd64_sse_register_names): Remove xcr0. -+ (amd64_avx_register_names): Likewise. -+ (amd64_register_name): Remove AMD64_XCR0_REGNUM. -+ (amd64_register_type): Remove AMD64_XCR0_REGNUM. Update -+ AMD64_XSTATE_BV_REGNUM. -+ -+ * amd64-tdep.h (AMD64_XCR0_REGNUM): Removed. -+ -+ * i386-linux-nat.c (regmap): Remove xcr0. -+ -+ * i386-tdep.c (i386_sse_register_names): Remove xcr0. -+ (i386_avx_register_names): Likewise. -+ (i386_xstate_regnum_p): Removed. -+ (i386_register_name): Remove I387_XCR0_REGNUM. -+ (i386_xcr0_type): Removed. -+ (i386_register_type): Remove I387_XCR0_REGNUM and -+ I387_XSTATE_BV_REGNUM. -+ (i386_register_reggroup_p): Remove i386_xstate_regnum_p. -+ -+ * i386-tdep.h (gdbarch_tdep): Remove i386_xcr0_type. -+ (I386_SSE_NUM_REGS): Remove xcr0. -+ (i386_xcr0_type): Removed. -+ -+ * i387-tdep.c (XSAVE_XCR0_ADDR): Removed. -+ (i387_supply_xsave): Clear part in vector registers if its bit in -+ xstat_bv is zero. Don't update I387_XCR0_REGNUM nor -+ I387_XSTATE_BV_REGNUM. -+ (i387_collect_xsave): Clear part in vector registers if its bit -+ in xstat_bv is zero. Update xstat_bv directly. -+ -+ * i387-tdep.h (I387_XCR0_REGNUM): Removed. -+ -+2010-02-01 H.J. Lu -+ -+ * gdbarch.c (gdbarch): Add qsupported. -+ (startup_gdbarch): Likewise. -+ (gdbarch_alloc): Likewise. -+ (verify_gdbarch): Likewise. -+ (gdbarch_dump): Likewise. -+ (gdbarch_qsupported): New. -+ (set_gdbarch_qsupported): Likewise. -+ -+ * gdbarch.h (gdbarch_qsupported): New. -+ (set_gdbarch_qsupported): Likewise. -+ -+ * i386-tdep.c (i386_gdbarch_init): Call set_gdbarch_qsupported. -+ -+ * remote.c (remote_state): Add qsupported. -+ (init_remote_state): Set qsupported from gdbarch_qsupported. -+ (remote_query_supported): Support qsupported. -+ -+2010-02-01 H.J. Lu -+ -+ * i387-tdep.c (i387_collect_xsave): Optimize updating single -+ vector register. -+ -+2010-02-01 H.J. Lu -+ -+ * i387-tdep.c (i387_collect_xsave): Get the original `xstat_bv'. -+ -+2010-02-01 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Use -+ regcache_cooked_read_unsigned. -+ -+ * i387-tdep.c (i387_collect_xsave): Update the bits in -+ `xstate_bv' if any SSE/AVX registers are changed. Don't change -+ `xcr0'. -+ -+2010-02-01 H.J. Lu -+ -+ * amd64-tdep.c (amd64_sse_register_names): Use NULL on xstate_bv. -+ (amd64_avx_register_names): Likewise. -+ (amd64_register_name): Return NULL for AMD64_XSTATE_BV_REGNUM. -+ -+ * amd64-tdep. (AMD64_G_PACKET_SIZE_AVX): Don't include xstate_bv. -+ -+ * i386-tdep.c (i386_sse_register_names): Use NULL on xstate_bv. -+ (i386_avx_register_names): Likewise. -+ (i386_register_name): Return NULL for I386_XSTATE_BV_REGNUM. -+ -+ * i386-tdep. (I386_G_PACKET_SIZE_AVX): Don't include xstate_bv. -+ -+ * i387-tdep.c (XSAVE_XSTATE_BV_ADDR): Update comments. -+ -+ * regformats/reg-i386-avx-linux.dat: Remove xstate_bv. -+ * regformats/reg-i386-avx.dat: Likewise. -+ * regformats/reg-x86-64-avx-linux.dat: Likewise. -+ * regformats/reg-x86-64-avx.dat: Likewise. -+ -+2010-02-01 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Correct the -+ XCR0 register number for 64bit. -+ -+2010-02-01 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Get xcr0 from -+ the remote target. -+ -+2010-01-31 H.J. Lu -+ -+ * amd64-tdep.h (AMD64_G_PACKET_SIZE_AVX): Add sizes for xcr0 -+ and xstate_bv. -+ * i386-tdep.h (I386_G_PACKET_SIZE_AVX): Likewise. -+ -+ * regformats/reg-i386-avx-linux.dat: Add xcr0 and xstate_bv. -+ * regformats/reg-i386-avx.dat: Likewise. -+ * regformats/reg-x86-64-avx-linux.dat: Likewise. -+ * regformats/reg-x86-64-avx.dat: Likewise. -+ -+2010-01-30 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Read 8 -+ bytes for xcr0. -+ -+2010-01-30 H.J. Lu -+ -+ * i387-tdep.h (XSAVE_XCR0_OFFSET): Update comments. -+ -+2010-01-30 H.J. Lu -+ -+ * amd64-tdep.c (amd64_register_name): Return NULL for xcr0 -+ and xstate_bv if XSAVE extended state isn't supported. -+ * i386-tdep.c (i386_register_name): Likewise. -+ (i386_xstate_regnum_p): Return 0 of XSAVE extended state isn't -+ supported. -+ -+2010-01-30 H.J. Lu -+ -+ * i386-tdep.c (i386_xstate_regnum_p): New. -+ (i386_register_reggroup_p): Use it. -+ -+2010-01-30 H.J. Lu -+ -+ * i386-linux-tdep.c: Include i387-tdep.h and xstate-nat.h. -+ (i386_linux_core_read_description): Read xcr0 from core file. -+ -+ * i387-tdep.c (XSAVE_XCR0_ADDR): New. -+ (XSAVE_XSTATE_BV_ADDR): Likewise. -+ -+ * i387-tdep.h (XSAVE_XCR0_OFFSET): New. -+ (XSAVE_XCR0_ADDR): Removed. -+ (XSAVE_XSTATE_BV_ADDR): Likewise. -+ -+2010-01-30 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_gregset64_reg_offset): Add -+ entries of -1 for xcr0 and xstate_bv. -+ (amd64_linux_gregset32_reg_offset): Likewise. -+ * i386-linux-nat.c (regmap): Likewise. -+ -+ * amd64-linux-tdep.h (AMD64_LINUX_ORIG_RAX_REGNUM): Replace -+ AMD64_MXCSR_REGNUM with AMD64_XSTATE_BV_REGNUM. -+ -+ * amd64-tdep.c (amd64_sse_register_names): Add xcr0 and xstate_bv. -+ (amd64_avx_register_names): Likewise. -+ (amd64_register_type): Handle AMD64_XCR0_REGNUM and -+ AMD64_XSTATE_BV_REGNUM. -+ -+ * amd64-tdep.h (amd64_regnum): Add AMD64_XCR0_REGNUM and -+ AMD64_XSTATE_BV_REGNUM. -+ -+ * i386-tdep.c (i386_sse_register_names): Add xcr0 and xstate_bv. -+ (i386_avx_register_names): Likewise. -+ (i386_xcr0_type): New. -+ (i386_register_type): Handle AMD64_XCR0_REGNUM and -+ AMD64_XSTATE_BV_REGNUM. -+ (i386_gdbarch_vector_unit_init): Set the xcr0 field. -+ -+ * i386-tdep.h (gdbarch_tdep): Add xcr0 and i386_xcr0_type. -+ (I386_SSE_NUM_REGS): Increase by 2. -+ (i386_xcr0_type): New. -+ -+ * i387-tdep.c (i387_supply_xsave): Handle I387_XCR0_REGNUM -+ and I387_XSTATE_BV_REGNUM. -+ (i387_collect_xsave): Likewise. -+ -+ * i387-tdep.h (I387_XCR0_REGNUM): New. -+ (I387_XSTATE_BV_REGNUM): Likewise. -+ (XSAVE_XCR0_ADDR): Likewise. -+ (XSAVE_XSTATE_BV_ADDR): Likewise. -+ -+2010-01-29 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Fall -+ back after PTRACE_GETXSTATEREGS if have_ptrace_getxstateregs == 1. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (_initialize_amd64_linux_nat): Initialize have_ptrace_getxstateregs -+ to 2 for AVX. -+ -+ * i386-linux-nat.c (fetch_xstateregs): Fall back after -+ PTRACE_GETXSTATEREGS if have_ptrace_getxstateregs == 1. -+ (store_xstateregs): Likewise. -+ (_initialize_i386_linux_nat): Initialize have_ptrace_getxstateregs -+ to 2 for AVX. -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Updated. -+ -+ * common/xstate-nat.h (xstate): Removed. -+ (xstate_status): New. -+ (bit_XSTATE_X87): Likewise. -+ (bit_XSTATE_SSE): Likewise. -+ (bit_XSTATE_AVX): Likewise. -+ (i386_xstate_type): Remove state. Add status and xcr0. -+ -+ * common/xstate-nat.c (i386_xstate_init): Updated. ---- ./gdb/ChangeLog.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/ChangeLog.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,464 @@ -+2010-03-30 H.J. Lu -+ -+ * remote.c (register_remote_support_xml): Use strtok. -+ -+2010-03-30 H.J. Lu -+ -+ * NEWS: Mention xmlRegisters= in qSupported packet. -+ -+2010-03-30 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Move -+ register_remote_support_xml call to ... -+ (_initialize_i386_tdep): Here. -+ -+2010-03-29 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Pass "i386" instead of "x86" -+ to register_remote_support_xml. -+ -+2010-03-29 H.J. Lu -+ -+ * remote.c (register_remote_support_xml): Do nothing if -+ HAVE_LIBEXPAT is undefined. -+ -+2010-03-28 H.J. Lu -+ -+ * remote.c (register_remote_support_xml): Add "xmlRegisters=" -+ prefix. Free the unused old memory. -+ (remote_query_supported_append): New. -+ (remote_query_supported): Call remote_query_supported_append. -+ -+2010-03-28 H.J. Lu -+ -+ * i386-tdep.c: Include "remote.h". -+ (i386_gdbarch_init): Call register_remote_support_xml. -+ -+ * remote.c (remote_support_xml): New. -+ (register_remote_support_xml): Likewise. -+ (remote_query_supported): Support remote_support_xml. -+ -+ * remote.h (register_remote_support_xml): New. -+ -+2010-02-28 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_core_read_description): Don't -+ check .reg section size. -+ * i386-linux-tdep.c (i386_linux_core_read_description): Likewise. -+ -+2010-02-28 H.J. Lu -+ -+ * amd64-linux-nat.c (AMD64_LINUX_USER64_CS): New. -+ (amd64_linux_read_description): Use it. -+ -+2010-02-22 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_init_abi): Check orig_rax -+ right after amd64_init_abi. -+ -+ * i386-linux-tdep.c (i386_linux_init_abi): Check orig_eax -+ right after i386_elf_init_abi. -+ -+2010-02-22 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Read CS -+ register to check process address space. -+ -+2010-02-22 H.J. Lu -+ -+ * i386-tdep.c (i386_validate_tdesc_p): New. -+ (i386_gdbarch_init): Use it. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): Return -+ tdesc_i386_linux for 32bit. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Set num_core_regs and -+ register_names after tdesc. -+ * i386-tdep.c (i386_gdbarch_init): Don't check bfd_arch_i386. Set -+ num_core_regs and register_names after tdesc. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_init_abi): Remove a strayed -+ comment. -+ -+2010-02-18 H.J. Lu -+ -+ * amd64-linux-nat.c: Don't include "i387-tdep.h". -+ * amd64-linux-tdep.c: Likewise. -+ * i386-linux-tdep.c: Likewise. -+ -+ * i386-tdep.h (i386_regnum): Add I386_MXCSR_REGNUM. -+ (I386_SSE_NUM_REGS): Defined with I386_MXCSR_REGNUM. -+ -+2010-02-17 H.J. Lu -+ -+ * i386-tdep.h (tdesc_i386): Removed. -+ -+2010-02-17 H.J. Lu -+ -+ * amd64-linux-nat.c: Include "i387-tdep.h". -+ (amd64_linux_read_description): Just return tdesc_amd64_linux. -+ -+ * amd64-linux-tdep.c: Don't include "i386-linux-tdep.h". -+ Include "i387-tdep.h". -+ (amd64_linux_register_name): Removed. -+ (amd64_linux_register_type): Likewise. -+ (amd64_linux_core_read_description): Just return -+ tdesc_amd64_linux. -+ (amd64_linux_init_abi): Set target description to -+ tdesc_amd64_linux if needed. Support orig_rax. Set -+ register_reggroup_p. -+ -+ * amd64-tdep.c (amd64_register_names): Make it static. -+ (amd64_core_read_description): Removed. -+ (amd64_init_abi): Set num_core_regs and register_names. Set -+ target description to tdesc_amd64 if needed. Call -+ set_gdbarch_num_regs. -+ -+ * amd64-tdep.h (amd64_register_names): Removed. -+ (tdesc_amd64): Likewise. -+ -+ * i386-linux-tdep.c: Include "i387-tdep.h". -+ (i386_linux_register_name): Removed. -+ (i386_linux_register_type): Likewise. -+ (amd64_linux_init_abi): Set target description to -+ tdesc_i386_linux if needed. Support orig_eax. Set -+ register_reggroup_p. -+ -+ * i386-nto-tdep.c (i386nto_regset_id): Replace I386_NUM_FREGS -+ with I387_NUM_REGS. -+ -+ * i386-tdep.c: Don't include "amd64-tdep.h". -+ (i386_go32_init_abi): Replace I386_NUM_FREGS with I387_NUM_REGS. -+ (i386_core_read_description): Removed. -+ (i386_gdbarch_init): Set target description to tdesc_i386 if -+ needed. Set gregset_num_regs to I386_NUM_GREGS. Set -+ num_core_regs and register_names. Set register_reggroup_p. -+ -+2010-02-17 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Move tdesc_use_registers -+ more toward the end of the function. Call tdesc_use_registers -+ after gdbarch_init_osabi. Update -+ set_gdbarch_register_reggroup_p. -+ -+ * i386-tdep.h (gdbarch_tdep): Add num_core_regs, -+ register_names, tdesc and register_reggroup_p. -+ (I386_NUM_FREGS): Removed. -+ (I386_SSE_NUM_REGS): Replace I386_NUM_FREGS with I387_NUM_REGS. -+ -+ * i387-tdep.h (I387_NUM_REGS): New. -+ -+2010-02-17 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Move tdesc_use_registers -+ further toward the end of the function. -+ -+2010-02-17 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Move tdesc_use_registers -+ toward the end of the function. -+ -+2010-02-17 H.J. Lu -+ -+ * amd64-tdep.c: Include "features/i386/amd64.c". -+ (amd64_core_read_description): New. -+ (_initialize_amd64_tdep): Likewise. -+ (amd64_init_abi): Call set_gdbarch_core_read_description. -+ -+ * amd64-tdep.h (tdesc_amd64): New. -+ -+ * i386-tdep.c: Include i386-tdep.h" instead of "amd64-tdep.h". -+ Include "amd64-tdep.h" instead of "features/i386/amd64.c" when -+ BFD64 is defined. -+ (i386_core_read_description): New. -+ (i386_gdbarch_init): Call set_gdbarch_core_read_description. -+ (_initialize_i386_tdep): Don't Call initialize_tdesc_amd64. -+ -+ * i386-tdep.h (tdesc_i386): New. -+ -+2010-02-17 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_read_description): New. -+ (_initialize_amd64_linux_nat): Use it. -+ -+ * amd64-linux-tdep.c: Include "i386-linux-tdep.h" and -+ features/i386/amd64-linux.c. -+ (amd64_linux_register_name): New. -+ (amd64_linux_register_type): Likewise. -+ (amd64_linux_core_read_description): Likewise. -+ (amd64_linux_init_abi): Support remote stub without XML target -+ description. Use amd64_linux_core_read_description instead of -+ i386_linux_core_read_description. -+ (_initialize_amd64_linux_tdep): Call initialize_tdesc_amd64_linux. -+ -+ * amd64-linux-tdep.h: Don't include "i386-linux-tdep.h". -+ (tdesc_amd64_linux): New. -+ -+ * i386-linux-nat.c (i386_linux_read_description): New. -+ -+ * i386-linux-tdep.c: Include "i386-tdep.h/"i386-linux-tdep.h" -+ instead of "amd64-tdep.h"/"amd64-linux-tdep.h". -+ (i386_linux_register_name): Don't check BFD64. -+ (i386_linux_register_type): Likewise. -+ (_initialize_i386_linux_tdep): Likewise. -+ (i386_linux_init_orig_eax): Removed. -+ (i386_linux_core_read_description): Make it static. Don't -+ check BFD64. -+ (i386_linux_read_description): Removed. -+ (i386_linux_init_abi): Support remote stub without XML target -+ description. -+ -+ * i386-linux-tdep.h (i386_linux_core_read_description): Removed. -+ (i386_linux_read_description): Likewise. -+ (i386_linux_init_orig_eax): Likewise. -+ (tdesc_i386_linux): New. -+ -+2010-02-10 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Optimize for BFD64. -+ -+2010-02-09 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_register_name): Optimized for -+ BFD64. -+ (i386_linux_register_type): Likewise. -+ (i386_linux_init_orig_eax): Likewise. -+ (i386_linux_read_description): Likewise. -+ -+2010-02-09 H.J. Lu -+ -+ * target-descriptions.c (tdesc_gdb_type): Correct i386_eflags -+ type. -+ -+2010-02-08 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Set numbers of different -+ registers separately for 32bit and 64bit. -+ -+2010-02-08 H.J. Lu -+ -+ * i386-tdep.c (i387_ext_type): Call tdesc_find_type instead of -+ arch_float_type. -+ -+ * target-descriptions.c (tdesc_find_type): New. -+ (tdesc_gdb_type): Use it. -+ -+ * target-descriptions.h (tdesc_find_type): New. -+ -+2010-02-07 H.J. Lu -+ -+ * i386-linux-tdep.c: Replace x86-64/x86_64 with amd64. -+ * i386-tdep.c: Likewise. -+ -+ * features/Makefile: Replace x86-64 with amd64. -+ * features/i386/*: Rename x86-64* to amd64*. -+ -+ * regformats/i386/*: Rename x86-64* to amd64*. -+ -+2010-02-07 H.J. Lu -+ -+ * features/Makefile (I386-XMLTOC): Removed. -+ (I386-CFILES): Likewise. -+ (i386-cfiles): Likewise. -+ -+2010-02-06 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_init_orig_eax): Return only -+ if XML target description is available. -+ -+2010-02-06 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_init_orig_eax): Check -+ org.gnu.gdb.i386.linux instead of org.gnu.gdb.i386.core. -+ -+2010-02-06 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_init_abi): Revert the last -+ change. Call i386_linux_init_orig_eax. -+ -+ * i386-linux-tdep.c (i386_linux_register_name): Make it static. -+ (i386_linux_register_type): Likewise. -+ (i386_linux_init_orig_eax): New. -+ (i386_linux_init_abi): Revert the last change. Call -+ i386_linux_init_orig_eax. -+ -+ * i386-linux-tdep.h (i386_linux_register_name): Removed. -+ (i386_linux_register_type): Likewise. -+ (i386_linux_init_orig_eax): New. -+ -+2010-02-05 H.J. Lu -+ -+ * amd64-linux-tdep.c (amd64_linux_init_abi): Restore -+ set_gdbarch_num_regs. Call set_gdbarch_register_name, -+ set_gdbarch_register_type and set_gdbarch_remote_register_number. -+ -+ * amd64-linux-tdep.h: Include "i386-linux-tdep.h". -+ -+ * i386-linux-tdep.c: Include "i386-tdep.h" and -+ "i386-linux-tdep.h" with "amd64-tdep.h" and "amd64-linux-tdep.h". -+ (i386_linux_register_name): Restored and rewote. Make it global. -+ (i386_linux_register_type): New. -+ (i386_linux_init_abi): Restore set_gdbarch_num_regs and -+ set_gdbarch_register_name. Call set_gdbarch_register_type and -+ set_gdbarch_remote_register_number. -+ -+ * i386-linux-tdep.h (i386_linux_register_name): New. -+ (i386_linux_register_type): Likewise. -+ -+2010-02-05 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Fix a -+ typo in comments. -+ -+2010-02-05 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_init): Optimize target description -+ check. -+ -+2010-02-04 H.J. Lu -+ -+ * amd64-linux-tdep.c: Include "i386-linux-tdep.h" -+ (amd64_linux_init_abi): Call set_gdbarch_core_read_description. -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Fix a -+ typo. -+ -+2010-02-04 H.J. Lu -+ -+ * amd64-linux-nat.c (_initialize_amd64_linux_nat): Set -+ to_read_description to i386_linux_read_description. -+ * i386-linux-nat.c (_initialize_i386_linux_nat): Likewise. -+ -+ * amd64-linux-tdep.c (amd64_linux_register_name): Removed. -+ (amd64_linux_register_type): Likewise. -+ (amd64_linux_init_abi): Don't call set_gdbarch_num_regs, -+ set_gdbarch_register_name nor set_gdbarch_register_type. -+ -+ * amd64-tdep.c (amd64_register_names): Make it global. -+ (amd64_register_name): Removed. -+ (amd64_register_type): Likewise. -+ (amd64_init_abi): Don't call set_gdbarch_num_regs, -+ set_gdbarch_register_name nor set_gdbarch_register_type. -+ -+ * amd64-tdep.h (amd64_register_names): New. -+ -+ * i386-linux-tdep.c: Include features/i386/i386-linux.c and -+ features/i386/x86-64-linux.c. -+ (i386_linux_register_name): Removed. -+ (i386_linux_core_read_description): New. -+ (i386_linux_read_description): Likewise. -+ (i386_linux_init_abi): Don't call set_gdbarch_num_regs nor -+ set_gdbarch_register_name. Call -+ set_gdbarch_core_read_description. -+ (_initialize_i386_linux_tdep): Call initialize_tdesc_i386_linux -+ and initialize_tdesc_x86_64_linux. -+ -+ * i386-linux-tdep.h (i386_linux_core_read_description): New. -+ (i386_linux_read_description): Likewise. -+ -+ * i386-tdep.c: Include "amd64-tdep.h" instead of "i386-tdep.h". -+ Include features/i386/i386.c and features/i386/x86-64.c. -+ (i386_num_register_names): Removed. -+ (i386_register_names): Make it const. -+ (i386_mmx_names): Likewise. -+ (i386_num_register_names): Removed. -+ (i386_register_name): Likewise. -+ (i386_eflags_type): Likewise. -+ (i386_mxcsr_type): Likewise. -+ (i386_sse_type): Likewise. -+ (i386_register_type): Likewise. -+ (i386_pseudo_register_name): New. -+ (i386_pseudo_register_type): Likewise. -+ (i386_mmx_type): Make it static. -+ (i386_gdbarch_init): Don't call set_gdbarch_register_name -+ nor set_gdbarch_register_type. Call -+ set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_name -+ and tdesc_use_registers. -+ (_initialize_i386_tdep): Call initialize_tdesc_i386 and -+ initialize_tdesc_x86_64. -+ -+ * i386-tdep.h (gdbarch_tdep): Remove i386_eflags_type, -+ i386_mxcsr_type and i386_sse_type. -+ (i386_eflags_type): Removed. -+ (i386_mxcsr_type): Likewise. -+ (i386_mmx_type): Likewise. -+ (i386_sse_type): Likewise. -+ (i386_register_name): Likewise. -+ -+ * features/Makefile (I386-XMLTOC): New. -+ (I386-CFILES): Likewise. -+ (i386-cfiles): Likewise. -+ -+ * features/i386/32bit-sse.xml: Update vec128 type. -+ * features/i386/64bit-sse.xml: Likewise. -+ -+ * features/i386/i386-linux.c: Regenerated. -+ * features/i386/i386.c: Likewise. -+ * features/i386/x86-64-linux.c: Likewise. -+ * features/i386/x86-64.c: Likewise. -+ -+2010-02-03 H.J. Lu -+ -+ * target-descriptions.c (tdesc_type): Add TDESC_TYPE_I387_EXT, -+ TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR. -+ (tdesc_predefined_types): Add i387_ext, i386_eflags and -+ i386_mxcsr. -+ (tdesc_gdb_type): Handle TDESC_TYPE_I387_EXT, -+ TDESC_TYPE_I386_EFLAGS and TDESC_TYPE_I386_MXCSR. -+ ( -+ * features/i386/32bit-core.xml: Replace i386_ext with i387_ext. -+ * features/i386/64bit-core.xml: Likewise. -+ -+ * features/i386/i386-linux.c: New. -+ * features/i386/i386.c: Likewise. -+ * features/i386/x86-64-linux.c: Likewise. -+ * features/i386/x86-64.c: Likewise. -+ -+2010-02-03 H.J. Lu -+ -+ * features/i386/32bit-core.xml: New. -+ * features/i386/32bit-linux.xml: Likewise. -+ * features/i386/32bit-sse.xml: Likewise. -+ * features/i386/64bit-core.xml: Likewise. -+ * features/i386/64bit-linux.xml: Likewise. -+ * features/i386/64bit-sse.xml: Likewise. -+ * features/i386/i386-linux.xml: Likewise. -+ * features/i386/i386.xml: Likewise. -+ * features/i386/x86-64-linux.xml: Likewise. -+ * features/i386/x86-64.xml: Likewise. -+ -+ * features/Makefile (WHICH): Add i386/i386, i386/i386-linux, -+ i386/x86-64 and i386/x86-64-linux. -+ (i386/i386-expedite): New. -+ (i386/i386-linux-expedite): Likewise. -+ (i386/x86-64-expedite):Likewise. -+ (i386/x86-64-linux-expedite): Likewise. -+ ($(outdir)/i386/i386.dat): New dependency. -+ ($(outdir)/i386/i386-linux.dat): Likewise. -+ ($(outdir)/i386/x86-64.dat): Likewise. -+ ($(outdir)/i386/x86-64-linux.dat): Likewise. -+ -+ * regformats/i386/i386-linux.dat: Regenerated. -+ * regformats/i386/i386.dat: Likewise. -+ * regformats/i386/x86-64-linux.dat: Likewise. -+ * regformats/i386/x86-64.dat: Likewise. -+ -+2010-02-03 H.J. Lu -+ -+ * regformats/reg-i386-linux.dat: Moved to ... -+ * regformats/i386/i386-linux.dat: Here. -+ -+ * regformats/reg-i386.dat: Moved to ... -+ * regformats/i386/i386.dat: Here. -+ -+ * regformats/reg-x86-64-linux.dat: Moved to ... -+ * regformats/i386/x86-64-linux.dat: Here. -+ -+ * regformats/reg-x86-64.dat: Moved to ... -+ * regformats/i386/x86-64.dat: Here. ---- ./gdb/ChangeLog.xstate 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/ChangeLog.xstate 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,384 @@ -+2010-02-01 H.J. Lu -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Updated. -+ -+2010-01-31 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Updated. -+ * i386-tdep.c (i386_gdbarch_init): Likewise. -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Change function -+ arguments. -+ * i386-tdep.h (i386_gdbarch_vector_unit_init): Likeise. -+ -+2010-01-28 H.J. Lu -+ -+ * common/xstate-nat.c (i386_xstate_init): Use enabled size. -+ -+2010-01-28 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_fxsave): Check vector_unit. -+ (i387_collect_fxsave): Likewise. -+ -+2010-01-28 H.J. Lu -+ -+ * regcache.c (regcache_raw_supply_part): Group it with ... -+ (regcache_raw_collect_part): This. -+ -+2010-01-28 H.J. Lu -+ -+ * i386-linux-tdep.c (i386_linux_core_read_description): Set -+ vector_unit to sse if there is no .reg-xstate section. -+ -+2010-01-27 H.J. Lu -+ -+ * amd64-linux-nat.c (_initialize_amd64_linux_nat): Assert -+ i386_xstate.state != XSTATE_UNKNOWN instead of calling i386_xstate_init. -+ * i386-linux-nat.c (_initialize_i386_linux_nat): Likewise. -+ -+2010-01-27 H.J. Lu -+ -+ * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Call -+ i386_xstate_init and update the XSAVE extended state size on -+ Linux/x86 host. -+ * i386-linux-tdep.c (_initialize_i386_linux_tdep): Likewise. -+ -+2010-01-27 H.J. Lu -+ -+ * amd64-linux-tdep.c: Include "i386-linux-tdep.h" and "regset.h". -+ (amd64_linux_regset_sections): New. -+ (amd64_linux_init_abi): Call set_gdbarch_core_regset_sections -+ with amd64_linux_regset_sections. Call -+ set_gdbarch_core_read_description with -+ i386_linux_core_read_description. -+ -+ * amd64-tdep.c (amd64_supply_xstateregset): New. -+ (amd64_collect_xstateregset): Likewise. -+ (amd64_regset_from_core_section): Check .reg-xstate section. -+ -+ * i386-linux-tdep.c (i386_linux_regset_sections): Add -+ .reg-xstate section. -+ (i386_linux_core_read_description): New. -+ (i386_linux_init_abi): Call set_gdbarch_core_read_description -+ with i386_linux_core_read_description. -+ -+ * i386-linux-tdep.h (i386_linux_core_read_description): New. -+ -+ * i386-tdep.c (i386_supply_xstateregset): New. -+ (i386_collect_xstateregset): Likewise. -+ (i386_regset_from_core_section): Check .reg-xstate section. -+ (i386_gdbarch_init): Initialize xstateregset to NULL. -+ -+ * i386-tdep.h (gdbarch_tdep): Add xstateregset. -+ -+2010-01-27 H.J. Lu -+ -+ * amd64-tdep.c (amd64_init_abi): Set sizeof_xstateregset to 0. -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): Set -+ sizeof_xstateregset if XSAVE extended state is supported. -+ (i386_gdbarch_init): Set sizeof_xstateregset to 0. -+ -+ * i386-tdep.h (gdbarch_tdep): Add sizeof_xstateregset. -+ -+ * common/xstate-nat.c (i386_xstate_init): Set i386_xstate.size. -+ -+ * common/xstate-nat.h (i386_xstate_type): Add size. -+ -+2010-01-27 H.J. Lu -+ -+ * amd64-tdep.c (amd64_register_names): Renamed to ... -+ (amd64_sse_register_names): This. Remove AVX registers. -+ (amd64_avx_register_names): New. -+ (AMD64_NUM_REGS): Updated. -+ (amd64_register_name): Handle vector_unit. -+ (amd64_register_type): Replace i386_sse_type with -+ i386_vector_type. -+ -+ * defs.h (MAX_REGISTER_SIZE): Increase to 32. -+ -+ * i386-tdep.c: (i386_register_names): Renamed to ... -+ (i386_sse_register_names): This. -+ (i386_avx_register_names): New. -+ (i386_vec128_type): Likewise. -+ (i386_vec256_type): Likewise. -+ (i386_num_register_names): Updated. -+ (i386_gdbarch_sse_unit_init): Likewise. -+ (i386_register_name): Handle vector_unit. -+ (i386_sse_type): Renamed to ... -+ (i386_vector_type): This. Handle vector_unit. -+ (amd64_register_type): Replace i386_sse_type with -+ i386_vector_type. -+ -+ * i386-tdep.h (gdbarch_tdep): Replace i386_sse_type with -+ i386_vector_type. -+ (I386_MAX_REGISTER_SIZE): Increase to 32. -+ (i386_sse_type): Renamed to ... -+ (i386_vector_type): This. -+ -+2010-01-25 H.J. Lu -+ -+ * Makefile.in (xsave-nat.o): Renamed to ... -+ (xstate-nat.o): This. -+ -+ * common/xsave-nat.c: Moved to ... -+ * common/xstate-nat.c: This. -+ -+ * common/xsave-nat.h: Moved to ... -+ * common/xstate-nat.h: This. -+ -+ * config/i386/linux.mh (NATDEPFILES): Replace xsave-nat.o with -+ xstate-nat.o. -+ * config/i386/linux64.mh (NATDEPFILES): Likewise. -+ -+ * config/i386/nm-linux.h: Include "xstate-nat.h" instead of -+ "xsave-nat.h". -+ * config/i386/nm-linux64.h: Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): -+ Issue an error if PTRACE_GETXSTATEREGS failed and XSAVE -+ extended state is higher than SSE. -+ (amd64_linux_store_inferior_registers): Likewise. -+ * i386-linux-nat.c (fetch_xstateregs): Likewise. -+ (store_xstateregs): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * common/xsave-nat.c: Include "i386-cpuid.h" instead of -+ "config/i386/i386-cpuid.h". -+ -+ * config/i386/i386-cpuid.h: Moved to ... -+ * common/i386-cpuid.h: Here. -+ -+2010-01-22 H.J. Lu -+ -+ * Makefile.in (xsave-nat.o): New. -+ -+ * xsave-nat.c: Moved to ... -+ * common/xsave-nat.c: Here. -+ -+ * xsave-nat.h: Moved to ... -+ * common/xsave-nat.h: Here. -+ -+2010-01-22 H.J. Lu -+ -+ * i386-linux-nat.c (have_ptrace_getxstateregs): New. -+ (PTRACE_GETXSTATEREGS): Likewise. -+ (PTRACE_SETXSTATEREGS): Likewise. -+ (fetch_xstateregs): Likewise. -+ (store_xstateregs): Likewise. -+ (i386_linux_fetch_inferior_registers): Support XSAVE extended -+ state. -+ (i386_linux_store_inferior_registers): Likewise. -+ (_initialize_i386_linux_nat): Call i386_xstate_init and set -+ have_ptrace_getxstateregs. -+ -+2010-01-22 H.J. Lu -+ -+ * i387-tdep.c (xsave_avxh_offset): New. -+ (XSAVE_AVXH_ADDR): Likewise. -+ (i387_supply_xsave): Use XSAVE_SSE_ADDR and XSAVE_AVXH_ADDR for -+ AVX vector unit. -+ (i387_collect_xsave): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * i387-tdep.c (xsave_sse_offset): New. -+ (XSAVE_SSE_ADDR): Likewise. -+ (i387_supply_xsave): Use XSAVE_SSE_ADDR. -+ (i387_collect_xsave): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * i387-tdep.c (i387_supply_xsave): Check vector unit. -+ (i387_collect_xsave): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * gregset.h (GDB_XSTATE_SSE_REGSET_T): Removed. -+ (GDB_XSTATE_AVX_REGSET_T): Likewise. -+ (gdb_xstate_sse_regset_t): Likewise. -+ (gdb_xstate_avx_regset_t): Likewise. -+ (supply_xstate_sse_regset): Likewise. -+ (supply_xstate_avx_regset): Likewise. -+ (fill_xstate_sse_regset): Likewise. -+ (fill_xstate_avx_regset): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * regcache.c (regcache_raw_supply_part): New. -+ (regcache_raw_collect_part): Likewise. -+ * regcache.h (regcache_raw_supply_part): Likewise. -+ (regcache_raw_collect_part): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_init_abi): Call -+ i386_gdbarch_vector_unit_init. -+ -+ * i386-tdep.c (i386_gdbarch_vector_unit_init): New. -+ (i386_gdbarch_init): Call i386_gdbarch_vector_unit_init. -+ -+ * i386-tdep.h (x86_vector_unit): New. -+ (gdbarch_tdep): Add vector_unit. -+ -+2010-01-22 H.J. Lu -+ -+ * amd64-linux-nat.c (_initialize_amd64_linux_nat): Always call -+ i386_xstate_init (). -+ -+2010-01-22 H.J. Lu -+ -+ * amd64-linux-nat.c (have_ptrace_getxstateregs): New. -+ (PTRACE_GETXSTATEREGS): Likewise. -+ (PTRACE_SETXSTATEREGS): Likewise. -+ (amd64_linux_fetch_inferior_registers): Support XSAVE extended -+ state. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_fetch_inferior_registers_with_xsave): Removed. -+ (amd64_linux_store_inferior_registers_with_xsave): Likewise. -+ (_initialize_amd64_linux_nat): Updated. -+ -+ * configure.ac: Remove check for PTRACE_GETXSTATEREGS. -+ * config.in: Regenerated. -+ * configure: Likewise. -+ -+ * config/i386/nm-linux.h (USE_XSAVE): Changed to ... -+ (FILL_XSTATEREGSET): This. -+ * onfig/i386/nm-linux64.h: Likewise. -+ -+2010-01-21 H.J. Lu -+ -+ * xsave-nat.c (i386_xstate_init): Properly set state. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-linux-nat.c: Don't include "xsave-nat.h". -+ (amd64_linux_fetch_inferior_registers_with_xstate): Renamed to ... -+ (amd64_linux_fetch_inferior_registers_with_xsave): This. -+ (amd64_linux_store_inferior_registers_with_xstate): Renamed to ... -+ (amd64_linux_store_inferior_registers_with_xsave): This. -+ -+ * config/i386/nm-linux.h: Include "xsave-nat.h". -+ * config/i386/nm-linux64.h: Likewise. -+ -+2010-01-21 H.J. Lu -+ -+ * config/i386/linux64.mh (NAT_FILE): Set to nm-linux64.h. -+ -+ * config/i386/nm-linux.h (USE_XSAVE): New. -+ -+ * config/i386/nm-linux64.h: New. -+ -+2010-01-21 H.J. Lu -+ -+ * xsave-nat.c: Include "config/i386/i386-cpuid.h" if -+ isn't available. -+ -+ * config/i386/i386-cpuid.h: New. Taken from gcc 4.4. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-linux-nat.c: Include "xsave-nat.h" -+ (_initialize_amd64_linux_nat): Check HAVE_PTRACE_GETXSTATEREGS -+ instead of HAVE_SYS_XSTATE_H. -+ -+ * configure.ac: Add check for cpuid.h. Remove check for -+ sys/xstate.h, __get_xstate and __get_xstate_size. -+ * config.in: Regenerated. -+ * configure: Likewise. -+ -+ * i386-nat.c (i386_xstate): Removed. -+ (i386_xstate_init): Likewise. -+ -+ * i386-nat.h (i386_xstate_type): Removed. -+ (i386_xstate): Likewise. -+ (i386_xstate_init): Likewise. -+ -+ * xsave-nat.c: New. -+ * xsave-nat.h: Likewise. -+ -+ * config/i386/linux.mh (NATDEPFILES): Add xsave-nat.o. -+ * config/i386/linux64.mh (NATDEPFILES): Likewise. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers_with_xstate): -+ Call amd64_supply_xsave instead of amd64_supply_fxsave. -+ (amd64_linux_store_inferior_registers_with_xstate): Call -+ amd64_collect_fxsave instead of amd64_collect_xsave. -+ -+ * amd64-tdep.c (amd64_supply_xsave): New. -+ (amd64_collect_xsave): Likewise. -+ * amd64-tdep.h (amd64_supply_xsave): Likewise. -+ (amd64_collect_xsave): Likewise. -+ * i387-tdep.c (i387_supply_xsave): Likewise. -+ (i387_collect_xsave): Likewise. -+ * i387-tdep.h (i387_supply_xsave): Likewise. -+ (i387_collect_xsave): Likewise. -+ -+ * i386-nat.h: Update comments. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Revert -+ the last change, -+ (amd64_linux_store_inferior_registers): Likewise. -+ (amd64_linux_fetch_inferior_registers_with_xstate): New. -+ (amd64_linux_store_inferior_registers_with_xstate): Likewise. -+ (_initialize_amd64_linux_nat): Use -+ amd64_linux_fetch_inferior_registers_with_xstate and -+ amd64_linux_store_inferior_registers_with_xstate if possible. -+ -+ * i386-nat.h (i386_xstate_type): Rename size to n_of_int64. -+ * i386-nat.c (i386_xstate): Updated. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): -+ Use PTRACE_GETXSTATEREGS/PTRACE_SETXSTATEREGS if posssible. -+ (amd64_linux_store_inferior_registers): Likewise. -+ (_initialize_amd64_linux_nat): Call i386_xstate_init. -+ -+ * i386-nat.c (i386_xstate): New. -+ (i386_xstate_init): Likewise. -+ -+ * i386-nat.h (i386_xstate_type): New. -+ (i386_xstate): Likewise. -+ (i386_xstate_init): Likewise. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-linux-nat.c: Revert the change change. -+ -+2010-01-21 H.J. Lu -+ -+ * configure.ac: Add check for __get_xstate_size. -+ * config.in: Regenerated. -+ * configure: Likewise. -+ -+2010-01-21 H.J. Lu -+ -+ * amd64-linux-nat.c: Include if HAVE_SYS_XSTATE_H -+ is defined. -+ (have_ptrace_getxstateregs): New. -+ (_initialize_amd64_linux_nat): Clear have_ptrace_getxstateregs -+ if needed. -+ -+ * gregset.h (GDB_XSTATE_SSE_REGSET_T): New. -+ (GDB_XSTATE_AVX_REGSET_T): Likewise. -+ (gdb_xstate_sse_regset_t): Likewise. -+ (gdb_xstate_avx_regset_t): Likewise. -+ (supply_xstate_sse_regset): Likewise. -+ (supply_xstate_avx_regset): Likewise. -+ (fill_xstate_sse_regset): Likewise. -+ (fill_xstate_avx_regset): Likewise. -+ -+2010-01-21 H.J. Lu -+ -+ * configure.ac: Add check for sys/xstate.h, __get_xstate and -+ PTRACE_GETXSTATEREGS. -+ * config.in: Regenerated. -+ * configure: Likewise. ---- ./gdb/amd64-linux-nat.c 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/amd64-linux-nat.c 2010-04-03 21:15:08.000000000 +0200 -@@ -23,11 +23,14 @@ - #include "inferior.h" - #include "gdbcore.h" - #include "regcache.h" -+#include "regset.h" - #include "linux-nat.h" - #include "amd64-linux-tdep.h" - - #include "gdb_assert.h" - #include "gdb_string.h" -+#include "elf/common.h" -+#include - #include - #include - #include -@@ -54,6 +57,18 @@ - #include "i387-tdep.h" - #include "elf-bfd.h" - #include "gdb_procfs32.h" -+#include "i386-xstate.h" -+ -+#ifndef PTRACE_GETREGSET -+#define PTRACE_GETREGSET 0x4204 -+#endif -+ -+#ifndef PTRACE_SETREGSET -+#define PTRACE_SETREGSET 0x4205 -+#endif -+ -+/* Does the current host support PTRACE_GETREGSET? */ -+static int have_ptrace_getregset = -1; - - /* Mapping between the general-purpose registers in GNU/Linux x86-64 - `struct user' format and GDB's register cache layout. */ -@@ -76,6 +91,8 @@ static int amd64_linux_gregset64_reg_off - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -+ -1, -1, -1, -1, -1, -1, -1, -1, -+ -1, -1, -1, -1, -1, -1, -1, -1, - ORIG_RAX * 8 - }; - -@@ -131,6 +148,7 @@ static int amd64_linux_gregset32_reg_off - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -+ -1, -1, -1, -1, -1, -1, -1, -1, - ORIG_RAX * 8 /* "orig_eax" */ - }; - -@@ -312,10 +330,26 @@ amd64_linux_fetch_inferior_registers (st - { - elf_fpregset_t fpregs; - -- if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) -- perror_with_name (_("Couldn't get floating point status")); -+ if (have_ptrace_getregset) -+ { -+ char xstateregs[I386_XSTATE_MAX_SIZE]; -+ struct iovec iov; -+ -+ iov.iov_base = xstateregs; -+ iov.iov_len = sizeof (xstateregs); -+ if (ptrace (PTRACE_GETREGSET, tid, -+ (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) -+ perror_with_name (_("Couldn't get extended state status")); - -- amd64_supply_fxsave (regcache, -1, &fpregs); -+ amd64_supply_xsave (regcache, -1, xstateregs); -+ } -+ else -+ { -+ if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) -+ perror_with_name (_("Couldn't get floating point status")); -+ -+ amd64_supply_fxsave (regcache, -1, &fpregs); -+ } - } - } - -@@ -355,15 +389,33 @@ amd64_linux_store_inferior_registers (st - { - elf_fpregset_t fpregs; - -- if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) -- perror_with_name (_("Couldn't get floating point status")); -+ if (have_ptrace_getregset) -+ { -+ char xstateregs[I386_XSTATE_MAX_SIZE]; -+ struct iovec iov; - -- amd64_collect_fxsave (regcache, regnum, &fpregs); -+ iov.iov_base = xstateregs; -+ iov.iov_len = sizeof (xstateregs); -+ if (ptrace (PTRACE_GETREGSET, tid, -+ (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) -+ perror_with_name (_("Couldn't get extended state status")); -+ -+ amd64_collect_xsave (regcache, regnum, xstateregs, 0); -+ -+ if (ptrace (PTRACE_SETREGSET, tid, -+ (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) -+ perror_with_name (_("Couldn't write extended state status")); -+ } -+ else -+ { -+ if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) -+ perror_with_name (_("Couldn't get floating point status")); - -- if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0) -- perror_with_name (_("Couldn't write floating point status")); -+ amd64_collect_fxsave (regcache, regnum, &fpregs); - -- return; -+ if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0) -+ perror_with_name (_("Couldn't write floating point status")); -+ } - } - } - -@@ -831,6 +883,8 @@ amd64_linux_read_description (struct tar - { - unsigned long cs; - int tid; -+ int is_64bit; -+ static uint64_t xcr0; - - /* GNU/Linux LWP ID's are process ID's. */ - tid = TIDGET (inferior_ptid); -@@ -844,10 +898,55 @@ amd64_linux_read_description (struct tar - if (errno != 0) - perror_with_name (_("Couldn't get CS register")); - -- if (cs == AMD64_LINUX_USER64_CS) -- return tdesc_amd64_linux; -+ is_64bit = cs == AMD64_LINUX_USER64_CS; -+ -+ if (have_ptrace_getregset == -1) -+ { -+ uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))]; -+ struct iovec iov; -+ unsigned int xstate_size; -+ -+ iov.iov_base = xstateregs; -+ iov.iov_len = sizeof (xstateregs); -+ -+ /* Check if PTRACE_GETREGSET works. */ -+ if (ptrace (PTRACE_GETREGSET, tid, -+ (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) -+ { -+ have_ptrace_getregset = 0; -+ xstate_size = 0; -+ } -+ else -+ { -+ have_ptrace_getregset = 1; -+ -+ /* Get XCR0 from XSAVE extended state. */ -+ xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET -+ / sizeof (uint64_t))]; -+ -+ xstate_size = I386_XSTATE_SIZE (xcr0); -+ } -+ -+ i386_linux_update_xstateregset (xstate_size); -+ amd64_linux_update_xstateregset (xstate_size); -+ } -+ -+ /* Check the native XCR0 only if PTRACE_GETREGSET is available. */ -+ if (have_ptrace_getregset -+ && (xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) -+ { -+ if (is_64bit) -+ return tdesc_amd64_avx_linux; -+ else -+ return tdesc_i386_avx_linux; -+ } - else -- return tdesc_i386_linux; -+ { -+ if (is_64bit) -+ return tdesc_amd64_linux; -+ else -+ return tdesc_i386_linux; -+ } - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ ---- ./gdb/amd64-linux-tdep.c 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/amd64-linux-tdep.c 2010-04-03 21:12:32.000000000 +0200 -@@ -28,8 +28,11 @@ - #include "symtab.h" - #include "gdbtypes.h" - #include "reggroups.h" -+#include "regset.h" - #include "amd64-linux-tdep.h" -+#include "i386-linux-tdep.h" - #include "linux-tdep.h" -+#include "i386-xstate.h" - - #include "gdb_string.h" - -@@ -38,6 +41,7 @@ - #include "xml-syscall.h" - - #include "features/i386/amd64-linux.c" -+#include "features/i386/amd64-avx-linux.c" - - /* The syscall's XML filename for i386. */ - #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" -@@ -45,6 +49,15 @@ - #include "record.h" - #include "linux-record.h" - -+/* Supported register note sections. */ -+static struct core_regset_section amd64_linux_regset_sections[] = -+{ -+ { ".reg", 144, "general-purpose" }, -+ { ".reg2", 512, "floating-point" }, -+ { ".reg-xstate", 0, "XSAVE extended state" }, -+ { NULL, 0 } -+}; -+ - /* Mapping between the general-purpose registers in `struct user' - format and GDB's register cache layout. */ - -@@ -1316,6 +1329,22 @@ amd64_linux_record_signal (struct gdbarc - return 0; - } - -+/* Update XSAVE extended state register note section. */ -+ -+void -+amd64_linux_update_xstateregset (unsigned int xstate_size) -+{ -+ struct core_regset_section *xstate = &amd64_linux_regset_sections[2]; -+ -+ /* Update the XSAVE extended state register note section for "gcore". -+ Disable it if its size is 0. */ -+ gdb_assert (strcmp (xstate->sect_name, ".reg-xstate") == 0); -+ if (xstate_size) -+ xstate->size = xstate_size; -+ else -+ xstate->sect_name = NULL; -+} -+ - /* Get Linux/x86 target description from core dump. */ - - static const struct target_desc * -@@ -1324,12 +1353,17 @@ amd64_linux_core_read_description (struc - bfd *abfd) - { - asection *section = bfd_get_section_by_name (abfd, ".reg2"); -+ uint64_t xcr0; - - if (section == NULL) - return NULL; - - /* Linux/x86-64. */ -- return tdesc_amd64_linux; -+ xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); -+ if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) -+ return tdesc_amd64_avx_linux; -+ else -+ return tdesc_amd64_linux; - } - - static void -@@ -1373,6 +1407,8 @@ amd64_linux_init_abi (struct gdbarch_inf - - tdep->outermost_frame_p = amd64_linux_outermost_frame; - -+ tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; -+ - /* GNU/Linux uses SVR4-style shared libraries. */ - set_solib_svr4_fetch_link_map_offsets - (gdbarch, svr4_lp64_fetch_link_map_offsets); -@@ -1394,6 +1430,9 @@ amd64_linux_init_abi (struct gdbarch_inf - /* GNU/Linux uses SVR4-style shared libraries. */ - set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - -+ /* Install supported register note sections. */ -+ set_gdbarch_core_regset_sections (gdbarch, amd64_linux_regset_sections); -+ - set_gdbarch_core_read_description (gdbarch, - amd64_linux_core_read_description); - -@@ -1596,4 +1635,5 @@ _initialize_amd64_linux_tdep (void) - - /* Initialize the Linux target description */ - initialize_tdesc_amd64_linux (); -+ initialize_tdesc_amd64_avx_linux (); - } ---- ./gdb/amd64-linux-tdep.h 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/amd64-linux-tdep.h 2010-04-03 21:12:32.000000000 +0200 -@@ -26,13 +26,17 @@ - /* Register number for the "orig_rax" register. If this register - contains a value >= 0 it is interpreted as the system call number - that the kernel is supposed to restart. */ --#define AMD64_LINUX_ORIG_RAX_REGNUM (AMD64_MXCSR_REGNUM + 1) -+#define AMD64_LINUX_ORIG_RAX_REGNUM (AMD64_YMM15H_REGNUM + 1) - - /* Total number of registers for GNU/Linux. */ - #define AMD64_LINUX_NUM_REGS (AMD64_LINUX_ORIG_RAX_REGNUM + 1) - - /* Linux target description. */ - extern struct target_desc *tdesc_amd64_linux; -+extern struct target_desc *tdesc_amd64_avx_linux; -+ -+/* Update XSAVE extended state register note section. */ -+extern void amd64_linux_update_xstateregset (unsigned int xstate_size); - - /* Enum that defines the syscall identifiers for amd64 linux. - Used for process record/replay, these will be translated into ---- ./gdb/amd64-tdep.c 2010-04-03 21:11:41.000000000 +0200 -+++ ./gdb/amd64-tdep.c 2010-04-03 21:12:32.000000000 +0200 -@@ -43,6 +43,7 @@ - #include "i387-tdep.h" - - #include "features/i386/amd64.c" -+#include "features/i386/amd64-avx.c" - - /* Note that the AMD64 architecture was previously known as x86-64. - The latter is (forever) engraved into the canonical system name as -@@ -71,8 +72,21 @@ static const char *amd64_register_names[ - "mxcsr", - }; - --/* Total number of registers. */ --#define AMD64_NUM_REGS ARRAY_SIZE (amd64_register_names) -+static const char *amd64_ymm_names[] = -+{ -+ "ymm0", "ymm1", "ymm2", "ymm3", -+ "ymm4", "ymm5", "ymm6", "ymm7", -+ "ymm8", "ymm9", "ymm10", "ymm11", -+ "ymm12", "ymm13", "ymm14", "ymm15" -+}; -+ -+static const char *amd64_ymmh_names[] = -+{ -+ "ymm0h", "ymm1h", "ymm2h", "ymm3h", -+ "ymm4h", "ymm5h", "ymm6h", "ymm7h", -+ "ymm8h", "ymm9h", "ymm10h", "ymm11h", -+ "ymm12h", "ymm13h", "ymm14h", "ymm15h" -+}; - - /* The registers used to pass integer arguments during a function call. */ - static int amd64_dummy_call_integer_regs[] = -@@ -163,6 +177,8 @@ static const int amd64_dwarf_regmap_len - static int - amd64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg) - { -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int ymm0_regnum = tdep->ymm0_regnum; - int regnum = -1; - - if (reg >= 0 && reg < amd64_dwarf_regmap_len) -@@ -170,6 +186,9 @@ amd64_dwarf_reg_to_regnum (struct gdbarc - - if (regnum == -1) - warning (_("Unmapped DWARF Register #%d encountered."), reg); -+ else if (ymm0_regnum >= 0 -+ && i386_xmm_regnum_p (gdbarch, regnum)) -+ regnum += ymm0_regnum - I387_XMM0_REGNUM (tdep); - - return regnum; - } -@@ -238,6 +257,19 @@ static const char *amd64_dword_names[] = - "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" - }; - -+/* Return the name of register REGNUM, or the empty string if it is -+ an anonymous register. */ -+ -+static const char * -+amd64_register_name (struct gdbarch *gdbarch, int regnum) -+{ -+ /* Hide the upper YMM registers. */ -+ if (i386_ymmh_regnum_p (gdbarch, regnum)) -+ return ""; -+ -+ return tdesc_register_name (gdbarch, regnum); -+} -+ - /* Return the name of register REGNUM. */ - - static const char * -@@ -246,6 +278,8 @@ amd64_pseudo_register_name (struct gdbar - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (i386_byte_regnum_p (gdbarch, regnum)) - return amd64_byte_names[regnum - tdep->al_regnum]; -+ else if (i386_ymm_regnum_p (gdbarch, regnum)) -+ return amd64_ymm_names[regnum - tdep->ymm0_regnum]; - else if (i386_word_regnum_p (gdbarch, regnum)) - return amd64_word_names[regnum - tdep->ax_regnum]; - else if (i386_dword_regnum_p (gdbarch, regnum)) -@@ -2181,6 +2215,28 @@ amd64_collect_fpregset (const struct reg - amd64_collect_fxsave (regcache, regnum, fpregs); - } - -+/* Similar to amd64_supply_fpregset, but use XSAVE extended state. */ -+ -+static void -+amd64_supply_xstateregset (const struct regset *regset, -+ struct regcache *regcache, int regnum, -+ const void *xstateregs, size_t len) -+{ -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); -+ amd64_supply_xsave (regcache, regnum, xstateregs); -+} -+ -+/* Similar to amd64_collect_fpregset, but use XSAVE extended state. */ -+ -+static void -+amd64_collect_xstateregset (const struct regset *regset, -+ const struct regcache *regcache, -+ int regnum, void *xstateregs, size_t len) -+{ -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); -+ amd64_collect_xsave (regcache, regnum, xstateregs, 1); -+} -+ - /* Return the appropriate register set for the core section identified - by SECT_NAME and SECT_SIZE. */ - -@@ -2199,6 +2255,16 @@ amd64_regset_from_core_section (struct g - return tdep->fpregset; - } - -+ if (strcmp (sect_name, ".reg-xstate") == 0) -+ { -+ if (tdep->xstateregset == NULL) -+ tdep->xstateregset = regset_alloc (gdbarch, -+ amd64_supply_xstateregset, -+ amd64_collect_xstateregset); -+ -+ return tdep->xstateregset; -+ } -+ - return i386_regset_from_core_section (gdbarch, sect_name, sect_size); - } - -@@ -2261,6 +2327,13 @@ amd64_init_abi (struct gdbarch_info info - tdep->num_core_regs = AMD64_NUM_GREGS + I387_NUM_REGS; - tdep->register_names = amd64_register_names; - -+ if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx") != NULL) -+ { -+ tdep->ymmh_register_names = amd64_ymmh_names; -+ tdep->num_ymm_regs = 16; -+ tdep->ymm0h_regnum = AMD64_YMM0H_REGNUM; -+ } -+ - tdep->num_byte_regs = 20; - tdep->num_word_regs = 16; - tdep->num_dword_regs = 16; -@@ -2274,6 +2347,8 @@ amd64_init_abi (struct gdbarch_info info - - set_tdesc_pseudo_register_name (gdbarch, amd64_pseudo_register_name); - -+ set_gdbarch_register_name (gdbarch, amd64_register_name); -+ - /* AMD64 has an FPU and 16 SSE registers. */ - tdep->st0_regnum = AMD64_ST0_REGNUM; - tdep->num_xmm_regs = 16; -@@ -2354,6 +2429,7 @@ void - _initialize_amd64_tdep (void) - { - initialize_tdesc_amd64 (); -+ initialize_tdesc_amd64_avx (); - } - - -@@ -2389,6 +2465,30 @@ amd64_supply_fxsave (struct regcache *re - } - } - -+/* Similar to amd64_supply_fxsave, but use XSAVE extended state. */ -+ -+void -+amd64_supply_xsave (struct regcache *regcache, int regnum, -+ const void *xsave) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ i387_supply_xsave (regcache, regnum, xsave); -+ -+ if (xsave && gdbarch_ptr_bit (gdbarch) == 64) -+ { -+ const gdb_byte *regs = xsave; -+ -+ if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep)) -+ regcache_raw_supply (regcache, I387_FISEG_REGNUM (tdep), -+ regs + 12); -+ if (regnum == -1 || regnum == I387_FOSEG_REGNUM (tdep)) -+ regcache_raw_supply (regcache, I387_FOSEG_REGNUM (tdep), -+ regs + 20); -+ } -+} -+ - /* Fill register REGNUM (if it is a floating-point or SSE register) in - *FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for - all registers. This function doesn't touch any of the reserved -@@ -2412,3 +2512,26 @@ amd64_collect_fxsave (const struct regca - regcache_raw_collect (regcache, I387_FOSEG_REGNUM (tdep), regs + 20); - } - } -+ -+/* Similar to amd64_collect_fxsave, but but use XSAVE extended state. */ -+ -+void -+amd64_collect_xsave (const struct regcache *regcache, int regnum, -+ void *xsave, int gcore) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ gdb_byte *regs = xsave; -+ -+ i387_collect_xsave (regcache, regnum, xsave, gcore); -+ -+ if (gdbarch_ptr_bit (gdbarch) == 64) -+ { -+ if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep)) -+ regcache_raw_collect (regcache, I387_FISEG_REGNUM (tdep), -+ regs + 12); -+ if (regnum == -1 || regnum == I387_FOSEG_REGNUM (tdep)) -+ regcache_raw_collect (regcache, I387_FOSEG_REGNUM (tdep), -+ regs + 20); -+ } -+} ---- ./gdb/amd64-tdep.h 2010-01-29 06:19:22.000000000 +0100 -+++ ./gdb/amd64-tdep.h 2010-04-03 21:12:32.000000000 +0200 -@@ -61,12 +61,16 @@ enum amd64_regnum - AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9, - AMD64_XMM0_REGNUM = 40, /* %xmm0 */ - AMD64_XMM1_REGNUM, /* %xmm1 */ -- AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16 -+ AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16, -+ AMD64_YMM0H_REGNUM, /* %ymm0h */ -+ AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15 - }; - - /* Number of general purpose registers. */ - #define AMD64_NUM_GREGS 24 - -+#define AMD64_NUM_REGS (AMD64_YMM15H_REGNUM + 1) -+ - extern struct displaced_step_closure *amd64_displaced_step_copy_insn - (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, - struct regcache *regs); -@@ -77,12 +81,6 @@ extern void amd64_displaced_step_fixup ( - - extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); - --/* Functions from amd64-tdep.c which may be needed on architectures -- with extra registers. */ -- --extern const char *amd64_register_name (struct gdbarch *gdbarch, int regnum); --extern struct type *amd64_register_type (struct gdbarch *gdbarch, int regnum); -- - /* Fill register REGNUM in REGCACHE with the appropriate - floating-point or SSE register value from *FXSAVE. If REGNUM is - -1, do this for all registers. This function masks off any of the -@@ -91,6 +89,10 @@ extern struct type *amd64_register_type - extern void amd64_supply_fxsave (struct regcache *regcache, int regnum, - const void *fxsave); - -+/* Similar to amd64_supply_fxsave, but use XSAVE extended state. */ -+extern void amd64_supply_xsave (struct regcache *regcache, int regnum, -+ const void *xsave); -+ - /* Fill register REGNUM (if it is a floating-point or SSE register) in - *FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for - all registers. This function doesn't touch any of the reserved -@@ -99,6 +101,10 @@ extern void amd64_supply_fxsave (struct - extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum, - void *fxsave); - -+/* Similar to amd64_collect_fxsave, but but use XSAVE extended state. */ -+extern void amd64_collect_xsave (const struct regcache *regcache, -+ int regnum, void *xsave, int gcore); -+ - void amd64_classify (struct type *type, enum amd64_reg_class class[2]); - - ---- ./gdb/common/i386-xstate.h 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/common/i386-xstate.h 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,41 @@ -+/* Common code for i386 XSAVE extended state. -+ -+ Copyright (C) 2010 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef I386_XSTATE_H -+#define I386_XSTATE_H 1 -+ -+/* The extended state feature bits. */ -+#define I386_XSTATE_X87 (1ULL << 0) -+#define I386_XSTATE_SSE (1ULL << 1) -+#define I386_XSTATE_AVX (1ULL << 2) -+ -+/* Supported mask and size of the extended state. */ -+#define I386_XSTATE_SSE_MASK (I386_XSTATE_X87 | I386_XSTATE_SSE) -+#define I386_XSTATE_AVX_MASK (I386_XSTATE_SSE_MASK | I386_XSTATE_AVX) -+ -+#define I386_XSTATE_SSE_SIZE 576 -+#define I386_XSTATE_AVX_SIZE 832 -+#define I386_XSTATE_MAX_SIZE 832 -+ -+/* Get I386 XSAVE extended state size. */ -+#define I386_XSTATE_SIZE(XCR0) \ -+ (((XCR0) & I386_XSTATE_AVX) != 0 \ -+ ? I386_XSTATE_AVX_SIZE : I386_XSTATE_SSE_SIZE) -+ -+#endif /* I386_XSTATE_H */ ---- ./gdb/config/djgpp/fnchange.lst 2010-02-01 20:27:55.000000000 +0100 -+++ ./gdb/config/djgpp/fnchange.lst 2010-04-03 21:12:32.000000000 +0200 -@@ -228,6 +228,14 @@ - @V@/gdb/features/rs6000/powerpc-vsx64l.xml @V@/gdb/features/rs6000/ppc-v64l.xml - @V@/gdb/features/rs6000/powerpc-cell32l.xml @V@/gdb/features/rs6000/ppc-c32l.xml - @V@/gdb/features/rs6000/powerpc-cell64l.xml @V@/gdb/features/rs6000/ppc-c64l.xml -+@V@/gdb/features/i386/amd64-avx-linux.c @V@/gdb/features/i386/a64-al.c -+@V@/gdb/features/i386/amd64-avx.c @V@/gdb/features/i386/a64-a.c -+@V@/gdb/features/i386/amd64-avx-linux.xml @V@/gdb/features/i386/a64-al.xml -+@V@/gdb/features/i386/amd64-avx.xml @V@/gdb/features/i386/a64-a.xml -+@V@/gdb/features/i386/i386-avx-linux.c @V@/features/i386/i32-al.c -+@V@/gdb/features/i386/i386-avx.c @V@/gdb/features/i386/i32-a.c -+@V@/gdb/features/i386/i386-avx-linux.xml @V@/gdb/features/i386/i32-al.xml -+@V@/gdb/features/i386/i386-avx.xml @V@/gdb/features/i386/i32-a.xml - @V@/gdb/f-exp.tab.c @V@/gdb/f-exp_tab.c - @V@/gdb/gdbserver/linux-cris-low.c @V@/gdb/gdbserver/lx-cris.c - @V@/gdb/gdbserver/linux-crisv32-low.c @V@/gdb/gdbserver/lx-cris32.c ---- ./gdb/doc/ChangeLog.xcr 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/doc/ChangeLog.xcr 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,31 @@ -+2010-03-27 H.J. Lu -+ -+ * gdb.texinfo (General Query Packets): Replace "x86=xml" with -+ "xmlRegisters+". -+ -+2010-03-12 H.J. Lu -+ -+ * gdb.texinfo (General Query Packets): Updated. -+ (i386 Features): Likewise. -+ -+2010-03-06 H.J. Lu -+ -+ * gdb.texinfo (i386 Features): Make org.gnu.gdb.i386.avx optional. -+ -+2010-03-05 H.J. Lu -+ -+ * gdb.texinfo (General Query Packets): Remove x86:xstate extension. -+ Document x86=xml extension in gdb remote protocol. -+ -+2010-02-11 H.J. Lu -+ -+ * gdb.texinfo (i386 Features): Add org.gnu.gdb.i386.avx. -+ -+2010-02-03 H.J. Lu -+ -+ * gdb.texinfo: Remove x86:xstate from stub reply. -+ -+2010-02-02 H.J. Lu -+ -+ * gdb.texinfo: Document x86:xstate extension in gdb remote -+ protocol. ---- ./gdb/doc/ChangeLog.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/doc/ChangeLog.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,28 @@ -+2010-03-30 H.J. Lu -+ -+ * gdb.texinfo (General Query Packets): Updated. -+ -+2010-03-29 H.J. Lu -+ -+ * gdb.texinfo (General Query Packets): Updated. -+ -+2010-03-29 H.J. Lu -+ -+ * gdb.texinfo (General Query Packets): Remove extra supports. -+ -+2010-03-28 H.J. Lu -+ -+ * gdb.texinfo (General Query Packets): Add xmlRegisters. -+ -+2010-02-09 H.J. Lu -+ -+ * gdb.texinfo (Predefined Target Types): Add i387_ext, -+ i386_eflags and i386_mxcsr. -+ -+2010-02-08 H.J. Lu -+ -+ * gdb.texinfo: Update i386 target features. -+ -+2010-02-08 H.J. Lu -+ -+ * gdb.texinfo: Document i386 target features. ---- ./gdb/features/Makefile 2010-02-08 06:08:46.000000000 +0100 -+++ ./gdb/features/Makefile 2010-04-03 21:12:32.000000000 +0200 -@@ -33,6 +33,8 @@ - WHICH = arm-with-iwmmxt arm-with-vfpv2 arm-with-vfpv3 arm-with-neon \ - i386/i386 i386/i386-linux \ - i386/amd64 i386/amd64-linux \ -+ i386/i386-avx i386/i386-avx-linux \ -+ i386/amd64-avx i386/amd64-avx-linux \ - mips-linux mips64-linux \ - rs6000/powerpc-32l rs6000/powerpc-altivec32l rs6000/powerpc-e500l \ - rs6000/powerpc-64l rs6000/powerpc-altivec64l rs6000/powerpc-vsx32l \ -@@ -45,6 +47,10 @@ i386/i386-expedite = ebp,esp,eip - i386/i386-linux-expedite = ebp,esp,eip - i386/amd64-expedite = rbp,rsp,rip - i386/amd64-linux-expedite = rbp,rsp,rip -+i386/i386-avx-expedite = ebp,esp,eip -+i386/i386-avx-linux-expedite = ebp,esp,eip -+i386/amd64-avx-expedite = rbp,rsp,rip -+i386/amd64-avx-linux-expedite = rbp,rsp,rip - mips-expedite = r29,pc - mips64-expedite = r29,pc - powerpc-expedite = r1,pc -@@ -90,3 +96,9 @@ $(outdir)/i386/i386-linux.dat: i386/32bi - $(outdir)/i386/amd64.dat: i386/64bit-core.xml i386/64bit-sse.xml - $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \ - i386/64bit-linux.xml -+$(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml -+$(outdir)/i386/i386-avx-linux.dat: i386/32bit-core.xml i386/32bit-avx.xml \ -+ i386/32bit-linux.xml -+$(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml -+$(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ -+ i386/64bit-linux.xml ---- ./gdb/features/i386/32bit-avx.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/32bit-avx.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,18 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ ---- ./gdb/features/i386/64bit-avx.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/64bit-avx.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,26 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ ---- ./gdb/features/i386/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/Makefile 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,5 @@ -+include Makefile -+ -+XMLTOC = $(addsuffix .xml, $(filter i386/%, $(WHICH))) -+CFILES = $(patsubst %.xml,%.c,$(XMLTOC)) -+cfiles: $(CFILES) ---- ./gdb/features/i386/amd64-avx-linux.c 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/amd64-avx-linux.c 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,171 @@ -+/* THIS FILE IS GENERATED. Original: amd64-avx-linux.xml */ -+ -+#include "defs.h" -+#include "osabi.h" -+#include "target-descriptions.h" -+ -+struct target_desc *tdesc_amd64_avx_linux; -+static void -+initialize_tdesc_amd64_avx_linux (void) -+{ -+ struct target_desc *result = allocate_target_description (); -+ struct tdesc_feature *feature; -+ struct tdesc_type *field_type, *type; -+ -+ set_tdesc_architecture (result, bfd_scan_arch ("i386:x86-64")); -+ -+ 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"); -+ tdesc_create_reg (feature, "rdx", 3, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rsi", 4, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rdi", 5, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rbp", 6, 1, NULL, 64, "data_ptr"); -+ tdesc_create_reg (feature, "rsp", 7, 1, NULL, 64, "data_ptr"); -+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rip", 16, 1, NULL, 64, "code_ptr"); -+ tdesc_create_reg (feature, "eflags", 17, 1, NULL, 32, "i386_eflags"); -+ tdesc_create_reg (feature, "cs", 18, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ss", 19, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ds", 20, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "es", 21, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "fs", 22, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "gs", 23, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "st0", 24, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st1", 25, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st2", 26, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st3", 27, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st4", 28, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st5", 29, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st6", 30, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st7", 31, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "fctrl", 32, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fstat", 33, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "ftag", 34, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fiseg", 35, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fioff", 36, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "foseg", 37, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fooff", 38, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fop", 39, 1, "float", 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse"); -+ field_type = tdesc_named_type (feature, "ieee_single"); -+ tdesc_create_vector (feature, "v4f", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "ieee_double"); -+ tdesc_create_vector (feature, "v2d", field_type, 2); -+ -+ field_type = tdesc_named_type (feature, "int8"); -+ tdesc_create_vector (feature, "v16i8", field_type, 16); -+ -+ field_type = tdesc_named_type (feature, "int16"); -+ tdesc_create_vector (feature, "v8i16", field_type, 8); -+ -+ field_type = tdesc_named_type (feature, "int32"); -+ tdesc_create_vector (feature, "v4i32", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "int64"); -+ tdesc_create_vector (feature, "v2i64", field_type, 2); -+ -+ type = tdesc_create_union (feature, "vec128"); -+ field_type = tdesc_named_type (feature, "v4f"); -+ tdesc_add_field (type, "v4_float", field_type); -+ field_type = tdesc_named_type (feature, "v2d"); -+ tdesc_add_field (type, "v2_double", field_type); -+ field_type = tdesc_named_type (feature, "v16i8"); -+ tdesc_add_field (type, "v16_int8", field_type); -+ field_type = tdesc_named_type (feature, "v8i16"); -+ tdesc_add_field (type, "v8_int16", field_type); -+ field_type = tdesc_named_type (feature, "v4i32"); -+ tdesc_add_field (type, "v4_int32", field_type); -+ field_type = tdesc_named_type (feature, "v2i64"); -+ tdesc_add_field (type, "v2_int64", field_type); -+ 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"); -+ tdesc_create_reg (feature, "xmm3", 43, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm4", 44, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm5", 45, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm6", 46, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm7", 47, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm8", 48, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm9", 49, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm10", 50, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm11", 51, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm12", 52, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm13", 53, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm14", 54, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); -+ tdesc_create_reg (feature, "orig_rax", 57, 1, NULL, 64, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -+ tdesc_create_reg (feature, "ymm0h", 58, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 59, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 60, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 61, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 62, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 63, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 64, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 65, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm8h", 66, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm9h", 67, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm10h", 68, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm11h", 69, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm12h", 70, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm13h", 71, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm14h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm15h", 73, 1, NULL, 128, "uint128"); -+ -+ tdesc_amd64_avx_linux = result; -+} ---- ./gdb/features/i386/amd64-avx-linux.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/amd64-avx-linux.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,18 @@ -+ -+ -+ -+ -+ -+ -+ -+ i386:x86-64 -+ GNU/Linux -+ -+ -+ -+ -+ ---- ./gdb/features/i386/amd64-avx.c 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/amd64-avx.c 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,166 @@ -+/* THIS FILE IS GENERATED. Original: amd64-avx.xml */ -+ -+#include "defs.h" -+#include "osabi.h" -+#include "target-descriptions.h" -+ -+struct target_desc *tdesc_amd64_avx; -+static void -+initialize_tdesc_amd64_avx (void) -+{ -+ struct target_desc *result = allocate_target_description (); -+ struct tdesc_feature *feature; -+ struct tdesc_type *field_type, *type; -+ -+ 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"); -+ tdesc_create_reg (feature, "rdx", 3, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rsi", 4, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rdi", 5, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rbp", 6, 1, NULL, 64, "data_ptr"); -+ tdesc_create_reg (feature, "rsp", 7, 1, NULL, 64, "data_ptr"); -+ tdesc_create_reg (feature, "r8", 8, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r9", 9, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r10", 10, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r11", 11, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r12", 12, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r13", 13, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r14", 14, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "r15", 15, 1, NULL, 64, "int64"); -+ tdesc_create_reg (feature, "rip", 16, 1, NULL, 64, "code_ptr"); -+ tdesc_create_reg (feature, "eflags", 17, 1, NULL, 32, "i386_eflags"); -+ tdesc_create_reg (feature, "cs", 18, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ss", 19, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ds", 20, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "es", 21, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "fs", 22, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "gs", 23, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "st0", 24, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st1", 25, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st2", 26, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st3", 27, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st4", 28, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st5", 29, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st6", 30, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st7", 31, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "fctrl", 32, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fstat", 33, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "ftag", 34, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fiseg", 35, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fioff", 36, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "foseg", 37, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fooff", 38, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fop", 39, 1, "float", 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse"); -+ field_type = tdesc_named_type (feature, "ieee_single"); -+ tdesc_create_vector (feature, "v4f", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "ieee_double"); -+ tdesc_create_vector (feature, "v2d", field_type, 2); -+ -+ field_type = tdesc_named_type (feature, "int8"); -+ tdesc_create_vector (feature, "v16i8", field_type, 16); -+ -+ field_type = tdesc_named_type (feature, "int16"); -+ tdesc_create_vector (feature, "v8i16", field_type, 8); -+ -+ field_type = tdesc_named_type (feature, "int32"); -+ tdesc_create_vector (feature, "v4i32", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "int64"); -+ tdesc_create_vector (feature, "v2i64", field_type, 2); -+ -+ type = tdesc_create_union (feature, "vec128"); -+ field_type = tdesc_named_type (feature, "v4f"); -+ tdesc_add_field (type, "v4_float", field_type); -+ field_type = tdesc_named_type (feature, "v2d"); -+ tdesc_add_field (type, "v2_double", field_type); -+ field_type = tdesc_named_type (feature, "v16i8"); -+ tdesc_add_field (type, "v16_int8", field_type); -+ field_type = tdesc_named_type (feature, "v8i16"); -+ tdesc_add_field (type, "v8_int16", field_type); -+ field_type = tdesc_named_type (feature, "v4i32"); -+ tdesc_add_field (type, "v4_int32", field_type); -+ field_type = tdesc_named_type (feature, "v2i64"); -+ tdesc_add_field (type, "v2_int64", field_type); -+ 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"); -+ tdesc_create_reg (feature, "xmm3", 43, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm4", 44, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm5", 45, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm6", 46, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm7", 47, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm8", 48, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm9", 49, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm10", 50, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm11", 51, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm12", 52, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm13", 53, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm14", 54, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -+ tdesc_create_reg (feature, "ymm0h", 57, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 58, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 59, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 60, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 61, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 62, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 63, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 64, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm8h", 65, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm9h", 66, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm10h", 67, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm11h", 68, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm12h", 69, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm13h", 70, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm14h", 71, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128"); -+ -+ tdesc_amd64_avx = result; -+} ---- ./gdb/features/i386/amd64-avx.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/amd64-avx.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,16 @@ -+ -+ -+ -+ -+ -+ -+ -+ i386:x86-64 -+ -+ -+ -+ ---- ./gdb/features/i386/i386-avx-linux.c 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/i386-avx-linux.c 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,147 @@ -+/* THIS FILE IS GENERATED. Original: i386-avx-linux.xml */ -+ -+#include "defs.h" -+#include "osabi.h" -+#include "target-descriptions.h" -+ -+struct target_desc *tdesc_i386_avx_linux; -+static void -+initialize_tdesc_i386_avx_linux (void) -+{ -+ struct target_desc *result = allocate_target_description (); -+ struct tdesc_feature *feature; -+ struct tdesc_type *field_type, *type; -+ -+ set_tdesc_architecture (result, bfd_scan_arch ("i386")); -+ -+ 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"); -+ tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr"); -+ tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr"); -+ tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr"); -+ tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags"); -+ tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse"); -+ field_type = tdesc_named_type (feature, "ieee_single"); -+ tdesc_create_vector (feature, "v4f", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "ieee_double"); -+ tdesc_create_vector (feature, "v2d", field_type, 2); -+ -+ field_type = tdesc_named_type (feature, "int8"); -+ tdesc_create_vector (feature, "v16i8", field_type, 16); -+ -+ field_type = tdesc_named_type (feature, "int16"); -+ tdesc_create_vector (feature, "v8i16", field_type, 8); -+ -+ field_type = tdesc_named_type (feature, "int32"); -+ tdesc_create_vector (feature, "v4i32", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "int64"); -+ tdesc_create_vector (feature, "v2i64", field_type, 2); -+ -+ type = tdesc_create_union (feature, "vec128"); -+ field_type = tdesc_named_type (feature, "v4f"); -+ tdesc_add_field (type, "v4_float", field_type); -+ field_type = tdesc_named_type (feature, "v2d"); -+ tdesc_add_field (type, "v2_double", field_type); -+ field_type = tdesc_named_type (feature, "v16i8"); -+ tdesc_add_field (type, "v16_int8", field_type); -+ field_type = tdesc_named_type (feature, "v8i16"); -+ tdesc_add_field (type, "v8_int16", field_type); -+ field_type = tdesc_named_type (feature, "v4i32"); -+ tdesc_add_field (type, "v4_int32", field_type); -+ field_type = tdesc_named_type (feature, "v2i64"); -+ tdesc_add_field (type, "v2_int64", field_type); -+ 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"); -+ tdesc_create_reg (feature, "xmm3", 35, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm4", 36, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm5", 37, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm6", 38, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm7", 39, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "mxcsr", 40, 1, "vector", 32, "i386_mxcsr"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux"); -+ tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -+ tdesc_create_reg (feature, "ymm0h", 42, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 43, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 44, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 45, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 46, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 47, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 48, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 49, 1, NULL, 128, "uint128"); -+ -+ tdesc_i386_avx_linux = result; -+} ---- ./gdb/features/i386/i386-avx-linux.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/i386-avx-linux.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,18 @@ -+ -+ -+ -+ -+ -+ -+ -+ i386 -+ GNU/Linux -+ -+ -+ -+ -+ ---- ./gdb/features/i386/i386-avx.c 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/i386-avx.c 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,142 @@ -+/* THIS FILE IS GENERATED. Original: i386-avx.xml */ -+ -+#include "defs.h" -+#include "osabi.h" -+#include "target-descriptions.h" -+ -+struct target_desc *tdesc_i386_avx; -+static void -+initialize_tdesc_i386_avx (void) -+{ -+ struct target_desc *result = allocate_target_description (); -+ struct tdesc_feature *feature; -+ struct tdesc_type *field_type, *type; -+ -+ 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"); -+ tdesc_create_reg (feature, "ebx", 3, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "esp", 4, 1, NULL, 32, "data_ptr"); -+ tdesc_create_reg (feature, "ebp", 5, 1, NULL, 32, "data_ptr"); -+ tdesc_create_reg (feature, "esi", 6, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "edi", 7, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "eip", 8, 1, NULL, 32, "code_ptr"); -+ tdesc_create_reg (feature, "eflags", 9, 1, NULL, 32, "i386_eflags"); -+ tdesc_create_reg (feature, "cs", 10, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ss", 11, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "ds", 12, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "es", 13, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "fs", 14, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "gs", 15, 1, NULL, 32, "int32"); -+ tdesc_create_reg (feature, "st0", 16, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st1", 17, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st2", 18, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st3", 19, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st4", 20, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st5", 21, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st6", 22, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "st7", 23, 1, NULL, 80, "i387_ext"); -+ tdesc_create_reg (feature, "fctrl", 24, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fstat", 25, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "ftag", 26, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fiseg", 27, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fioff", 28, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "foseg", 29, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int"); -+ tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse"); -+ field_type = tdesc_named_type (feature, "ieee_single"); -+ tdesc_create_vector (feature, "v4f", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "ieee_double"); -+ tdesc_create_vector (feature, "v2d", field_type, 2); -+ -+ field_type = tdesc_named_type (feature, "int8"); -+ tdesc_create_vector (feature, "v16i8", field_type, 16); -+ -+ field_type = tdesc_named_type (feature, "int16"); -+ tdesc_create_vector (feature, "v8i16", field_type, 8); -+ -+ field_type = tdesc_named_type (feature, "int32"); -+ tdesc_create_vector (feature, "v4i32", field_type, 4); -+ -+ field_type = tdesc_named_type (feature, "int64"); -+ tdesc_create_vector (feature, "v2i64", field_type, 2); -+ -+ type = tdesc_create_union (feature, "vec128"); -+ field_type = tdesc_named_type (feature, "v4f"); -+ tdesc_add_field (type, "v4_float", field_type); -+ field_type = tdesc_named_type (feature, "v2d"); -+ tdesc_add_field (type, "v2_double", field_type); -+ field_type = tdesc_named_type (feature, "v16i8"); -+ tdesc_add_field (type, "v16_int8", field_type); -+ field_type = tdesc_named_type (feature, "v8i16"); -+ tdesc_add_field (type, "v8_int16", field_type); -+ field_type = tdesc_named_type (feature, "v4i32"); -+ tdesc_add_field (type, "v4_int32", field_type); -+ field_type = tdesc_named_type (feature, "v2i64"); -+ tdesc_add_field (type, "v2_int64", field_type); -+ 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"); -+ tdesc_create_reg (feature, "xmm3", 35, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm4", 36, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm5", 37, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm6", 38, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm7", 39, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "mxcsr", 40, 1, "vector", 32, "i386_mxcsr"); -+ -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -+ tdesc_create_reg (feature, "ymm0h", 41, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 42, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 43, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 44, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 45, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 46, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 47, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 48, 1, NULL, 128, "uint128"); -+ -+ tdesc_i386_avx = result; -+} ---- ./gdb/features/i386/i386-avx.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/features/i386/i386-avx.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,16 @@ -+ -+ -+ -+ -+ -+ -+ -+ i386 -+ -+ -+ -+ ---- ./gdb/gdbserver/ChangeLog.avx 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/gdbserver/ChangeLog.avx 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,84 @@ -+2010-03-03 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Use -+ I386_XSTATE_SSE_SIZE instead of I386_XSTATE_MAX_SIZE. Use -+ I386_XSTATE_SIZE. -+ -+2010-03-02 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Updated. -+ (i387_xsave_to_cache): Likewise. -+ (x86_xcr0): Likewise. -+ * linux-x86-low.c (x86_linux_process_qsupported): Likewise. -+ -+2010-03-02 H.J. Lu -+ -+ * Makefile.in (i386-xstate.o): Removed. -+ -+ * configure.srv (srv_tgtobj): Remove i386-xstate.o for -+ i[34567]86-*-linux* and x86_64-*-linux*. -+ -+ * i387-fp.c (x86_xcr0): Initialized to XSTATE_SSE_MASK. -+ (x86_xcr0_init): Removed. -+ -+ * i387-fp.h (x86_xcr0_init): Removed. -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Use -+ XSTATE_MAX_SIZE_N_OF_INT64 and XSTATE_MAX_SIZE. Get xcr0 -+ from XSAVE extended state. -+ -+2010-02-02 H.J. Lu -+ -+ * Makefile.in (clean): Replace reg-i386-linux-avx.c with -+ reg-i386-avx-linux.c. -+ (reg-x86-64-avx.c): Fixed. -+ (reg-x86-64-avx-linux.c): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * configure.srv (srv_tgtobj): Add xsave-nat.o for -+ i[34567]86-*-linux* and x86_64-*-linux*. -+ -+2010-01-21 H.J. Lu -+ -+ * i387-fp.c (x86_sse_unit): Renamed to ... -+ (x86_vector_unit): This. -+ (x86_get_sse_unit): Renamed to ... -+ (x86_get_vector_unit): This. -+ (i387_cache_to_fxsave): Updated. -+ * linux-x86-low.c (x86_arch_setup): Likewise. -+ -+2010-01-21 H.J. Lu -+ -+ * i387-fp.h (x86_sse_unit): Renamed to ... -+ (x86_vector_unit): This. -+ -+2009-10-14 H.J. Lu -+ -+ * Makefile.in (clean): Also remove reg-i386-avx.c, -+ reg-i386-avx-linux.c, reg-x86-64-avx.c and reg-x86-64-avx-linux.c. -+ (reg-i386-avx.o): New target. -+ (reg-i386-avx.c): Likewise. -+ (reg-i386-avx-linux.o): Likewise. -+ (reg-i386-avx-linux.c): Likewise. -+ (reg-x86-64-avx.o): Likewise. -+ (reg-x86-64-avx.c): Likewise. -+ (reg-x86-64-avx-linux.o): Likewise. -+ (reg-x86-64-avx-linux.c): Likewise. -+ -+ * gdbserver/configure.srv (srv_regobj): Add reg-i386-avx-linux.o -+ for i[34567]86-*-linux*. Add reg-x86-64-avx-linux.o and -+ reg-i386-avx-linux.o for x86_64-*-linux*. -+ -+ * i387-fp.c (x86_sse_unit): New. -+ (x86_get_sse_unit): Likewise. -+ (i387_cache_to_fxsave): Handle x86_sse_unit. Support fake -+ AVX registers. -+ (i387_fxsave_to_cache): Likewise. -+ -+ * i387-fp.h (x86_sse_unit): New. -+ (x86_get_sse_unit): Likewise. -+ -+ * linux-x86-low.c (init_registers_i386_avx_linux): New. -+ (init_registers_x86_64_avx_linux): Likewise. -+ (x86_arch_setup): Call x86_get_sse_unit () to handle x86_sse_unit. ---- ./gdb/gdbserver/ChangeLog.xcr 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/gdbserver/ChangeLog.xcr 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,373 @@ -+2010-03-30 H.J. Lu -+ -+ * linux-x86-low.c: Don't include . -+ -+2010-03-29 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_update_xmltarget): Call ptrace -+ only once. -+ -+2010-03-29 H.J. Lu -+ -+ * linux-x86-low.c (use_xml): New. -+ (x86_linux_update_xmltarget): Likewise. -+ (x86_linux_process_qsupported): Use x86_linux_update_xmltarget. -+ (x86_arch_setup): Don't call init_registers_amd64_linux, -+ init_registers_i386_linux. Don't set gdbserver_xmltarget. Use -+ x86_linux_update_xmltarget. -+ -+ * server.c (handle_query): Call target_process_qsupported with -+ NULL query first. -+ -+2010-03-29 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Replace -+ uint64_t with unsigned long long. -+ -+2010-03-28 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Check -+ "xmlRegisters=" instead of "xmlRegisters+". -+ -+2010-03-28 H.J. Lu -+ -+ * linux-x86-low.c (target_regsets): Always use EXTENDED_REGS -+ with NT_X86_XSTATE. -+ -+2010-03-28 H.J. Lu -+ -+ * linux-x86-low.c (xmltarget_amd64_linux_no_xml): New. -+ (xmltarget_i386_linux_no_xml): Likewise. -+ (x86_linux_process_qsupported): Remove use_xml. Update -+ gdbserver_xmltarget. -+ (x86_arch_setup): Set gdbserver_xmltarget to -+ xmltarget_amd64_linux_no_xml/xmltarget_i386_linux_no_xml. -+ -+ * server.c (use_xml): Removed. -+ (get_features_xml): Updated. -+ (handle_query): Don't call target_process_qsupported with NULL. -+ -+ * server.h (use_xml): Removed. -+ -+2010-03-28 H.J. Lu -+ -+ * linux-x86-low.c: Include . -+ (x86_linux_process_qsupported): Use getpid. -+ -+2010-03-28 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Replace -+ unsigned long long with uint64_t. -+ -+2010-03-28 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Set use_xml -+ to 1 if XML is supported. -+ -+2010-03-27 H.J. Lu -+ -+ * server.c (handle_query): Don't check "x86:xstate=". -+ -+2010-03-27 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Check -+ xmlRegisters+ instead of x86=xml. -+ -+ * server.c (USE_XML): Default to 0. -+ (use_xml): Initialize to USE_XML. -+ -+2010-03-12 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Replace bit_I386_XSTATE_XXX -+ with I386_XSTATE_XXX. -+ (i387_xsave_to_cache): Likewise. -+ -+2010-03-05 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Check bit_I386_XSTATE_X87. -+ (i387_xsave_to_cache): Likewise. -+ -+2010-03-05 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Optimized. -+ -+2010-03-05 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Handle upper YMM registers. -+ (i387_xsave_to_cache): Likewise. -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Check x86=xml. -+ -+2010-02-19 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Also check x87 registers. -+ (i387_xsave_to_cache): Likewise. -+ -+ * linux-x86-low.c: Include . -+ (x86_linux_process_qsupported): Support AVX only if -+ PTRACE_GETREGSET works. -+ -+2010-02-13 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Check x86_xcr0 instead of -+ x86_vector_unit. -+ (i387_xsave_to_cache): Likewise. -+ (x86_vector_unit): Removed. -+ (x86_vector_unit_init): Likewise. -+ (x86_xcr0): New. -+ (x86_xcr0_init): Likewise. -+ -+ * i387-fp.h (x86_vector_unit): Removed. -+ (x86_vector_unit_init): Likewise. -+ (x86_xcr0): New. -+ (x86_xcr0_init): Likewise. -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Check x86_xcr0 -+ instead of x86_vector_unit. -+ -+2010-02-11 H.J. Lu -+ -+ * linux-arm-low.c (target_regsets): Initialize nt_type to 0. -+ * linux-crisv32-low.c (target_regsets): Likewise. -+ * linux-m68k-low.c (target_regsets): Likewise. -+ * linux-mips-low.c (target_regsets): Likewise. -+ * linux-ppc-low.c (target_regsets): Likewise. -+ * linux-s390-low.c (target_regsets): Likewise. -+ * linux-sh-low.c (target_regsets): Likewise. -+ * linux-sparc-low.c (target_regsets): Likewise. -+ * linux-xtensa-low.c (target_regsets): Likewise. -+ -+2010-02-11 H.J. Lu -+ -+ * linux-low.c (regsets_fetch_inferior_registers): Simplify -+ nt_type. -+ (regsets_store_inferior_registers): Likewise. -+ -+2010-02-10 H.J. Lu -+ -+ * linux-low.c: Include . -+ (regsets_fetch_inferior_registers): Support nt_type. -+ (regsets_store_inferior_registers): Likewise. -+ -+ * linux-low.h (regset_info): Add nt_type. -+ -+ * linux-x86-low.c: Include "elf/common.h". Don't include -+ "../config/i386/nm-linux-xstate.h". -+ (PTRACE_GETREGSET): New. -+ (PTRACE_SETREGSET): Likewise. -+ (target_regsets): Initialize nt_type. -+ -+2010-02-09 H.J. Lu -+ -+ * linux-x86-low.c: Replace PTRACE_GETXSTATEREGS with -+ PTRACE_GETREGSET in comments. -+ -+2010-02-09 H.J. Lu -+ -+ * linux-x86-low.c: Include "../config/i386/nm-linux-xstate.h". -+ (PTRACE_SETXSTATEREGS): Removed. -+ (PTRACE_SETXSTATEREGS): Likewise. -+ (target_regsets): Use PTRACE_GETREGSET/PTRACE_SETREGSET instead -+ of PTRACE_GETXSTATEREGS/PTRACE_SETXSTATEREGS. -+ (x86_linux_process_qsupported): Check PTRACE_GETREGSET instead -+ of PTRACE_GETXSTATEREGS. -+ -+2010-02-06 H.J. Lu -+ -+ * i387-fp.c (x86_vector_unit_init): Properly check xcr0. -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Set use_xml -+ to 0 and return for NULL query. Set use_xml to 1 if there is -+ "x86:xstate=" in qSupported packet. -+ -+ * server.c (get_features_xml): Optimized. -+ (handle_query): Call target_process_qsupported with NULL -+ query first. -+ -+2010-02-05 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Remove unsigned from raw. -+ (i387_xsave_to_cache): Remove unsigned from raw and xmm. Fix -+ a typo. -+ -+2010-02-05 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Set use_xml -+ to 0 if there is no "x86:xstate=" in qSupported packet. -+ -+ * server.c (use_xml): New. -+ (get_features_xml): Don't use XML file if use_xml is 0. -+ (handle_query): Always call target_process_qsupported. -+ -+ * server.h (use_xml): New. -+ -+2010-02-05 H.J. Lu -+ -+ * Makefile.in (clean): Updated. -+ (i386-avx.o): New. -+ (i386-avx.c): Likewise. -+ (i386-avx-linux.o): Likewise. -+ (i386-avx-linux.c): Likewise. -+ (x86-64-avx.o): Likewise. -+ (x86-64-avx.c): Likewise. -+ (x86-64-avx-linux.o): Likewise. -+ (x86-64-avx-linux.c): Likewise. -+ -+ * configure.srv (srv_i386_regobj): Add i386-avx.o. -+ (srv_i386_linux_regobj): Add i386-avx-linux.o. -+ (srv_x86_64_regobj): Add x86-64-avx.o. -+ (srv_x86_64_linux_regobj): Add x86-64-avx-linux.o. -+ -+2010-02-05 H.J. Lu -+ -+ * configure.srv (srv_i386_32bit_xmlfiles): Add -+ i386/32bit-avx.xml. -+ (srv_i386_64bit_xmlfiles): Add i386/64bit-avx.xml. -+ (srv_i386_xmlfiles): Add i386/i386-avx.xml. -+ (srv_x86_64_xmlfiles): Add i386/x86-64-avx.xml. -+ (srv_i386_linux_xmlfiles): Add i386/i386-avx-linux.xml. -+ (srv_x86_64_linux_xmlfiles): Add i386/x86-64-avx-linux.xml. -+ -+2010-02-04 H.J. Lu -+ -+ * linux-low.c (linux_process_qsupported): Make it void. -+ * linux-x86-low.c (x86_linux_process_qsupported): Likewise. -+ -+ * linux-low.h (linux_target_ops): Make process_qsupported void. -+ -+ * server.c (handle_query): Make target_process_qsupported void. -+ -+ * target.h (target_ops): Make process_qsupported void. -+ (target_process_qsupported): Make it void. -+ -+2010-02-03 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Replace xmm[32] with raw[32]. -+ (i387_xsave_to_cache): Optimize xstate_bv == 0. -+ -+2010-02-03 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Remove collect_register_part. -+ (i387_xsave_to_cache): Remove supply_register_part. -+ -+ * regcache.c (supply_register_part): Removed. -+ (collect_register_part): Likewise. -+ * regcache.h (supply_register_part): Likewise. -+ (collect_register_part): Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * Makefile.in (xstate-nat.o): Renamed to ... -+ (i386-xstate.o): This. -+ -+ * configure.srv (srv_tgtobj): Add i386-xstate.o instead of -+ xstate-nat.o for i[34567]86-*-linux* and x86_64-*-linux*. -+ -+ * i387-fp.c: Include "i386-xstate.h" instead of "xstate-nat.h". -+ * linux-x86-low.c: Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Add another missing break. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Add the missing break. -+ -+2010-02-02 H.J. Lu -+ -+ * regcache.c (supply_register_part): Clear regcache if buf is -+ NULL. -+ -+2010-02-02 H.J. Lu -+ -+ * linux-x86-low.c (x86_linux_process_qsupported): Always -+ initialize size and xcr0. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-fp.c (x86_vector_unit_init): Support only what both gdb -+ and host support. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Clear part in vector registers -+ if its bit in xstat_bv is zero. Update xstat_bv if needed. -+ (i387_xsave_to_cache): Clear part in vector registers if its bit -+ in xstat_bv is zero. -+ -+ * regcache.c (supply_register): Clear regcache if buf is NULL. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Remove xcr0. -+ (i387_xsave_to_cache): Likewise. -+ -+2010-02-02 H.J. Lu -+ -+ * i387-fp.c (x86_vector_unit_init): Updated. -+ * i387-fp.h (x86_vector_unit_init): Likewise. -+ -+ * linux-low.c (linux_update_x86_xstate_size): Renamed to ... -+ (linux_process_qsupported): This. Updated. -+ (linux_target_ops): Updated. -+ -+ * linux-low.h (linux_target_ops): Replace update_x86_xstate_size -+ with process_qsupported. -+ -+ * linux-x86-low.c (x86_linux_update_x86_xstate_size): Renamed -+ to ... -+ (x86_linux_process_qsupported): This. Assemble qSupported ACK. -+ -+ * server.c (handle_query): Call target_process_qsupported -+ for unhandled query. -+ -+ * target.h (target_ops): Replace update_x86_xstate_size with -+ process_qsupported. -+ (target_update_x86_xstate_size): Removed. -+ (target_process_qsupported): New. -+ -+2010-02-01 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Remove xstate_bv. -+ (i387_xsave_to_cache): Likewise. -+ -+2010-02-01 H.J. Lu -+ -+ * i387-fp.c (x86_vector_unit_init): Add and check size argument. -+ -+ * i387-fp.h (x86_vector_unit): Remove unknown. -+ (x86_vector_unit_init): Add size argument. -+ -+ * linux-low.c (linux_update_x86_xstate_size): New. -+ (linux_target_ops): Add linux_update_x86_xstate_size. -+ -+ * linux-low.h (linux_target_ops): Add update_x86_xstate_size. -+ -+ * linux-x86-low.c (x86_update_xstateregset_size): Renamed to -+ ... -+ (x86_linux_update_x86_xstate_size): This. Updated. -+ (x86_arch_setup): Don't call x86_update_xstateregset_size. -+ (the_low_target): Add x86_linux_update_x86_xstate_size. -+ -+ * server.c (handle_query): Handle "x86:xstate:SIZE". -+ -+ * target.h (target_ops): Add update_x86_xstate_size. -+ (target_update_x86_xstate_size): New. -+ -+2010-01-31 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Handle xcr0 and xstate_bv -+ only for AVX and above. -+ (i387_xsave_to_cache): Likewise. -+ -+2010-01-31 H.J. Lu -+ -+ * i387-fp.c (i387_xsave): Add xcr0 and xstate_bv. -+ (i387_cache_to_xsave): Handle xcr0 and xstate_bv. -+ (i387_xsave_to_cache): Likewise. -+ -+2010-01-29 H.J. Lu -+ -+ * i387-fp.c (x86_vector_unit_init): Updated. -+ * linux-x86-low.c (x86_update_xstateregset_size): Likewise. ---- ./gdb/gdbserver/ChangeLog.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/gdbserver/ChangeLog.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,68 @@ -+2010-02-08 H.J. Lu -+ -+ * linux-x86-low.c (init_registers_i386_linux): Update comments. -+ (init_registers_amd64_linux): Likewise. -+ -+2010-02-07 H.J. Lu -+ -+ * Makefile.in: Replace x86-64 with amd64. -+ -+ * configure.srv: Replace x86-64/x86_64 with amd64. -+ -+ * linux-x86-low.c: Replace x86_64 with amd64. -+ -+2010-02-04 H.J. Lu -+ -+ * configure.srv (srv_i386_regobj): New. -+ (srv_i386_linux_regobj): Likewise. -+ (srv_x86_64_regobj): Likewise. -+ (srv_x86_64_linux_regobj): Likewise. -+ (i[34567]86-*-cygwin*): Set srv_regobj to $srv_i386_regobj. -+ (i[34567]86-*-mingw32ce*): Likewise. -+ (i[34567]86-*-mingw*): Likewise. -+ (i[34567]86-*-nto*): Likewise. -+ (i[34567]86-*-linux*): Set srv_regobj to $srv_i386_linux_regobj -+ and $srv_x86_64_linux_regobj. -+ (x86_64-*-linux*): Likewise. -+ -+2010-02-04 H.J. Lu -+ -+ * configure.srv (srv_i386_32bit_xmlfiles): New. -+ (srv_i386_64bit_xmlfiles): Likewise. -+ (srv_i386_xmlfiles): Likewise. -+ (srv_x86_64_xmlfiles): Likewise. -+ (srv_i386_linux_xmlfiles): Likewise. -+ (srv_x86_64_linux_xmlfiles): Likewise. -+ (i[34567]86-*-cygwin*): Set srv_xmlfiles to $srv_i386_xmlfiles. -+ (i[34567]86-*-mingw32ce*): Likewise. -+ (i[34567]86-*-mingw*): Likewise. -+ (i[34567]86-*-nto*): Likewise. -+ (i[34567]86-*-linux*): Set srv_xmlfiles to -+ $srv_i386_linux_xmlfiles and $srv_x86_64_linux_xmlfiles. -+ (x86_64-*-linux*): Likewise. -+ -+2010-02-03 H.J. Lu -+ -+ * Makefile.in (clean): Replace reg-i386.c, reg-x86-64.c, -+ reg-i386-linux.c and reg-x86-64-linux.c with i386.c, x86-64.c, -+ i386-linux.c and x86-64-linux.c. -+ (reg-i386.o): Removed. -+ (reg-i386.c): Likewise. -+ (reg-i386-linux.o): Likewise. -+ (reg-i386-linux.c): Likewise. -+ (reg-x86-64.o): Likewise. -+ (reg-x86-64.c): Likewise. -+ (reg-x86-64-linux.o): Likewise. -+ (reg-x86-64-linux.c): Likewise. -+ (i386.o): New. -+ (i386.c): Likewise. -+ (i386-linux.o): Likewise. -+ (i386-linux.c): Likewise. -+ (x86-64.o): Likewise. -+ (x86-64.c): Likewise. -+ (x86-64-linux.o): Likewise. -+ (x86-64-linux.c): Likewise. -+ -+ * configure.srv: Replace reg-i386.o, reg-x86-64.o, -+ reg-i386-linux.o and reg-x86-64-linux.o with i386.o, x86-64.o, -+ i386-linux.o and x86-64-linux.o. ---- ./gdb/gdbserver/ChangeLog.xstate 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/gdbserver/ChangeLog.xstate 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,89 @@ -+2010-01-31 H.J. Lu -+ -+ * i387-fp.c (i387_xsave): Correct layout. -+ -+2010-01-27 H.J. Lu -+ -+ * linux-x86-low.c (x86_update_xstateregset_size): Use -+ i386_xstate.size. -+ -+2010-01-27 H.J. Lu -+ -+ * linux-x86-low.c (x86_update_xstateregset_size): Call -+ x86_vector_unit_init here. Turn off other FP PTRACE requests -+ only on AVX host. -+ (x86_arch_setup): Don't call x86_vector_unit_init here. -+ -+2010-01-26 H.J. Lu -+ -+ * linux-x86-low.c (x86_update_xstateregset_size): Update -+ size for PTRACE_GETXSTATEREGS only if it is supported. -+ -+2010-01-26 H.J. Lu -+ -+ * linux-x86-low.c (x86_update_xstateregset_size): Use only -+ PTRACE_GETXSTATEREGS if it is supported. -+ -+2010-01-26 H.J. Lu -+ -+ * linux-x86-low.c (x86_update_xstateregset_size): For AVX, -+ only use PTRACE_GETXSTATEREGS. -+ -+2010-01-26 H.J. Lu -+ -+ * i387-fp.c (i387_cache_to_xsave): Find ymm0 for AVX. -+ (i387_xsave_to_cache): Likewise. -+ -+2010-01-25 H.J. Lu -+ -+ * Makefile.in (xsave-nat.o): Renamed to ... -+ (xstate-nat.o): This. -+ -+ * configure.srv (srv_tgtobj): Add xstate-nat.o instead of -+ xsave-nat.o for i[34567]86-*-linux* and x86_64-*-linux*. -+ -+ * i387-fp.c: Include "xstate-nat.h" instead of "xsave-nat.h". -+ * linux-x86-low.c: Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * regcache.c (supply_register_part): Change size to unsigned int. -+ (collect_register_part): Likewise. -+ * regcache.h (supply_register_part): Likewise. -+ (collect_register_part): Likewise. -+ -+2010-01-22 H.J. Lu -+ -+ * linux-x86-low.c: Include "xsave-nat.h" -+ (PTRACE_GETXSTATEREGS): New. -+ (PTRACE_SETXSTATEREGS): Likewise. -+ (x86_fill_xstateregset): Likewise. -+ (x86_store_xstateregset): Likewise. -+ (x86_update_xstateregset_size): Likewise. -+ (target_regsets): Add PTRACE_GETXSTATEREGS entry. -+ (x86_arch_setup): Call x86_update_xstateregset_size. -+ -+2010-01-22 H.J. Lu -+ -+ * configure.srv (srv_tgtobj): Add xsave-nat.o for -+ i[34567]86-*-linux* and x86_64-*-linux*. -+ -+ * i387-fp.c (i387_xsave): New. -+ (i387_cache_to_xsave): Likewise. -+ (i387_xsave_to_cache): Likewise. -+ (x86_vector_unit): Likewise. -+ (x86_vector_unit_init): Likewise. -+ * 387-fp.h (i387_cache_to_xsave): Likewise. -+ (i387_xsave_to_cache): Likewise. -+ (x86_vector_unit): Likewise. -+ (x86_vector_unit_init): Likewise. -+ * regcache.c (supply_register_part): Likewise. -+ (collect_register_part): Likewise. -+ * regcache.h (supply_register_part): Likewise. -+ (collect_register_part): Likewise. -+ -+ * linux-x86-low.c (x86_arch_setup): Call x86_vector_unit_init. -+ -+2010-01-22 H.J. Lu -+ -+ * Makefile.in (xsave-nat.o): New. ---- ./gdb/gdbserver/Makefile.in 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/gdbserver/Makefile.in 2010-04-03 21:12:32.000000000 +0200 -@@ -217,6 +217,8 @@ clean: - rm -f powerpc-isa205-vsx64l.c - rm -f s390-linux32.c s390-linux64.c s390x-linux64.c - rm -f xml-builtin.c stamp-xml -+ rm -f i386-avx.c i386-avx-linux.c -+ rm -f amd64-avx.c amd64-avx-linux.c - - maintainer-clean realclean distclean: clean - rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log -@@ -351,6 +353,12 @@ i386.c : $(srcdir)/../regformats/i386/i3 - i386-linux.o : i386-linux.c $(regdef_h) - i386-linux.c : $(srcdir)/../regformats/i386/i386-linux.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-linux.dat i386-linux.c -+i386-avx.o : i386-avx.c $(regdef_h) -+i386-avx.c : $(srcdir)/../regformats/i386/i386-avx.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx.dat i386-avx.c -+i386-avx-linux.o : i386-avx-linux.c $(regdef_h) -+i386-avx-linux.c : $(srcdir)/../regformats/i386/i386-avx-linux.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/i386-avx-linux.dat i386-avx-linux.c - reg-ia64.o : reg-ia64.c $(regdef_h) - reg-ia64.c : $(srcdir)/../regformats/reg-ia64.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-ia64.dat reg-ia64.c -@@ -438,6 +446,12 @@ amd64.c : $(srcdir)/../regformats/i386/a - amd64-linux.o : amd64-linux.c $(regdef_h) - amd64-linux.c : $(srcdir)/../regformats/i386/amd64-linux.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-linux.dat amd64-linux.c -+amd64-avx.o : amd64-avx.c $(regdef_h) -+amd64-avx.c : $(srcdir)/../regformats/i386/amd64-avx.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx.dat amd64-avx.c -+amd64-avx-linux.o : amd64-avx-linux.c $(regdef_h) -+amd64-avx-linux.c : $(srcdir)/../regformats/i386/amd64-avx-linux.dat $(regdat_sh) -+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c - reg-xtensa.o : reg-xtensa.c $(regdef_h) - reg-xtensa.c : $(srcdir)/../regformats/reg-xtensa.dat $(regdat_sh) - $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-xtensa.dat reg-xtensa.c ---- ./gdb/gdbserver/configure.srv 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/gdbserver/configure.srv 2010-04-03 21:12:32.000000000 +0200 -@@ -22,17 +22,17 @@ - # Default hostio_last_error implementation - srv_hostio_err_objs="hostio-errno.o" - --srv_i386_regobj=i386.o --srv_i386_linux_regobj=i386-linux.o --srv_amd64_regobj=amd64.o --srv_amd64_linux_regobj=amd64-linux.o -+srv_i386_regobj="i386.o i386-avx.o" -+srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o" -+srv_amd64_regobj="amd64.o x86-64-avx.o" -+srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o" - --srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml" --srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml" --srv_i386_xmlfiles="i386/i386.xml $srv_i386_32bit_xmlfiles" --srv_amd64_xmlfiles="i386/amd64.xml $srv_i386_64bit_xmlfiles" --srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles" --srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles" -+srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml" -+srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml" -+srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml $srv_i386_32bit_xmlfiles" -+srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml $srv_i386_64bit_xmlfiles" -+srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles" -+srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles" - - # Input is taken from the "${target}" variable. - ---- ./gdb/gdbserver/i387-fp.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/i387-fp.c 2010-04-03 21:12:32.000000000 +0200 -@@ -19,6 +19,7 @@ - - #include "server.h" - #include "i387-fp.h" -+#include "i386-xstate.h" - - int num_xmm_registers = 8; - -@@ -72,6 +73,46 @@ struct i387_fxsave { - unsigned char xmm_space[256]; - }; - -+struct i387_xsave { -+ /* All these are only sixteen bits, plus padding, except for fop (which -+ is only eleven bits), and fooff / fioff (which are 32 bits each). */ -+ unsigned short fctrl; -+ unsigned short fstat; -+ unsigned short ftag; -+ unsigned short fop; -+ unsigned int fioff; -+ unsigned short fiseg; -+ unsigned short pad1; -+ unsigned int fooff; -+ unsigned short foseg; -+ unsigned short pad12; -+ -+ unsigned int mxcsr; -+ unsigned int mxcsr_mask; -+ -+ /* Space for eight 80-bit FP values in 128-bit spaces. */ -+ unsigned char st_space[128]; -+ -+ /* Space for eight 128-bit XMM values, or 16 on x86-64. */ -+ unsigned char xmm_space[256]; -+ -+ unsigned char reserved1[48]; -+ -+ /* The extended control register 0 (the XFEATURE_ENABLED_MASK -+ register). */ -+ unsigned long long xcr0; -+ -+ unsigned char reserved2[40]; -+ -+ /* The XSTATE_BV bit vector. */ -+ unsigned long long xstate_bv; -+ -+ unsigned char reserved3[56]; -+ -+ /* Space for eight upper 128-bit YMM values, or 16 on x86-64. */ -+ unsigned char ymmh_space[256]; -+}; -+ - void - i387_cache_to_fsave (struct regcache *regcache, void *buf) - { -@@ -199,6 +240,128 @@ i387_cache_to_fxsave (struct regcache *r - fp->foseg = val; - } - -+void -+i387_cache_to_xsave (struct regcache *regcache, void *buf) -+{ -+ struct i387_xsave *fp = (struct i387_xsave *) buf; -+ int i; -+ unsigned long val, val2; -+ unsigned int clear_bv; -+ unsigned long long xstate_bv = 0; -+ char raw[16]; -+ char *p; -+ -+ /* The supported bits in `xstat_bv' are 1 byte. Clear part in -+ vector registers if its bit in xstat_bv is zero. */ -+ clear_bv = (~fp->xstate_bv) & x86_xcr0; -+ -+ /* Clear part in x87 and vector registers if its bit in xstat_bv is -+ zero. */ -+ if (clear_bv) -+ { -+ if ((clear_bv & I386_XSTATE_X87)) -+ for (i = 0; i < 8; i++) -+ memset (((char *) &fp->st_space[0]) + i * 16, 0, 10); -+ -+ if ((clear_bv & I386_XSTATE_SSE)) -+ for (i = 0; i < num_xmm_registers; i++) -+ memset (((char *) &fp->xmm_space[0]) + i * 16, 0, 16); -+ -+ if ((clear_bv & I386_XSTATE_AVX)) -+ for (i = 0; i < num_xmm_registers; i++) -+ memset (((char *) &fp->ymmh_space[0]) + i * 16, 0, 16); -+ } -+ -+ /* Check if any x87 registers are changed. */ -+ if ((x86_xcr0 & I386_XSTATE_X87)) -+ { -+ int st0_regnum = find_regno ("st0"); -+ -+ for (i = 0; i < 8; i++) -+ { -+ collect_register (regcache, i + st0_regnum, raw); -+ p = ((char *) &fp->st_space[0]) + i * 16; -+ if (memcmp (raw, p, 10)) -+ { -+ xstate_bv |= I386_XSTATE_X87; -+ memcpy (p, raw, 10); -+ } -+ } -+ } -+ -+ /* Check if any SSE registers are changed. */ -+ if ((x86_xcr0 & I386_XSTATE_SSE)) -+ { -+ int xmm0_regnum = find_regno ("xmm0"); -+ -+ for (i = 0; i < num_xmm_registers; i++) -+ { -+ collect_register (regcache, i + xmm0_regnum, raw); -+ p = ((char *) &fp->xmm_space[0]) + i * 16; -+ if (memcmp (raw, p, 16)) -+ { -+ xstate_bv |= I386_XSTATE_SSE; -+ memcpy (p, raw, 16); -+ } -+ } -+ } -+ -+ /* Check if any AVX registers are changed. */ -+ if ((x86_xcr0 & I386_XSTATE_AVX)) -+ { -+ int ymm0h_regnum = find_regno ("ymm0h"); -+ -+ for (i = 0; i < num_xmm_registers; i++) -+ { -+ collect_register (regcache, i + ymm0h_regnum, raw); -+ p = ((char *) &fp->ymmh_space[0]) + i * 16; -+ if (memcmp (raw, p, 16)) -+ { -+ xstate_bv |= I386_XSTATE_AVX; -+ memcpy (p, raw, 16); -+ } -+ } -+ } -+ -+ /* Update the corresponding bits in xstate_bv if any SSE/AVX -+ registers are changed. */ -+ fp->xstate_bv |= xstate_bv; -+ -+ collect_register_by_name (regcache, "fioff", &fp->fioff); -+ collect_register_by_name (regcache, "fooff", &fp->fooff); -+ collect_register_by_name (regcache, "mxcsr", &fp->mxcsr); -+ -+ /* This one's 11 bits... */ -+ collect_register_by_name (regcache, "fop", &val2); -+ fp->fop = (val2 & 0x7FF) | (fp->fop & 0xF800); -+ -+ /* Some registers are 16-bit. */ -+ collect_register_by_name (regcache, "fctrl", &val); -+ fp->fctrl = val; -+ -+ collect_register_by_name (regcache, "fstat", &val); -+ fp->fstat = val; -+ -+ /* Convert to the simplifed tag form stored in fxsave data. */ -+ collect_register_by_name (regcache, "ftag", &val); -+ val &= 0xFFFF; -+ val2 = 0; -+ for (i = 7; i >= 0; i--) -+ { -+ int tag = (val >> (i * 2)) & 3; -+ -+ if (tag != 3) -+ val2 |= (1 << i); -+ } -+ fp->ftag = val2; -+ -+ collect_register_by_name (regcache, "fiseg", &val); -+ fp->fiseg = val; -+ -+ collect_register_by_name (regcache, "foseg", &val); -+ fp->foseg = val; -+} -+ - static int - i387_ftag (struct i387_fxsave *fp, int regno) - { -@@ -296,3 +459,107 @@ i387_fxsave_to_cache (struct regcache *r - val = (fp->fop) & 0x7FF; - supply_register_by_name (regcache, "fop", &val); - } -+ -+void -+i387_xsave_to_cache (struct regcache *regcache, const void *buf) -+{ -+ struct i387_xsave *fp = (struct i387_xsave *) buf; -+ struct i387_fxsave *fxp = (struct i387_fxsave *) buf; -+ int i, top; -+ unsigned long val; -+ unsigned int clear_bv; -+ char *p; -+ -+ /* The supported bits in `xstat_bv' are 1 byte. Clear part in -+ vector registers if its bit in xstat_bv is zero. */ -+ clear_bv = (~fp->xstate_bv) & x86_xcr0; -+ -+ /* Check if any x87 registers are changed. */ -+ if ((x86_xcr0 & I386_XSTATE_X87)) -+ { -+ int st0_regnum = find_regno ("st0"); -+ -+ if ((clear_bv & I386_XSTATE_X87)) -+ p = NULL; -+ else -+ p = (char *) buf; -+ -+ for (i = 0; i < 8; i++) -+ { -+ if (p) -+ p = ((char *) &fp->st_space[0]) + i * 16; -+ supply_register (regcache, i + st0_regnum, p); -+ } -+ } -+ -+ if ((x86_xcr0 & I386_XSTATE_SSE)) -+ { -+ int xmm0_regnum = find_regno ("xmm0"); -+ -+ if ((clear_bv & I386_XSTATE_SSE)) -+ p = NULL; -+ else -+ p = (char *) buf; -+ -+ for (i = 0; i < num_xmm_registers; i++) -+ { -+ if (p) -+ p = ((char *) &fp->xmm_space[0]) + i * 16; -+ supply_register (regcache, i + xmm0_regnum, p); -+ } -+ } -+ -+ if ((x86_xcr0 & I386_XSTATE_AVX)) -+ { -+ int ymm0h_regnum = find_regno ("ymm0h"); -+ -+ if ((clear_bv & I386_XSTATE_AVX)) -+ p = NULL; -+ else -+ p = (char *) buf; -+ -+ for (i = 0; i < num_xmm_registers; i++) -+ { -+ if (p) -+ p = ((char *) &fp->ymmh_space[0]) + i * 16; -+ supply_register (regcache, i + ymm0h_regnum, p); -+ } -+ } -+ -+ supply_register_by_name (regcache, "fioff", &fp->fioff); -+ supply_register_by_name (regcache, "fooff", &fp->fooff); -+ supply_register_by_name (regcache, "mxcsr", &fp->mxcsr); -+ -+ /* Some registers are 16-bit. */ -+ val = fp->fctrl & 0xFFFF; -+ supply_register_by_name (regcache, "fctrl", &val); -+ -+ val = fp->fstat & 0xFFFF; -+ supply_register_by_name (regcache, "fstat", &val); -+ -+ /* Generate the form of ftag data that GDB expects. */ -+ top = (fp->fstat >> 11) & 0x7; -+ val = 0; -+ for (i = 7; i >= 0; i--) -+ { -+ int tag; -+ if (fp->ftag & (1 << i)) -+ tag = i387_ftag (fxp, (i + 8 - top) % 8); -+ else -+ tag = 3; -+ val |= tag << (2 * i); -+ } -+ supply_register_by_name (regcache, "ftag", &val); -+ -+ val = fp->fiseg & 0xFFFF; -+ supply_register_by_name (regcache, "fiseg", &val); -+ -+ val = fp->foseg & 0xFFFF; -+ supply_register_by_name (regcache, "foseg", &val); -+ -+ val = (fp->fop) & 0x7FF; -+ supply_register_by_name (regcache, "fop", &val); -+} -+ -+/* Default to SSE. */ -+unsigned long long x86_xcr0 = I386_XSTATE_SSE_MASK; ---- ./gdb/gdbserver/i387-fp.h 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/i387-fp.h 2010-04-03 21:12:32.000000000 +0200 -@@ -26,6 +26,11 @@ void i387_fsave_to_cache (struct regcach - void i387_cache_to_fxsave (struct regcache *regcache, void *buf); - void i387_fxsave_to_cache (struct regcache *regcache, const void *buf); - -+void i387_cache_to_xsave (struct regcache *regcache, void *buf); -+void i387_xsave_to_cache (struct regcache *regcache, const void *buf); -+ -+extern unsigned long long x86_xcr0; -+ - extern int num_xmm_registers; - - #endif /* I387_FP_H */ ---- ./gdb/gdbserver/linux-arm-low.c 2010-02-01 17:13:16.000000000 +0100 -+++ ./gdb/gdbserver/linux-arm-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -354,16 +354,16 @@ arm_arch_setup (void) - } - - struct regset_info target_regsets[] = { -- { PTRACE_GETREGS, PTRACE_SETREGS, 18 * 4, -+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, 18 * 4, - GENERAL_REGS, - arm_fill_gregset, arm_store_gregset }, -- { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 16 * 8 + 6 * 4, -+ { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 0, 16 * 8 + 6 * 4, - EXTENDED_REGS, - arm_fill_wmmxregset, arm_store_wmmxregset }, -- { PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 32 * 8 + 4, -+ { PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 0, 32 * 8 + 4, - EXTENDED_REGS, - arm_fill_vfpregset, arm_store_vfpregset }, -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - struct linux_target_ops the_low_target = { ---- ./gdb/gdbserver/linux-crisv32-low.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-crisv32-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -365,9 +365,9 @@ cris_store_gregset (const void *buf) - typedef unsigned long elf_gregset_t[cris_num_regs]; - - struct regset_info target_regsets[] = { -- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), -+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), - GENERAL_REGS, cris_fill_gregset, cris_store_gregset }, -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - struct linux_target_ops the_low_target = { ---- ./gdb/gdbserver/linux-low.c 2010-03-06 01:12:57.000000000 +0100 -+++ ./gdb/gdbserver/linux-low.c 2010-04-03 21:19:14.000000000 +0200 -@@ -39,6 +39,7 @@ - #include - #include - #include -+#include - #ifndef ELFMAG0 - /* Don't include here. If it got included by gdb_proc_service.h - then ELFMAG0 will have been defined. If it didn't get included by -@@ -2281,14 +2282,15 @@ regsets_fetch_inferior_registers (struct - struct regset_info *regset; - int saw_general_regs = 0; - int pid; -+ struct iovec iov; - - regset = target_regsets; - - pid = lwpid_of (get_thread_lwp (current_inferior)); - while (regset->size >= 0) - { -- void *buf; -- int res; -+ void *buf, *data; -+ int nt_type, res; - - if (regset->size == 0 || disabled_regsets[regset - target_regsets]) - { -@@ -2297,10 +2299,21 @@ regsets_fetch_inferior_registers (struct - } - - buf = xmalloc (regset->size); -+ -+ nt_type = regset->nt_type; -+ if (nt_type) -+ { -+ iov.iov_base = buf; -+ iov.iov_len = regset->size; -+ data = (void *) &iov; -+ } -+ else -+ data = buf; -+ - #ifndef __sparc__ -- res = ptrace (regset->get_request, pid, 0, buf); -+ res = ptrace (regset->get_request, pid, nt_type, data); - #else -- res = ptrace (regset->get_request, pid, buf, 0); -+ res = ptrace (regset->get_request, pid, data, nt_type); - #endif - if (res < 0) - { -@@ -2338,14 +2351,15 @@ regsets_store_inferior_registers (struct - struct regset_info *regset; - int saw_general_regs = 0; - int pid; -+ struct iovec iov; - - regset = target_regsets; - - pid = lwpid_of (get_thread_lwp (current_inferior)); - while (regset->size >= 0) - { -- void *buf; -- int res; -+ void *buf, *data; -+ int nt_type, res; - - if (regset->size == 0 || disabled_regsets[regset - target_regsets]) - { -@@ -2358,10 +2372,21 @@ regsets_store_inferior_registers (struct - /* First fill the buffer with the current register set contents, - in case there are any items in the kernel's regset that are - not in gdbserver's regcache. */ -+ -+ nt_type = regset->nt_type; -+ if (nt_type) -+ { -+ iov.iov_base = buf; -+ iov.iov_len = regset->size; -+ data = (void *) &iov; -+ } -+ else -+ data = buf; -+ - #ifndef __sparc__ -- res = ptrace (regset->get_request, pid, 0, buf); -+ res = ptrace (regset->get_request, pid, nt_type, data); - #else -- res = ptrace (regset->get_request, pid, buf, 0); -+ res = ptrace (regset->get_request, pid, &iov, data); - #endif - - if (res == 0) -@@ -2371,9 +2396,9 @@ regsets_store_inferior_registers (struct - - /* Only now do we write the register set. */ - #ifndef __sparc__ -- res = ptrace (regset->set_request, pid, 0, buf); -+ res = ptrace (regset->set_request, pid, nt_type, data); - #else -- res = ptrace (regset->set_request, pid, buf, 0); -+ res = ptrace (regset->set_request, pid, data, nt_type); - #endif - } - -@@ -3434,6 +3459,13 @@ linux_core_of_thread (ptid_t ptid) - return core; - } - -+static void -+linux_process_qsupported (const char *query) -+{ -+ if (the_low_target.process_qsupported != NULL) -+ the_low_target.process_qsupported (query); -+} -+ - static struct target_ops linux_target_ops = { - linux_create_inferior, - linux_attach, -@@ -3477,7 +3509,8 @@ static struct target_ops linux_target_op - #else - NULL, - #endif -- linux_core_of_thread -+ linux_core_of_thread, -+ linux_process_qsupported - }; - - static void ---- ./gdb/gdbserver/linux-low.h 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-low.h 2010-04-03 21:12:32.000000000 +0200 -@@ -35,6 +35,9 @@ enum regset_type { - struct regset_info - { - int get_request, set_request; -+ /* If NT_TYPE isn't 0, it will be passed to ptrace as the 3rd -+ argument and the 4th argument should be "const struct iovec *". */ -+ int nt_type; - int size; - enum regset_type type; - regset_fill_func fill_function; -@@ -111,6 +114,9 @@ struct linux_target_ops - - /* Hook to call prior to resuming a thread. */ - void (*prepare_to_resume) (struct lwp_info *); -+ -+ /* Hook to support target specific qSupported. */ -+ void (*process_qsupported) (const char *); - }; - - extern struct linux_target_ops the_low_target; ---- ./gdb/gdbserver/linux-m68k-low.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-m68k-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -112,14 +112,14 @@ m68k_store_fpregset (struct regcache *re - - struct regset_info target_regsets[] = { - #ifdef HAVE_PTRACE_GETREGS -- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), -+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), - GENERAL_REGS, - m68k_fill_gregset, m68k_store_gregset }, -- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t), -+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t), - FP_REGS, - m68k_fill_fpregset, m68k_store_fpregset }, - #endif /* HAVE_PTRACE_GETREGS */ -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - static const unsigned char m68k_breakpoint[] = { 0x4E, 0x4F }; ---- ./gdb/gdbserver/linux-mips-low.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-mips-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -343,12 +343,12 @@ mips_store_fpregset (struct regcache *re - - struct regset_info target_regsets[] = { - #ifdef HAVE_PTRACE_GETREGS -- { PTRACE_GETREGS, PTRACE_SETREGS, 38 * 8, GENERAL_REGS, -+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, 38 * 8, GENERAL_REGS, - mips_fill_gregset, mips_store_gregset }, -- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 33 * 8, FP_REGS, -+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, 33 * 8, FP_REGS, - mips_fill_fpregset, mips_store_fpregset }, - #endif /* HAVE_PTRACE_GETREGS */ -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - struct linux_target_ops the_low_target = { ---- ./gdb/gdbserver/linux-ppc-low.c 2010-01-21 23:10:18.000000000 +0100 -+++ ./gdb/gdbserver/linux-ppc-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -593,14 +593,14 @@ struct regset_info target_regsets[] = { - fetch them every time, but still fall back to PTRACE_PEEKUSER for the - general registers. Some kernels support these, but not the newer - PPC_PTRACE_GETREGS. */ -- { PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, SIZEOF_VSXREGS, EXTENDED_REGS, -+ { PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, 0, SIZEOF_VSXREGS, EXTENDED_REGS, - ppc_fill_vsxregset, ppc_store_vsxregset }, - { PTRACE_GETVRREGS, PTRACE_SETVRREGS, SIZEOF_VRREGS, EXTENDED_REGS, - ppc_fill_vrregset, ppc_store_vrregset }, -- { PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 32 * 4 + 8 + 4, EXTENDED_REGS, -+ { PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 0, 32 * 4 + 8 + 4, EXTENDED_REGS, - ppc_fill_evrregset, ppc_store_evrregset }, -- { 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL }, -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL }, -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - struct linux_target_ops the_low_target = { ---- ./gdb/gdbserver/linux-s390-low.c 2010-01-21 20:26:49.000000000 +0100 -+++ ./gdb/gdbserver/linux-s390-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -181,8 +181,8 @@ static void s390_fill_gregset (struct re - } - - struct regset_info target_regsets[] = { -- { 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL }, -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL }, -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - ---- ./gdb/gdbserver/linux-sh-low.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-sh-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -104,8 +104,8 @@ static void sh_fill_gregset (struct regc - } - - struct regset_info target_regsets[] = { -- { 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL }, -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL }, -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - struct linux_target_ops the_low_target = { ---- ./gdb/gdbserver/linux-sparc-low.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-sparc-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -260,13 +260,13 @@ sparc_reinsert_addr (void) - - - struct regset_info target_regsets[] = { -- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), -+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), - GENERAL_REGS, - sparc_fill_gregset, sparc_store_gregset }, -- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (fpregset_t), -+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (fpregset_t), - FP_REGS, - sparc_fill_fpregset, sparc_store_fpregset }, -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - struct linux_target_ops the_low_target = { ---- ./gdb/gdbserver/linux-x86-low.c 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/gdbserver/linux-x86-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -24,6 +24,8 @@ - #include "linux-low.h" - #include "i387-fp.h" - #include "i386-low.h" -+#include "i386-xstate.h" -+#include "elf/common.h" - - #include "gdb_proc_service.h" - -@@ -31,10 +33,35 @@ - void init_registers_i386_linux (void); - /* Defined in auto-generated file amd64-linux.c. */ - void init_registers_amd64_linux (void); -+/* Defined in auto-generated file i386-avx-linux.c. */ -+void init_registers_i386_avx_linux (void); -+/* Defined in auto-generated file amd64-avx-linux.c. */ -+void init_registers_amd64_avx_linux (void); -+ -+/* Backward compatibility for gdb without XML support. */ -+ -+static const char *xmltarget_i386_linux_no_xml = "@\ -+i386\ -+GNU/Linux\ -+"; -+static const char *xmltarget_amd64_linux_no_xml = "@\ -+i386:x86-64\ -+GNU/Linux\ -+"; - - #include - #include - #include -+#include -+ -+#ifndef PTRACE_GETREGSET -+#define PTRACE_GETREGSET 0x4204 -+#endif -+ -+#ifndef PTRACE_SETREGSET -+#define PTRACE_SETREGSET 0x4205 -+#endif -+ - - #ifndef PTRACE_GET_THREAD_AREA - #define PTRACE_GET_THREAD_AREA 25 -@@ -252,6 +279,18 @@ x86_store_fpxregset (struct regcache *re - - #endif - -+static void -+x86_fill_xstateregset (struct regcache *regcache, void *buf) -+{ -+ i387_cache_to_xsave (regcache, buf); -+} -+ -+static void -+x86_store_xstateregset (struct regcache *regcache, const void *buf) -+{ -+ i387_xsave_to_cache (regcache, buf); -+} -+ - /* ??? The non-biarch i386 case stores all the i387 regs twice. - Once in i387_.*fsave.* and once in i387_.*fxsave.*. - This is, presumably, to handle the case where PTRACE_[GS]ETFPXREGS -@@ -264,21 +303,23 @@ x86_store_fpxregset (struct regcache *re - struct regset_info target_regsets[] = - { - #ifdef HAVE_PTRACE_GETREGS -- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), -+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), - GENERAL_REGS, - x86_fill_gregset, x86_store_gregset }, -+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_X86_XSTATE, 0, -+ EXTENDED_REGS, x86_fill_xstateregset, x86_store_xstateregset }, - # ifndef __x86_64__ - # ifdef HAVE_PTRACE_GETFPXREGS -- { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, sizeof (elf_fpxregset_t), -+ { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, 0, sizeof (elf_fpxregset_t), - EXTENDED_REGS, - x86_fill_fpxregset, x86_store_fpxregset }, - # endif - # endif -- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, sizeof (elf_fpregset_t), -+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t), - FP_REGS, - x86_fill_fpregset, x86_store_fpregset }, - #endif /* HAVE_PTRACE_GETREGS */ -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - static CORE_ADDR -@@ -772,6 +813,121 @@ x86_siginfo_fixup (struct siginfo *nativ - return 0; - } - -+static int use_xml; -+ -+/* Update gdbserver_xmltarget. */ -+ -+static void -+x86_linux_update_xmltarget (void) -+{ -+ static unsigned long long xcr0; -+ static int have_ptrace_getregset = -1; -+ -+ if (!current_inferior) -+ return; -+ -+#ifdef __x86_64__ -+ if (num_xmm_registers == 8) -+ init_registers_i386_linux (); -+ else -+ init_registers_amd64_linux (); -+#else -+ init_registers_i386_linux (); -+#endif -+ -+ if (!use_xml) -+ { -+ /* Don't use XML. */ -+#ifdef __x86_64__ -+ if (num_xmm_registers == 8) -+ gdbserver_xmltarget = xmltarget_i386_linux_no_xml; -+ else -+ gdbserver_xmltarget = xmltarget_amd64_linux_no_xml; -+#else -+ gdbserver_xmltarget = xmltarget_i386_linux_no_xml; -+#endif -+ -+ x86_xcr0 = I386_XSTATE_SSE_MASK; -+ -+ return; -+ } -+ -+ /* Update gdbserver_xmltarget with XML support. */ -+#ifdef __x86_64__ -+ if (num_xmm_registers == 8) -+ gdbserver_xmltarget = "i386-linux.xml"; -+ else -+ gdbserver_xmltarget = "amd64-linux.xml"; -+#else -+ gdbserver_xmltarget = "i386-linux.xml"; -+#endif -+ -+ /* Check if XSAVE extended state is supported. */ -+ if (have_ptrace_getregset == -1) -+ { -+ int pid = pid_of (get_thread_lwp (current_inferior)); -+ unsigned long long xstateregs[I386_XSTATE_SSE_SIZE / sizeof (long long)]; -+ struct iovec iov; -+ struct regset_info *regset; -+ -+ iov.iov_base = xstateregs; -+ iov.iov_len = sizeof (xstateregs); -+ -+ /* Check if PTRACE_GETREGSET works. */ -+ if (ptrace (PTRACE_GETREGSET, pid, (unsigned int) NT_X86_XSTATE, -+ &iov) < 0) -+ { -+ have_ptrace_getregset = 0; -+ return; -+ } -+ else -+ have_ptrace_getregset = 1; -+ -+ /* Get XCR0 from XSAVE extended state at byte 464. */ -+ xcr0 = xstateregs[464 / sizeof (long long)]; -+ -+ /* Use PTRACE_GETREGSET if it is available. */ -+ for (regset = target_regsets; -+ regset->fill_function != NULL; regset++) -+ if (regset->get_request == PTRACE_GETREGSET) -+ regset->size = I386_XSTATE_SIZE (xcr0); -+ else if (regset->type != GENERAL_REGS) -+ regset->size = 0; -+ } -+ -+ if (have_ptrace_getregset) -+ { -+ /* AVX is the highest feature we support. */ -+ if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) -+ { -+ x86_xcr0 = xcr0; -+ -+#ifdef __x86_64__ -+ /* I386 has 8 xmm regs. */ -+ if (num_xmm_registers == 8) -+ init_registers_i386_avx_linux (); -+ else -+ init_registers_amd64_avx_linux (); -+#else -+ init_registers_i386_avx_linux (); -+#endif -+ } -+ } -+} -+ -+/* Process qSupported query, "xmlRegisters=". Update the buffer size for -+ PTRACE_GETREGSET. */ -+ -+static void -+x86_linux_process_qsupported (const char *query) -+{ -+ /* Return if gdb doesn't support XML. If gdb sends "xmlRegisters=" -+ in qSupported query, it supports x86 XML target descriptions. */ -+ use_xml = query != NULL && strncmp (query, "xmlRegisters=", 13) == 0; -+ -+ x86_linux_update_xmltarget (); -+} -+ - /* Initialize gdbserver for the architecture of the inferior. */ - - static void -@@ -792,8 +948,6 @@ x86_arch_setup (void) - } - else if (use_64bit) - { -- init_registers_amd64_linux (); -- - /* Amd64 doesn't have HAVE_LINUX_USRREGS. */ - the_low_target.num_regs = -1; - the_low_target.regmap = NULL; -@@ -803,14 +957,13 @@ x86_arch_setup (void) - /* Amd64 has 16 xmm regs. */ - num_xmm_registers = 16; - -+ x86_linux_update_xmltarget (); - return; - } - #endif - - /* Ok we have a 32-bit inferior. */ - -- init_registers_i386_linux (); -- - the_low_target.num_regs = I386_NUM_REGS; - the_low_target.regmap = i386_regmap; - the_low_target.cannot_fetch_register = i386_cannot_fetch_register; -@@ -818,6 +971,8 @@ x86_arch_setup (void) - - /* I386 has 8 xmm regs. */ - num_xmm_registers = 8; -+ -+ x86_linux_update_xmltarget (); - } - - /* This is initialized assuming an amd64 target. -@@ -850,5 +1005,6 @@ struct linux_target_ops the_low_target = - x86_siginfo_fixup, - x86_linux_new_process, - x86_linux_new_thread, -- x86_linux_prepare_to_resume -+ x86_linux_prepare_to_resume, -+ x86_linux_process_qsupported - }; ---- ./gdb/gdbserver/linux-xtensa-low.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/linux-xtensa-low.c 2010-04-03 21:12:32.000000000 +0200 -@@ -131,13 +131,13 @@ xtensa_store_xtregset (struct regcache * - } - - struct regset_info target_regsets[] = { -- { PTRACE_GETREGS, PTRACE_SETREGS, sizeof (elf_gregset_t), -+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), - GENERAL_REGS, - xtensa_fill_gregset, xtensa_store_gregset }, -- { PTRACE_GETXTREGS, PTRACE_SETXTREGS, XTENSA_ELF_XTREG_SIZE, -+ { PTRACE_GETXTREGS, PTRACE_SETXTREGS, 0, XTENSA_ELF_XTREG_SIZE, - EXTENDED_REGS, - xtensa_fill_xtregset, xtensa_store_xtregset }, -- { 0, 0, -1, -1, NULL, NULL } -+ { 0, 0, 0, -1, -1, NULL, NULL } - }; - - #if XCHAL_HAVE_BE ---- ./gdb/gdbserver/server.c 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/server.c 2010-04-03 21:12:32.000000000 +0200 -@@ -1236,6 +1236,9 @@ handle_query (char *own_buf, int packet_ - { - char *p = &own_buf[10]; - -+ /* Start processing qSupported packet. */ -+ target_process_qsupported (NULL); -+ - /* Process each feature being provided by GDB. The first - feature will follow a ':', and latter features will follow - ';'. */ -@@ -1251,6 +1254,8 @@ handle_query (char *own_buf, int packet_ - if (target_supports_multi_process ()) - multi_process = 1; - } -+ else -+ target_process_qsupported (p); - } - - sprintf (own_buf, "PacketSize=%x;QPassSignals+", PBUFSIZ - 1); ---- ./gdb/gdbserver/target.h 2010-01-20 23:55:38.000000000 +0100 -+++ ./gdb/gdbserver/target.h 2010-04-03 21:12:32.000000000 +0200 -@@ -286,6 +286,9 @@ struct target_ops - - /* Returns the core given a thread, or -1 if not known. */ - int (*core_of_thread) (ptid_t); -+ -+ /* Target specific qSupported support. */ -+ void (*process_qsupported) (const char *); - }; - - extern struct target_ops *the_target; -@@ -326,6 +329,10 @@ void set_target_ops (struct target_ops * - (the_target->supports_multi_process ? \ - (*the_target->supports_multi_process) () : 0) - -+#define target_process_qsupported(query) \ -+ if (the_target->process_qsupported) \ -+ the_target->process_qsupported (query) -+ - /* Start non-stop mode, returns 0 on success, -1 on failure. */ - - int start_non_stop (int nonstop); ---- ./gdb/i386-linux-nat.c 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/i386-linux-nat.c 2010-04-03 21:12:32.000000000 +0200 -@@ -23,11 +23,14 @@ - #include "inferior.h" - #include "gdbcore.h" - #include "regcache.h" -+#include "regset.h" - #include "target.h" - #include "linux-nat.h" - - #include "gdb_assert.h" - #include "gdb_string.h" -+#include "elf/common.h" -+#include - #include - #include - #include -@@ -69,6 +72,19 @@ - - /* Defines ps_err_e, struct ps_prochandle. */ - #include "gdb_proc_service.h" -+ -+#include "i386-xstate.h" -+ -+#ifndef PTRACE_GETREGSET -+#define PTRACE_GETREGSET 0x4204 -+#endif -+ -+#ifndef PTRACE_SETREGSET -+#define PTRACE_SETREGSET 0x4205 -+#endif -+ -+/* Does the current host support PTRACE_GETREGSET? */ -+static int have_ptrace_getregset = -1; - - - /* The register sets used in GNU/Linux ELF core-dumps are identical to -@@ -98,6 +114,8 @@ static int regmap[] = - -1, -1, -1, -1, /* xmm0, xmm1, xmm2, xmm3 */ - -1, -1, -1, -1, /* xmm4, xmm5, xmm6, xmm6 */ - -1, /* mxcsr */ -+ -1, -1, -1, -1, /* ymm0h, ymm1h, ymm2h, ymm3h */ -+ -1, -1, -1, -1, /* ymm4h, ymm5h, ymm6h, ymm6h */ - ORIG_EAX - }; - -@@ -110,6 +128,9 @@ static int regmap[] = - #define GETFPXREGS_SUPPLIES(regno) \ - (I386_ST0_REGNUM <= (regno) && (regno) < I386_SSE_NUM_REGS) - -+#define GETXSTATEREGS_SUPPLIES(regno) \ -+ (I386_ST0_REGNUM <= (regno) && (regno) < I386_AVX_NUM_REGS) -+ - /* Does the current host support the GETREGS request? */ - int have_ptrace_getregs = - #ifdef HAVE_PTRACE_GETREGS -@@ -355,6 +376,57 @@ static void store_fpregs (const struct r - - /* Transfering floating-point and SSE registers to and from GDB. */ - -+/* Fetch all registers covered by the PTRACE_GETREGSET request from -+ process/thread TID and store their values in GDB's register array. -+ Return non-zero if successful, zero otherwise. */ -+ -+static int -+fetch_xstateregs (struct regcache *regcache, int tid) -+{ -+ char xstateregs[I386_XSTATE_MAX_SIZE]; -+ struct iovec iov; -+ -+ if (!have_ptrace_getregset) -+ return 0; -+ -+ iov.iov_base = xstateregs; -+ iov.iov_len = sizeof(xstateregs); -+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, -+ &iov) < 0) -+ perror_with_name (_("Couldn't read extended state status")); -+ -+ i387_supply_xsave (regcache, -1, xstateregs); -+ return 1; -+} -+ -+/* Store all valid registers in GDB's register array covered by the -+ PTRACE_SETREGSET request into the process/thread specified by TID. -+ Return non-zero if successful, zero otherwise. */ -+ -+static int -+store_xstateregs (const struct regcache *regcache, int tid, int regno) -+{ -+ char xstateregs[I386_XSTATE_MAX_SIZE]; -+ struct iovec iov; -+ -+ if (!have_ptrace_getregset) -+ return 0; -+ -+ iov.iov_base = xstateregs; -+ iov.iov_len = sizeof(xstateregs); -+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, -+ &iov) < 0) -+ perror_with_name (_("Couldn't read extended state status")); -+ -+ i387_collect_xsave (regcache, regno, xstateregs, 0); -+ -+ if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE, -+ (int) &iov) < 0) -+ perror_with_name (_("Couldn't write extended state status")); -+ -+ return 1; -+} -+ - #ifdef HAVE_PTRACE_GETFPXREGS - - /* Fill GDB's register array with the floating-point and SSE register -@@ -489,6 +561,8 @@ i386_linux_fetch_inferior_registers (str - return; - } - -+ if (fetch_xstateregs (regcache, tid)) -+ return; - if (fetch_fpxregs (regcache, tid)) - return; - fetch_fpregs (regcache, tid); -@@ -501,6 +575,12 @@ i386_linux_fetch_inferior_registers (str - return; - } - -+ if (GETXSTATEREGS_SUPPLIES (regno)) -+ { -+ if (fetch_xstateregs (regcache, tid)) -+ return; -+ } -+ - if (GETFPXREGS_SUPPLIES (regno)) - { - if (fetch_fpxregs (regcache, tid)) -@@ -553,6 +633,8 @@ i386_linux_store_inferior_registers (str - if (regno == -1) - { - store_regs (regcache, tid, regno); -+ if (store_xstateregs (regcache, tid, regno)) -+ return; - if (store_fpxregs (regcache, tid, regno)) - return; - store_fpregs (regcache, tid, regno); -@@ -565,6 +647,12 @@ i386_linux_store_inferior_registers (str - return; - } - -+ if (GETXSTATEREGS_SUPPLIES (regno)) -+ { -+ if (store_xstateregs (regcache, tid, regno)) -+ return; -+ } -+ - if (GETFPXREGS_SUPPLIES (regno)) - { - if (store_fpxregs (regcache, tid, regno)) -@@ -873,7 +961,50 @@ i386_linux_child_post_startup_inferior ( - static const struct target_desc * - i386_linux_read_description (struct target_ops *ops) - { -- return tdesc_i386_linux; -+ static uint64_t xcr0; -+ -+ if (have_ptrace_getregset == -1) -+ { -+ int tid; -+ uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))]; -+ struct iovec iov; -+ unsigned int xstate_size; -+ -+ /* GNU/Linux LWP ID's are process ID's. */ -+ tid = TIDGET (inferior_ptid); -+ if (tid == 0) -+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */ -+ -+ iov.iov_base = xstateregs; -+ iov.iov_len = sizeof (xstateregs); -+ -+ /* Check if PTRACE_GETREGSET works. */ -+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, -+ &iov) < 0) -+ { -+ have_ptrace_getregset = 0; -+ xstate_size = 0; -+ } -+ else -+ { -+ have_ptrace_getregset = 1; -+ -+ /* Get XCR0 from XSAVE extended state. */ -+ xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET -+ / sizeof (long long))]; -+ -+ xstate_size = I386_XSTATE_SIZE (xcr0); -+ } -+ -+ i386_linux_update_xstateregset (xstate_size); -+ } -+ -+ /* Check the native XCR0 only if PTRACE_GETREGSET is available. */ -+ if (have_ptrace_getregset -+ && (xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) -+ return tdesc_i386_avx_linux; -+ else -+ return tdesc_i386_linux; - } - - void ---- ./gdb/i386-linux-tdep.c 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/i386-linux-tdep.c 2010-04-03 21:12:32.000000000 +0200 -@@ -23,6 +23,7 @@ - #include "frame.h" - #include "value.h" - #include "regcache.h" -+#include "regset.h" - #include "inferior.h" - #include "osabi.h" - #include "reggroups.h" -@@ -36,9 +37,11 @@ - #include "solib-svr4.h" - #include "symtab.h" - #include "arch-utils.h" --#include "regset.h" - #include "xml-syscall.h" - -+#include "i387-tdep.h" -+#include "i386-xstate.h" -+ - /* The syscall's XML filename for i386. */ - #define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml" - -@@ -47,6 +50,7 @@ - #include - - #include "features/i386/i386-linux.c" -+#include "features/i386/i386-avx-linux.c" - - /* Supported register note sections. */ - static struct core_regset_section i386_linux_regset_sections[] = -@@ -54,6 +58,7 @@ static struct core_regset_section i386_l - { ".reg", 144, "general-purpose" }, - { ".reg2", 108, "floating-point" }, - { ".reg-xfp", 512, "extended floating-point" }, -+ { ".reg-xstate", 0, "XSAVE extended state" }, - { NULL, 0 } - }; - -@@ -533,6 +538,7 @@ static int i386_linux_gregset_reg_offset - -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" */ - }; - -@@ -560,6 +566,59 @@ static int i386_linux_sc_reg_offset[] = - 0 * 4 /* %gs */ - }; - -+/* Update XSAVE extended state register note section. */ -+ -+void -+i386_linux_update_xstateregset (unsigned int xstate_size) -+{ -+ struct core_regset_section *xstate = &i386_linux_regset_sections[3]; -+ -+ /* Update the XSAVE extended state register note section for "gcore". -+ Disable it if its size is 0. */ -+ gdb_assert (strcmp (xstate->sect_name, ".reg-xstate") == 0); -+ if (xstate_size) -+ xstate->size = xstate_size; -+ else -+ xstate->sect_name = NULL; -+} -+ -+/* Get XSAVE extended state xcr0 from core dump. */ -+ -+uint64_t -+i386_linux_core_read_xcr0 (struct gdbarch *gdbarch, -+ struct target_ops *target, bfd *abfd) -+{ -+ asection *xstate = bfd_get_section_by_name (abfd, ".reg-xstate"); -+ uint64_t xcr0; -+ -+ if (xstate) -+ { -+ size_t size = bfd_section_size (abfd, xstate); -+ -+ /* Check extended state size. */ -+ if (size < I386_XSTATE_AVX_SIZE) -+ xcr0 = I386_XSTATE_SSE_MASK; -+ else -+ { -+ char contents[8]; -+ -+ if (! bfd_get_section_contents (abfd, xstate, contents, -+ I386_LINUX_XSAVE_XCR0_OFFSET, -+ 8)) -+ { -+ warning (_("Couldn't read `xcr0' bytes from `.reg-xstate' section in core file.")); -+ return 0; -+ } -+ -+ xcr0 = bfd_get_64 (abfd, contents); -+ } -+ } -+ else -+ xcr0 = I386_XSTATE_SSE_MASK; -+ -+ return xcr0; -+} -+ - /* Get Linux/x86 target description from core dump. */ - - static const struct target_desc * -@@ -568,12 +627,17 @@ i386_linux_core_read_description (struct - bfd *abfd) - { - asection *section = bfd_get_section_by_name (abfd, ".reg2"); -+ uint64_t xcr0; - - if (section == NULL) - return NULL; - - /* Linux/i386. */ -- return tdesc_i386_linux; -+ xcr0 = i386_linux_core_read_xcr0 (gdbarch, target, abfd); -+ if ((xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) -+ return tdesc_i386_avx_linux; -+ else -+ return tdesc_i386_linux; - } - - static void -@@ -623,6 +687,8 @@ i386_linux_init_abi (struct gdbarch_info - tdep->sc_reg_offset = i386_linux_sc_reg_offset; - tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset); - -+ tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; -+ - set_gdbarch_process_record (gdbarch, i386_process_record); - set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal); - -@@ -843,4 +909,5 @@ _initialize_i386_linux_tdep (void) - - /* Initialize the Linux target description */ - initialize_tdesc_i386_linux (); -+ initialize_tdesc_i386_avx_linux (); - } ---- ./gdb/i386-linux-tdep.h 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/i386-linux-tdep.h 2010-04-03 21:12:32.000000000 +0200 -@@ -30,12 +30,41 @@ - /* Register number for the "orig_eax" pseudo-register. If this - pseudo-register contains a value >= 0 it is interpreted as the - system call number that the kernel is supposed to restart. */ --#define I386_LINUX_ORIG_EAX_REGNUM I386_SSE_NUM_REGS -+#define I386_LINUX_ORIG_EAX_REGNUM I386_AVX_NUM_REGS - - /* Total number of registers for GNU/Linux. */ - #define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1) - -+/* Get XSAVE extended state xcr0 from core dump. */ -+extern uint64_t i386_linux_core_read_xcr0 -+ (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd); -+ - /* Linux target description. */ - extern struct target_desc *tdesc_i386_linux; -+extern struct target_desc *tdesc_i386_avx_linux; -+ -+/* Update XSAVE extended state register note section. */ -+extern void i386_linux_update_xstateregset (unsigned int xstate_size); -+ -+/* Format of XSAVE extended state is: -+ struct -+ { -+ fxsave_bytes[0..463] -+ sw_usable_bytes[464..511] -+ xstate_hdr_bytes[512..575] -+ avx_bytes[576..831] -+ future_state etc -+ }; -+ -+ Same memory layout will be used for the coredump NT_X86_XSTATE -+ representing the XSAVE extended state registers. -+ -+ The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled -+ extended state mask, which is the same as the extended control register -+ 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask -+ together with the mask saved in the xstate_hdr_bytes to determine what -+ states the processor/OS supports and what state, used or initialized, -+ the process/thread is in. */ -+#define I386_LINUX_XSAVE_XCR0_OFFSET 464 - - #endif /* i386-linux-tdep.h */ ---- ./gdb/i386-tdep.c 2010-04-03 21:09:29.000000000 +0200 -+++ ./gdb/i386-tdep.c 2010-04-03 21:12:32.000000000 +0200 -@@ -51,11 +51,13 @@ - - #include "i386-tdep.h" - #include "i387-tdep.h" -+#include "i386-xstate.h" - - #include "record.h" - #include - - #include "features/i386/i386.c" -+#include "features/i386/i386-avx.c" - - /* Register names. */ - -@@ -74,6 +76,18 @@ static const char *i386_register_names[] - "mxcsr" - }; - -+static const char *i386_ymm_names[] = -+{ -+ "ymm0", "ymm1", "ymm2", "ymm3", -+ "ymm4", "ymm5", "ymm6", "ymm7", -+}; -+ -+static const char *i386_ymmh_names[] = -+{ -+ "ymm0h", "ymm1h", "ymm2h", "ymm3h", -+ "ymm4h", "ymm5h", "ymm6h", "ymm7h", -+}; -+ - /* Register names for MMX pseudo-registers. */ - - static const char *i386_mmx_names[] = -@@ -150,18 +164,47 @@ i386_dword_regnum_p (struct gdbarch *gdb - return regnum >= 0 && regnum < tdep->num_dword_regs; - } - -+int -+i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int ymm0h_regnum = tdep->ymm0h_regnum; -+ -+ if (ymm0h_regnum < 0) -+ return 0; -+ -+ regnum -= ymm0h_regnum; -+ return regnum >= 0 && regnum < tdep->num_ymm_regs; -+} -+ -+/* AVX register? */ -+ -+int -+i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int ymm0_regnum = tdep->ymm0_regnum; -+ -+ if (ymm0_regnum < 0) -+ return 0; -+ -+ regnum -= ymm0_regnum; -+ return regnum >= 0 && regnum < tdep->num_ymm_regs; -+} -+ - /* SSE register? */ - --static int --i386_sse_regnum_p (struct gdbarch *gdbarch, int regnum) -+int -+i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int num_xmm_regs = I387_NUM_XMM_REGS (tdep); - -- if (I387_NUM_XMM_REGS (tdep) == 0) -+ if (num_xmm_regs == 0) - return 0; - -- return (I387_XMM0_REGNUM (tdep) <= regnum -- && regnum < I387_MXCSR_REGNUM (tdep)); -+ regnum -= I387_XMM0_REGNUM (tdep); -+ return regnum >= 0 && regnum < num_xmm_regs; - } - - static int -@@ -201,6 +244,19 @@ i386_fpc_regnum_p (struct gdbarch *gdbar - && regnum < I387_XMM0_REGNUM (tdep)); - } - -+/* Return the name of register REGNUM, or the empty string if it is -+ an anonymous register. */ -+ -+static const char * -+i386_register_name (struct gdbarch *gdbarch, int regnum) -+{ -+ /* Hide the upper YMM registers. */ -+ if (i386_ymmh_regnum_p (gdbarch, regnum)) -+ return ""; -+ -+ return tdesc_register_name (gdbarch, regnum); -+} -+ - /* Return the name of register REGNUM. */ - - const char * -@@ -209,6 +265,8 @@ i386_pseudo_register_name (struct gdbarc - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - if (i386_mmx_regnum_p (gdbarch, regnum)) - return i386_mmx_names[regnum - I387_MM0_REGNUM (tdep)]; -+ else if (i386_ymm_regnum_p (gdbarch, regnum)) -+ return i386_ymm_names[regnum - tdep->ymm0_regnum]; - else if (i386_byte_regnum_p (gdbarch, regnum)) - return i386_byte_names[regnum - tdep->al_regnum]; - else if (i386_word_regnum_p (gdbarch, regnum)) -@@ -246,7 +304,13 @@ i386_dbx_reg_to_regnum (struct gdbarch * - else if (reg >= 21 && reg <= 28) - { - /* SSE registers. */ -- return reg - 21 + I387_XMM0_REGNUM (tdep); -+ int ymm0_regnum = tdep->ymm0_regnum; -+ -+ if (ymm0_regnum >= 0 -+ && i386_xmm_regnum_p (gdbarch, reg)) -+ return reg - 21 + ymm0_regnum; -+ else -+ return reg - 21 + I387_XMM0_REGNUM (tdep); - } - else if (reg >= 29 && reg <= 36) - { -@@ -2184,6 +2248,59 @@ i387_ext_type (struct gdbarch *gdbarch) - return tdep->i387_ext_type; - } - -+/* Construct vector type for pseudo YMM registers. We can't use -+ tdesc_find_type since YMM isn't described in target description. */ -+ -+static struct type * -+i386_ymm_type (struct gdbarch *gdbarch) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ if (!tdep->i386_ymm_type) -+ { -+ const struct builtin_type *bt = builtin_type (gdbarch); -+ -+ /* The type we're building is this: */ -+#if 0 -+ union __gdb_builtin_type_vec256i -+ { -+ int128_t uint128[2]; -+ int64_t v2_int64[4]; -+ int32_t v4_int32[8]; -+ int16_t v8_int16[16]; -+ int8_t v16_int8[32]; -+ double v2_double[4]; -+ float v4_float[8]; -+ }; -+#endif -+ -+ struct type *t; -+ -+ t = arch_composite_type (gdbarch, -+ "__gdb_builtin_type_vec256i", TYPE_CODE_UNION); -+ append_composite_type_field (t, "v8_float", -+ init_vector_type (bt->builtin_float, 8)); -+ append_composite_type_field (t, "v4_double", -+ init_vector_type (bt->builtin_double, 4)); -+ append_composite_type_field (t, "v32_int8", -+ init_vector_type (bt->builtin_int8, 32)); -+ append_composite_type_field (t, "v16_int16", -+ init_vector_type (bt->builtin_int16, 16)); -+ append_composite_type_field (t, "v8_int32", -+ init_vector_type (bt->builtin_int32, 8)); -+ append_composite_type_field (t, "v4_int64", -+ init_vector_type (bt->builtin_int64, 4)); -+ append_composite_type_field (t, "v2_int128", -+ init_vector_type (bt->builtin_int128, 2)); -+ -+ TYPE_VECTOR (t) = 1; -+ TYPE_NAME (t) = "builtin_type_vec128i"; -+ tdep->i386_ymm_type = t; -+ } -+ -+ return tdep->i386_ymm_type; -+} -+ - /* Construct vector type for MMX registers. */ - static struct type * - i386_mmx_type (struct gdbarch *gdbarch) -@@ -2234,6 +2351,8 @@ i386_pseudo_register_type (struct gdbarc - { - if (i386_mmx_regnum_p (gdbarch, regnum)) - return i386_mmx_type (gdbarch); -+ else if (i386_ymm_regnum_p (gdbarch, regnum)) -+ return i386_ymm_type (gdbarch); - else - { - const struct builtin_type *bt = builtin_type (gdbarch); -@@ -2285,7 +2404,22 @@ i386_pseudo_register_read (struct gdbarc - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - -- if (i386_word_regnum_p (gdbarch, regnum)) -+ if (i386_ymm_regnum_p (gdbarch, regnum)) -+ { -+ regnum -= tdep->ymm0_regnum; -+ -+ /* Extract (always little endian). Read lower 128bits. */ -+ regcache_raw_read (regcache, -+ I387_XMM0_REGNUM (tdep) + regnum, -+ raw_buf); -+ memcpy (buf, raw_buf, 16); -+ /* Read upper 128bits. */ -+ regcache_raw_read (regcache, -+ tdep->ymm0h_regnum + regnum, -+ raw_buf); -+ memcpy (buf + 16, raw_buf, 16); -+ } -+ else if (i386_word_regnum_p (gdbarch, regnum)) - { - int gpnum = regnum - tdep->ax_regnum; - -@@ -2334,7 +2468,20 @@ i386_pseudo_register_write (struct gdbar - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - -- if (i386_word_regnum_p (gdbarch, regnum)) -+ if (i386_ymm_regnum_p (gdbarch, regnum)) -+ { -+ regnum -= tdep->ymm0_regnum; -+ -+ /* ... Write lower 128bits. */ -+ regcache_raw_write (regcache, -+ I387_XMM0_REGNUM (tdep) + regnum, -+ buf); -+ /* ... Write upper 128bits. */ -+ regcache_raw_write (regcache, -+ tdep->ymm0h_regnum + regnum, -+ buf + 16); -+ } -+ else if (i386_word_regnum_p (gdbarch, regnum)) - { - int gpnum = regnum - tdep->ax_regnum; - -@@ -2581,6 +2728,28 @@ i386_collect_fpregset (const struct regs - i387_collect_fsave (regcache, regnum, fpregs); - } - -+/* Similar to i386_supply_fpregset, but use XSAVE extended state. */ -+ -+static void -+i386_supply_xstateregset (const struct regset *regset, -+ struct regcache *regcache, int regnum, -+ const void *xstateregs, size_t len) -+{ -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); -+ i387_supply_xsave (regcache, regnum, xstateregs); -+} -+ -+/* Similar to i386_collect_fpregset , but use XSAVE extended state. */ -+ -+static void -+i386_collect_xstateregset (const struct regset *regset, -+ const struct regcache *regcache, -+ int regnum, void *xstateregs, size_t len) -+{ -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); -+ i387_collect_xsave (regcache, regnum, xstateregs, 1); -+} -+ - /* Return the appropriate register set for the core section identified - by SECT_NAME and SECT_SIZE. */ - -@@ -2608,6 +2777,16 @@ i386_regset_from_core_section (struct gd - return tdep->fpregset; - } - -+ if (strcmp (sect_name, ".reg-xstate") == 0) -+ { -+ if (tdep->xstateregset == NULL) -+ tdep->xstateregset = regset_alloc (gdbarch, -+ i386_supply_xstateregset, -+ i386_collect_xstateregset); -+ -+ return tdep->xstateregset; -+ } -+ - return NULL; - } - -@@ -2801,46 +2980,60 @@ int - i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - struct reggroup *group) - { -- int sse_regnum_p, fp_regnum_p, mmx_regnum_p, byte_regnum_p, -- word_regnum_p, dword_regnum_p; -+ const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p, -+ ymm_regnum_p, ymmh_regnum_p; - - /* Don't include pseudo registers, except for MMX, in any register - groups. */ -- byte_regnum_p = i386_byte_regnum_p (gdbarch, regnum); -- if (byte_regnum_p) -+ if (i386_byte_regnum_p (gdbarch, regnum)) - return 0; - -- word_regnum_p = i386_word_regnum_p (gdbarch, regnum); -- if (word_regnum_p) -+ if (i386_word_regnum_p (gdbarch, regnum)) - return 0; - -- dword_regnum_p = i386_dword_regnum_p (gdbarch, regnum); -- if (dword_regnum_p) -+ if (i386_dword_regnum_p (gdbarch, regnum)) - return 0; - - mmx_regnum_p = i386_mmx_regnum_p (gdbarch, regnum); - if (group == i386_mmx_reggroup) - return mmx_regnum_p; - -- sse_regnum_p = (i386_sse_regnum_p (gdbarch, regnum) -- || i386_mxcsr_regnum_p (gdbarch, regnum)); -+ xmm_regnum_p = i386_xmm_regnum_p (gdbarch, regnum); -+ mxcsr_regnum_p = i386_mxcsr_regnum_p (gdbarch, regnum); - if (group == i386_sse_reggroup) -- return sse_regnum_p; -+ return xmm_regnum_p || mxcsr_regnum_p; -+ -+ ymm_regnum_p = i386_ymm_regnum_p (gdbarch, regnum); - if (group == vector_reggroup) -- return mmx_regnum_p || sse_regnum_p; -+ return (mmx_regnum_p -+ || ymm_regnum_p -+ || mxcsr_regnum_p -+ || (xmm_regnum_p -+ && ((tdep->xcr0 & I386_XSTATE_AVX_MASK) -+ == I386_XSTATE_SSE_MASK))); - - fp_regnum_p = (i386_fp_regnum_p (gdbarch, regnum) - || i386_fpc_regnum_p (gdbarch, regnum)); - if (group == float_reggroup) - return fp_regnum_p; - -+ /* For "info reg all", don't include upper YMM registers nor XMM -+ registers when AVX is supported. */ -+ ymmh_regnum_p = i386_ymmh_regnum_p (gdbarch, regnum); -+ if (group == all_reggroup -+ && ((xmm_regnum_p -+ && (tdep->xcr0 & I386_XSTATE_AVX)) -+ || ymmh_regnum_p)) -+ return 0; -+ - if (group == general_reggroup) - return (!fp_regnum_p - && !mmx_regnum_p -- && !sse_regnum_p -- && !byte_regnum_p -- && !word_regnum_p -- && !dword_regnum_p); -+ && !mxcsr_regnum_p -+ && !xmm_regnum_p -+ && !ymm_regnum_p -+ && !ymmh_regnum_p); - - return default_register_reggroup_p (gdbarch, regnum, group); - } -@@ -5650,7 +5843,8 @@ i386_validate_tdesc_p (struct gdbarch_td - struct tdesc_arch_data *tdesc_data) - { - const struct target_desc *tdesc = tdep->tdesc; -- const struct tdesc_feature *feature_core, *feature_vector; -+ const struct tdesc_feature *feature_core; -+ const struct tdesc_feature *feature_sse, *feature_avx; - int i, num_regs, valid_p; - - if (! tdesc_has_registers (tdesc)) -@@ -5660,13 +5854,37 @@ i386_validate_tdesc_p (struct gdbarch_td - feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.core"); - - /* Get SSE registers. */ -- feature_vector = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"); -+ feature_sse = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"); - -- if (feature_core == NULL || feature_vector == NULL) -+ if (feature_core == NULL || feature_sse == NULL) - return 0; - -+ /* Try AVX registers. */ -+ feature_avx = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"); -+ - valid_p = 1; - -+ /* The XCR0 bits. */ -+ if (feature_avx) -+ { -+ tdep->xcr0 = I386_XSTATE_AVX_MASK; -+ -+ /* It may have been set by OSABI initialization function. */ -+ if (tdep->num_ymm_regs == 0) -+ { -+ tdep->ymmh_register_names = i386_ymmh_names; -+ tdep->num_ymm_regs = 8; -+ tdep->ymm0h_regnum = I386_YMM0H_REGNUM; -+ } -+ -+ for (i = 0; i < tdep->num_ymm_regs; i++) -+ valid_p &= tdesc_numbered_register (feature_avx, tdesc_data, -+ tdep->ymm0h_regnum + i, -+ tdep->ymmh_register_names[i]); -+ } -+ else -+ tdep->xcr0 = I386_XSTATE_SSE_MASK; -+ - num_regs = tdep->num_core_regs; - for (i = 0; i < num_regs; i++) - valid_p &= tdesc_numbered_register (feature_core, tdesc_data, i, -@@ -5675,7 +5893,7 @@ i386_validate_tdesc_p (struct gdbarch_td - /* Need to include %mxcsr, so add one. */ - num_regs += tdep->num_xmm_regs + 1; - for (; i < num_regs; i++) -- valid_p &= tdesc_numbered_register (feature_vector, tdesc_data, i, -+ valid_p &= tdesc_numbered_register (feature_sse, tdesc_data, i, - tdep->register_names[i]); - - return valid_p; -@@ -5690,6 +5908,7 @@ i386_gdbarch_init (struct gdbarch_info i - struct tdesc_arch_data *tdesc_data; - const struct target_desc *tdesc; - int mm0_regnum; -+ int ymm0_regnum; - - /* If there is already a candidate, use it. */ - arches = gdbarch_list_lookup_by_info (arches, &info); -@@ -5710,6 +5929,8 @@ i386_gdbarch_init (struct gdbarch_info i - tdep->fpregset = NULL; - tdep->sizeof_fpregset = I387_SIZEOF_FSAVE; - -+ tdep->xstateregset = NULL; -+ - /* The default settings include the FPU registers, the MMX registers - and the SSE registers. This can be overridden for a specific ABI - by adjusting the members `st0_regnum', `mm0_regnum' and -@@ -5742,6 +5963,8 @@ i386_gdbarch_init (struct gdbarch_info i - /* Unwinding stops on i386 automatically. */ - tdep->outermost_frame_p = NULL; - -+ tdep->xsave_xcr0_offset = -1; -+ - tdep->record_regmap = i386_record_regmap; - - /* The format used for `long double' on almost all i386 targets is -@@ -5858,9 +6081,14 @@ i386_gdbarch_init (struct gdbarch_info i - set_tdesc_pseudo_register_type (gdbarch, i386_pseudo_register_type); - set_tdesc_pseudo_register_name (gdbarch, i386_pseudo_register_name); - -- /* The default ABI includes general-purpose registers, -- floating-point registers, and the SSE registers. */ -- set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); -+ /* Override the normal target description method to make the AVX -+ upper halves anonymous. */ -+ set_gdbarch_register_name (gdbarch, i386_register_name); -+ -+ /* Even though the default ABI only includes general-purpose registers, -+ floating-point registers and the SSE registers, we have to leave a -+ gap for the upper AVX registers. */ -+ set_gdbarch_num_regs (gdbarch, I386_AVX_NUM_REGS); - - /* Get the x86 target description from INFO. */ - tdesc = info.target_desc; -@@ -5871,10 +6099,15 @@ i386_gdbarch_init (struct gdbarch_info i - tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS; - tdep->register_names = i386_register_names; - -+ /* No upper YMM registers. */ -+ tdep->ymmh_register_names = NULL; -+ tdep->ymm0h_regnum = -1; -+ - tdep->num_byte_regs = 8; - tdep->num_word_regs = 8; - tdep->num_dword_regs = 0; - tdep->num_mmx_regs = 8; -+ tdep->num_ymm_regs = 0; - - tdesc_data = tdesc_data_alloc (); - -@@ -5882,24 +6115,25 @@ i386_gdbarch_init (struct gdbarch_info i - info.tdep_info = (void *) tdesc_data; - gdbarch_init_osabi (info, gdbarch); - -+ if (!i386_validate_tdesc_p (tdep, tdesc_data)) -+ { -+ tdesc_data_cleanup (tdesc_data); -+ xfree (tdep); -+ gdbarch_free (gdbarch); -+ return NULL; -+ } -+ - /* Wire in pseudo registers. Number of pseudo registers may be - changed. */ - set_gdbarch_num_pseudo_regs (gdbarch, (tdep->num_byte_regs - + tdep->num_word_regs - + tdep->num_dword_regs -- + tdep->num_mmx_regs)); -+ + tdep->num_mmx_regs -+ + tdep->num_ymm_regs)); - - /* Target description may be changed. */ - tdesc = tdep->tdesc; - -- if (!i386_validate_tdesc_p (tdep, tdesc_data)) -- { -- tdesc_data_cleanup (tdesc_data); -- xfree (tdep); -- gdbarch_free (gdbarch); -- return NULL; -- } -- - tdesc_use_registers (gdbarch, tdesc, tdesc_data); - - /* Override gdbarch_register_reggroup_p set in tdesc_use_registers. */ -@@ -5909,16 +6143,26 @@ i386_gdbarch_init (struct gdbarch_info i - tdep->al_regnum = gdbarch_num_regs (gdbarch); - tdep->ax_regnum = tdep->al_regnum + tdep->num_byte_regs; - -- mm0_regnum = tdep->ax_regnum + tdep->num_word_regs; -+ ymm0_regnum = tdep->ax_regnum + tdep->num_word_regs; - if (tdep->num_dword_regs) - { - /* Support dword pseudo-registesr if it hasn't been disabled, */ -- tdep->eax_regnum = mm0_regnum; -- mm0_regnum = tdep->eax_regnum + tdep->num_dword_regs; -+ tdep->eax_regnum = ymm0_regnum; -+ ymm0_regnum += tdep->num_dword_regs; - } - else - tdep->eax_regnum = -1; - -+ mm0_regnum = ymm0_regnum; -+ if (tdep->num_ymm_regs) -+ { -+ /* Support YMM pseudo-registesr if it is available, */ -+ tdep->ymm0_regnum = ymm0_regnum; -+ mm0_regnum += tdep->num_ymm_regs; -+ } -+ else -+ tdep->ymm0_regnum = -1; -+ - if (tdep->num_mmx_regs != 0) - { - /* Support MMX pseudo-registesr if MMX hasn't been disabled, */ -@@ -6001,6 +6245,7 @@ is \"default\"."), - - /* Initialize the standard target descriptions. */ - initialize_tdesc_i386 (); -+ initialize_tdesc_i386_avx (); - - /* Tell remote stub that we support XML target description. */ - register_remote_support_xml ("i386"); ---- ./gdb/i386-tdep.h 2010-04-03 21:06:52.000000000 +0200 -+++ ./gdb/i386-tdep.h 2010-04-03 21:12:32.000000000 +0200 -@@ -109,6 +109,9 @@ struct gdbarch_tdep - struct regset *fpregset; - size_t sizeof_fpregset; - -+ /* XSAVE extended state. */ -+ struct regset *xstateregset; -+ - /* Register number for %st(0). The register numbers for the other - registers follow from this one. Set this to -1 to indicate the - absence of an FPU. */ -@@ -121,6 +124,13 @@ struct gdbarch_tdep - of MMX support. */ - int mm0_regnum; - -+ /* Number of pseudo YMM registers. */ -+ int num_ymm_regs; -+ -+ /* Register number for %ymm0. Set this to -1 to indicate the absence -+ of pseudo YMM register support. */ -+ int ymm0_regnum; -+ - /* Number of byte registers. */ - int num_byte_regs; - -@@ -146,9 +156,24 @@ struct gdbarch_tdep - /* Number of SSE registers. */ - int num_xmm_regs; - -+ /* Bits of the extended control register 0 (the XFEATURE_ENABLED_MASK -+ register), excluding the x87 bit, which are supported by this GDB. -+ */ -+ uint64_t xcr0; -+ -+ /* Offset of XCR0 in XSAVE extended state. */ -+ int xsave_xcr0_offset; -+ - /* Register names. */ - const char **register_names; - -+ /* Register number for %ymm0h. Set this to -1 to indicate the absence -+ of upper YMM register support. */ -+ int ymm0h_regnum; -+ -+ /* Upper YMM register names. Only used for tdesc_numbered_register. */ -+ const char **ymmh_register_names; -+ - /* Target description. */ - const struct target_desc *tdesc; - -@@ -182,6 +207,7 @@ struct gdbarch_tdep - - /* ISA-specific data types. */ - struct type *i386_mmx_type; -+ struct type *i386_ymm_type; - struct type *i387_ext_type; - - /* Process record/replay target. */ -@@ -231,7 +257,9 @@ enum i386_regnum - I386_FS_REGNUM, /* %fs */ - I386_GS_REGNUM, /* %gs */ - I386_ST0_REGNUM, /* %st(0) */ -- I386_MXCSR_REGNUM = 40 /* %mxcsr */ -+ I386_MXCSR_REGNUM = 40, /* %mxcsr */ -+ I386_YMM0H_REGNUM, /* %ymm0h */ -+ I386_YMM7H_REGNUM = I386_YMM0H_REGNUM + 7 - }; - - /* Register numbers of RECORD_REGMAP. */ -@@ -268,6 +296,7 @@ enum record_i386_regnum - #define I386_NUM_XREGS 9 - - #define I386_SSE_NUM_REGS (I386_MXCSR_REGNUM + 1) -+#define I386_AVX_NUM_REGS (I386_YMM7H_REGNUM + 1) - - /* Size of the largest register. */ - #define I386_MAX_REGISTER_SIZE 16 -@@ -279,6 +308,9 @@ extern struct type *i387_ext_type (struc - extern int i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum); - extern int i386_word_regnum_p (struct gdbarch *gdbarch, int regnum); - extern int i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum); -+extern int i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum); -+extern int i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum); -+extern int i386_ymmh_regnum_p (struct gdbarch *gdbarch, int regnum); - - extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch, - int regnum); ---- ./gdb/i387-tdep.c 2010-01-01 08:31:36.000000000 +0100 -+++ ./gdb/i387-tdep.c 2010-04-03 21:12:32.000000000 +0200 -@@ -34,6 +34,7 @@ - - #include "i386-tdep.h" - #include "i387-tdep.h" -+#include "i386-xstate.h" - - /* Print the floating point number specified by RAW. */ - -@@ -677,6 +678,518 @@ i387_collect_fxsave (const struct regcac - FXSAVE_MXCSR_ADDR (regs)); - } - -+/* `xstate_bv' is at byte offset 512. */ -+#define XSAVE_XSTATE_BV_ADDR(xsave) (xsave + 512) -+ -+/* At xsave_avxh_offset[REGNUM] you'll find the offset to the location in -+ the upper 128bit of AVX register data structure used by the "xsave" -+ instruction where GDB register REGNUM is stored. */ -+ -+static int xsave_avxh_offset[] = -+{ -+ 576 + 0 * 16, /* Upper 128bit of %ymm0 through ... */ -+ 576 + 1 * 16, -+ 576 + 2 * 16, -+ 576 + 3 * 16, -+ 576 + 4 * 16, -+ 576 + 5 * 16, -+ 576 + 6 * 16, -+ 576 + 7 * 16, -+ 576 + 8 * 16, -+ 576 + 9 * 16, -+ 576 + 10 * 16, -+ 576 + 11 * 16, -+ 576 + 12 * 16, -+ 576 + 13 * 16, -+ 576 + 14 * 16, -+ 576 + 15 * 16 /* Upper 128bit of ... %ymm15 (128 bits each). */ -+}; -+ -+#define XSAVE_AVXH_ADDR(tdep, xsave, regnum) \ -+ (xsave + xsave_avxh_offset[regnum - I387_YMM0H_REGNUM (tdep)]) -+ -+/* Similar to i387_supply_fxsave, but use XSAVE extended state. */ -+ -+void -+i387_supply_xsave (struct regcache *regcache, int regnum, -+ const void *xsave) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); -+ const gdb_byte *regs = xsave; -+ int i; -+ unsigned int clear_bv; -+ const gdb_byte *p; -+ enum -+ { -+ none = 0x0, -+ x87 = 0x1, -+ sse = 0x2, -+ avxh = 0x4, -+ all = x87 | sse | avxh -+ } regclass; -+ -+ gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); -+ gdb_assert (tdep->num_xmm_regs > 0); -+ -+ if (regnum == -1) -+ regclass = all; -+ else if (regnum >= I387_YMM0H_REGNUM (tdep) -+ && regnum < I387_YMMENDH_REGNUM (tdep)) -+ regclass = avxh; -+ else if (regnum >= I387_XMM0_REGNUM(tdep) -+ && regnum < I387_MXCSR_REGNUM (tdep)) -+ regclass = sse; -+ else if (regnum >= I387_ST0_REGNUM (tdep) -+ && regnum < I387_FCTRL_REGNUM (tdep)) -+ regclass = x87; -+ else -+ regclass = none; -+ -+ if (regs != NULL && regclass != none) -+ { -+ /* Get `xstat_bv'. */ -+ const gdb_byte *xstate_bv_p = XSAVE_XSTATE_BV_ADDR (regs); -+ -+ /* The supported bits in `xstat_bv' are 1 byte. Clear part in -+ vector registers if its bit in xstat_bv is zero. */ -+ clear_bv = (~(*xstate_bv_p)) & tdep->xcr0; -+ } -+ else -+ clear_bv = I386_XSTATE_AVX_MASK; -+ -+ switch (regclass) -+ { -+ case none: -+ break; -+ -+ case avxh: -+ if ((clear_bv & I386_XSTATE_AVX)) -+ p = NULL; -+ else -+ p = XSAVE_AVXH_ADDR (tdep, regs, regnum); -+ regcache_raw_supply (regcache, regnum, p); -+ return; -+ -+ case sse: -+ if ((clear_bv & I386_XSTATE_SSE)) -+ p = NULL; -+ else -+ p = FXSAVE_ADDR (tdep, regs, regnum); -+ regcache_raw_supply (regcache, regnum, p); -+ return; -+ -+ case x87: -+ if ((clear_bv & I386_XSTATE_X87)) -+ p = NULL; -+ else -+ p = FXSAVE_ADDR (tdep, regs, regnum); -+ regcache_raw_supply (regcache, regnum, p); -+ return; -+ -+ case all: -+ /* Hanle the upper YMM registers. */ -+ if ((tdep->xcr0 & I386_XSTATE_AVX)) -+ { -+ if ((clear_bv & I386_XSTATE_AVX)) -+ p = NULL; -+ else -+ p = regs; -+ -+ for (i = I387_YMM0H_REGNUM (tdep); -+ i < I387_YMMENDH_REGNUM (tdep); i++) -+ { -+ if (p != NULL) -+ p = XSAVE_AVXH_ADDR (tdep, regs, i); -+ regcache_raw_supply (regcache, i, p); -+ } -+ } -+ -+ /* Handle the XMM registers. */ -+ if ((tdep->xcr0 & I386_XSTATE_SSE)) -+ { -+ if ((clear_bv & I386_XSTATE_SSE)) -+ p = NULL; -+ else -+ p = regs; -+ -+ for (i = I387_XMM0_REGNUM (tdep); -+ i < I387_MXCSR_REGNUM (tdep); i++) -+ { -+ if (p != NULL) -+ p = FXSAVE_ADDR (tdep, regs, i); -+ regcache_raw_supply (regcache, i, p); -+ } -+ } -+ -+ /* Handle the x87 registers. */ -+ if ((tdep->xcr0 & I386_XSTATE_X87)) -+ { -+ if ((clear_bv & I386_XSTATE_X87)) -+ p = NULL; -+ else -+ p = regs; -+ -+ for (i = I387_ST0_REGNUM (tdep); -+ i < I387_FCTRL_REGNUM (tdep); i++) -+ { -+ if (p != NULL) -+ p = FXSAVE_ADDR (tdep, regs, i); -+ regcache_raw_supply (regcache, i, p); -+ } -+ } -+ break; -+ } -+ -+ /* Only handle x87 control registers. */ -+ for (i = I387_FCTRL_REGNUM (tdep); i < I387_XMM0_REGNUM (tdep); i++) -+ if (regnum == -1 || regnum == i) -+ { -+ if (regs == NULL) -+ { -+ regcache_raw_supply (regcache, i, NULL); -+ continue; -+ } -+ -+ /* Most of the FPU control registers occupy only 16 bits in -+ the xsave extended state. Give those a special treatment. */ -+ if (i != I387_FIOFF_REGNUM (tdep) -+ && i != I387_FOOFF_REGNUM (tdep)) -+ { -+ gdb_byte val[4]; -+ -+ memcpy (val, FXSAVE_ADDR (tdep, regs, i), 2); -+ val[2] = val[3] = 0; -+ if (i == I387_FOP_REGNUM (tdep)) -+ val[1] &= ((1 << 3) - 1); -+ else if (i== I387_FTAG_REGNUM (tdep)) -+ { -+ /* The fxsave area contains a simplified version of -+ the tag word. We have to look at the actual 80-bit -+ FP data to recreate the traditional i387 tag word. */ -+ -+ unsigned long ftag = 0; -+ int fpreg; -+ int top; -+ -+ top = ((FXSAVE_ADDR (tdep, regs, -+ I387_FSTAT_REGNUM (tdep)))[1] >> 3); -+ top &= 0x7; -+ -+ for (fpreg = 7; fpreg >= 0; fpreg--) -+ { -+ int tag; -+ -+ if (val[0] & (1 << fpreg)) -+ { -+ int regnum = (fpreg + 8 - top) % 8 -+ + I387_ST0_REGNUM (tdep); -+ tag = i387_tag (FXSAVE_ADDR (tdep, regs, regnum)); -+ } -+ else -+ tag = 3; /* Empty */ -+ -+ ftag |= tag << (2 * fpreg); -+ } -+ val[0] = ftag & 0xff; -+ val[1] = (ftag >> 8) & 0xff; -+ } -+ regcache_raw_supply (regcache, i, val); -+ } -+ else -+ regcache_raw_supply (regcache, i, FXSAVE_ADDR (tdep, regs, i)); -+ } -+ -+ if (regnum == I387_MXCSR_REGNUM (tdep) || regnum == -1) -+ { -+ p = regs == NULL ? NULL : FXSAVE_MXCSR_ADDR (regs); -+ regcache_raw_supply (regcache, I387_MXCSR_REGNUM (tdep), p); -+ } -+} -+ -+/* Similar to i387_collect_fxsave, but use XSAVE extended state. */ -+ -+void -+i387_collect_xsave (const struct regcache *regcache, int regnum, -+ void *xsave, int gcore) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); -+ gdb_byte *regs = xsave; -+ int i; -+ enum -+ { -+ none = 0x0, -+ check = 0x1, -+ x87 = 0x2 | check, -+ sse = 0x4 | check, -+ avxh = 0x8 | check, -+ all = x87 | sse | avxh -+ } regclass; -+ -+ gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM); -+ gdb_assert (tdep->num_xmm_regs > 0); -+ -+ if (regnum == -1) -+ regclass = all; -+ else if (regnum >= I387_YMM0H_REGNUM (tdep) -+ && regnum < I387_YMMENDH_REGNUM (tdep)) -+ regclass = avxh; -+ else if (regnum >= I387_XMM0_REGNUM(tdep) -+ && regnum < I387_MXCSR_REGNUM (tdep)) -+ regclass = sse; -+ else if (regnum >= I387_ST0_REGNUM (tdep) -+ && regnum < I387_FCTRL_REGNUM (tdep)) -+ regclass = x87; -+ else -+ regclass = none; -+ -+ if (gcore) -+ { -+ /* Update XCR0 and `xstate_bv' with XCR0 for gcore. */ -+ if (tdep->xsave_xcr0_offset != -1) -+ memcpy (regs + tdep->xsave_xcr0_offset, &tdep->xcr0, 8); -+ memcpy (XSAVE_XSTATE_BV_ADDR (regs), &tdep->xcr0, 8); -+ -+ switch (regclass) -+ { -+ default: -+ abort (); -+ -+ case all: -+ /* Handle the upper YMM registers. */ -+ if ((tdep->xcr0 & I386_XSTATE_AVX)) -+ for (i = I387_YMM0H_REGNUM (tdep); -+ i < I387_YMMENDH_REGNUM (tdep); i++) -+ regcache_raw_collect (regcache, i, -+ XSAVE_AVXH_ADDR (tdep, regs, i)); -+ -+ /* Handle the XMM registers. */ -+ if ((tdep->xcr0 & I386_XSTATE_SSE)) -+ for (i = I387_XMM0_REGNUM (tdep); -+ i < I387_MXCSR_REGNUM (tdep); i++) -+ regcache_raw_collect (regcache, i, -+ FXSAVE_ADDR (tdep, regs, i)); -+ -+ /* Handle the x87 registers. */ -+ if ((tdep->xcr0 & I386_XSTATE_X87)) -+ for (i = I387_ST0_REGNUM (tdep); -+ i < I387_FCTRL_REGNUM (tdep); i++) -+ regcache_raw_collect (regcache, i, -+ FXSAVE_ADDR (tdep, regs, i)); -+ break; -+ -+ case x87: -+ regcache_raw_collect (regcache, regnum, -+ FXSAVE_ADDR (tdep, regs, regnum)); -+ return; -+ -+ case sse: -+ regcache_raw_collect (regcache, regnum, -+ FXSAVE_ADDR (tdep, regs, regnum)); -+ return; -+ -+ case avxh: -+ regcache_raw_collect (regcache, regnum, -+ XSAVE_AVXH_ADDR (tdep, regs, regnum)); -+ return; -+ } -+ } -+ else -+ { -+ if ((regclass & check)) -+ { -+ gdb_byte raw[I386_MAX_REGISTER_SIZE]; -+ gdb_byte *xstate_bv_p = XSAVE_XSTATE_BV_ADDR (regs); -+ unsigned int xstate_bv = 0; -+ /* The supported bits in `xstat_bv' are 1 byte. */ -+ unsigned int clear_bv = (~(*xstate_bv_p)) & tdep->xcr0; -+ gdb_byte *p; -+ -+ /* Clear register set if its bit in xstat_bv is zero. */ -+ if (clear_bv) -+ { -+ if ((clear_bv & I386_XSTATE_AVX)) -+ for (i = I387_YMM0H_REGNUM (tdep); -+ i < I387_YMMENDH_REGNUM (tdep); i++) -+ memset (XSAVE_AVXH_ADDR (tdep, regs, i), 0, 16); -+ -+ if ((clear_bv & I386_XSTATE_SSE)) -+ for (i = I387_XMM0_REGNUM (tdep); -+ i < I387_MXCSR_REGNUM (tdep); i++) -+ memset (FXSAVE_ADDR (tdep, regs, i), 0, 16); -+ -+ if ((clear_bv & I386_XSTATE_X87)) -+ for (i = I387_ST0_REGNUM (tdep); -+ i < I387_FCTRL_REGNUM (tdep); i++) -+ memset (FXSAVE_ADDR (tdep, regs, i), 0, 10); -+ } -+ -+ if (regclass == all) -+ { -+ /* Check if any upper YMM registers are changed. */ -+ if ((tdep->xcr0 & I386_XSTATE_AVX)) -+ for (i = I387_YMM0H_REGNUM (tdep); -+ i < I387_YMMENDH_REGNUM (tdep); i++) -+ { -+ regcache_raw_collect (regcache, i, raw); -+ p = XSAVE_AVXH_ADDR (tdep, regs, i); -+ if (memcmp (raw, p, 16)) -+ { -+ xstate_bv |= I386_XSTATE_AVX; -+ memcpy (p, raw, 16); -+ } -+ } -+ -+ /* Check if any SSE registers are changed. */ -+ if ((tdep->xcr0 & I386_XSTATE_SSE)) -+ for (i = I387_XMM0_REGNUM (tdep); -+ i < I387_MXCSR_REGNUM (tdep); i++) -+ { -+ regcache_raw_collect (regcache, i, raw); -+ p = FXSAVE_ADDR (tdep, regs, i); -+ if (memcmp (raw, p, 16)) -+ { -+ xstate_bv |= I386_XSTATE_SSE; -+ memcpy (p, raw, 16); -+ } -+ } -+ -+ /* Check if any X87 registers are changed. */ -+ if ((tdep->xcr0 & I386_XSTATE_X87)) -+ for (i = I387_ST0_REGNUM (tdep); -+ i < I387_FCTRL_REGNUM (tdep); i++) -+ { -+ regcache_raw_collect (regcache, i, raw); -+ p = FXSAVE_ADDR (tdep, regs, i); -+ if (memcmp (raw, p, 10)) -+ { -+ xstate_bv |= I386_XSTATE_X87; -+ memcpy (p, raw, 10); -+ } -+ } -+ } -+ else -+ { -+ /* Check if REGNUM is changed. */ -+ regcache_raw_collect (regcache, regnum, raw); -+ -+ switch (regclass) -+ { -+ default: -+ abort (); -+ -+ case avxh: -+ /* This is an upper YMM register. */ -+ p = XSAVE_AVXH_ADDR (tdep, regs, regnum); -+ if (memcmp (raw, p, 16)) -+ { -+ xstate_bv |= I386_XSTATE_AVX; -+ memcpy (p, raw, 16); -+ } -+ break; -+ -+ case sse: -+ /* This is an SSE register. */ -+ p = FXSAVE_ADDR (tdep, regs, regnum); -+ if (memcmp (raw, p, 16)) -+ { -+ xstate_bv |= I386_XSTATE_SSE; -+ memcpy (p, raw, 16); -+ } -+ break; -+ -+ case x87: -+ /* This is an x87 register. */ -+ p = FXSAVE_ADDR (tdep, regs, regnum); -+ if (memcmp (raw, p, 10)) -+ { -+ xstate_bv |= I386_XSTATE_X87; -+ memcpy (p, raw, 10); -+ } -+ break; -+ } -+ } -+ -+ /* Update the corresponding bits in `xstate_bv' if any SSE/AVX -+ registers are changed. */ -+ if (xstate_bv) -+ { -+ /* The supported bits in `xstat_bv' are 1 byte. */ -+ *xstate_bv_p |= (gdb_byte) xstate_bv; -+ -+ switch (regclass) -+ { -+ default: -+ abort (); -+ -+ case all: -+ break; -+ -+ case x87: -+ case sse: -+ case avxh: -+ /* Register REGNUM has been updated. Return. */ -+ return; -+ } -+ } -+ else -+ { -+ /* Return if REGNUM isn't changed. */ -+ if (regclass != all) -+ return; -+ } -+ } -+ } -+ -+ /* Only handle x87 control registers. */ -+ for (i = I387_FCTRL_REGNUM (tdep); i < I387_XMM0_REGNUM (tdep); i++) -+ if (regnum == -1 || regnum == i) -+ { -+ /* Most of the FPU control registers occupy only 16 bits in -+ the xsave extended state. Give those a special treatment. */ -+ if (i != I387_FIOFF_REGNUM (tdep) -+ && i != I387_FOOFF_REGNUM (tdep)) -+ { -+ gdb_byte buf[4]; -+ -+ regcache_raw_collect (regcache, i, buf); -+ -+ if (i == I387_FOP_REGNUM (tdep)) -+ { -+ /* The opcode occupies only 11 bits. Make sure we -+ don't touch the other bits. */ -+ buf[1] &= ((1 << 3) - 1); -+ buf[1] |= ((FXSAVE_ADDR (tdep, regs, i))[1] & ~((1 << 3) - 1)); -+ } -+ else if (i == I387_FTAG_REGNUM (tdep)) -+ { -+ /* Converting back is much easier. */ -+ -+ unsigned short ftag; -+ int fpreg; -+ -+ ftag = (buf[1] << 8) | buf[0]; -+ buf[0] = 0; -+ buf[1] = 0; -+ -+ for (fpreg = 7; fpreg >= 0; fpreg--) -+ { -+ int tag = (ftag >> (fpreg * 2)) & 3; -+ -+ if (tag != 3) -+ buf[0] |= (1 << fpreg); -+ } -+ } -+ memcpy (FXSAVE_ADDR (tdep, regs, i), buf, 2); -+ } -+ else -+ regcache_raw_collect (regcache, i, FXSAVE_ADDR (tdep, regs, i)); -+ } -+ -+ if (regnum == I387_MXCSR_REGNUM (tdep) || regnum == -1) -+ regcache_raw_collect (regcache, I387_MXCSR_REGNUM (tdep), -+ FXSAVE_MXCSR_ADDR (regs)); -+} -+ - /* Recreate the FTW (tag word) valid bits from the 80-bit FP data in - *RAW. */ - ---- ./gdb/i387-tdep.h 2010-04-03 20:59:52.000000000 +0200 -+++ ./gdb/i387-tdep.h 2010-04-03 21:12:32.000000000 +0200 -@@ -33,6 +33,8 @@ struct ui_file; - #define I387_ST0_REGNUM(tdep) ((tdep)->st0_regnum) - #define I387_NUM_XMM_REGS(tdep) ((tdep)->num_xmm_regs) - #define I387_MM0_REGNUM(tdep) ((tdep)->mm0_regnum) -+#define I387_NUM_YMM_REGS(tdep) ((tdep)->num_ymm_regs) -+#define I387_YMM0H_REGNUM(tdep) ((tdep)->ymm0h_regnum) - - #define I387_FCTRL_REGNUM(tdep) (I387_ST0_REGNUM (tdep) + 8) - #define I387_FSTAT_REGNUM(tdep) (I387_FCTRL_REGNUM (tdep) + 1) -@@ -45,6 +47,8 @@ struct ui_file; - #define I387_XMM0_REGNUM(tdep) (I387_ST0_REGNUM (tdep) + 16) - #define I387_MXCSR_REGNUM(tdep) \ - (I387_XMM0_REGNUM (tdep) + I387_NUM_XMM_REGS (tdep)) -+#define I387_YMMENDH_REGNUM(tdep) \ -+ (I387_YMM0H_REGNUM (tdep) + I387_NUM_YMM_REGS (tdep)) - - /* Print out the i387 floating point state. */ - -@@ -99,6 +103,11 @@ extern void i387_collect_fsave (const st - extern void i387_supply_fxsave (struct regcache *regcache, int regnum, - const void *fxsave); - -+/* Similar to i387_supply_fxsave, but use XSAVE extended state. */ -+ -+extern void i387_supply_xsave (struct regcache *regcache, int regnum, -+ const void *xsave); -+ - /* Fill register REGNUM (if it is a floating-point or SSE register) in - *FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for - all registers. This function doesn't touch any of the reserved -@@ -107,6 +116,11 @@ extern void i387_supply_fxsave (struct r - extern void i387_collect_fxsave (const struct regcache *regcache, int regnum, - void *fxsave); - -+/* Similar to i387_collect_fxsave, but use XSAVE extended state. */ -+ -+extern void i387_collect_xsave (const struct regcache *regcache, -+ int regnum, void *xsave, int gcore); -+ - /* Prepare the FPU stack in REGCACHE for a function return. */ - - extern void i387_return_value (struct gdbarch *gdbarch, ---- ./gdb/regformats/i386/amd64-avx-linux.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/amd64-avx-linux.dat 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,78 @@ -+# DO NOT EDIT: generated from i386/amd64-avx-linux.xml -+name:amd64_avx_linux -+xmltarget:amd64-avx-linux.xml -+expedite:rbp,rsp,rip -+64:rax -+64:rbx -+64:rcx -+64:rdx -+64:rsi -+64:rdi -+64:rbp -+64:rsp -+64:r8 -+64:r9 -+64:r10 -+64:r11 -+64:r12 -+64:r13 -+64:r14 -+64:r15 -+64:rip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+128:xmm8 -+128:xmm9 -+128:xmm10 -+128:xmm11 -+128:xmm12 -+128:xmm13 -+128:xmm14 -+128:xmm15 -+32:mxcsr -+64:orig_rax -+128:ymm0h -+128:ymm1h -+128:ymm2h -+128:ymm3h -+128:ymm4h -+128:ymm5h -+128:ymm6h -+128:ymm7h -+128:ymm8h -+128:ymm9h -+128:ymm10h -+128:ymm11h -+128:ymm12h -+128:ymm13h -+128:ymm14h -+128:ymm15h ---- ./gdb/regformats/i386/amd64-avx.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/amd64-avx.dat 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,77 @@ -+# DO NOT EDIT: generated from i386/amd64-avx.xml -+name:amd64_avx -+xmltarget:amd64-avx.xml -+expedite:rbp,rsp,rip -+64:rax -+64:rbx -+64:rcx -+64:rdx -+64:rsi -+64:rdi -+64:rbp -+64:rsp -+64:r8 -+64:r9 -+64:r10 -+64:r11 -+64:r12 -+64:r13 -+64:r14 -+64:r15 -+64:rip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+128:xmm8 -+128:xmm9 -+128:xmm10 -+128:xmm11 -+128:xmm12 -+128:xmm13 -+128:xmm14 -+128:xmm15 -+32:mxcsr -+128:ymm0h -+128:ymm1h -+128:ymm2h -+128:ymm3h -+128:ymm4h -+128:ymm5h -+128:ymm6h -+128:ymm7h -+128:ymm8h -+128:ymm9h -+128:ymm10h -+128:ymm11h -+128:ymm12h -+128:ymm13h -+128:ymm14h -+128:ymm15h ---- ./gdb/regformats/i386/i386-avx-linux.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/i386-avx-linux.dat 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,54 @@ -+# DO NOT EDIT: generated from i386/i386-avx-linux.xml -+name:i386_avx_linux -+xmltarget:i386-avx-linux.xml -+expedite:ebp,esp,eip -+32:eax -+32:ecx -+32:edx -+32:ebx -+32:esp -+32:ebp -+32:esi -+32:edi -+32:eip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+32:mxcsr -+32:orig_eax -+128:ymm0h -+128:ymm1h -+128:ymm2h -+128:ymm3h -+128:ymm4h -+128:ymm5h -+128:ymm6h -+128:ymm7h ---- ./gdb/regformats/i386/i386-avx.dat 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/regformats/i386/i386-avx.dat 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,53 @@ -+# DO NOT EDIT: generated from i386/i386-avx.xml -+name:i386_avx -+xmltarget:i386-avx.xml -+expedite:ebp,esp,eip -+32:eax -+32:ecx -+32:edx -+32:ebx -+32:esp -+32:ebp -+32:esi -+32:edi -+32:eip -+32:eflags -+32:cs -+32:ss -+32:ds -+32:es -+32:fs -+32:gs -+80:st0 -+80:st1 -+80:st2 -+80:st3 -+80:st4 -+80:st5 -+80:st6 -+80:st7 -+32:fctrl -+32:fstat -+32:ftag -+32:fiseg -+32:fioff -+32:foseg -+32:fooff -+32:fop -+128:xmm0 -+128:xmm1 -+128:xmm2 -+128:xmm3 -+128:xmm4 -+128:xmm5 -+128:xmm6 -+128:xmm7 -+32:mxcsr -+128:ymm0h -+128:ymm1h -+128:ymm2h -+128:ymm3h -+128:ymm4h -+128:ymm5h -+128:ymm6h -+128:ymm7h ---- ./gdb/testsuite/ChangeLog.pseudo 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/testsuite/ChangeLog.pseudo 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,26 @@ -+2010-02-18 H.J. Lu -+ -+ * gdb.arch/amd64-dword.exp: New. -+ -+ * gdb.arch/amd64-word.exp: Simplified. -+ -+2010-02-18 H.J. Lu -+ -+ * gdb.arch/amd64-word.exp: New. -+ * gdb.arch/i386-word.exp: Likewise. -+ -+ * gdb.arch/i386-byte.exp (nr_regs): Removed. -+ -+2010-02-18 H.J. Lu -+ -+ * gdb.arch/amd64-pseudo.c: New. -+ * gdb.arch/i386-byte.exp: Likewise. -+ -+ * gdb.arch/amd64-byte.exp: Updated. -+ -+ * gdb.arch/i386-pseudo.c: Make it 32bit only. -+ -+2010-02-18 H.J. Lu -+ -+ * gdb.arch/amd64-byte.exp: New. -+ * gdb.arch/i386-pseudo.c: Likewise. ---- ./gdb/testsuite/ChangeLog.xcr 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/testsuite/ChangeLog.xcr 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,6 @@ -+2010-03-28 H.J. Lu -+ -+ * gdb.arch/i386-avx.c: New. -+ * gdb.arch/i386-avx.exp: Likewise. -+ -+ * gdb.arch/i386-cpuid.h: Updated from gcc 4.4. ---- ./gdb/testsuite/ChangeLog.xml 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/testsuite/ChangeLog.xml 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,4 @@ -+2010-02-22 H.J. Lu -+ -+ * gdb.xml/tdesc-regs.exp (architecture): New. Set it for x86. -+ (load_description): Set architecture if defined. ---- ./gdb/testsuite/gdb.arch/i386-avx.c 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/testsuite/gdb.arch/i386-avx.c 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,128 @@ -+/* Test program for AVX registers. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+#include "i386-cpuid.h" -+ -+typedef struct { -+ float f[8]; -+} v8sf_t; -+ -+ -+v8sf_t data[] = -+ { -+ { { 0.0, 0.125, 0.25, 0.375, 0.50, 0.625, 0.75, 0.875 } }, -+ { { 1.0, 1.125, 1.25, 1.375, 1.50, 1.625, 1.75, 1.875 } }, -+ { { 2.0, 2.125, 2.25, 2.375, 2.50, 2.625, 2.75, 2.875 } }, -+ { { 3.0, 3.125, 3.25, 3.375, 3.50, 3.625, 3.75, 3.875 } }, -+ { { 4.0, 4.125, 4.25, 4.375, 4.50, 4.625, 4.75, 4.875 } }, -+ { { 5.0, 5.125, 5.25, 5.375, 5.50, 5.625, 5.75, 5.875 } }, -+ { { 6.0, 6.125, 6.25, 6.375, 6.50, 6.625, 6.75, 6.875 } }, -+ { { 7.0, 7.125, 7.25, 7.375, 7.50, 7.625, 7.75, 7.875 } }, -+#ifdef __x86_64__ -+ { { 8.0, 8.125, 8.25, 8.375, 8.50, 8.625, 8.75, 8.875 } }, -+ { { 9.0, 9.125, 9.25, 9.375, 9.50, 9.625, 9.75, 9.875 } }, -+ { { 10.0, 10.125, 10.25, 10.375, 10.50, 10.625, 10.75, 10.875 } }, -+ { { 11.0, 11.125, 11.25, 11.375, 11.50, 11.625, 11.75, 11.875 } }, -+ { { 12.0, 12.125, 12.25, 12.375, 12.50, 12.625, 12.75, 12.875 } }, -+ { { 13.0, 13.125, 13.25, 13.375, 13.50, 13.625, 13.75, 13.875 } }, -+ { { 14.0, 14.125, 14.25, 14.375, 14.50, 14.625, 14.75, 14.875 } }, -+ { { 15.0, 15.125, 15.25, 15.375, 15.50, 15.625, 15.75, 15.875 } }, -+#endif -+ }; -+ -+ -+int -+have_avx (void) -+{ -+ unsigned int eax, ebx, ecx, edx; -+ -+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) -+ return 0; -+ -+ if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) -+ return 1; -+ else -+ return 0; -+} -+ -+int -+main (int argc, char **argv) -+{ -+ if (have_avx ()) -+ { -+ asm ("vmovaps 0(%0), %%ymm0\n\t" -+ "vmovaps 32(%0), %%ymm1\n\t" -+ "vmovaps 64(%0), %%ymm2\n\t" -+ "vmovaps 96(%0), %%ymm3\n\t" -+ "vmovaps 128(%0), %%ymm4\n\t" -+ "vmovaps 160(%0), %%ymm5\n\t" -+ "vmovaps 192(%0), %%ymm6\n\t" -+ "vmovaps 224(%0), %%ymm7\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"); -+#ifdef __x86_64__ -+ asm ("vmovaps 256(%0), %%ymm8\n\t" -+ "vmovaps 288(%0), %%ymm9\n\t" -+ "vmovaps 320(%0), %%ymm10\n\t" -+ "vmovaps 352(%0), %%ymm11\n\t" -+ "vmovaps 384(%0), %%ymm12\n\t" -+ "vmovaps 416(%0), %%ymm13\n\t" -+ "vmovaps 448(%0), %%ymm14\n\t" -+ "vmovaps 480(%0), %%ymm15\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"); -+#endif -+ -+ asm ("nop"); /* first breakpoint here */ -+ -+ asm ( -+ "vmovaps %%ymm0, 0(%0)\n\t" -+ "vmovaps %%ymm1, 32(%0)\n\t" -+ "vmovaps %%ymm2, 64(%0)\n\t" -+ "vmovaps %%ymm3, 96(%0)\n\t" -+ "vmovaps %%ymm4, 128(%0)\n\t" -+ "vmovaps %%ymm5, 160(%0)\n\t" -+ "vmovaps %%ymm6, 192(%0)\n\t" -+ "vmovaps %%ymm7, 224(%0)\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"); -+#ifdef __x86_64__ -+ asm ( -+ "vmovaps %%ymm8, 256(%0)\n\t" -+ "vmovaps %%ymm9, 288(%0)\n\t" -+ "vmovaps %%ymm10, 320(%0)\n\t" -+ "vmovaps %%ymm11, 352(%0)\n\t" -+ "vmovaps %%ymm12, 384(%0)\n\t" -+ "vmovaps %%ymm13, 416(%0)\n\t" -+ "vmovaps %%ymm14, 448(%0)\n\t" -+ "vmovaps %%ymm15, 480(%0)\n\t" -+ : /* no output operands */ -+ : "r" (data) -+ : "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"); -+#endif -+ -+ puts ("Bye!"); /* second breakpoint here */ -+ } -+ -+ return 0; -+} ---- ./gdb/testsuite/gdb.arch/i386-avx.exp 1970-01-01 01:00:00.000000000 +0100 -+++ ./gdb/testsuite/gdb.arch/i386-avx.exp 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,110 @@ -+# 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 . -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@gnu.org -+ -+# This file is part of the gdb testsuite. -+ -+if $tracelevel { -+ strace $tracelevel -+} -+ -+set prms_id 0 -+set bug_id 0 -+ -+if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { -+ verbose "Skipping x86 AVX tests." -+ return -+} -+ -+set testfile "i386-avx" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+set additional_flags "" -+if [test_compiler_info gcc*] { -+ set additional_flags "additional_flags=-mavx" -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { -+ unsupported "compiler does not support AVX" -+ return -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] then { -+ gdb_suppress_tests -+} -+ -+send_gdb "print have_avx ()\r" -+gdb_expect { -+ -re ".. = 1\r\n$gdb_prompt " { -+ pass "check whether processor supports AVX" -+ } -+ -re ".. = 0\r\n$gdb_prompt " { -+ verbose "processor does not support AVX; skipping AVX tests" -+ return -+ } -+ -re ".*$gdb_prompt $" { -+ fail "check whether processor supports AVX" -+ } -+ timeout { -+ fail "check whether processor supports AVX (timeout)" -+ } -+} -+ -+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ -+ "Breakpoint .* at .*i386-avx.c.*" \ -+ "set first breakpoint in main" -+gdb_continue_to_breakpoint "continue to first breakpoint in main" -+ -+if [istarget i?86-*-*] { -+ set nr_regs 8 -+} else { -+ set nr_regs 16 -+} -+ -+for { set r 0 } { $r < $nr_regs } { incr r } { -+ gdb_test "print \$ymm$r.v8_float" \ -+ ".. = \\{$r, $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}.*" \ -+ "check float contents of %ymm$r" -+ gdb_test "print \$ymm$r.v32_int8" \ -+ ".. = \\{(-?\[0-9\]+, ){31}-?\[0-9\]+\\}.*" \ -+ "check int8 contents of %ymm$r" -+} -+ -+for { set r 0 } { $r < $nr_regs } { incr r } { -+ gdb_test "set var \$ymm$r.v8_float\[0\] = $r + 10" "" "set %ymm$r" -+} -+ -+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ -+ "Breakpoint .* at .*i386-avx.c.*" \ -+ "set second breakpoint in main" -+gdb_continue_to_breakpoint "continue to second breakpoint in main" -+ -+for { set r 0 } { $r < $nr_regs } { incr r } { -+ gdb_test "print data\[$r\]" \ -+ ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \ -+ "check contents of data\[$r\]" -+} ---- ./gdb/testsuite/gdb.arch/i386-cpuid.h 2010-01-01 08:32:00.000000000 +0100 -+++ ./gdb/testsuite/gdb.arch/i386-cpuid.h 2010-04-03 21:12:32.000000000 +0200 -@@ -1,30 +1,186 @@ --/* Helper file for i386 platform. Runtime check for MMX/SSE/SSE2 support. -+/* Helper file for i386 platform. Runtime check for MMX/SSE/SSE2/AVX -+ * support. Copied from gcc 4.4. -+ * -+ * Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. -+ * -+ * This file 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, or (at your option) any -+ * later version. -+ * -+ * This file 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. -+ * -+ * Under Section 7 of GPL version 3, you are granted additional -+ * permissions described in the GCC Runtime Library Exception, version -+ * 3.1, as published by the Free Software Foundation. -+ * -+ * You should have received a copy of the GNU General Public License and -+ * a copy of the GCC Runtime Library Exception along with this program; -+ * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -+ * . -+ */ -+ -+/* %ecx */ -+#define bit_SSE3 (1 << 0) -+#define bit_PCLMUL (1 << 1) -+#define bit_SSSE3 (1 << 9) -+#define bit_FMA (1 << 12) -+#define bit_CMPXCHG16B (1 << 13) -+#define bit_SSE4_1 (1 << 19) -+#define bit_SSE4_2 (1 << 20) -+#define bit_MOVBE (1 << 22) -+#define bit_POPCNT (1 << 23) -+#define bit_AES (1 << 25) -+#define bit_XSAVE (1 << 26) -+#define bit_OSXSAVE (1 << 27) -+#define bit_AVX (1 << 28) -+ -+/* %edx */ -+#define bit_CMPXCHG8B (1 << 8) -+#define bit_CMOV (1 << 15) -+#define bit_MMX (1 << 23) -+#define bit_FXSAVE (1 << 24) -+#define bit_SSE (1 << 25) -+#define bit_SSE2 (1 << 26) -+ -+/* Extended Features */ -+/* %ecx */ -+#define bit_LAHF_LM (1 << 0) -+#define bit_ABM (1 << 5) -+#define bit_SSE4a (1 << 6) -+#define bit_XOP (1 << 11) -+#define bit_LWP (1 << 15) -+#define bit_FMA4 (1 << 16) -+ -+/* %edx */ -+#define bit_LM (1 << 29) -+#define bit_3DNOWP (1 << 30) -+#define bit_3DNOW (1 << 31) -+ -+ -+#if defined(__i386__) && defined(__PIC__) -+/* %ebx may be the PIC register. */ -+#if __GNUC__ >= 3 -+#define __cpuid(level, a, b, c, d) \ -+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ -+ "cpuid\n\t" \ -+ "xchg{l}\t{%%}ebx, %1\n\t" \ -+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ -+ : "0" (level)) -+ -+#define __cpuid_count(level, count, a, b, c, d) \ -+ __asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \ -+ "cpuid\n\t" \ -+ "xchg{l}\t{%%}ebx, %1\n\t" \ -+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ -+ : "0" (level), "2" (count)) -+#else -+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax -+ nor alternatives in i386 code. */ -+#define __cpuid(level, a, b, c, d) \ -+ __asm__ ("xchgl\t%%ebx, %1\n\t" \ -+ "cpuid\n\t" \ -+ "xchgl\t%%ebx, %1\n\t" \ -+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ -+ : "0" (level)) -+ -+#define __cpuid_count(level, count, a, b, c, d) \ -+ __asm__ ("xchgl\t%%ebx, %1\n\t" \ -+ "cpuid\n\t" \ -+ "xchgl\t%%ebx, %1\n\t" \ -+ : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ -+ : "0" (level), "2" (count)) -+#endif -+#else -+#define __cpuid(level, a, b, c, d) \ -+ __asm__ ("cpuid\n\t" \ -+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ -+ : "0" (level)) -+ -+#define __cpuid_count(level, count, a, b, c, d) \ -+ __asm__ ("cpuid\n\t" \ -+ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ -+ : "0" (level), "2" (count)) -+#endif -+ -+/* Return highest supported input value for cpuid instruction. ext can -+ be either 0x0 or 0x8000000 to return highest supported value for -+ basic or extended cpuid information. Function returns 0 if cpuid -+ is not supported or whatever cpuid returns in eax register. If sig -+ pointer is non-null, then first four bytes of the signature -+ (as found in ebx register) are returned in location pointed by sig. */ -+ -+static __inline unsigned int -+__get_cpuid_max (unsigned int __ext, unsigned int *__sig) -+{ -+ unsigned int __eax, __ebx, __ecx, __edx; -+ -+#ifndef __x86_64__ -+#if __GNUC__ >= 3 -+ /* See if we can use cpuid. On AMD64 we always can. */ -+ __asm__ ("pushf{l|d}\n\t" -+ "pushf{l|d}\n\t" -+ "pop{l}\t%0\n\t" -+ "mov{l}\t{%0, %1|%1, %0}\n\t" -+ "xor{l}\t{%2, %0|%0, %2}\n\t" -+ "push{l}\t%0\n\t" -+ "popf{l|d}\n\t" -+ "pushf{l|d}\n\t" -+ "pop{l}\t%0\n\t" -+ "popf{l|d}\n\t" -+ : "=&r" (__eax), "=&r" (__ebx) -+ : "i" (0x00200000)); -+#else -+/* Host GCCs older than 3.0 weren't supporting Intel asm syntax -+ nor alternatives in i386 code. */ -+ __asm__ ("pushfl\n\t" -+ "pushfl\n\t" -+ "popl\t%0\n\t" -+ "movl\t%0, %1\n\t" -+ "xorl\t%2, %0\n\t" -+ "pushl\t%0\n\t" -+ "popfl\n\t" -+ "pushfl\n\t" -+ "popl\t%0\n\t" -+ "popfl\n\t" -+ : "=&r" (__eax), "=&r" (__ebx) -+ : "i" (0x00200000)); -+#endif - -- Copyright 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -+ if (!((__eax ^ __ebx) & 0x00200000)) -+ return 0; -+#endif - -- This file is part of GDB. -+ /* Host supports cpuid. Return highest supported cpuid input value. */ -+ __cpuid (__ext, __eax, __ebx, __ecx, __edx); - -- 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. -+ if (__sig) -+ *__sig = __ebx; - -- 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. -+ return __eax; -+} - -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . */ -+/* Return cpuid data for requested cpuid level, as found in returned -+ eax, ebx, ecx and edx registers. The function checks if cpuid is -+ supported and returns 1 for valid cpuid information or 0 for -+ unsupported cpuid level. All pointers are required to be non-null. */ -+ -+static __inline int -+__get_cpuid (unsigned int __level, -+ unsigned int *__eax, unsigned int *__ebx, -+ unsigned int *__ecx, unsigned int *__edx) -+{ -+ unsigned int __ext = __level & 0x80000000; - --/* Used by 20020523-2.c and i386-sse-6.c, and possibly others. */ --/* Plagarized from 20020523-2.c. */ --/* Plagarized from gcc. */ -+ if (__get_cpuid_max (__ext, 0) < __level) -+ return 0; - --#define bit_CMOV (1 << 15) --#define bit_MMX (1 << 23) --#define bit_SSE (1 << 25) --#define bit_SSE2 (1 << 26) -+ __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx); -+ return 1; -+} - - #ifndef NOINLINE - #define NOINLINE __attribute__ ((noinline)) -@@ -35,41 +191,10 @@ unsigned int i386_cpuid (void) NOINLINE; - unsigned int NOINLINE - i386_cpuid (void) - { -- int fl1, fl2; -- --#ifndef __x86_64__ -- /* See if we can use cpuid. On AMD64 we always can. */ -- __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;" -- "pushl %0; popfl; pushfl; popl %0; popfl" -- : "=&r" (fl1), "=&r" (fl2) -- : "i" (0x00200000)); -- if (((fl1 ^ fl2) & 0x00200000) == 0) -- return (0); --#endif -+ unsigned int eax, ebx, ecx, edx; - -- /* Host supports cpuid. See if cpuid gives capabilities, try -- CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we -- don't need their CPUID values here, and %ebx may be the PIC -- register. */ --#ifdef __x86_64__ -- __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx" -- : "=a" (fl1) : "0" (0) : "rdx", "cc"); --#else -- __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx" -- : "=a" (fl1) : "0" (0) : "edx", "cc"); --#endif -- if (fl1 == 0) -- return (0); -- -- /* Invoke CPUID(1), return %edx; caller can examine bits to -- determine what's supported. */ --#ifdef __x86_64__ -- __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx" -- : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc"); --#else -- __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx" -- : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc"); --#endif -+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) -+ return 0; - -- return fl2; -+ return edx; - } ---- ./include/elf/ChangeLog.xstate 1970-01-01 01:00:00.000000000 +0100 -+++ ./include/elf/ChangeLog.xstate 2010-04-03 21:12:32.000000000 +0200 -@@ -0,0 +1,8 @@ -+2010-01-27 H.J. Lu -+ -+ * common.h (NT_386_XSTATE): Renamed to ... -+ (NT_X86_XSTATE): This. -+ -+2010-01-27 H.J. Lu -+ -+ * common.h (NT_386_XSTATE): New. diff --git a/gdb-bz589467-pieces-vla-compat.patch b/gdb-bz589467-pieces-vla-compat.patch deleted file mode 100644 index ca5762d..0000000 --- a/gdb-bz589467-pieces-vla-compat.patch +++ /dev/null @@ -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 - - * 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), diff --git a/gdb-bz589467-pieces01of4.patch b/gdb-bz589467-pieces01of4.patch deleted file mode 100644 index f077d19..0000000 --- a/gdb-bz589467-pieces01of4.patch +++ /dev/null @@ -1,80 +0,0 @@ -commit 96c23bfd2863bcca7388653a7bc4c9f8a64a03be -Author: Ulrich Weigand -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; - } diff --git a/gdb-bz589467-pieces02of4.patch b/gdb-bz589467-pieces02of4.patch deleted file mode 100644 index f9986f0..0000000 --- a/gdb-bz589467-pieces02of4.patch +++ /dev/null @@ -1,68 +0,0 @@ -commit 60d15ff6d78921d080aee681e60372abe6627570 -Author: 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; - diff --git a/gdb-bz589467-pieces03of4.patch b/gdb-bz589467-pieces03of4.patch deleted file mode 100644 index 8fc73f9..0000000 --- a/gdb-bz589467-pieces03of4.patch +++ /dev/null @@ -1,99 +0,0 @@ -commit dacd66a53b559be9c26d2c523f168f1ef0261f4d -Author: Michael Snyder -Date: Fri May 14 17:53:11 2010 +0000 - - 2010-05-14 Michael Snyder - - * 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); - } diff --git a/gdb-bz589467-pieces1of4.patch b/gdb-bz589467-pieces1of4.patch deleted file mode 100644 index 52163c6..0000000 --- a/gdb-bz589467-pieces1of4.patch +++ /dev/null @@ -1,2075 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2010-05/msg00186.html - -### src/gdb/ChangeLog 2010/05/21 20:34:45 1.11828 -### src/gdb/ChangeLog 2010/05/21 20:39:50 1.11829 -## -1,3 +1,9 @@ -+2010-05-21 Tom Tromey -+ -+ * dwarf2loc.c (read_pieced_value): Work properly when 'v' has an -+ offset. -+ (write_pieced_value): Likewise. -+ -### src/gdb/testsuite/ChangeLog 2010/05/20 19:18:57 1.2272 -### src/gdb/testsuite/ChangeLog 2010/05/21 20:39:50 1.2273 -## -1,3 +1,9 @@ -+2010-05-21 Tom Tromey -+ -+ * gdb.dwarf2.pieces.exp: New file. -+ * gdb.dwarf2.pieces.S: New file. -+ * gdb.dwarf2.pieces.c: New file. -+ ---- src/gdb/dwarf2loc.c 2010/05/14 17:53:16 1.78 -+++ src/gdb/dwarf2loc.c 2010/05/21 20:39:50 1.79 -@@ -264,14 +264,46 @@ - { - int i; - long offset = 0; -+ ULONGEST bytes_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; -+ -+ 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")); - - contents = value_contents_raw (v); -- for (i = 0; i < c->n_pieces; i++) -+ bytes_to_skip = value_offset (v); -+ type_len = 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) -+ { -+ bytes_to_skip -= p->size; -+ 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; -+ } -+ else -+ { -+ dest_offset = offset; -+ source_offset = 0; -+ } - - switch (p->location) - { -@@ -280,17 +312,17 @@ - struct gdbarch *arch = get_frame_arch (frame); - int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, - p->v.expr.value); -- int reg_offset = 0; -+ int reg_offset = source_offset; - - if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG -- && p->size < register_size (arch, gdb_regnum)) -+ && this_size < register_size (arch, gdb_regnum)) - /* Big-endian, and we want less than full size. */ -- reg_offset = register_size (arch, gdb_regnum) - p->size; -+ reg_offset = register_size (arch, gdb_regnum) - this_size; - - if (gdb_regnum != -1) - { - get_frame_register_bytes (frame, gdb_regnum, reg_offset, -- p->size, contents + offset); -+ this_size, contents + dest_offset); - } - else - { -@@ -302,38 +334,60 @@ - - case DWARF_VALUE_MEMORY: - if (p->v.expr.in_stack_memory) -- read_stack (p->v.expr.value, contents + offset, p->size); -+ read_stack (p->v.expr.value + source_offset, -+ contents + dest_offset, this_size); - else -- read_memory (p->v.expr.value, contents + offset, p->size); -+ read_memory (p->v.expr.value + source_offset, -+ contents + dest_offset, this_size); - break; - - case DWARF_VALUE_STACK: - { - struct gdbarch *gdbarch = get_type_arch (value_type (v)); -- size_t n = p->size; -+ size_t n = this_size; -+ -+ if (n > c->addr_size - source_offset) -+ n = (c->addr_size >= source_offset -+ ? c->addr_size - source_offset -+ : 0); -+ if (n == 0) -+ { -+ /* Nothing. */ -+ } -+ else if (source_offset == 0) -+ store_unsigned_integer (contents + dest_offset, n, -+ gdbarch_byte_order (gdbarch), -+ p->v.expr.value); -+ else -+ { -+ gdb_byte bytes[sizeof (ULONGEST)]; - -- if (n > c->addr_size) -- n = c->addr_size; -- store_unsigned_integer (contents + offset, n, -- gdbarch_byte_order (gdbarch), -- p->v.expr.value); -+ store_unsigned_integer (bytes, n + source_offset, -+ gdbarch_byte_order (gdbarch), -+ p->v.expr.value); -+ memcpy (contents + dest_offset, bytes + source_offset, n); -+ } - } - break; - - case DWARF_VALUE_LITERAL: - { -- size_t n = p->size; -+ size_t n = this_size; - -- if (n > p->v.literal.length) -- n = p->v.literal.length; -- memcpy (contents + offset, p->v.literal.data, n); -+ if (n > p->v.literal.length - source_offset) -+ n = (p->v.literal.length >= source_offset -+ ? p->v.literal.length - source_offset -+ : 0); -+ if (n != 0) -+ memcpy (contents + dest_offset, -+ p->v.literal.data + source_offset, n); - } - break; - - default: - internal_error (__FILE__, __LINE__, _("invalid location type")); - } -- offset += p->size; -+ offset += this_size; - } - } - -@@ -342,9 +396,11 @@ - { - int i; - long offset = 0; -- gdb_byte *contents; -+ ULONGEST bytes_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; - - if (frame == NULL) - { -@@ -352,10 +408,35 @@ - return; - } - -- contents = value_contents_raw (from); -- for (i = 0; i < c->n_pieces; i++) -+ contents = value_contents (from); -+ bytes_to_skip = value_offset (to); -+ type_len = 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; -+ -+ if (bytes_to_skip > 0 && bytes_to_skip >= p->size) -+ { -+ bytes_to_skip -= p->size; -+ 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; -+ } -+ else -+ { -+ dest_offset = 0; -+ source_offset = offset; -+ } - - switch (p->location) - { -@@ -363,17 +444,17 @@ - { - struct gdbarch *arch = get_frame_arch (frame); - int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.expr.value); -- int reg_offset = 0; -+ int reg_offset = dest_offset; - - if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG -- && p->size < register_size (arch, gdb_regnum)) -+ && this_size <= register_size (arch, gdb_regnum)) - /* Big-endian, and we want less than full size. */ -- reg_offset = register_size (arch, gdb_regnum) - p->size; -+ reg_offset = register_size (arch, gdb_regnum) - this_size; - - if (gdb_regnum != -1) - { - put_frame_register_bytes (frame, gdb_regnum, reg_offset, -- p->size, contents + offset); -+ this_size, contents + source_offset); - } - else - { -@@ -383,13 +464,14 @@ - } - break; - case DWARF_VALUE_MEMORY: -- write_memory (p->v.expr.value, contents + offset, p->size); -+ write_memory (p->v.expr.value + dest_offset, -+ contents + source_offset, this_size); - break; - default: - set_value_optimized_out (to, 1); - return; - } -- offset += p->size; -+ offset += this_size; - } - } - ---- src/gdb/testsuite/gdb.dwarf2/pieces.S -+++ src/gdb/testsuite/gdb.dwarf2/pieces.S 2010-05-25 20:17:51.988718000 +0000 -@@ -0,0 +1,1655 @@ -+/* -+ 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 . -+ */ -+ -+/* This was compiled with a version of gcc modified to emit better -+ debuginfo for SRA'd structures. See: -+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43983 -+ -+ The original program is "pieces.c", in this directory. -+*/ -+ -+ .file "pieces.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+ .p2align 4,,15 -+.globl bar -+ .type bar, @function -+bar: -+.LFB0: -+ .file 1 "pieces.c" -+ # pieces.c:28 -+ .loc 1 28 0 -+.LVL0: -+ # basic block 2 -+ pushl %ebp -+.LCFI0: -+ movl %esp, %ebp -+.LCFI1: -+ # pieces.c:29 -+ .loc 1 29 0 -+ movl 8(%ebp), %eax -+ # pieces.c:30 -+ .loc 1 30 0 -+ popl %ebp -+.LCFI2: -+ ret -+.LFE0: -+ .size bar, .-bar -+ .p2align 4,,15 -+.globl f1 -+ .type f1, @function -+f1: -+.LFB1: -+ # pieces.c:34 -+ .loc 1 34 0 -+.LVL1: -+ # basic block 2 -+ pushl %ebp -+.LCFI3: -+ movl %esp, %ebp -+.LCFI4: -+.LVL2: -+ subl $12, %esp -+.LCFI5: -+ movl %esi, -4(%ebp) -+.LCFI6: -+ # pieces.c:37 -+ .loc 1 37 0 -+ movl 8(%ebp), %esi -+ # pieces.c:34 -+ .loc 1 34 0 -+ movl %ebx, -8(%ebp) -+.LCFI7: -+ # pieces.c:36 -+ .loc 1 36 0 -+ movl $4, %ebx -+.LVL3: -+ # pieces.c:38 -+ .loc 1 38 0 -+ movl %ebx, (%esp) -+ # pieces.c:37 -+ .loc 1 37 0 -+ addl $7, %esi -+.LVL4: -+ # pieces.c:38 -+ .loc 1 38 0 -+ call bar -+ # pieces.c:39 -+ .loc 1 39 0 -+ movl %esi, (%esp) -+ call bar -+ # pieces.c:40 -+ .loc 1 40 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:41 -+ .loc 1 41 0 -+ movl -8(%ebp), %ebx -+.LVL5: -+ movl -4(%ebp), %esi -+.LVL6: -+ movl %ebp, %esp -+.LCFI8: -+ popl %ebp -+.LCFI9: -+ ret -+.LFE1: -+ .size f1, .-f1 -+ .p2align 4,,15 -+.globl f2 -+ .type f2, @function -+f2: -+.LFB2: -+ # pieces.c:45 -+ .loc 1 45 0 -+.LVL7: -+ # basic block 2 -+ pushl %ebp -+.LCFI10: -+ movl %esp, %ebp -+.LCFI11: -+.LVL8: -+ subl $12, %esp -+.LCFI12: -+ movl %esi, -4(%ebp) -+.LCFI13: -+ # pieces.c:48 -+ .loc 1 48 0 -+ movl 8(%ebp), %esi -+ # pieces.c:45 -+ .loc 1 45 0 -+ movl %ebx, -8(%ebp) -+.LCFI14: -+ # pieces.c:47 -+ .loc 1 47 0 -+ movl $4, %ebx -+.LVL9: -+ # pieces.c:49 -+ .loc 1 49 0 -+ movl %ebx, (%esp) -+ # pieces.c:48 -+ .loc 1 48 0 -+ addl $7, %esi -+.LVL10: -+ # pieces.c:49 -+ .loc 1 49 0 -+ call bar -+ # pieces.c:50 -+ .loc 1 50 0 -+ movl %esi, (%esp) -+ call bar -+ # pieces.c:51 -+ .loc 1 51 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:52 -+ .loc 1 52 0 -+ movl -8(%ebp), %ebx -+.LVL11: -+ movl -4(%ebp), %esi -+.LVL12: -+ movl %ebp, %esp -+.LCFI15: -+ popl %ebp -+.LCFI16: -+ ret -+.LFE2: -+ .size f2, .-f2 -+ .p2align 4,,15 -+.globl f3 -+ .type f3, @function -+f3: -+.LFB3: -+ # pieces.c:56 -+ .loc 1 56 0 -+.LVL13: -+ # basic block 2 -+ pushl %ebp -+.LCFI17: -+ # pieces.c:58 -+ .loc 1 58 0 -+ movl $4, %edx -+ # pieces.c:56 -+ .loc 1 56 0 -+ movl %esp, %ebp -+.LCFI18: -+.LVL14: -+ subl $12, %esp -+.LCFI19: -+ # pieces.c:58 -+ .loc 1 58 0 -+.LVL15: -+ # pieces.c:56 -+ .loc 1 56 0 -+ movl %esi, -4(%ebp) -+.LCFI20: -+ # pieces.c:60 -+ .loc 1 60 0 -+ movswl %dx, %esi -+ # pieces.c:56 -+ .loc 1 56 0 -+ movl %ebx, -8(%ebp) -+.LCFI21: -+ # pieces.c:60 -+ .loc 1 60 0 -+ movl %esi, (%esp) -+ call bar -+.LVL16: -+ # pieces.c:57 -+ .loc 1 57 0 -+ movl 8(%ebp), %edx -+ sall $4, %edx -+ # pieces.c:59 -+ .loc 1 59 0 -+ addl $112, %edx -+ sarw $4, %dx -+ # pieces.c:61 -+ .loc 1 61 0 -+ movswl %dx, %ebx -+ movl %ebx, (%esp) -+ call bar -+ # pieces.c:62 -+ .loc 1 62 0 -+ leal (%esi,%ebx), %eax -+ # pieces.c:63 -+ .loc 1 63 0 -+ movl -8(%ebp), %ebx -+ movl -4(%ebp), %esi -+.LVL17: -+ movl %ebp, %esp -+.LCFI22: -+ popl %ebp -+.LCFI23: -+ ret -+.LFE3: -+ .size f3, .-f3 -+ .p2align 4,,15 -+.globl f4 -+ .type f4, @function -+f4: -+.LFB4: -+ # pieces.c:67 -+ .loc 1 67 0 -+.LVL18: -+ # basic block 2 -+ pushl %ebp -+.LCFI24: -+ movl %esp, %ebp -+.LCFI25: -+ subl $12, %esp -+.LCFI26: -+ movl %esi, -4(%ebp) -+.LCFI27: -+ movl 8(%ebp), %esi -+.LVL19: -+ movl %ebx, -8(%ebp) -+.LCFI28: -+ # pieces.c:69 -+ .loc 1 69 0 -+ movl %esi, %ebx -+ # pieces.c:70 -+ .loc 1 70 0 -+ addl $1, %esi -+ # pieces.c:69 -+ .loc 1 69 0 -+.LVL20: -+ # pieces.c:71 -+ .loc 1 71 0 -+ movl %ebx, (%esp) -+ call bar -+ # pieces.c:72 -+ .loc 1 72 0 -+ movl %esi, (%esp) -+ call bar -+ # pieces.c:73 -+ .loc 1 73 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:74 -+ .loc 1 74 0 -+ movl -8(%ebp), %ebx -+.LVL21: -+ movl -4(%ebp), %esi -+.LVL22: -+ movl %ebp, %esp -+.LCFI29: -+ popl %ebp -+.LCFI30: -+ ret -+.LFE4: -+ .size f4, .-f4 -+ .p2align 4,,15 -+.globl f5 -+ .type f5, @function -+f5: -+.LFB5: -+ # pieces.c:78 -+ .loc 1 78 0 -+.LVL23: -+ # basic block 2 -+ pushl %ebp -+.LCFI31: -+ movl %esp, %ebp -+.LCFI32: -+ subl $12, %esp -+.LCFI33: -+ movl %esi, -4(%ebp) -+.LCFI34: -+ movl 8(%ebp), %esi -+.LVL24: -+ movl %ebx, -8(%ebp) -+.LCFI35: -+ # pieces.c:80 -+ .loc 1 80 0 -+ movl %esi, %ebx -+ # pieces.c:81 -+ .loc 1 81 0 -+ addl $1, %esi -+ # pieces.c:80 -+ .loc 1 80 0 -+.LVL25: -+ # pieces.c:82 -+ .loc 1 82 0 -+ movl %ebx, (%esp) -+ call bar -+ # pieces.c:83 -+ .loc 1 83 0 -+ movl %esi, (%esp) -+ call bar -+ # pieces.c:84 -+ .loc 1 84 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:85 -+ .loc 1 85 0 -+ movl -8(%ebp), %ebx -+.LVL26: -+ movl -4(%ebp), %esi -+.LVL27: -+ movl %ebp, %esp -+.LCFI36: -+ popl %ebp -+.LCFI37: -+ ret -+.LFE5: -+ .size f5, .-f5 -+ .p2align 4,,15 -+.globl main -+ .type main, @function -+main: -+.LFB6: -+ # pieces.c:89 -+ .loc 1 89 0 -+ # basic block 2 -+ pushl %ebp -+.LCFI38: -+ movl %esp, %ebp -+.LCFI39: -+ pushl %ebx -+.LCFI40: -+ # pieces.c:91 -+ .loc 1 91 0 -+ movl $7, %ebx -+ # pieces.c:89 -+ .loc 1 89 0 -+ subl $4, %esp -+.LCFI41: -+ # pieces.c:91 -+ .loc 1 91 0 -+.LVL28: -+ # pieces.c:92 -+ .loc 1 92 0 -+ movl %ebx, (%esp) -+ call f1 -+ # pieces.c:93 -+ .loc 1 93 0 -+ movl %ebx, (%esp) -+ call f2 -+ # pieces.c:94 -+ .loc 1 94 0 -+ movl %ebx, (%esp) -+ call f3 -+ # pieces.c:95 -+ .loc 1 95 0 -+ movl %ebx, (%esp) -+ call f4 -+ # pieces.c:96 -+ .loc 1 96 0 -+ movl %ebx, (%esp) -+ call f5 -+ # pieces.c:98 -+ .loc 1 98 0 -+ addl $4, %esp -+ xorl %eax, %eax -+ popl %ebx -+.LCFI42: -+.LVL29: -+ popl %ebp -+.LCFI43: -+ ret -+.LFE6: -+ .size main, .-main -+#APP -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 # Length of Common Information Entry -+.LSCIE0: -+ .long 0xffffffff # CIE Identifier Tag -+ .byte 0x1 # CIE Version -+ .ascii "\0" # CIE Augmentation -+ .uleb128 0x1 # CIE Code Alignment Factor -+ .sleb128 -4 # CIE Data Alignment Factor -+ .byte 0x8 # CIE RA Column -+ .byte 0xc # DW_CFA_def_cfa -+ .uleb128 0x4 -+ .uleb128 0x4 -+ .byte 0x88 # DW_CFA_offset, column 0x8 -+ .uleb128 0x1 -+ .align 4 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 # FDE Length -+.LASFDE0: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB0 # FDE initial location -+ .long .LFE0-.LFB0 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI0-.LFB0 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI2-.LCFI1 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xc # DW_CFA_def_cfa -+ .uleb128 0x4 -+ .uleb128 0x4 -+ .align 4 -+.LEFDE0: -+.LSFDE2: -+ .long .LEFDE2-.LASFDE2 # FDE Length -+.LASFDE2: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB1 # FDE initial location -+ .long .LFE1-.LFB1 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI3-.LFB1 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI4-.LCFI3 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI6-.LCFI4 -+ .byte 0x86 # DW_CFA_offset, column 0x6 -+ .uleb128 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI7-.LCFI6 -+ .byte 0x83 # DW_CFA_offset, column 0x3 -+ .uleb128 0x4 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI8-.LCFI7 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x4 -+ .byte 0xc6 # DW_CFA_restore, column 0x6 -+ .byte 0xc3 # DW_CFA_restore, column 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI9-.LCFI8 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x4 -+ .align 4 -+.LEFDE2: -+.LSFDE4: -+ .long .LEFDE4-.LASFDE4 # FDE Length -+.LASFDE4: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB2 # FDE initial location -+ .long .LFE2-.LFB2 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI10-.LFB2 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI11-.LCFI10 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI13-.LCFI11 -+ .byte 0x86 # DW_CFA_offset, column 0x6 -+ .uleb128 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI14-.LCFI13 -+ .byte 0x83 # DW_CFA_offset, column 0x3 -+ .uleb128 0x4 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI15-.LCFI14 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x4 -+ .byte 0xc6 # DW_CFA_restore, column 0x6 -+ .byte 0xc3 # DW_CFA_restore, column 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI16-.LCFI15 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x4 -+ .align 4 -+.LEFDE4: -+.LSFDE6: -+ .long .LEFDE6-.LASFDE6 # FDE Length -+.LASFDE6: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB3 # FDE initial location -+ .long .LFE3-.LFB3 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI17-.LFB3 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI18-.LCFI17 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI20-.LCFI18 -+ .byte 0x86 # DW_CFA_offset, column 0x6 -+ .uleb128 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI21-.LCFI20 -+ .byte 0x83 # DW_CFA_offset, column 0x3 -+ .uleb128 0x4 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI22-.LCFI21 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x4 -+ .byte 0xc6 # DW_CFA_restore, column 0x6 -+ .byte 0xc3 # DW_CFA_restore, column 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI23-.LCFI22 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x4 -+ .align 4 -+.LEFDE6: -+.LSFDE8: -+ .long .LEFDE8-.LASFDE8 # FDE Length -+.LASFDE8: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB4 # FDE initial location -+ .long .LFE4-.LFB4 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI24-.LFB4 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI25-.LCFI24 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI27-.LCFI25 -+ .byte 0x86 # DW_CFA_offset, column 0x6 -+ .uleb128 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI28-.LCFI27 -+ .byte 0x83 # DW_CFA_offset, column 0x3 -+ .uleb128 0x4 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI29-.LCFI28 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x4 -+ .byte 0xc6 # DW_CFA_restore, column 0x6 -+ .byte 0xc3 # DW_CFA_restore, column 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI30-.LCFI29 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x4 -+ .align 4 -+.LEFDE8: -+.LSFDE10: -+ .long .LEFDE10-.LASFDE10 # FDE Length -+.LASFDE10: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB5 # FDE initial location -+ .long .LFE5-.LFB5 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI31-.LFB5 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI32-.LCFI31 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI34-.LCFI32 -+ .byte 0x86 # DW_CFA_offset, column 0x6 -+ .uleb128 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI35-.LCFI34 -+ .byte 0x83 # DW_CFA_offset, column 0x3 -+ .uleb128 0x4 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI36-.LCFI35 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x4 -+ .byte 0xc6 # DW_CFA_restore, column 0x6 -+ .byte 0xc3 # DW_CFA_restore, column 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI37-.LCFI36 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x4 -+ .align 4 -+.LEFDE10: -+.LSFDE12: -+ .long .LEFDE12-.LASFDE12 # FDE Length -+.LASFDE12: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB6 # FDE initial location -+ .long .LFE6-.LFB6 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI38-.LFB6 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI39-.LCFI38 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI40-.LCFI39 -+ .byte 0x83 # DW_CFA_offset, column 0x3 -+ .uleb128 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI42-.LCFI40 -+ .byte 0xc3 # DW_CFA_restore, column 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI43-.LCFI42 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xc # DW_CFA_def_cfa -+ .uleb128 0x4 -+ .uleb128 0x4 -+ .align 4 -+.LEFDE12: -+#NO_APP -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .long .LFB0-.Ltext0 # Location list begin address (*.LLST0) -+ .long .LCFI0-.Ltext0 # Location list end address (*.LLST0) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI0-.Ltext0 # Location list begin address (*.LLST0) -+ .long .LCFI1-.Ltext0 # Location list end address (*.LLST0) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI1-.Ltext0 # Location list begin address (*.LLST0) -+ .long .LCFI2-.Ltext0 # Location list end address (*.LLST0) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI2-.Ltext0 # Location list begin address (*.LLST0) -+ .long .LFE0-.Ltext0 # Location list end address (*.LLST0) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST0) -+ .long 0 # Location list terminator end (*.LLST0) -+.LLST1: -+ .long .LFB1-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LCFI3-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI3-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LCFI4-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI4-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LCFI8-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI8-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LCFI9-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI9-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LFE1-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST1) -+ .long 0 # Location list terminator end (*.LLST1) -+.LLST2: -+ .long .LVL1-.Ltext0 # Location list begin address (*.LLST2) -+ .long .LVL2-.Ltext0 # Location list end address (*.LLST2) -+ .value 0x6 # Location expression size -+ .byte 0x34 # DW_OP_lit4 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL2-.Ltext0 # Location list begin address (*.LLST2) -+ .long .LVL3-.Ltext0 # Location list end address (*.LLST2) -+ .value 0xc # Location expression size -+ .byte 0x34 # DW_OP_lit4 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x6 # DW_OP_deref -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x6 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL3-.Ltext0 # Location list begin address (*.LLST2) -+ .long .LVL4-.Ltext0 # Location list end address (*.LLST2) -+ .value 0xb # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x6 # DW_OP_deref -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x6 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL4-.Ltext0 # Location list begin address (*.LLST2) -+ .long .LVL5-.Ltext0 # Location list end address (*.LLST2) -+ .value 0x6 # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL5-.Ltext0 # Location list begin address (*.LLST2) -+ .long .LVL6-.Ltext0 # Location list end address (*.LLST2) -+ .value 0x5 # Location expression size -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long 0 # Location list terminator begin (*.LLST2) -+ .long 0 # Location list terminator end (*.LLST2) -+.LLST3: -+ .long .LFB2-.Ltext0 # Location list begin address (*.LLST3) -+ .long .LCFI10-.Ltext0 # Location list end address (*.LLST3) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI10-.Ltext0 # Location list begin address (*.LLST3) -+ .long .LCFI11-.Ltext0 # Location list end address (*.LLST3) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI11-.Ltext0 # Location list begin address (*.LLST3) -+ .long .LCFI15-.Ltext0 # Location list end address (*.LLST3) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI15-.Ltext0 # Location list begin address (*.LLST3) -+ .long .LCFI16-.Ltext0 # Location list end address (*.LLST3) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI16-.Ltext0 # Location list begin address (*.LLST3) -+ .long .LFE2-.Ltext0 # Location list end address (*.LLST3) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST3) -+ .long 0 # Location list terminator end (*.LLST3) -+.LLST4: -+ .long .LVL7-.Ltext0 # Location list begin address (*.LLST4) -+ .long .LVL8-.Ltext0 # Location list end address (*.LLST4) -+ .value 0x6 # Location expression size -+ .byte 0x34 # DW_OP_lit4 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL8-.Ltext0 # Location list begin address (*.LLST4) -+ .long .LVL9-.Ltext0 # Location list end address (*.LLST4) -+ .value 0xc # Location expression size -+ .byte 0x34 # DW_OP_lit4 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x6 # DW_OP_deref -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x6 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL9-.Ltext0 # Location list begin address (*.LLST4) -+ .long .LVL10-.Ltext0 # Location list end address (*.LLST4) -+ .value 0xb # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x6 # DW_OP_deref -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x6 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL10-.Ltext0 # Location list begin address (*.LLST4) -+ .long .LVL11-.Ltext0 # Location list end address (*.LLST4) -+ .value 0x6 # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL11-.Ltext0 # Location list begin address (*.LLST4) -+ .long .LVL12-.Ltext0 # Location list end address (*.LLST4) -+ .value 0x5 # Location expression size -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long 0 # Location list terminator begin (*.LLST4) -+ .long 0 # Location list terminator end (*.LLST4) -+.LLST5: -+ .long .LFB3-.Ltext0 # Location list begin address (*.LLST5) -+ .long .LCFI17-.Ltext0 # Location list end address (*.LLST5) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI17-.Ltext0 # Location list begin address (*.LLST5) -+ .long .LCFI18-.Ltext0 # Location list end address (*.LLST5) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI18-.Ltext0 # Location list begin address (*.LLST5) -+ .long .LCFI22-.Ltext0 # Location list end address (*.LLST5) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI22-.Ltext0 # Location list begin address (*.LLST5) -+ .long .LCFI23-.Ltext0 # Location list end address (*.LLST5) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI23-.Ltext0 # Location list begin address (*.LLST5) -+ .long .LFE3-.Ltext0 # Location list end address (*.LLST5) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST5) -+ .long 0 # Location list terminator end (*.LLST5) -+.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 -+ .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 0 -+ .byte 0x34 # DW_OP_lit4 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0xc -+ .uleb128 0 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x94 # DW_OP_deref_size -+ .byte 0x2 -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x6 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0xc -+ .uleb128 0 -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0x4 -+ .uleb128 0 -+ .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 -+ .byte 0x52 # DW_OP_reg2 -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0xc -+ .uleb128 0 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x94 # DW_OP_deref_size -+ .byte 0x2 -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x7 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0xc -+ .uleb128 0 -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0x4 -+ .uleb128 0 -+ .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 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0xc -+ .uleb128 0 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x94 # DW_OP_deref_size -+ .byte 0x2 -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x7 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0xc -+ .uleb128 0 -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0x4 -+ .uleb128 0 -+ .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 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x94 # DW_OP_deref_size -+ .byte 0x2 -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x7 -+ .byte 0x9f # DW_OP_stack_value -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0xc -+ .uleb128 0 -+ .byte 0x9d # DW_OP_bit_piece -+ .uleb128 0x4 -+ .uleb128 0 -+ .long 0 # Location list terminator begin (*.LLST6) -+ .long 0 # Location list terminator end (*.LLST6) -+.LLST7: -+ .long .LFB4-.Ltext0 # Location list begin address (*.LLST7) -+ .long .LCFI24-.Ltext0 # Location list end address (*.LLST7) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI24-.Ltext0 # Location list begin address (*.LLST7) -+ .long .LCFI25-.Ltext0 # Location list end address (*.LLST7) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI25-.Ltext0 # Location list begin address (*.LLST7) -+ .long .LCFI29-.Ltext0 # Location list end address (*.LLST7) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI29-.Ltext0 # Location list begin address (*.LLST7) -+ .long .LCFI30-.Ltext0 # Location list end address (*.LLST7) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI30-.Ltext0 # Location list begin address (*.LLST7) -+ .long .LFE4-.Ltext0 # Location list end address (*.LLST7) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST7) -+ .long 0 # Location list terminator end (*.LLST7) -+.LLST8: -+ .long .LVL19-.Ltext0 # Location list begin address (*.LLST8) -+ .long .LVL20-.Ltext0 # Location list end address (*.LLST8) -+ .value 0x8 # Location expression size -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL20-.Ltext0 # Location list begin address (*.LLST8) -+ .long .LVL21-.Ltext0 # Location list end address (*.LLST8) -+ .value 0x6 # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL21-.Ltext0 # Location list begin address (*.LLST8) -+ .long .LVL22-.Ltext0 # Location list end address (*.LLST8) -+ .value 0x5 # Location expression size -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long 0 # Location list terminator begin (*.LLST8) -+ .long 0 # Location list terminator end (*.LLST8) -+.LLST9: -+ .long .LFB5-.Ltext0 # Location list begin address (*.LLST9) -+ .long .LCFI31-.Ltext0 # Location list end address (*.LLST9) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI31-.Ltext0 # Location list begin address (*.LLST9) -+ .long .LCFI32-.Ltext0 # Location list end address (*.LLST9) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI32-.Ltext0 # Location list begin address (*.LLST9) -+ .long .LCFI36-.Ltext0 # Location list end address (*.LLST9) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI36-.Ltext0 # Location list begin address (*.LLST9) -+ .long .LCFI37-.Ltext0 # Location list end address (*.LLST9) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI37-.Ltext0 # Location list begin address (*.LLST9) -+ .long .LFE5-.Ltext0 # Location list end address (*.LLST9) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST9) -+ .long 0 # Location list terminator end (*.LLST9) -+.LLST10: -+ .long .LVL24-.Ltext0 # Location list begin address (*.LLST10) -+ .long .LVL25-.Ltext0 # Location list end address (*.LLST10) -+ .value 0x8 # Location expression size -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL25-.Ltext0 # Location list begin address (*.LLST10) -+ .long .LVL26-.Ltext0 # Location list end address (*.LLST10) -+ .value 0x6 # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL26-.Ltext0 # Location list begin address (*.LLST10) -+ .long .LVL27-.Ltext0 # Location list end address (*.LLST10) -+ .value 0x5 # Location expression size -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long 0 # Location list terminator begin (*.LLST10) -+ .long 0 # Location list terminator end (*.LLST10) -+.LLST11: -+ .long .LFB6-.Ltext0 # Location list begin address (*.LLST11) -+ .long .LCFI38-.Ltext0 # Location list end address (*.LLST11) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI38-.Ltext0 # Location list begin address (*.LLST11) -+ .long .LCFI39-.Ltext0 # Location list end address (*.LLST11) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI39-.Ltext0 # Location list begin address (*.LLST11) -+ .long .LCFI43-.Ltext0 # Location list end address (*.LLST11) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI43-.Ltext0 # Location list begin address (*.LLST11) -+ .long .LFE6-.Ltext0 # Location list end address (*.LLST11) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST11) -+ .long 0 # Location list terminator end (*.LLST11) -+.LLST12: -+ .long .LVL28-.Ltext0 # Location list begin address (*.LLST12) -+ .long .LVL29-.Ltext0 # Location list end address (*.LLST12) -+ .value 0x1 # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .long 0 # Location list terminator begin (*.LLST12) -+ .long 0 # Location list terminator end (*.LLST12) -+ .section .debug_info -+ .long 0x1e3 # Length of Compilation Unit Info -+ .value 0x2 # DWARF version number -+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section -+ .byte 0x4 # Pointer Size (in bytes) -+ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) -+ .long .LASF1 # DW_AT_producer: "GNU C 4.6.0 20100506 (experimental) [trunk revision 159117]" -+ .byte 0x1 # DW_AT_language -+ .long .LASF2 # DW_AT_name: "pieces.c" -+ .long .LASF3 # DW_AT_comp_dir: "/home/tromey/gnu/archer/archer/gdb/testsuite/gdb.dwarf2" -+ .long .Ltext0 # DW_AT_low_pc -+ .long .Letext0 # DW_AT_high_pc -+ .long .Ldebug_line0 # DW_AT_stmt_list -+ .uleb128 0x2 # (DIE (0x25) DW_TAG_structure_type) -+ .ascii "A\0" # DW_AT_name -+ .byte 0x8 # DW_AT_byte_size -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x17 # DW_AT_decl_line -+ .long 0x48 # DW_AT_sibling -+ .uleb128 0x3 # (DIE (0x2f) DW_TAG_member) -+ .ascii "i\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x17 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_data_member_location -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0 -+ .uleb128 0x3 # (DIE (0x3b) DW_TAG_member) -+ .ascii "j\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x17 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_data_member_location -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x4 -+ .byte 0 # end of children of DIE 0x25 -+ .uleb128 0x4 # (DIE (0x48) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x5 # DW_AT_encoding -+ .ascii "int\0" # DW_AT_name -+ .uleb128 0x2 # (DIE (0x4f) DW_TAG_structure_type) -+ .ascii "B\0" # DW_AT_name -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x18 # DW_AT_decl_line -+ .long 0x78 # DW_AT_sibling -+ .uleb128 0x5 # (DIE (0x59) DW_TAG_member) -+ .ascii "i\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x18 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0xc # DW_AT_bit_size -+ .byte 0x10 # DW_AT_bit_offset -+ .byte 0x2 # DW_AT_data_member_location -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0 -+ .uleb128 0x5 # (DIE (0x68) DW_TAG_member) -+ .ascii "j\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x18 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0xc # DW_AT_bit_size -+ .byte 0x4 # DW_AT_bit_offset -+ .byte 0x2 # DW_AT_data_member_location -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0 -+ .byte 0 # end of children of DIE 0x4f -+ .uleb128 0x6 # (DIE (0x78) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .ascii "bar\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x1b # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long .LFB0 # DW_AT_low_pc -+ .long .LFE0 # DW_AT_high_pc -+ .long .LLST0 # DW_AT_frame_base -+ .long 0x9e # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x91) DW_TAG_formal_parameter) -+ .ascii "x\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x1b # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0 # end of children of DIE 0x78 -+ .uleb128 0x8 # (DIE (0x9e) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .ascii "f1\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x21 # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long 0x48 # DW_AT_type -+ .long .LFB1 # DW_AT_low_pc -+ .long .LFE1 # DW_AT_high_pc -+ .long .LLST1 # DW_AT_frame_base -+ .long 0xd4 # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0xba) DW_TAG_formal_parameter) -+ .ascii "k\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x21 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .uleb128 0x9 # (DIE (0xc6) DW_TAG_variable) -+ .ascii "a\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x23 # DW_AT_decl_line -+ .long 0x25 # DW_AT_type -+ .long .LLST2 # DW_AT_location -+ .byte 0 # end of children of DIE 0x9e -+ .uleb128 0x8 # (DIE (0xd4) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .ascii "f2\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x2c # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long 0x48 # DW_AT_type -+ .long .LFB2 # DW_AT_low_pc -+ .long .LFE2 # DW_AT_high_pc -+ .long .LLST3 # DW_AT_frame_base -+ .long 0x10a # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0xf0) DW_TAG_formal_parameter) -+ .ascii "k\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x2c # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .uleb128 0x9 # (DIE (0xfc) DW_TAG_variable) -+ .ascii "a\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x2e # DW_AT_decl_line -+ .long 0x10a # DW_AT_type -+ .long .LLST4 # DW_AT_location -+ .byte 0 # end of children of DIE 0xd4 -+ .uleb128 0xa # (DIE (0x10a) DW_TAG_array_type) -+ .long 0x48 # DW_AT_type -+ .long 0x11a # DW_AT_sibling -+ .uleb128 0xb # (DIE (0x113) DW_TAG_subrange_type) -+ .long 0x11a # DW_AT_type -+ .byte 0x1 # DW_AT_upper_bound -+ .byte 0 # end of children of DIE 0x10a -+ .uleb128 0xc # (DIE (0x11a) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x7 # DW_AT_encoding -+ .uleb128 0x8 # (DIE (0x11d) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .ascii "f3\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x37 # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long 0x48 # DW_AT_type -+ .long .LFB3 # DW_AT_low_pc -+ .long .LFE3 # DW_AT_high_pc -+ .long .LLST5 # DW_AT_frame_base -+ .long 0x153 # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x139) DW_TAG_formal_parameter) -+ .ascii "k\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x37 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .uleb128 0x9 # (DIE (0x145) DW_TAG_variable) -+ .ascii "a\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x39 # DW_AT_decl_line -+ .long 0x4f # DW_AT_type -+ .long .LLST6 # DW_AT_location -+ .byte 0 # end of children of DIE 0x11d -+ .uleb128 0x8 # (DIE (0x153) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .ascii "f4\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x42 # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long 0x48 # DW_AT_type -+ .long .LFB4 # DW_AT_low_pc -+ .long .LFE4 # DW_AT_high_pc -+ .long .LLST7 # DW_AT_frame_base -+ .long 0x189 # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x16f) DW_TAG_formal_parameter) -+ .ascii "k\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x42 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .uleb128 0x9 # (DIE (0x17b) DW_TAG_variable) -+ .ascii "a\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x44 # DW_AT_decl_line -+ .long 0x10a # DW_AT_type -+ .long .LLST8 # DW_AT_location -+ .byte 0 # end of children of DIE 0x153 -+ .uleb128 0x8 # (DIE (0x189) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .ascii "f5\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x4d # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long 0x48 # DW_AT_type -+ .long .LFB5 # DW_AT_low_pc -+ .long .LFE5 # DW_AT_high_pc -+ .long .LLST9 # DW_AT_frame_base -+ .long 0x1bf # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x1a5) DW_TAG_formal_parameter) -+ .ascii "k\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x4d # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .uleb128 0x9 # (DIE (0x1b1) DW_TAG_variable) -+ .ascii "a\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x4f # DW_AT_decl_line -+ .long 0x25 # DW_AT_type -+ .long .LLST10 # DW_AT_location -+ .byte 0 # end of children of DIE 0x189 -+ .uleb128 0xd # (DIE (0x1bf) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .long .LASF0 # DW_AT_name: "main" -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x58 # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long 0x48 # DW_AT_type -+ .long .LFB6 # DW_AT_low_pc -+ .long .LFE6 # DW_AT_high_pc -+ .long .LLST11 # DW_AT_frame_base -+ .uleb128 0x9 # (DIE (0x1d8) DW_TAG_variable) -+ .ascii "k\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x5a # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .long .LLST12 # DW_AT_location -+ .byte 0 # end of children of DIE 0x1bf -+ .byte 0 # end of children of DIE 0xb -+ .section .debug_abbrev -+ .uleb128 0x1 # (abbrev code) -+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x25 # (DW_AT_producer) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x13 # (DW_AT_language) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x1b # (DW_AT_comp_dir) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x10 # (DW_AT_stmt_list) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x2 # (abbrev code) -+ .uleb128 0x13 # (TAG: DW_TAG_structure_type) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x3 # (abbrev code) -+ .uleb128 0xd # (TAG: DW_TAG_member) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x38 # (DW_AT_data_member_location) -+ .uleb128 0xa # (DW_FORM_block1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x4 # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0 # DW_children_no -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3e # (DW_AT_encoding) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x5 # (abbrev code) -+ .uleb128 0xd # (TAG: DW_TAG_member) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0xd # (DW_AT_bit_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0xc # (DW_AT_bit_offset) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x38 # (DW_AT_data_member_location) -+ .uleb128 0xa # (DW_FORM_block1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x6 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x7 # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0xa # (DW_FORM_block1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x8 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x9 # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xa # (abbrev code) -+ .uleb128 0x1 # (TAG: DW_TAG_array_type) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xb # (abbrev code) -+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type) -+ .byte 0 # DW_children_no -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2f # (DW_AT_upper_bound) -+ .uleb128 0xb # (DW_FORM_data1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xc # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0 # DW_children_no -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3e # (DW_AT_encoding) -+ .uleb128 0xb # (DW_FORM_data1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xd # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x27 # (DW_AT_prototyped) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x42 # Length of Public Names Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .long 0x1e7 # Compilation Unit Length -+ .long 0x78 # DIE offset -+ .ascii "bar\0" # external name -+ .long 0x9e # DIE offset -+ .ascii "f1\0" # external name -+ .long 0xd4 # DIE offset -+ .ascii "f2\0" # external name -+ .long 0x11d # DIE offset -+ .ascii "f3\0" # external name -+ .long 0x153 # DIE offset -+ .ascii "f4\0" # external name -+ .long 0x189 # DIE offset -+ .ascii "f5\0" # external name -+ .long 0x1bf # DIE offset -+ .ascii "main\0" # external name -+ .long 0 -+ .section .debug_pubtypes,"",@progbits -+ .long 0x1a # Length of Public Type Names Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .long 0x1e7 # Compilation Unit Length -+ .long 0x25 # DIE offset -+ .ascii "A\0" # external name -+ .long 0x4f # DIE offset -+ .ascii "B\0" # external name -+ .long 0 -+ .section .debug_aranges,"",@progbits -+ .long 0x1c # Length of Address Ranges Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .byte 0x4 # Size of Address -+ .byte 0 # Size of Segment Descriptor -+ .value 0 # Pad to 8 byte boundary -+ .value 0 -+ .long .Ltext0 # Address -+ .long .Letext0-.Ltext0 # Length -+ .long 0 -+ .long 0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF2: -+ .string "pieces.c" -+.LASF3: -+ .string "/home/tromey/gnu/archer/archer/gdb/testsuite/gdb.dwarf2" -+.LASF1: -+ .string "GNU C 4.6.0 20100506 (experimental) [trunk revision 159117]" -+.LASF0: -+ .string "main" -+ .ident "GCC: (GNU) 4.6.0 20100506 (experimental) [trunk revision 159117]" -+ .section .note.GNU-stack,"",@progbits ---- src/gdb/testsuite/gdb.dwarf2/pieces.c -+++ src/gdb/testsuite/gdb.dwarf2/pieces.c 2010-05-25 20:18:00.627622000 +0000 -@@ -0,0 +1,98 @@ -+/* Copyright (C) 2010 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* The original program corresponding to pieces.S. -+ This came from https://bugzilla.redhat.com/show_bug.cgi?id=589467 -+ Note that it is not ever compiled, pieces.S is used instead. -+ 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; }; -+ -+__attribute__((noinline)) void -+bar (int x) -+{ -+ asm volatile ("" : : "r" (x) : "memory"); -+} -+ -+__attribute__((noinline)) int -+f1 (int k) -+{ -+ struct A a = { 4, k + 6 }; -+ asm ("" : "+r" (a.i)); -+ a.j++; -+ bar (a.i); /* { dg-final { gdb-test 20 "a.i" "4" } } */ -+ bar (a.j); /* { dg-final { gdb-test 20 "a.j" "14" } } */ -+ return a.i + a.j; /* f1 breakpoint */ -+} -+ -+__attribute__((noinline)) int -+f2 (int k) -+{ -+ int a[2] = { 4, k + 6 }; -+ asm ("" : "+r" (a[0])); -+ a[1]++; -+ bar (a[0]); /* { dg-final { gdb-test 31 "a\[0\]" "4" } } */ -+ bar (a[1]); /* { dg-final { gdb-test 31 "a\[1\]" "14" } } */ -+ return a[0] + a[1]; /* f2 breakpoint */ -+} -+ -+__attribute__((noinline)) int -+f3 (int k) -+{ -+ struct B a = { 4, k + 6 }; -+ asm ("" : "+r" (a.i)); -+ a.j++; -+ bar (a.i); /* { dg-final { gdb-test 42 "a.i" "4" } } */ -+ bar (a.j); /* { dg-final { gdb-test 42 "a.j" "14" } } */ -+ return a.i + a.j; /* f3 breakpoint */ -+} -+ -+__attribute__((noinline)) int -+f4 (int k) -+{ -+ int a[2] = { k, k }; -+ asm ("" : "+r" (a[0])); -+ a[1]++; -+ bar (a[0]); -+ bar (a[1]); -+ return a[0] + a[1]; /* f4 breakpoint */ -+} -+ -+__attribute__((noinline)) int -+f5 (int k) -+{ -+ struct A a = { k, k }; -+ asm ("" : "+r" (a.i)); -+ a.j++; -+ bar (a.i); -+ bar (a.j); -+ return a.i + a.j; /* f5 breakpoint */ -+} -+ -+int -+main (void) -+{ -+ int k; -+ asm ("" : "=r" (k) : "0" (7)); -+ f1 (k); -+ f2 (k); -+ f3 (k); -+ f4 (k); -+ f5 (k); -+ return 0; -+} ---- src/gdb/testsuite/gdb.dwarf2/pieces.exp -+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010-05-25 20:18:03.961111000 +0000 -@@ -0,0 +1,57 @@ -+# 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 . -+ -+# Test some DWARF piece operators. -+ -+# 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 -+} -+# This test can only be run on x86 targets. -+if {![istarget i?86-*]} { -+ return 0 -+} -+ -+set testfile "pieces" -+set srcfile ${testfile}.S -+set csrcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile}.x -+ -+if {[prepare_for_testing ${testfile}.exp ${testfile}.x $srcfile]} { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+# Function f1 tests a particular gdb bug involving DW_OP_piece. -+proc pieces_test_f1 {} { -+ global csrcfile -+ set line [gdb_get_line_number "f1 breakpoint" $csrcfile] -+ gdb_test "break pieces.c:$line" "Breakpoint 2.*" \ -+ "set f1 breakpoint for pieces" -+ gdb_continue_to_breakpoint "continue to f1 breakpoint for pieces" -+ gdb_test "print a" " = {i = 4, j = 14}" "print a in pieces:f1" -+ gdb_test "print a.j" " = 14" "print a.j in pieces:f1" -+} -+ -+pieces_test_f1 diff --git a/gdb-bz589467-pieces2of4.patch b/gdb-bz589467-pieces2of4.patch deleted file mode 100644 index 4c27039..0000000 --- a/gdb-bz589467-pieces2of4.patch +++ /dev/null @@ -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 -+ -+ * eval.c (evaluate_subexp_standard) : 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 - -+ * 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 diff --git a/gdb-bz589467-pieces3of4.patch b/gdb-bz589467-pieces3of4.patch deleted file mode 100644 index 3d77fcf..0000000 --- a/gdb-bz589467-pieces3of4.patch +++ /dev/null @@ -1,1198 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2010-05/msg00190.html - -### src/gdb/ChangeLog 2010/05/21 20:56:48 1.11831 -### src/gdb/ChangeLog 2010/05/21 21:01:46 1.11832 -## -1,5 +1,16 @@ - 2010-05-21 Tom Tromey - -+ * dwarf2loc.c (read_pieced_value): Exit loop when result is full. -+ : New case. -+ * dwarf2expr.h (enum dwarf_value_location) -+ : New constant. -+ * dwarf2expr.c (dwarf_expr_stack_empty_p): New function. -+ (add_piece): Handle empty piece. -+ (execute_stack_op) : Handle -+ DWARF_VALUE_OPTIMIZED_OUT. -+ -### src/gdb/testsuite/ChangeLog 2010/05/21 20:56:49 1.2274 -### src/gdb/testsuite/ChangeLog 2010/05/21 21:01:46 1.2275 -## -1,5 +1,13 @@ - 2010-05-21 Tom Tromey - -+ * gdb.dwarf2/pieces.exp (pieces_test_f6): New proc. -+ Call it. -+ * gdb.dwarf2/pieces.c (struct C): New. -+ (f6): New function. -+ * gdb.dwarf2/pieces.S: Replace. -+ ---- src/gdb/dwarf2expr.c 2010/05/14 17:53:16 1.42 -+++ src/gdb/dwarf2expr.c 2010/05/21 21:01:46 1.43 -@@ -143,6 +143,14 @@ - - } - -+/* Return true if the expression stack is empty. */ -+ -+static int -+dwarf_expr_stack_empty_p (struct dwarf_expr_context *ctx) -+{ -+ return ctx->stack_len == 0; -+} -+ - /* Add a new piece to CTX's piece list. */ - static void - add_piece (struct dwarf_expr_context *ctx, ULONGEST size) -@@ -167,6 +175,15 @@ - p->v.literal.data = ctx->data; - p->v.literal.length = ctx->len; - } -+ else if (dwarf_expr_stack_empty_p (ctx)) -+ { -+ p->location = DWARF_VALUE_OPTIMIZED_OUT; -+ /* Also reset the context's location, for our callers. This is -+ a somewhat strange approach, but this lets us avoid setting -+ the location to DWARF_VALUE_MEMORY in all the individual -+ cases in the evaluator. */ -+ ctx->location = DWARF_VALUE_OPTIMIZED_OUT; -+ } - else - { - p->v.expr.value = dwarf_expr_fetch (ctx, 0); -@@ -859,7 +876,8 @@ - - /* Pop off the address/regnum, and reset the location - type. */ -- if (ctx->location != DWARF_VALUE_LITERAL) -+ if (ctx->location != DWARF_VALUE_LITERAL -+ && ctx->location != DWARF_VALUE_OPTIMIZED_OUT) - dwarf_expr_pop (ctx); - ctx->location = DWARF_VALUE_MEMORY; - } ---- src/gdb/dwarf2expr.h 2010/01/01 07:31:30 1.20 -+++ src/gdb/dwarf2expr.h 2010/05/21 21:01:46 1.21 -@@ -38,7 +38,10 @@ - DWARF_VALUE_STACK, - - /* The piece is a literal. */ -- DWARF_VALUE_LITERAL -+ DWARF_VALUE_LITERAL, -+ -+ /* The piece was optimized out. */ -+ DWARF_VALUE_OPTIMIZED_OUT - }; - - /* The dwarf expression stack. */ ---- src/gdb/dwarf2loc.c 2010/05/21 20:39:50 1.79 -+++ src/gdb/dwarf2loc.c 2010/05/21 21:01:46 1.80 -@@ -384,6 +384,16 @@ - } - break; - -+ case DWARF_VALUE_OPTIMIZED_OUT: -+ /* 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; " -+ "replacing with zeroes"), -+ offset, -+ offset + (long) this_size); -+ break; -+ - default: - internal_error (__FILE__, __LINE__, _("invalid location type")); - } -@@ -609,6 +619,9 @@ - } - break; - -+ /* DWARF_VALUE_OPTIMIZED_OUT can't occur in this context -- -+ it can only be encountered when making a piece. */ -+ case DWARF_VALUE_OPTIMIZED_OUT: - default: - internal_error (__FILE__, __LINE__, _("invalid location type")); - } ---- src/gdb/testsuite/gdb.dwarf2/pieces.S 2010/05/21 20:39:50 1.1 -+++ src/gdb/testsuite/gdb.dwarf2/pieces.S 2010/05/21 21:01:46 1.2 -@@ -37,19 +37,19 @@ - bar: - .LFB0: - .file 1 "pieces.c" -- # pieces.c:28 -- .loc 1 28 0 -+ # pieces.c:29 -+ .loc 1 29 0 - .LVL0: - # basic block 2 - pushl %ebp - .LCFI0: - movl %esp, %ebp - .LCFI1: -- # pieces.c:29 -- .loc 1 29 0 -- movl 8(%ebp), %eax - # pieces.c:30 - .loc 1 30 0 -+ movl 8(%ebp), %eax -+ # pieces.c:31 -+ .loc 1 31 0 - popl %ebp - .LCFI2: - ret -@@ -60,8 +60,8 @@ - .type f1, @function - f1: - .LFB1: -- # pieces.c:34 -- .loc 1 34 0 -+ # pieces.c:35 -+ .loc 1 35 0 - .LVL1: - # basic block 2 - pushl %ebp -@@ -73,36 +73,36 @@ - .LCFI5: - movl %esi, -4(%ebp) - .LCFI6: -- # pieces.c:37 -- .loc 1 37 0 -+ # pieces.c:38 -+ .loc 1 38 0 - movl 8(%ebp), %esi -- # pieces.c:34 -- .loc 1 34 0 -+ # pieces.c:35 -+ .loc 1 35 0 - movl %ebx, -8(%ebp) - .LCFI7: -- # pieces.c:36 -- .loc 1 36 0 -+ # pieces.c:37 -+ .loc 1 37 0 - movl $4, %ebx - .LVL3: -+ # pieces.c:39 -+ .loc 1 39 0 -+ movl %ebx, (%esp) - # pieces.c:38 - .loc 1 38 0 -- movl %ebx, (%esp) -- # pieces.c:37 -- .loc 1 37 0 - addl $7, %esi - .LVL4: -- # pieces.c:38 -- .loc 1 38 0 -- call bar - # pieces.c:39 - .loc 1 39 0 -- movl %esi, (%esp) - call bar - # pieces.c:40 - .loc 1 40 0 -- leal (%ebx,%esi), %eax -+ movl %esi, (%esp) -+ call bar - # pieces.c:41 - .loc 1 41 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:42 -+ .loc 1 42 0 - movl -8(%ebp), %ebx - .LVL5: - movl -4(%ebp), %esi -@@ -119,8 +119,8 @@ - .type f2, @function - f2: - .LFB2: -- # pieces.c:45 -- .loc 1 45 0 -+ # pieces.c:46 -+ .loc 1 46 0 - .LVL7: - # basic block 2 - pushl %ebp -@@ -132,36 +132,36 @@ - .LCFI12: - movl %esi, -4(%ebp) - .LCFI13: -- # pieces.c:48 -- .loc 1 48 0 -+ # pieces.c:49 -+ .loc 1 49 0 - movl 8(%ebp), %esi -- # pieces.c:45 -- .loc 1 45 0 -+ # pieces.c:46 -+ .loc 1 46 0 - movl %ebx, -8(%ebp) - .LCFI14: -- # pieces.c:47 -- .loc 1 47 0 -+ # pieces.c:48 -+ .loc 1 48 0 - movl $4, %ebx - .LVL9: -+ # pieces.c:50 -+ .loc 1 50 0 -+ movl %ebx, (%esp) - # pieces.c:49 - .loc 1 49 0 -- movl %ebx, (%esp) -- # pieces.c:48 -- .loc 1 48 0 - addl $7, %esi - .LVL10: -- # pieces.c:49 -- .loc 1 49 0 -- call bar - # pieces.c:50 - .loc 1 50 0 -- movl %esi, (%esp) - call bar - # pieces.c:51 - .loc 1 51 0 -- leal (%ebx,%esi), %eax -+ movl %esi, (%esp) -+ call bar - # pieces.c:52 - .loc 1 52 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:53 -+ .loc 1 53 0 - movl -8(%ebp), %ebx - .LVL11: - movl -4(%ebp), %esi -@@ -178,59 +178,59 @@ - .type f3, @function - f3: - .LFB3: -- # pieces.c:56 -- .loc 1 56 0 -+ # pieces.c:57 -+ .loc 1 57 0 - .LVL13: - # basic block 2 - pushl %ebp - .LCFI17: -- # pieces.c:58 -- .loc 1 58 0 -+ # pieces.c:59 -+ .loc 1 59 0 - movl $4, %edx -- # pieces.c:56 -- .loc 1 56 0 -+ # pieces.c:57 -+ .loc 1 57 0 - movl %esp, %ebp - .LCFI18: - .LVL14: - subl $12, %esp - .LCFI19: -- # pieces.c:58 -- .loc 1 58 0 -+ # pieces.c:59 -+ .loc 1 59 0 - .LVL15: -- # pieces.c:56 -- .loc 1 56 0 -+ # pieces.c:57 -+ .loc 1 57 0 - movl %esi, -4(%ebp) - .LCFI20: -- # pieces.c:60 -- .loc 1 60 0 -+ # pieces.c:61 -+ .loc 1 61 0 - movswl %dx, %esi -- # pieces.c:56 -- .loc 1 56 0 -+ # pieces.c:57 -+ .loc 1 57 0 - movl %ebx, -8(%ebp) - .LCFI21: -- # pieces.c:60 -- .loc 1 60 0 -+ # pieces.c:61 -+ .loc 1 61 0 - movl %esi, (%esp) - call bar - .LVL16: -- # pieces.c:57 -- .loc 1 57 0 -+ # pieces.c:58 -+ .loc 1 58 0 - movl 8(%ebp), %edx - sall $4, %edx -- # pieces.c:59 -- .loc 1 59 0 -+ # pieces.c:60 -+ .loc 1 60 0 - addl $112, %edx - sarw $4, %dx -- # pieces.c:61 -- .loc 1 61 0 -+ # pieces.c:62 -+ .loc 1 62 0 - movswl %dx, %ebx - movl %ebx, (%esp) - call bar -- # pieces.c:62 -- .loc 1 62 0 -- leal (%esi,%ebx), %eax - # pieces.c:63 - .loc 1 63 0 -+ leal (%esi,%ebx), %eax -+ # pieces.c:64 -+ .loc 1 64 0 - movl -8(%ebp), %ebx - movl -4(%ebp), %esi - .LVL17: -@@ -246,8 +246,8 @@ - .type f4, @function - f4: - .LFB4: -- # pieces.c:67 -- .loc 1 67 0 -+ # pieces.c:68 -+ .loc 1 68 0 - .LVL18: - # basic block 2 - pushl %ebp -@@ -262,28 +262,28 @@ - .LVL19: - movl %ebx, -8(%ebp) - .LCFI28: -- # pieces.c:69 -- .loc 1 69 0 -- movl %esi, %ebx - # pieces.c:70 - .loc 1 70 0 -- addl $1, %esi -- # pieces.c:69 -- .loc 1 69 0 --.LVL20: -+ movl %esi, %ebx - # pieces.c:71 - .loc 1 71 0 -- movl %ebx, (%esp) -- call bar -+ addl $1, %esi -+ # pieces.c:70 -+ .loc 1 70 0 -+.LVL20: - # pieces.c:72 - .loc 1 72 0 -- movl %esi, (%esp) -+ movl %ebx, (%esp) - call bar - # pieces.c:73 - .loc 1 73 0 -- leal (%ebx,%esi), %eax -+ movl %esi, (%esp) -+ call bar - # pieces.c:74 - .loc 1 74 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:75 -+ .loc 1 75 0 - movl -8(%ebp), %ebx - .LVL21: - movl -4(%ebp), %esi -@@ -300,8 +300,8 @@ - .type f5, @function - f5: - .LFB5: -- # pieces.c:78 -- .loc 1 78 0 -+ # pieces.c:79 -+ .loc 1 79 0 - .LVL23: - # basic block 2 - pushl %ebp -@@ -316,28 +316,28 @@ - .LVL24: - movl %ebx, -8(%ebp) - .LCFI35: -- # pieces.c:80 -- .loc 1 80 0 -- movl %esi, %ebx - # pieces.c:81 - .loc 1 81 0 -- addl $1, %esi -- # pieces.c:80 -- .loc 1 80 0 --.LVL25: -+ movl %esi, %ebx - # pieces.c:82 - .loc 1 82 0 -- movl %ebx, (%esp) -- call bar -+ addl $1, %esi -+ # pieces.c:81 -+ .loc 1 81 0 -+.LVL25: - # pieces.c:83 - .loc 1 83 0 -- movl %esi, (%esp) -+ movl %ebx, (%esp) - call bar - # pieces.c:84 - .loc 1 84 0 -- leal (%ebx,%esi), %eax -+ movl %esi, (%esp) -+ call bar - # pieces.c:85 - .loc 1 85 0 -+ leal (%ebx,%esi), %eax -+ # pieces.c:86 -+ .loc 1 86 0 - movl -8(%ebp), %ebx - .LVL26: - movl -4(%ebp), %esi -@@ -350,60 +350,118 @@ - .LFE5: - .size f5, .-f5 - .p2align 4,,15 --.globl main -- .type main, @function --main: -+.globl f6 -+ .type f6, @function -+f6: - .LFB6: -- # pieces.c:89 -- .loc 1 89 0 -+ # pieces.c:90 -+ .loc 1 90 0 -+.LVL28: - # basic block 2 - pushl %ebp - .LCFI38: - movl %esp, %ebp - .LCFI39: -- pushl %ebx -+ subl $12, %esp - .LCFI40: -- # pieces.c:91 -- .loc 1 91 0 -- movl $7, %ebx -- # pieces.c:89 -- .loc 1 89 0 -- subl $4, %esp -+ movl %esi, -4(%ebp) - .LCFI41: -- # pieces.c:91 -- .loc 1 91 0 --.LVL28: -- # pieces.c:92 -- .loc 1 92 0 -- movl %ebx, (%esp) -- call f1 -+ movl 8(%ebp), %esi -+.LVL29: -+ movl %ebx, -8(%ebp) -+.LCFI42: - # pieces.c:93 - .loc 1 93 0 -- movl %ebx, (%esp) -- call f2 -+ movl %esi, %ebx - # pieces.c:94 - .loc 1 94 0 -- movl %ebx, (%esp) -- call f3 -+ addl $1, %esi -+ # pieces.c:93 -+ .loc 1 93 0 -+.LVL30: - # pieces.c:95 - .loc 1 95 0 - movl %ebx, (%esp) -- call f4 -+ call bar - # pieces.c:96 - .loc 1 96 0 -- movl %ebx, (%esp) -- call f5 -+ movl %esi, (%esp) -+ call bar -+ # pieces.c:97 -+ .loc 1 97 0 -+ leal (%ebx,%esi), %eax - # pieces.c:98 - .loc 1 98 0 -+ movl -8(%ebp), %ebx -+.LVL31: -+ movl -4(%ebp), %esi -+.LVL32: -+ movl %ebp, %esp -+.LCFI43: -+ popl %ebp -+.LCFI44: -+ ret -+.LFE6: -+ .size f6, .-f6 -+ .p2align 4,,15 -+.globl main -+ .type main, @function -+main: -+.LFB7: -+ # pieces.c:102 -+ .loc 1 102 0 -+ # basic block 2 -+ pushl %ebp -+.LCFI45: -+ movl %esp, %ebp -+.LCFI46: -+ pushl %ebx -+.LCFI47: -+ # pieces.c:104 -+ .loc 1 104 0 -+ movl $7, %ebx -+ # pieces.c:102 -+ .loc 1 102 0 -+ subl $4, %esp -+.LCFI48: -+ # pieces.c:104 -+ .loc 1 104 0 -+.LVL33: -+ # pieces.c:105 -+ .loc 1 105 0 -+ movl %ebx, (%esp) -+ call f1 -+ # pieces.c:106 -+ .loc 1 106 0 -+ movl %ebx, (%esp) -+ call f2 -+ # pieces.c:107 -+ .loc 1 107 0 -+ movl %ebx, (%esp) -+ call f3 -+ # pieces.c:108 -+ .loc 1 108 0 -+ movl %ebx, (%esp) -+ call f4 -+ # pieces.c:109 -+ .loc 1 109 0 -+ movl %ebx, (%esp) -+ call f5 -+ # pieces.c:110 -+ .loc 1 110 0 -+ movl %ebx, (%esp) -+ call f6 -+ # pieces.c:112 -+ .loc 1 112 0 - addl $4, %esp - xorl %eax, %eax - popl %ebx --.LCFI42: --.LVL29: -+.LCFI49: -+.LVL34: - popl %ebp --.LCFI43: -+.LCFI50: - ret --.LFE6: -+.LFE7: - .size main, .-main - #APP - .section .debug_frame,"",@progbits -@@ -649,20 +707,57 @@ - .byte 0xd # DW_CFA_def_cfa_register - .uleb128 0x5 - .byte 0x4 # DW_CFA_advance_loc4 -- .long .LCFI40-.LCFI39 -+ .long .LCFI41-.LCFI39 -+ .byte 0x86 # DW_CFA_offset, column 0x6 -+ .uleb128 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI42-.LCFI41 -+ .byte 0x83 # DW_CFA_offset, column 0x3 -+ .uleb128 0x4 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI43-.LCFI42 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x4 -+ .byte 0xc6 # DW_CFA_restore, column 0x6 -+ .byte 0xc3 # DW_CFA_restore, column 0x3 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI44-.LCFI43 -+ .byte 0xc5 # DW_CFA_restore, column 0x5 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x4 -+ .align 4 -+.LEFDE12: -+.LSFDE14: -+ .long .LEFDE14-.LASFDE14 # FDE Length -+.LASFDE14: -+ .long .Lframe0 # FDE CIE offset -+ .long .LFB7 # FDE initial location -+ .long .LFE7-.LFB7 # FDE address range -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI45-.LFB7 -+ .byte 0xe # DW_CFA_def_cfa_offset -+ .uleb128 0x8 -+ .byte 0x85 # DW_CFA_offset, column 0x5 -+ .uleb128 0x2 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI46-.LCFI45 -+ .byte 0xd # DW_CFA_def_cfa_register -+ .uleb128 0x5 -+ .byte 0x4 # DW_CFA_advance_loc4 -+ .long .LCFI47-.LCFI46 - .byte 0x83 # DW_CFA_offset, column 0x3 - .uleb128 0x3 - .byte 0x4 # DW_CFA_advance_loc4 -- .long .LCFI42-.LCFI40 -+ .long .LCFI49-.LCFI47 - .byte 0xc3 # DW_CFA_restore, column 0x3 - .byte 0x4 # DW_CFA_advance_loc4 -- .long .LCFI43-.LCFI42 -+ .long .LCFI50-.LCFI49 - .byte 0xc5 # DW_CFA_restore, column 0x5 - .byte 0xc # DW_CFA_def_cfa - .uleb128 0x4 - .uleb128 0x4 - .align 4 --.LEFDE12: -+.LEFDE14: - #NO_APP - .text - .Letext0: -@@ -1130,6 +1225,11 @@ - .byte 0x75 # DW_OP_breg5 - .sleb128 8 - .long .LCFI43-.Ltext0 # Location list begin address (*.LLST11) -+ .long .LCFI44-.Ltext0 # Location list end address (*.LLST11) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI44-.Ltext0 # Location list begin address (*.LLST11) - .long .LFE6-.Ltext0 # Location list end address (*.LLST11) - .value 0x2 # Location expression size - .byte 0x74 # DW_OP_breg4 -@@ -1137,14 +1237,74 @@ - .long 0 # Location list terminator begin (*.LLST11) - .long 0 # Location list terminator end (*.LLST11) - .LLST12: -- .long .LVL28-.Ltext0 # Location list begin address (*.LLST12) -- .long .LVL29-.Ltext0 # Location list end address (*.LLST12) -- .value 0x1 # Location expression size -+ .long .LVL29-.Ltext0 # Location list begin address (*.LLST12) -+ .long .LVL30-.Ltext0 # Location list end address (*.LLST12) -+ .value 0xa # Location expression size -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL30-.Ltext0 # Location list begin address (*.LLST12) -+ .long .LVL31-.Ltext0 # Location list end address (*.LLST12) -+ .value 0x8 # Location expression size - .byte 0x53 # DW_OP_reg3 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .long .LVL31-.Ltext0 # Location list begin address (*.LLST12) -+ .long .LVL32-.Ltext0 # Location list end address (*.LLST12) -+ .value 0x7 # Location expression size -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x56 # DW_OP_reg6 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 -+ .byte 0x93 # DW_OP_piece -+ .uleb128 0x4 - .long 0 # Location list terminator begin (*.LLST12) - .long 0 # Location list terminator end (*.LLST12) -+.LLST13: -+ .long .LFB7-.Ltext0 # Location list begin address (*.LLST13) -+ .long .LCFI45-.Ltext0 # Location list end address (*.LLST13) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI45-.Ltext0 # Location list begin address (*.LLST13) -+ .long .LCFI46-.Ltext0 # Location list end address (*.LLST13) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI46-.Ltext0 # Location list begin address (*.LLST13) -+ .long .LCFI50-.Ltext0 # Location list end address (*.LLST13) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI50-.Ltext0 # Location list begin address (*.LLST13) -+ .long .LFE7-.Ltext0 # Location list end address (*.LLST13) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST13) -+ .long 0 # Location list terminator end (*.LLST13) -+.LLST14: -+ .long .LVL33-.Ltext0 # Location list begin address (*.LLST14) -+ .long .LVL34-.Ltext0 # Location list end address (*.LLST14) -+ .value 0x1 # Location expression size -+ .byte 0x53 # DW_OP_reg3 -+ .long 0 # Location list terminator begin (*.LLST14) -+ .long 0 # Location list terminator end (*.LLST14) - .section .debug_info -- .long 0x1e3 # Length of Compilation Unit Info -+ .long 0x252 # Length of Compilation Unit Info - .value 0x2 # DWARF version number - .long .Ldebug_abbrev0 # Offset Into Abbrev. Section - .byte 0x4 # Pointer Size (in bytes) -@@ -1212,182 +1372,245 @@ - .byte 0x23 # DW_OP_plus_uconst - .uleb128 0 - .byte 0 # end of children of DIE 0x4f -- .uleb128 0x6 # (DIE (0x78) DW_TAG_subprogram) -+ .uleb128 0x2 # (DIE (0x78) DW_TAG_structure_type) -+ .ascii "C\0" # DW_AT_name -+ .byte 0xc # DW_AT_byte_size -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x19 # DW_AT_decl_line -+ .long 0xa7 # DW_AT_sibling -+ .uleb128 0x3 # (DIE (0x82) DW_TAG_member) -+ .ascii "i\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x19 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_data_member_location -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0 -+ .uleb128 0x3 # (DIE (0x8e) DW_TAG_member) -+ .ascii "j\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x19 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_data_member_location -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x4 -+ .uleb128 0x3 # (DIE (0x9a) DW_TAG_member) -+ .ascii "q\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x19 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_data_member_location -+ .byte 0x23 # DW_OP_plus_uconst -+ .uleb128 0x8 -+ .byte 0 # end of children of DIE 0x78 -+ .uleb128 0x6 # (DIE (0xa7) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external - .ascii "bar\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x1b # DW_AT_decl_line -+ .byte 0x1c # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long .LFB0 # DW_AT_low_pc - .long .LFE0 # DW_AT_high_pc - .long .LLST0 # DW_AT_frame_base -- .long 0x9e # DW_AT_sibling -- .uleb128 0x7 # (DIE (0x91) DW_TAG_formal_parameter) -+ .long 0xcd # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0xc0) DW_TAG_formal_parameter) - .ascii "x\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x1b # DW_AT_decl_line -+ .byte 0x1c # DW_AT_decl_line - .long 0x48 # DW_AT_type - .byte 0x2 # DW_AT_location - .byte 0x91 # DW_OP_fbreg - .sleb128 0 -- .byte 0 # end of children of DIE 0x78 -- .uleb128 0x8 # (DIE (0x9e) DW_TAG_subprogram) -+ .byte 0 # end of children of DIE 0xa7 -+ .uleb128 0x8 # (DIE (0xcd) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external - .ascii "f1\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x21 # DW_AT_decl_line -+ .byte 0x22 # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x48 # DW_AT_type - .long .LFB1 # DW_AT_low_pc - .long .LFE1 # DW_AT_high_pc - .long .LLST1 # DW_AT_frame_base -- .long 0xd4 # DW_AT_sibling -- .uleb128 0x7 # (DIE (0xba) DW_TAG_formal_parameter) -+ .long 0x103 # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0xe9) DW_TAG_formal_parameter) - .ascii "k\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x21 # DW_AT_decl_line -+ .byte 0x22 # DW_AT_decl_line - .long 0x48 # DW_AT_type - .byte 0x2 # DW_AT_location - .byte 0x91 # DW_OP_fbreg - .sleb128 0 -- .uleb128 0x9 # (DIE (0xc6) DW_TAG_variable) -+ .uleb128 0x9 # (DIE (0xf5) DW_TAG_variable) - .ascii "a\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x23 # DW_AT_decl_line -+ .byte 0x24 # DW_AT_decl_line - .long 0x25 # DW_AT_type - .long .LLST2 # DW_AT_location -- .byte 0 # end of children of DIE 0x9e -- .uleb128 0x8 # (DIE (0xd4) DW_TAG_subprogram) -+ .byte 0 # end of children of DIE 0xcd -+ .uleb128 0x8 # (DIE (0x103) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external - .ascii "f2\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x2c # DW_AT_decl_line -+ .byte 0x2d # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x48 # DW_AT_type - .long .LFB2 # DW_AT_low_pc - .long .LFE2 # DW_AT_high_pc - .long .LLST3 # DW_AT_frame_base -- .long 0x10a # DW_AT_sibling -- .uleb128 0x7 # (DIE (0xf0) DW_TAG_formal_parameter) -+ .long 0x139 # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x11f) DW_TAG_formal_parameter) - .ascii "k\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x2c # DW_AT_decl_line -+ .byte 0x2d # DW_AT_decl_line - .long 0x48 # DW_AT_type - .byte 0x2 # DW_AT_location - .byte 0x91 # DW_OP_fbreg - .sleb128 0 -- .uleb128 0x9 # (DIE (0xfc) DW_TAG_variable) -+ .uleb128 0x9 # (DIE (0x12b) DW_TAG_variable) - .ascii "a\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x2e # DW_AT_decl_line -- .long 0x10a # DW_AT_type -+ .byte 0x2f # DW_AT_decl_line -+ .long 0x139 # DW_AT_type - .long .LLST4 # DW_AT_location -- .byte 0 # end of children of DIE 0xd4 -- .uleb128 0xa # (DIE (0x10a) DW_TAG_array_type) -+ .byte 0 # end of children of DIE 0x103 -+ .uleb128 0xa # (DIE (0x139) DW_TAG_array_type) - .long 0x48 # DW_AT_type -- .long 0x11a # DW_AT_sibling -- .uleb128 0xb # (DIE (0x113) DW_TAG_subrange_type) -- .long 0x11a # DW_AT_type -+ .long 0x149 # DW_AT_sibling -+ .uleb128 0xb # (DIE (0x142) DW_TAG_subrange_type) -+ .long 0x149 # DW_AT_type - .byte 0x1 # DW_AT_upper_bound -- .byte 0 # end of children of DIE 0x10a -- .uleb128 0xc # (DIE (0x11a) DW_TAG_base_type) -+ .byte 0 # end of children of DIE 0x139 -+ .uleb128 0xc # (DIE (0x149) DW_TAG_base_type) - .byte 0x4 # DW_AT_byte_size - .byte 0x7 # DW_AT_encoding -- .uleb128 0x8 # (DIE (0x11d) DW_TAG_subprogram) -+ .uleb128 0x8 # (DIE (0x14c) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external - .ascii "f3\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x37 # DW_AT_decl_line -+ .byte 0x38 # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x48 # DW_AT_type - .long .LFB3 # DW_AT_low_pc - .long .LFE3 # DW_AT_high_pc - .long .LLST5 # DW_AT_frame_base -- .long 0x153 # DW_AT_sibling -- .uleb128 0x7 # (DIE (0x139) DW_TAG_formal_parameter) -+ .long 0x182 # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x168) DW_TAG_formal_parameter) - .ascii "k\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x37 # DW_AT_decl_line -+ .byte 0x38 # DW_AT_decl_line - .long 0x48 # DW_AT_type - .byte 0x2 # DW_AT_location - .byte 0x91 # DW_OP_fbreg - .sleb128 0 -- .uleb128 0x9 # (DIE (0x145) DW_TAG_variable) -+ .uleb128 0x9 # (DIE (0x174) DW_TAG_variable) - .ascii "a\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x39 # DW_AT_decl_line -+ .byte 0x3a # DW_AT_decl_line - .long 0x4f # DW_AT_type - .long .LLST6 # DW_AT_location -- .byte 0 # end of children of DIE 0x11d -- .uleb128 0x8 # (DIE (0x153) DW_TAG_subprogram) -+ .byte 0 # end of children of DIE 0x14c -+ .uleb128 0x8 # (DIE (0x182) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external - .ascii "f4\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x42 # DW_AT_decl_line -+ .byte 0x43 # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x48 # DW_AT_type - .long .LFB4 # DW_AT_low_pc - .long .LFE4 # DW_AT_high_pc - .long .LLST7 # DW_AT_frame_base -- .long 0x189 # DW_AT_sibling -- .uleb128 0x7 # (DIE (0x16f) DW_TAG_formal_parameter) -+ .long 0x1b8 # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x19e) DW_TAG_formal_parameter) - .ascii "k\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x42 # DW_AT_decl_line -+ .byte 0x43 # DW_AT_decl_line - .long 0x48 # DW_AT_type - .byte 0x2 # DW_AT_location - .byte 0x91 # DW_OP_fbreg - .sleb128 0 -- .uleb128 0x9 # (DIE (0x17b) DW_TAG_variable) -+ .uleb128 0x9 # (DIE (0x1aa) DW_TAG_variable) - .ascii "a\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x44 # DW_AT_decl_line -- .long 0x10a # DW_AT_type -+ .byte 0x45 # DW_AT_decl_line -+ .long 0x139 # DW_AT_type - .long .LLST8 # DW_AT_location -- .byte 0 # end of children of DIE 0x153 -- .uleb128 0x8 # (DIE (0x189) DW_TAG_subprogram) -+ .byte 0 # end of children of DIE 0x182 -+ .uleb128 0x8 # (DIE (0x1b8) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external - .ascii "f5\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x4d # DW_AT_decl_line -+ .byte 0x4e # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x48 # DW_AT_type - .long .LFB5 # DW_AT_low_pc - .long .LFE5 # DW_AT_high_pc - .long .LLST9 # DW_AT_frame_base -- .long 0x1bf # DW_AT_sibling -- .uleb128 0x7 # (DIE (0x1a5) DW_TAG_formal_parameter) -+ .long 0x1ee # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x1d4) DW_TAG_formal_parameter) - .ascii "k\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x4d # DW_AT_decl_line -+ .byte 0x4e # DW_AT_decl_line - .long 0x48 # DW_AT_type - .byte 0x2 # DW_AT_location - .byte 0x91 # DW_OP_fbreg - .sleb128 0 -- .uleb128 0x9 # (DIE (0x1b1) DW_TAG_variable) -+ .uleb128 0x9 # (DIE (0x1e0) DW_TAG_variable) - .ascii "a\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x4f # DW_AT_decl_line -+ .byte 0x50 # DW_AT_decl_line - .long 0x25 # DW_AT_type - .long .LLST10 # DW_AT_location -- .byte 0 # end of children of DIE 0x189 -- .uleb128 0xd # (DIE (0x1bf) DW_TAG_subprogram) -+ .byte 0 # end of children of DIE 0x1b8 -+ .uleb128 0x8 # (DIE (0x1ee) DW_TAG_subprogram) - .byte 0x1 # DW_AT_external -- .long .LASF0 # DW_AT_name: "main" -+ .ascii "f6\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x58 # DW_AT_decl_line -+ .byte 0x59 # DW_AT_decl_line - .byte 0x1 # DW_AT_prototyped - .long 0x48 # DW_AT_type - .long .LFB6 # DW_AT_low_pc - .long .LFE6 # DW_AT_high_pc - .long .LLST11 # DW_AT_frame_base -- .uleb128 0x9 # (DIE (0x1d8) DW_TAG_variable) -+ .long 0x22e # DW_AT_sibling -+ .uleb128 0x7 # (DIE (0x20a) DW_TAG_formal_parameter) - .ascii "k\0" # DW_AT_name - .byte 0x1 # DW_AT_decl_file (pieces.c) -- .byte 0x5a # DW_AT_decl_line -+ .byte 0x59 # DW_AT_decl_line - .long 0x48 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+ .uleb128 0xd # (DIE (0x216) DW_TAG_variable) -+ .ascii "z\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x5b # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .byte 0x17 # DW_AT_const_value -+ .uleb128 0x9 # (DIE (0x220) DW_TAG_variable) -+ .ascii "a\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x5c # DW_AT_decl_line -+ .long 0x78 # DW_AT_type - .long .LLST12 # DW_AT_location -- .byte 0 # end of children of DIE 0x1bf -+ .byte 0 # end of children of DIE 0x1ee -+ .uleb128 0xe # (DIE (0x22e) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .long .LASF0 # DW_AT_name: "main" -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x65 # DW_AT_decl_line -+ .byte 0x1 # DW_AT_prototyped -+ .long 0x48 # DW_AT_type -+ .long .LFB7 # DW_AT_low_pc -+ .long .LFE7 # DW_AT_high_pc -+ .long .LLST13 # DW_AT_frame_base -+ .uleb128 0x9 # (DIE (0x247) DW_TAG_variable) -+ .ascii "k\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (pieces.c) -+ .byte 0x67 # DW_AT_decl_line -+ .long 0x48 # DW_AT_type -+ .long .LLST14 # DW_AT_location -+ .byte 0 # end of children of DIE 0x22e - .byte 0 # end of children of DIE 0xb - .section .debug_abbrev - .uleb128 0x1 # (abbrev code) -@@ -1577,6 +1800,21 @@ - .byte 0 - .byte 0 - .uleb128 0xd # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x1c # (DW_AT_const_value) -+ .uleb128 0xb # (DW_FORM_data1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xe # (abbrev code) - .uleb128 0x2e # (TAG: DW_TAG_subprogram) - .byte 0x1 # DW_children_yes - .uleb128 0x3f # (DW_AT_external) -@@ -1601,34 +1839,38 @@ - .byte 0 - .byte 0 - .section .debug_pubnames,"",@progbits -- .long 0x42 # Length of Public Names Info -+ .long 0x49 # Length of Public Names Info - .value 0x2 # DWARF Version - .long .Ldebug_info0 # Offset of Compilation Unit Info -- .long 0x1e7 # Compilation Unit Length -- .long 0x78 # DIE offset -+ .long 0x256 # Compilation Unit Length -+ .long 0xa7 # DIE offset - .ascii "bar\0" # external name -- .long 0x9e # DIE offset -+ .long 0xcd # DIE offset - .ascii "f1\0" # external name -- .long 0xd4 # DIE offset -+ .long 0x103 # DIE offset - .ascii "f2\0" # external name -- .long 0x11d # DIE offset -+ .long 0x14c # DIE offset - .ascii "f3\0" # external name -- .long 0x153 # DIE offset -+ .long 0x182 # DIE offset - .ascii "f4\0" # external name -- .long 0x189 # DIE offset -+ .long 0x1b8 # DIE offset - .ascii "f5\0" # external name -- .long 0x1bf # DIE offset -+ .long 0x1ee # DIE offset -+ .ascii "f6\0" # external name -+ .long 0x22e # DIE offset - .ascii "main\0" # external name - .long 0 - .section .debug_pubtypes,"",@progbits -- .long 0x1a # Length of Public Type Names Info -+ .long 0x20 # Length of Public Type Names Info - .value 0x2 # DWARF Version - .long .Ldebug_info0 # Offset of Compilation Unit Info -- .long 0x1e7 # Compilation Unit Length -+ .long 0x256 # Compilation Unit Length - .long 0x25 # DIE offset - .ascii "A\0" # external name - .long 0x4f # DIE offset - .ascii "B\0" # external name -+ .long 0x78 # DIE offset -+ .ascii "C\0" # external name - .long 0 - .section .debug_aranges,"",@progbits - .long 0x1c # Length of Address Ranges Info ---- src/gdb/testsuite/gdb.dwarf2/pieces.c 2010/05/21 20:39:50 1.1 -+++ src/gdb/testsuite/gdb.dwarf2/pieces.c 2010/05/21 21:01:46 1.2 -@@ -22,6 +22,7 @@ - - struct A { int i; int j; }; - struct B { int : 4; int i : 12; int j : 12; int : 4; }; -+struct C { int i; int j; int q; }; - - __attribute__((noinline)) void - bar (int x) -@@ -84,6 +85,18 @@ - return a.i + a.j; /* f5 breakpoint */ - } - -+__attribute__((noinline)) int -+f6 (int k) -+{ -+ int z = 23; -+ struct C a = { k, k, z}; -+ asm ("" : "+r" (a.i)); -+ a.j++; -+ bar (a.i); -+ bar (a.j); -+ return a.i + a.j; /* f6 breakpoint */ -+} -+ - int - main (void) - { -@@ -94,5 +107,6 @@ - f3 (k); - f4 (k); - f5 (k); -+ f6 (k); - return 0; - } ---- src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:00:27 1.2 -+++ src/gdb/testsuite/gdb.dwarf2/pieces.exp 2010/05/21 21:01:46 1.3 -@@ -67,5 +67,28 @@ - gdb_test "print a\[1\]" " = 14" "print a\[1\] in pieces:f2" - } - -+# 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.*" \ -+ "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}" \ -+ "print a with optimized out piece" -+ # Note: no warning for this case. -+ gdb_test_multiple "print a.i" \ -+ "print a.i with optimized out piece" { -+ -re "warning: some bits in computed object" { -+ fail "print a.i with optimized out piece" -+ } -+ -re " = 7" { -+ pass "print a.i with optimized out piece" -+ } -+ } -+} -+ - pieces_test_f1 - pieces_test_f2 -+pieces_test_f6 diff --git a/gdb-bz589467-pieces4of4.patch b/gdb-bz589467-pieces4of4.patch deleted file mode 100644 index 42ffb41..0000000 --- a/gdb-bz589467-pieces4of4.patch +++ /dev/null @@ -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 - -+ * 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) : New field. -+ * dwarf2expr.c (add_piece): New arguments bit_piece, offset. -+ Always use xrealloc to resize piece array. -+ (execute_stack_op) : Handle DW_OP_bit_piece. -+ : Update. -+ : 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 - -+ * 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 diff --git a/gdb-bz595475-tui-layout.patch b/gdb-bz595475-tui-layout.patch deleted file mode 100644 index 71742f8..0000000 --- a/gdb-bz595475-tui-layout.patch +++ /dev/null @@ -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 -+ -+ * 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 - - * 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 . */ - - #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 . */ - - #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 . -+ -+set testfile tui-layout -+if { [prepare_for_testing ${testfile}.exp ${testfile} start.c] } { -+ return -1 -+} -+ -+gdb_test "layout asm" diff --git a/gdb-bz600746-koenig-crash.patch b/gdb-bz600746-koenig-crash.patch deleted file mode 100644 index 7b6e209..0000000 --- a/gdb-bz600746-koenig-crash.patch +++ /dev/null @@ -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 -+ -+ * cp-support.c (make_symbol_overload_list_adl_namespace): Handle -+ anonymous type case. -+ - 2010-06-02 Pierre Muller - - * 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 -+ -+ * gdb.cp/namespace-koenig.exp: Added new test case. -+ * gdb.cp/namespace-koenig.cc: Ditto. -+ - 2010-06-01 Michael Snyder - - * 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" diff --git a/gdb-bz601887-dwarf4-1of2.patch b/gdb-bz601887-dwarf4-1of2.patch deleted file mode 100644 index 22708df..0000000 --- a/gdb-bz601887-dwarf4-1of2.patch +++ /dev/null @@ -1,329 +0,0 @@ -commit be1f57c90bdf86477b9bc69cc982171d6ad5df56 -Author: Tom Tromey -Date: Tue Apr 20 17:33:13 2010 +0000 - - * dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4. - (struct dwarf2_cie) : 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) : 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 -+ -+ * dwarf2-frame.c (decode_frame_entry_1): Handle CIE version 4. -+ (struct dwarf2_cie) : 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) : New field. -+ (dwarf_decode_line_header): Set new field. -+ (dwarf_decode_lines): Handle new field. -+ - 2010-04-20 Jan Kratochvil - - * 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); - } - - diff --git a/gdb-bz601887-dwarf4-2of2.patch b/gdb-bz601887-dwarf4-2of2.patch deleted file mode 100644 index 97f88b0..0000000 --- a/gdb-bz601887-dwarf4-2of2.patch +++ /dev/null @@ -1,56 +0,0 @@ -commit 669907bd6d54ae8e85b1278f0f16f8641ce6802d -Author: Tom Tromey -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 -+ -+ * dwarf2read.c (dwarf2_compute_name): Handle DW_AT_linkage_name. -+ (read_partial_die): Likewise. -+ (dwarf_attr_name): Likewise. -+ - 2010-04-20 Chris Moller - - 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: diff --git a/gdb-bz602314-ptype-class-typedef-1of3.patch b/gdb-bz602314-ptype-class-typedef-1of3.patch deleted file mode 100644 index 1d31bf2..0000000 --- a/gdb-bz602314-ptype-class-typedef-1of3.patch +++ /dev/null @@ -1,274 +0,0 @@ -commit f49f91e9c3eaba847f75f5c46e77e261a76d9a9b -Author: Jan Kratochvil -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 - -+ * 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 -+ - Fix PR c++/11703 and PR gdb/1448. - * c-exp.y (yylex) : 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) diff --git a/gdb-bz602314-ptype-class-typedef-2of3.patch b/gdb-bz602314-ptype-class-typedef-2of3.patch deleted file mode 100644 index 3f01eb3..0000000 --- a/gdb-bz602314-ptype-class-typedef-2of3.patch +++ /dev/null @@ -1,308 +0,0 @@ -commit 758a1f7149cb7469c7e6bb30cb572715ee90a6e8 -Author: Jan Kratochvil -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) : 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) - (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 - -+ * 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) : 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) -+ (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 -+ - * 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, _("\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" diff --git a/gdb-bz602314-ptype-class-typedef-3of3.patch b/gdb-bz602314-ptype-class-typedef-3of3.patch deleted file mode 100644 index f0ad50d..0000000 --- a/gdb-bz602314-ptype-class-typedef-3of3.patch +++ /dev/null @@ -1,38 +0,0 @@ -commit 477c1359b217cdc052a7c9f83cae9c894396894c -Author: Jan Kratochvil -Date: Mon Jun 28 22:03:31 2010 +0000 - - gdb/ - * dwarf2read.c (read_structure_type) : Call - ALLOCATE_CPLUS_STRUCT_TYPE. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,3 +1,8 @@ -+2010-06-28 Jan Kratochvil -+ -+ * dwarf2read.c (read_structure_type) : Call -+ ALLOCATE_CPLUS_STRUCT_TYPE. -+ - 2010-06-28 Phil Muldoon - Tom Tromey - Thiago Jung Bauermann -## -27,8 +32,6 @@ - * python/py-inferior.c: New File. - * python/py-infthread.c: New File. - -- -- - 2010-06-28 Jan Kratochvil - - * 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; diff --git a/gdb-bz606185-obstack-1of5.patch b/gdb-bz606185-obstack-1of5.patch deleted file mode 100644 index e2879bb..0000000 --- a/gdb-bz606185-obstack-1of5.patch +++ /dev/null @@ -1,214 +0,0 @@ -commit 78c144e8c3ae7bb36d632f6bfaaaad9c97199ce6 -Author: 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 -+ -+ 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 - - * 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 ("", -+ 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 . -+ -+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 = -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 -+ -+ 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 - - PR pascal/11492. -## -3184,7 +3191,7 @@ - addr_bit. Adjust LOAD_ADDR sign for cross-arch inferiors. - - 2010-02-17 Tristan Gingold -- Petr Hluzín -+ Petr Hluzín - - * 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, ""); - 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 -+ -+template -+struct ATB -+{ -+ int data; -+ ATB() : data(0) {} -+}; -+ -+ -+template -+class A : public ATB -+{ -+public: -+ static DerivedType const DEFAULT_INSTANCE; -+}; -+ -+template -+const DerivedType A::DEFAULT_INSTANCE; -+ -+class B : public A -+{ -+ -+}; -+ -+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 . -+ -+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" "{> = {> = {data = 0}, static DEFAULT_INSTANCE = }, }" -+ diff --git a/gdb-bz606185-obstack-3of5.patch b/gdb-bz606185-obstack-3of5.patch deleted file mode 100644 index 4092c00..0000000 --- a/gdb-bz606185-obstack-3of5.patch +++ /dev/null @@ -1,85 +0,0 @@ -commit 407cb192dcac2602aebaa7e262419adb580ecca6 -Author: 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 -+ -+ * 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 - - * 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, ""); - 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; - } - } diff --git a/gdb-bz606185-obstack-4of5.patch b/gdb-bz606185-obstack-4of5.patch deleted file mode 100644 index 5153a2b..0000000 --- a/gdb-bz606185-obstack-4of5.patch +++ /dev/null @@ -1,42 +0,0 @@ -commit 744735550d4a4fd6d4be40776069d799dca5ee39 -Author: Ulrich Weigand -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 - -+ * 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 -+ - * 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 *)); - } diff --git a/gdb-bz606185-obstack-5of5.patch b/gdb-bz606185-obstack-5of5.patch deleted file mode 100644 index 4171e56..0000000 --- a/gdb-bz606185-obstack-5of5.patch +++ /dev/null @@ -1,202 +0,0 @@ -commit 47c8c764a9be6d023eca450336e6d9de16970fc0 -Author: Jan Kratochvil -Date: Mon Jun 28 16:59:43 2010 +0000 - - gdb/ - * cp-valprint.c (cp_print_value_fields) : 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 -+ -+ * cp-valprint.c (cp_print_value_fields) : Call -+ obstack_begin after each obstack_free. -+ - 2010-06-27 Doug Evans - - * value.c (value_static_field): Use `switch' instead of `if'. -## -12,27 +17,27 @@ - - 2010-06-25 Paul Hilfinger - -- * 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 - -## -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 - ---- 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 -+ -+ * gdb.cp/static-print-quit.exp, gdb.cp/static-print-quit.cc: New. -+ - 2010-06-28 Doug Evans - - * 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 . */ -+ -+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 . -+ -+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 to continue, or q 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" diff --git a/gdb-bz606660-print-object-nonvirtual.patch b/gdb-bz606660-print-object-nonvirtual.patch deleted file mode 100644 index 9b52038..0000000 --- a/gdb-bz606660-print-object-nonvirtual.patch +++ /dev/null @@ -1,106 +0,0 @@ -commit bb604f9e70de515b13e2a935d8ad9d2fb0290849 -Author: Jan Kratochvil -Date: Mon Jun 28 20:12:52 2010 +0000 - - gdb/ - Fix modification of cplus_struct_default. - * dwarf2read.c (dwarf2_add_member_fn) : - Call ALLOCATE_CPLUS_STRUCT_TYPE. - - * gdbtypes.c (cplus_struct_default): New empty initializer, comment it. - - - gdb/testsuite/ - * gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data) - (main) : New. - * gdb.cp/virtbase.exp (print rtti_data): New. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,3 +1,10 @@ -+2010-06-28 Jan Kratochvil -+ -+ Fix modification of cplus_struct_default. -+ * dwarf2read.c (dwarf2_add_member_fn) : -+ 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 -+ -+ * gdb.cp/virtbase.cc (class RTTI_base, class RTTI_data) -+ (main) : 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" " = { = {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\}" diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch index d05e72b..056a28c 100644 --- a/gdb-core-open-vdso-warning.patch +++ b/gdb-core-open-vdso-warning.patch @@ -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 diff --git a/gdb-fortran-common-reduce.patch b/gdb-fortran-common-reduce.patch index 1e13183..3b843b8 100644 --- a/gdb-fortran-common-reduce.patch +++ b/gdb-fortran-common-reduce.patch @@ -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); diff --git a/gdb-fortran-common.patch b/gdb-fortran-common.patch index 3b9079f..63fa81c 100644 --- a/gdb-fortran-common.patch +++ b/gdb-fortran-common.patch @@ -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. +! diff --git a/gdb-fortran-logical8.patch b/gdb-fortran-logical8.patch deleted file mode 100644 index aadb65a..0000000 --- a/gdb-fortran-logical8.patch +++ /dev/null @@ -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 . -+ -+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 . -+! Modified for the GDB testcase by Jan Kratochvil . -+ -+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 diff --git a/gdb-infcall-sp-underflow.patch b/gdb-infcall-sp-underflow.patch deleted file mode 100644 index d602a4f..0000000 --- a/gdb-infcall-sp-underflow.patch +++ /dev/null @@ -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 - - * infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp. - New comment. - -gdb/testsuite/ -2010-02-19 Jan Kratochvil - - * 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 -+} - diff --git a/gdb-pie-1of6-reprelinked-bin.patch b/gdb-pie-1of6-reprelinked-bin.patch deleted file mode 100644 index 277bc77..0000000 --- a/gdb-pie-1of6-reprelinked-bin.patch +++ /dev/null @@ -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 - - 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 - - * 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 - } - } - } - diff --git a/gdb-pie-2of6-reprelinked-ld.patch b/gdb-pie-2of6-reprelinked-ld.patch deleted file mode 100644 index 4f054a8..0000000 --- a/gdb-pie-2of6-reprelinked-ld.patch +++ /dev/null @@ -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 - - * auxv.c (ld_so_xfer_auxv): Do not error on failed read of data_address. - -gdb/testsuite/ -2010-03-29 Jan Kratochvil - - * 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" - diff --git a/gdb-pie-3of6-relocate-once.patch b/gdb-pie-3of6-relocate-once.patch deleted file mode 100644 index 397a5db..0000000 --- a/gdb-pie-3of6-relocate-once.patch +++ /dev/null @@ -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 - - * 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 - - * 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 . */ -+ -+#include -+#include -+ -+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 . -+ -+# 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 - diff --git a/gdb-pie-rerun.patch b/gdb-pie-rerun.patch deleted file mode 100644 index dd06805..0000000 --- a/gdb-pie-rerun.patch +++ /dev/null @@ -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 - - Fix re-run of PIE executable. - * solib-svr4.c (svr4_relocate_main_executable) : Remove - the part of pre-set SYMFILE_OBJFILE->SECTION_OFFSETS. - -gdb/testsuite/ -2010-03-25 Jan Kratochvil - - 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 - diff --git a/gdb-rhel5-gcc44.patch b/gdb-rhel5-gcc44.patch index d761538..e198d5d 100644 --- a/gdb-rhel5-gcc44.patch +++ b/gdb-rhel5-gcc44.patch @@ -1,10 +1,10 @@ Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as the default gcc and gfortran binaries are from gcc-4.1. -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/vla.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/vla.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/vla.exp 2010-01-15 22:14:13.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/vla.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/vla.exp 2010-07-12 23:07:33.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/vla.exp 2010-07-13 23:05:14.000000000 +0200 @@ -16,7 +16,25 @@ set testfile vla set srcfile ${testfile}.c @@ -32,11 +32,11 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/vla.exp untested "Couldn't compile test program" return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/break-interp.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/break-interp.exp 2010-01-14 22:12:00.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp 2010-01-15 22:14:51.000000000 +0100 -@@ -31,10 +31,30 @@ if [get_compiler_info ${binfile_lib}] { +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/break-interp.exp 2010-07-05 20:04:33.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/break-interp.exp 2010-07-13 23:11:22.000000000 +0200 +@@ -33,9 +33,29 @@ if [get_compiler_info ${binfile_lib}] { return -1 } @@ -53,8 +53,7 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp +} +set_board_info compiler gcc44 + - # Use -soname so that it is listed with " => " by ldd and this testcase makes - # a copy of ${binfile_lib} for each prelink variant. + # Use -soname so that the new library gets copied by build_executable_own_libs. -if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} { +set err [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] @@ -68,46 +67,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp return -1 } -@@ -480,9 +500,33 @@ foreach ldprelink {NO YES} { - if {$binpie != "NO"} { - lappend opts {additional_flags=-fPIE -pie} - } -- if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} { -- continue; -+ -+ -+ # Temporarily provide compiler=gcc44 saving the original value around. -+ # RHEL-5 workaround of its: -+ # gcc: -rpath: linker input file unused because linking not done -+ # gcc: --dynamic-linker: linker input file unused because linking not done -+ -+ set board [target_info name] -+ if [board_info $board exists compiler] { -+ set old_compiler [board_info $board compiler] -+ unset_board_info compiler -+ } elseif [info exists old_compiler] { -+ unset old_compiler -+ } -+ set_board_info compiler gcc44 -+ -+ set err [build_executable ${test}.exp [file tail $exec] $srcfile $opts] -+ -+ unset_board_info compiler -+ if [info exists old_compiler] { -+ set_board_info compiler $old_compiler - } -+ -+ if { $err == -1 } { -+ continue -+ } -+ - if {$binsepdebug == "SEP"} { - gdb_gnu_strip_debug $exec - # Just a sanity check. As gdb_gnu_strip_debug uses the -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/common-block.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/common-block.exp 2010-01-15 22:14:17.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/common-block.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/common-block.exp 2010-07-13 00:25:56.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp 2010-07-13 23:05:14.000000000 +0200 @@ -20,7 +20,25 @@ set testfile "common-block" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -135,10 +98,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/common-block.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dwarf-stride.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dwarf-stride.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-01-15 22:14:13.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-07-12 23:07:33.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-07-13 23:05:14.000000000 +0200 @@ -27,7 +27,25 @@ set testfile dwarf-stride set srcfile ${testfile}.f90 @@ -166,10 +129,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dwarf-stride.exp return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dynamic.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dynamic.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2010-01-15 22:14:13.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dynamic.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2010-07-12 23:07:33.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dynamic.exp 2010-07-13 23:05:14.000000000 +0200 @@ -25,7 +25,25 @@ set testfile "dynamic" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -197,10 +160,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dynamic.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/library-module.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/library-module.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/library-module.exp 2010-01-15 22:14:13.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/library-module.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/library-module.exp 2010-06-03 00:41:56.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/library-module.exp 2010-07-13 23:05:14.000000000 +0200 @@ -25,16 +25,34 @@ if [get_compiler_info not-used] { return -1 } @@ -240,10 +203,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/library-module.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/module.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/module.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/module.exp 2010-01-15 22:14:13.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/module.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/module.exp 2010-06-03 01:01:01.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/module.exp 2010-07-13 23:05:14.000000000 +0200 @@ -16,7 +16,25 @@ set testfile "module" set srcfile ${testfile}.f90 @@ -271,10 +234,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/module.exp return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/string.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/string.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/string.exp 2010-01-15 22:14:13.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/string.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/string.exp 2010-07-12 23:07:33.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/string.exp 2010-07-13 23:05:14.000000000 +0200 @@ -23,7 +23,25 @@ set testfile "string" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -302,10 +265,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/string.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/omp-step.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/omp-step.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2010-01-15 22:14:16.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/omp-step.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2010-07-13 00:21:30.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/omp-step.exp 2010-07-13 23:05:14.000000000 +0200 @@ -15,7 +15,26 @@ set testfile "omp-step" @@ -334,10 +297,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/omp-step.exp return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/derived-type.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/derived-type.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-01 08:32:02.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-15 22:16:20.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-01 08:32:02.000000000 +0100 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/derived-type.exp 2010-07-13 23:05:14.000000000 +0200 @@ -28,8 +28,26 @@ set testfile "derived-type" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -367,10 +330,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/derived-type.exp return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/subarray.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/subarray.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-01 08:32:02.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-15 22:17:18.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-01 08:32:02.000000000 +0100 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/subarray.exp 2010-07-13 23:05:14.000000000 +0200 @@ -28,8 +28,26 @@ set testfile "subarray" set srcfile ${testfile}.f set binfile ${objdir}/${subdir}/${testfile} @@ -400,10 +363,10 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/subarray.exp return -1 } -Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/tls-sepdebug.exp +Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/tls-sepdebug.exp =================================================================== ---- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-01-15 22:14:15.000000000 +0100 -+++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-01-15 22:14:51.000000000 +0100 +--- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-07-12 23:07:34.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-07-13 23:05:14.000000000 +0200 @@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi # FIXME: gcc dependency (-Wl,-soname). @@ -431,3 +394,41 @@ Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/tls-sepdebug.exp untested "Couldn't compile test library" return -1 } +Index: gdb-7.1.90.20100711/gdb/testsuite/lib/prelink-support.exp +=================================================================== +--- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/prelink-support.exp 2010-07-05 20:02:56.000000000 +0200 ++++ gdb-7.1.90.20100711/gdb/testsuite/lib/prelink-support.exp 2010-07-13 23:09:34.000000000 +0200 +@@ -118,9 +118,31 @@ proc file_copy {src dest} { + proc build_executable_own_libs {testname executable sources options {interp ""} {dir ""}} { + global objdir subdir + +- if {[build_executable $testname $executable $sources $options] == -1} { +- return "" ++ # Temporarily provide compiler=gcc44 saving the original value around. ++ # RHEL-5 workaround of its: ++ # gcc: -rpath: linker input file unused because linking not done ++ # gcc: --dynamic-linker: linker input file unused because linking not done ++ ++ set board [target_info name] ++ if [board_info $board exists compiler] { ++ set old_compiler [board_info $board compiler] ++ unset_board_info compiler ++ } elseif [info exists old_compiler] { ++ unset old_compiler + } ++ set_board_info compiler gcc44 ++ ++ set err [build_executable $testname $executable $sources $options] ++ ++ unset_board_info compiler ++ if [info exists old_compiler] { ++ set_board_info compiler $old_compiler ++ } ++ ++ if { $err == -1 } { ++ return "" ++ } ++ + set binfile ${objdir}/${subdir}/${executable} + + set command "ldd $binfile" diff --git a/gdb-solib-memory-error-nonfatal.patch b/gdb-solib-memory-error-nonfatal.patch deleted file mode 100644 index f8d73d8..0000000 --- a/gdb-solib-memory-error-nonfatal.patch +++ /dev/null @@ -1,41 +0,0 @@ -[RFC/ia64] memory error when reading wrong core file -http://sourceware.org/ml/gdb-patches/2010-01/msg00645.html -http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html -http://sourceware.org/ml/gdb-patches/2010-03/msg00298.html -http://sourceware.org/ml/gdb-cvs/2010-03/msg00065.html -c961a8da422283662e09ee498c0598d48fc9d70f - ---- src/gdb/solib-svr4.c 2010/02/24 00:29:02 1.125 -+++ src/gdb/solib-svr4.c 2010/03/08 07:45:49 1.126 -@@ -868,9 +868,16 @@ - { - struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); - struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; -+ CORE_ADDR addr = 0; -+ volatile struct gdb_exception ex; - -- return read_memory_typed_address (info->debug_base + lmo->r_map_offset, -- ptr_type); -+ TRY_CATCH (ex, RETURN_MASK_ERROR) -+ { -+ addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset, -+ ptr_type); -+ } -+ exception_print (gdb_stderr, ex); -+ return addr; - } - - /* Find r_brk from the inferior's debug base. */ -### src/gdb/ChangeLog 2010/03/08 01:49:30 1.11441 -### src/gdb/ChangeLog 2010/03/08 07:45:49 1.11442 -## -1,3 +1,10 @@ -+2010-03-08 Joel Brobecker -+ -+ Memory error when reading wrong core file. -+ * solib-svr4.c (solib_svr4_r_map): catch and print all exception -+ errors while reading the inferior memory, and return zero if -+ an exception was raised. -+ - 2010-03-07 Michael Snyder - - * record.c (record_restore): Rename tmpu8 to rectype. diff --git a/gdb-unwind-debughook-safe-fail.patch b/gdb-unwind-debughook-safe-fail.patch deleted file mode 100644 index c416b33..0000000 --- a/gdb-unwind-debughook-safe-fail.patch +++ /dev/null @@ -1,46 +0,0 @@ -commit 802214c97d1661ad337aad0d011dded44f0b5ddd -Author: Tom Tromey -Date: Mon Apr 26 15:15:55 2010 -0600 - - Fail gracefully if the _Unwind_DebugHook argument is optimized out - -diff --git a/gdb/infrun.c b/gdb/infrun.c -index 2eea550..9a5b534 100644 ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -4925,20 +4925,24 @@ insert_exception_resume_breakpoint (struct thread_info *tp, - - vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL); - value = read_var_value (vsym, frame); -- handler = value_as_address (value); -+ /* If the value was optimized out, revert to the old behavior. */ -+ if (! value_optimized_out (value)) -+ { -+ handler = value_as_address (value); - -- /* We're going to replace the current step-resume breakpoint -- with an exception-resume breakpoint. */ -- delete_step_resume_breakpoint (tp); -+ /* We're going to replace the current step-resume breakpoint -+ with an exception-resume breakpoint. */ -+ delete_step_resume_breakpoint (tp); - -- if (debug_infrun) -- fprintf_unfiltered (gdb_stdlog, -- "infrun: exception resume at %lx\n", -- (unsigned long) handler); -+ if (debug_infrun) -+ fprintf_unfiltered (gdb_stdlog, -+ "infrun: exception resume at %lx\n", -+ (unsigned long) handler); - -- bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), -- handler, bp_exception_resume); -- inferior_thread ()->step_resume_breakpoint = bp; -+ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), -+ handler, bp_exception_resume); -+ inferior_thread ()->step_resume_breakpoint = bp; -+ } - } - } - diff --git a/gdb-unwind-debughook-step-independent.patch b/gdb-unwind-debughook-step-independent.patch deleted file mode 100644 index 07bd2ba..0000000 --- a/gdb-unwind-debughook-step-independent.patch +++ /dev/null @@ -1,235 +0,0 @@ -commit f8ca03e0097ae49c66cf33a50e3247bccd3a4a33 -Author: Tom Tromey -Date: Wed Apr 28 14:17:38 2010 -0600 - - Reimplement infrun parts of next-over-throw. - Previously, we reset the step-resume breakpoint. - However, this can do the wrong thing if an exception - is thrown and caught beneath the nexting frame. - The new approach is to have a separate exception-resume - breakpoint. - -diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h -index 611dcbb..9638368 100644 ---- a/gdb/gdbthread.h -+++ b/gdb/gdbthread.h -@@ -66,6 +66,9 @@ struct thread_info - /* Step-resume or longjmp-resume breakpoint. */ - struct breakpoint *step_resume_breakpoint; - -+ /* Exception-resume breakpoint. */ -+ struct breakpoint *exception_resume_breakpoint; -+ - /* Range to single step within. - - If this is nonzero, respond to a single-step signal by continuing -@@ -225,6 +228,9 @@ extern void delete_thread_silent (ptid_t); - /* Delete a step_resume_breakpoint from the thread database. */ - extern void delete_step_resume_breakpoint (struct thread_info *); - -+/* Delete an exception_resume_breakpoint from the thread database. */ -+extern void delete_exception_resume_breakpoint (struct thread_info *); -+ - /* Translate the integer thread id (GDB's homegrown id, not the system's) - into a "pid" (which may be overloaded with extra thread information). */ - extern ptid_t thread_id_to_pid (int); -diff --git a/gdb/infrun.c b/gdb/infrun.c -index 9a5b534..3546cf1 100644 ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -300,6 +300,7 @@ follow_fork (void) - parent thread structure's run control related fields, not just these. - Initialized to avoid "may be used uninitialized" warnings from gcc. */ - struct breakpoint *step_resume_breakpoint = NULL; -+ struct breakpoint *exception_resume_breakpoint = NULL; - CORE_ADDR step_range_start = 0; - CORE_ADDR step_range_end = 0; - struct frame_id step_frame_id = { 0 }; -@@ -352,6 +353,8 @@ follow_fork (void) - step_range_start = tp->step_range_start; - step_range_end = tp->step_range_end; - step_frame_id = tp->step_frame_id; -+ exception_resume_breakpoint -+ = clone_momentary_breakpoint (tp->exception_resume_breakpoint); - - /* For now, delete the parent's sr breakpoint, otherwise, - parent/child sr breakpoints are considered duplicates, -@@ -362,6 +365,7 @@ follow_fork (void) - tp->step_range_start = 0; - tp->step_range_end = 0; - tp->step_frame_id = null_frame_id; -+ delete_exception_resume_breakpoint (tp); - } - - parent = inferior_ptid; -@@ -403,6 +407,8 @@ follow_fork (void) - tp->step_range_start = step_range_start; - tp->step_range_end = step_range_end; - tp->step_frame_id = step_frame_id; -+ tp->exception_resume_breakpoint -+ = exception_resume_breakpoint; - } - else - { -@@ -456,6 +462,9 @@ follow_inferior_reset_breakpoints (void) - if (tp->step_resume_breakpoint) - breakpoint_re_set_thread (tp->step_resume_breakpoint); - -+ if (tp->exception_resume_breakpoint) -+ breakpoint_re_set_thread (tp->exception_resume_breakpoint); -+ - /* Reinsert all breakpoints in the child. The user may have set - breakpoints after catching the fork, in which case those - were never set in the child, but only in the parent. This makes -@@ -694,6 +703,7 @@ follow_exec (ptid_t pid, char *execd_pathname) - /* If there was one, it's gone now. We cannot truly step-to-next - statement through an exec(). */ - th->step_resume_breakpoint = NULL; -+ th->exception_resume_breakpoint = NULL; - th->step_range_start = 0; - th->step_range_end = 0; - -@@ -2145,6 +2155,7 @@ delete_step_resume_breakpoint_callback (struct thread_info *info, void *data) - return 0; - - delete_step_resume_breakpoint (info); -+ delete_exception_resume_breakpoint (info); - return 0; - } - -@@ -2168,6 +2179,7 @@ delete_step_thread_step_resume_breakpoint (void) - stepping. */ - struct thread_info *tp = inferior_thread (); - delete_step_resume_breakpoint (tp); -+ delete_exception_resume_breakpoint (tp); - } - else - /* In all-stop mode, delete all step-resume and longjmp-resume -@@ -3832,30 +3844,31 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); - fprintf_unfiltered (gdb_stdlog, - "infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n"); - -- gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); -- delete_step_resume_breakpoint (ecs->event_thread); -- -- if (!what.is_longjmp) -+ if (what.is_longjmp) -+ { -+ gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); -+ delete_step_resume_breakpoint (ecs->event_thread); -+ } -+ else - { - /* There are several cases to consider. -- -+ - 1. The initiating frame no longer exists. In this case - we must stop, because the exception has gone too far. -- -+ - 2. The initiating frame exists, and is the same as the -- current frame. -- -- 2.1. If we are stepping, defer to the stepping logic. -- -- 2.2. Otherwise, we are not stepping, so we are doing a -- "finish" and we have reached the calling frame. So, -- stop. -- -+ current frame. We stop, because the exception has been -+ caught. -+ - 3. The initiating frame exists and is different from - the current frame. This means the exception has been - caught beneath the initiating frame, so keep going. */ - struct frame_info *init_frame - = frame_find_by_id (ecs->event_thread->initiating_frame); -+ -+ gdb_assert (ecs->event_thread->exception_resume_breakpoint != NULL); -+ delete_exception_resume_breakpoint (ecs->event_thread); -+ - if (init_frame) - { - struct frame_id current_id -@@ -3863,15 +3876,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); - if (frame_id_eq (current_id, - ecs->event_thread->initiating_frame)) - { -- if (ecs->event_thread->step_range_start) -- { -- /* Case 2.1. */ -- break; -- } -- else -- { -- /* Case 2.2: fall through. */ -- } -+ /* Case 2. Fall through. */ - } - else - { -@@ -3880,6 +3885,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); - return; - } - } -+ -+ /* For Cases 1 and 2, remove the step-resume breakpoint, -+ if it exists. */ -+ delete_step_resume_breakpoint (ecs->event_thread); - } - - ecs->event_thread->stop_step = 1; -@@ -4930,10 +4939,6 @@ insert_exception_resume_breakpoint (struct thread_info *tp, - { - handler = value_as_address (value); - -- /* We're going to replace the current step-resume breakpoint -- with an exception-resume breakpoint. */ -- delete_step_resume_breakpoint (tp); -- - if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, - "infrun: exception resume at %lx\n", -@@ -4941,7 +4946,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp, - - bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), - handler, bp_exception_resume); -- inferior_thread ()->step_resume_breakpoint = bp; -+ inferior_thread ()->exception_resume_breakpoint = bp; - } - } - } -diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp -index ee9aeff..c77dbd8 100644 ---- a/gdb/testsuite/gdb.cp/gdb9593.exp -+++ b/gdb/testsuite/gdb.cp/gdb9593.exp -@@ -145,7 +145,7 @@ gdb_test "step" \ - "step into finish, for until" - - gdb_test "until" \ -- ".*catch .int x.*" \ -+ ".*function1 ().*" \ - "until with no argument 1" - - set line [gdb_get_line_number "marker for until" $testfile.cc] -diff --git a/gdb/thread.c b/gdb/thread.c -index 16a207c..3c52ae4 100644 ---- a/gdb/thread.c -+++ b/gdb/thread.c -@@ -90,6 +90,16 @@ delete_step_resume_breakpoint (struct thread_info *tp) - } - } - -+void -+delete_exception_resume_breakpoint (struct thread_info *tp) -+{ -+ if (tp && tp->exception_resume_breakpoint) -+ { -+ delete_breakpoint (tp->exception_resume_breakpoint); -+ tp->exception_resume_breakpoint = NULL; -+ } -+} -+ - static void - clear_thread_inferior_resources (struct thread_info *tp) - { diff --git a/gdb-upstream.patch b/gdb-upstream.patch deleted file mode 100644 index b643ad6..0000000 --- a/gdb-upstream.patch +++ /dev/null @@ -1,1179 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2010-03/msg00104.html -5855954454f19a801f76bbf7baafd11a693c5d33 - -Imported to sync gdb.base/break-interp.exp for gdb-pie-rerun.patch. - -### src/gdb/ChangeLog 2010/03/11 03:45:48 1.11469 -### src/gdb/ChangeLog 2010/03/11 22:07:00 1.11470 -## -1,3 +1,9 @@ -+2010-03-11 Jan Kratochvil -+ -+ * solib-svr4.c (LM_ADDR_CHECK) : Use printf_unfiltered -+ for the PIC displacement, print also the displacement value. -+ (svr4_exec_displacement): Print DISPLACEMENT if INFO_VERBOSE. -+ - 2010-03-10 Kevin Buettner - - * remote-mips.c (close_ports, mips_initialize_cleanups) ---- src/gdb/solib-svr4.c 2010/03/10 20:55:44 1.129 -+++ src/gdb/solib-svr4.c 2010/03/11 22:07:02 1.130 -@@ -243,12 +243,10 @@ - l_addr = l_dynaddr - dynaddr; - - if (info_verbose) -- { -- warning (_(".dynamic section for \"%s\" " -- "is not at the expected address"), so->so_name); -- warning (_("difference appears to be caused by prelink, " -- "adjusting expectations")); -- } -+ printf_unfiltered (_("Using PIC (Position Independent Code) " -+ "prelink displacement %s for \"%s\".\n"), -+ paddress (target_gdbarch, l_addr), -+ so->so_name); - } - else - warning (_(".dynamic section for \"%s\" " -@@ -1767,6 +1765,18 @@ - return 0; - } - -+ if (info_verbose) -+ { -+ /* It can be printed repeatedly as there is no easy way to check -+ the executable symbols/file has been already relocated to -+ displacement. */ -+ -+ printf_unfiltered (_("Using PIE (Position Independent Executable) " -+ "displacement %s for \"%s\".\n"), -+ paddress (target_gdbarch, displacement), -+ bfd_get_filename (exec_bfd)); -+ } -+ - *displacementp = displacement; - return 1; - } -### src/gdb/testsuite/ChangeLog 2010/03/11 00:20:29 1.2168 -### src/gdb/testsuite/ChangeLog 2010/03/11 22:07:02 1.2169 -## -1,3 +1,20 @@ -+2010-03-11 Jan Kratochvil -+ -+ * gdb.base/break-interp.exp: Create new displacement parameter value -+ for the test_ld calls. -+ (reach): New parameter displacement, verify its content. New push of -+ pf_prefix "reach-$func:". Import global expect_out. -+ (test_core): New parameter displacement, verify its content. New push -+ of pf_prefix "core:". New command "set verbose on". Import global -+ expect_out. -+ (test_attach): New parameter displacement, verify its content. New -+ push of pf_prefix "attach:". New command "set verbose on". Import -+ global expect_out. -+ (test_ld): New parameter displacement, pass it to the reach, test_core -+ and test_attach calls and verify its content in the "ld.so exit" test. -+ * gdb.base/prelink.exp: Remove gdb_exit and final return. -+ (prelink): Update expected text, use gdb_test. -+ - 2010-03-10 Doug Evans - - * gdb.base/checkpoint.exp: Fix comment. ---- src/gdb/testsuite/gdb.base/break-interp.exp 2010/01/27 20:53:22 1.6 -+++ src/gdb/testsuite/gdb.base/break-interp.exp 2010/03/11 22:07:03 1.7 -@@ -221,30 +221,61 @@ - } - - # `runto' does not check we stopped really at the function we specified. --proc reach {func command} { -- global gdb_prompt -+# DISPLACEMENT can be "NONE", "ZERO" or "NONZERO" -+proc reach {func command displacement} { -+ global gdb_prompt expect_out -+ -+ global pf_prefix -+ set old_ldprefix $pf_prefix -+ lappend pf_prefix "reach-$func:" - - if [gdb_breakpoint $func allow-pending] { -- set test "reach $func" -+ set test "reach" -+ set test_displacement "seen displacement message as $displacement" - gdb_test_multiple $command $test { -+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { -+ # Missing "$gdb_prompt $" is intentional. -+ if {$expect_out(1,string) == "0x0"} { -+ set case "ZERO" -+ } else { -+ set case "NONZERO" -+ } -+ if {$displacement == $case} { -+ pass $test_displacement -+ # Permit multiple such messages. -+ set displacement "FOUND-$displacement" -+ } elseif {$displacement != "FOUND-$case"} { -+ fail $test_displacement -+ } -+ exp_continue -+ } - -re "Breakpoint \[0-9\]+, $func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" { - pass $test - } -- -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" { -+ -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" { - pass $test - } - } -+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] { -+ fail $test_displacement -+ } - } -+ -+ set pf_prefix $old_ldprefix - } - --proc test_core {file} { -- global srcdir subdir gdb_prompt -+proc test_core {file displacement} { -+ global srcdir subdir gdb_prompt expect_out - - set corefile [core_find $file {} "segv"] - if {$corefile == ""} { - return - } - -+ global pf_prefix -+ set old_ldprefix $pf_prefix -+ lappend pf_prefix "core:" -+ - gdb_exit - gdb_start - # Clear it to never find any separate debug infos in $debug_root. -@@ -252,14 +283,44 @@ - gdb_reinitialize_dir $srcdir/$subdir - gdb_load $file - -- # Do not check the binary filename as it may be truncated. -- gdb_test "core-file $corefile" "Core was generated by .*\r\n#0 .*" "core loaded" -+ # Print the "PIE (Position Independent Executable) displacement" message. -+ gdb_test "set verbose on" -+ -+ set test "core loaded" -+ set test_displacement "seen displacement message" -+ gdb_test_multiple "core-file $corefile" $test { -+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { -+ # Missing "$gdb_prompt $" is intentional. -+ if {$expect_out(1,string) == "0x0"} { -+ set case "ZERO" -+ } else { -+ set case "NONZERO" -+ } -+ if {$displacement == $case} { -+ pass $test_displacement -+ # Permit multiple such messages. -+ set displacement "FOUND-$displacement" -+ } elseif {$displacement != "FOUND-$case"} { -+ fail $test_displacement -+ } -+ exp_continue -+ } -+ -re "Core was generated by .*\r\n#0 .*$gdb_prompt $" { -+ # Do not check the binary filename as it may be truncated. -+ pass $test -+ } -+ } -+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] { -+ fail $test_displacement -+ } - - gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "core main bt" -+ -+ set pf_prefix $old_ldprefix - } - --proc test_attach {file} { -- global board_info -+proc test_attach {file displacement} { -+ global board_info gdb_prompt expect_out - - gdb_exit - -@@ -287,17 +348,61 @@ - } - } - -+ global pf_prefix -+ set old_ldprefix $pf_prefix -+ lappend pf_prefix "attach:" -+ - gdb_exit - gdb_start -- gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach" -+ -+ # Print the "PIE (Position Independent Executable) displacement" message. -+ gdb_test "set verbose on" -+ -+ set test "attach" -+ gdb_test_multiple "attach $pid" $test { -+ -re "Attaching to process $pid\r\n" { -+ # Missing "$gdb_prompt $" is intentional. -+ pass $test -+ } -+ } -+ -+ set test "attach final prompt" -+ set test_displacement "seen displacement message" -+ gdb_test_multiple "" $test { -+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { -+ # Missing "$gdb_prompt $" is intentional. -+ if {$expect_out(1,string) == "0x0"} { -+ set case "ZERO" -+ } else { -+ set case "NONZERO" -+ } -+ if {$displacement == $case} { -+ pass $test_displacement -+ # Permit multiple such messages. -+ set displacement "FOUND-$displacement" -+ } elseif {$displacement != "FOUND-$case"} { -+ fail $test_displacement -+ } -+ exp_continue -+ } -+ -re "$gdb_prompt $" { -+ pass $test -+ } -+ } -+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] { -+ fail $test_displacement -+ } -+ - gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain\\M.*" "attach main bt" - gdb_exit - - remote_exec host "kill -9 $pid" -+ -+ set pf_prefix $old_ldprefix - } - --proc test_ld {file ifmain trynosym} { -- global srcdir subdir gdb_prompt -+proc test_ld {file ifmain trynosym displacement} { -+ global srcdir subdir gdb_prompt expect_out - - # First test normal `file'-command loaded $FILE with symbols. - -@@ -308,20 +413,31 @@ - gdb_reinitialize_dir $srcdir/$subdir - gdb_load $file - -- reach "dl_main" "run segv" -+ # Print the "PIE (Position Independent Executable) displacement" message. -+ gdb_test "set verbose on" -+ -+ reach "dl_main" "run segv" $displacement - - gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt" - - if $ifmain { -- reach "main" continue -+ # Displacement message will be printed the second time on initializing -+ # the linker from svr4_special_symbol_handling. If any ANOFFSET has -+ # been already set as non-zero the detection will no longer be run. -+ if {$displacement == "NONZERO"} { -+ set displacement_main "NONE" -+ } else { -+ set displacement_main $displacement -+ } -+ reach "main" continue $displacement_main - -- reach "libfunc" continue -+ reach "libfunc" continue "NONE" - - gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain\\M.*" "main bt" - -- test_core $file -+ test_core $file $displacement - -- test_attach $file -+ test_attach $file $displacement - } - - if !$trynosym { -@@ -341,18 +457,21 @@ - gdb_test "set debug-file-directory" - gdb_reinitialize_dir $srcdir/$subdir - -+ # Print the "PIE (Position Independent Executable) displacement" message. -+ gdb_test "set verbose on" -+ - # Test no (error) message has been printed by `exec-file'. - set escapedfile [string_to_regexp $file] - gdb_test "exec-file $file" "exec-file $escapedfile" "load" - - if $ifmain { -- reach "dl_main" run -+ reach "dl_main" run $displacement - - set test "info files" - set entrynohex "" - gdb_test_multiple $test $test { - -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n.*$gdb_prompt $" { -- set entrynohex $expect_out(1,string) -+ set entrynohex $expect_out(1,string) - pass $test - } - } -@@ -363,7 +482,34 @@ - } else { - # There is no symbol to break at ld.so. Moreover it can exit with an - # error code. -- gdb_test "run" "Program exited (normally|with code \[0-9\]+)\\." "ld.so exit" -+ -+ set test "ld.so exit" -+ set test_displacement "seen displacement message" -+ gdb_test_multiple "run" $test { -+ -re "Using PIE \\(Position Independent Executable\\) displacement (0x\[0-9a-f\]+) " { -+ # Missing "$gdb_prompt $" is intentional. -+ if {$expect_out(1,string) == "0x0"} { -+ set case "ZERO" -+ } else { -+ set case "NONZERO" -+ } -+ if {$displacement == $case} { -+ pass $test_displacement -+ # Permit multiple such messages. -+ set displacement "FOUND-$displacement" -+ } elseif {$displacement != "FOUND-$case"} { -+ fail $test_displacement -+ } -+ exp_continue -+ } -+ -re "Program exited (normally|with code \[0-9\]+)\\.\r\n$gdb_prompt $" { -+ # Do not check the binary filename as it may be truncated. -+ pass $test -+ } -+ } -+ if ![regexp {^(NONE|FOUND-.*)$} $displacement] { -+ fail $test_displacement -+ } - } - - set pf_prefix $old_ldprefix -@@ -450,7 +596,12 @@ - if ![prelink$ldprelink $interp] { - continue - } -- test_ld $interp 0 [expr {$ldsepdebug == "NO"}] -+ if {$ldprelink == "NO"} { -+ set displacement "NONZERO" -+ } else { -+ set displacement "ZERO" -+ } -+ test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement - - if ![copy $interp $interp_saved] { - continue -@@ -531,7 +682,14 @@ - - if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" [file tail $exec]] - && [copy $interp_saved $interp]} { -- test_ld $exec 1 [expr {$binsepdebug == "NO"}] -+ if {$binpie == "NO"} { -+ set displacement "NONE" -+ } elseif {$binprelink == "NO"} { -+ set displacement "NONZERO" -+ } else { -+ set displacement "ZERO" -+ } -+ test_ld $exec 1 [expr {$binsepdebug == "NO"}] $displacement - } - } - } ---- src/gdb/testsuite/gdb.base/prelink.exp 2010/02/13 12:02:29 1.11 -+++ src/gdb/testsuite/gdb.base/prelink.exp 2010/03/11 22:07:03 1.12 -@@ -112,15 +112,4 @@ - # Print the "adjusting expectations" message. - gdb_test "set verbose on" - --set test "prelink" --global gdb_prompt --gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" { -- -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations.*$gdb_prompt $" { -- pass "$test" -- } --} -- --gdb_exit -- --return 0 -- -+gdb_test "core-file $objdir/$subdir/prelink.core" {Using PIC \(Position Independent Code\) prelink displacement.*} "prelink" - - - -http://sourceware.org/ml/gdb-cvs/2010-03/msg00066.html -16558457783d71e2856ff2b9ceaa83199d2d9811 - -### src/gdb/ChangeLog 2010/03/08 07:45:49 1.11442 -### src/gdb/ChangeLog 2010/03/08 08:32:49 1.11443 -## -1,3 +1,8 @@ -+2010-03-08 Jan Kratochvil -+ -+ * symfile.c (addr_info_make_relative): New variable sect_name, use it. -+ Do not warn on ".gnu.liblist" and ".gnu.conflict". -+ - 2010-03-08 Joel Brobecker - - Memory error when reading wrong core file. ---- src/gdb/symfile.c 2010/03/05 19:32:44 1.275 -+++ src/gdb/symfile.c 2010/03/08 08:32:49 1.276 -@@ -592,7 +592,8 @@ - - for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) - { -- asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name); -+ const char *sect_name = addrs->other[i].name; -+ asection *sect = bfd_get_section_by_name (abfd, sect_name); - - if (sect) - { -@@ -609,8 +610,22 @@ - } - else - { -- warning (_("section %s not found in %s"), addrs->other[i].name, -- bfd_get_filename (abfd)); -+ /* This section does not exist in ABFD, which is normally -+ unexpected and we want to issue a warning. -+ -+ However, the ELF prelinker does create a couple of sections -+ (".gnu.liblist" and ".gnu.conflict") which are marked in the main -+ executable as loadable (they are loaded in memory from the -+ DYNAMIC segment) and yet are not present in separate debug info -+ files. This is fine, and should not cause a warning. Shared -+ libraries contain just the section ".gnu.liblist" but it is not -+ marked as loadable there. */ -+ -+ if (!(strcmp (sect_name, ".gnu.liblist") == 0 -+ || strcmp (sect_name, ".gnu.conflict") == 0)) -+ warning (_("section %s not found in %s"), sect_name, -+ bfd_get_filename (abfd)); -+ - addrs->other[i].addr = 0; - - /* SECTINDEX is invalid if ADDR is zero. */ - - - -http://sourceware.org/ml/gdb-cvs/2010-03/msg00138.html -http://sourceware.org/ml/gdb-patches/2010-03/msg00535.html -cc3e71651e2fd0168a2d3dd4efc2d3e15fd508dd - -### src/gdb/ChangeLog 2010/03/15 03:48:46 1.11479 -### src/gdb/ChangeLog 2010/03/15 09:31:30 1.11480 -## -1,3 +1,8 @@ -+2010-03-15 Jan Kratochvil -+ -+ * symfile.c (addr_info_make_relative): Ignore also missing ".dynbss" -+ and ".sdynbss". Update the comment. -+ - 2010-03-15 Jie Zhang - - * MAINTAINERS: Update my email address. ---- src/gdb/symfile.c 2010/03/10 18:20:07 1.277 -+++ src/gdb/symfile.c 2010/03/15 09:31:34 1.278 -@@ -576,16 +576,19 @@ - /* This section does not exist in ABFD, which is normally - unexpected and we want to issue a warning. - -- However, the ELF prelinker does create a couple of sections -- (".gnu.liblist" and ".gnu.conflict") which are marked in the main -- executable as loadable (they are loaded in memory from the -- DYNAMIC segment) and yet are not present in separate debug info -- files. This is fine, and should not cause a warning. Shared -- libraries contain just the section ".gnu.liblist" but it is not -- marked as loadable there. */ -+ However, the ELF prelinker does create a few sections which are -+ marked in the main executable as loadable (they are loaded in -+ memory from the DYNAMIC segment) and yet are not present in -+ separate debug info files. This is fine, and should not cause -+ a warning. Shared libraries contain just the section -+ ".gnu.liblist" but it is not marked as loadable there. There is -+ no other way to identify them than by their name as the sections -+ created by prelink have no special flags. */ - - if (!(strcmp (sect_name, ".gnu.liblist") == 0 -- || strcmp (sect_name, ".gnu.conflict") == 0)) -+ || strcmp (sect_name, ".gnu.conflict") == 0 -+ || strcmp (sect_name, ".dynbss") == 0 -+ || strcmp (sect_name, ".sdynbss") == 0)) - warning (_("section %s not found in %s"), sect_name, - bfd_get_filename (abfd)); - - - - -http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html -Subject: [patch] Fix separate-debug with non-unique section names (PR 11409) - -A different version was checked-in but they are interchangeable: - http://sourceware.org/ml/gdb-patches/2010-03/msg00799.html - http://sourceware.org/ml/gdb-cvs/2010-03/msg00241.html - -Hi, - -gdb-7.1 is now broken for example for debugging /usr/bin/emacs due to: -http://sourceware.org/bugzilla/show_bug.cgi?id=11409 - [22] .data PROGBITS 00000000007fe8a0 1fe8a0 215068 00 WA 0 0 32 - [23] .data PROGBITS 0000000000a13920 413920 68c6e0 00 WA 0 0 32 - -It is in fact a regression against gdb-7.0 by me due to: - -commit 71d0069a9f238a11f7f455bf6ad2adfc25683521 -Author: Jan Kratochvil -Date: Tue Jan 5 15:51:01 2010 +0000 - -gdb/ - * symfile.c (syms_from_objfile): Remove the !MAINLINE conditional. - -as while the code was broken even before the broken relocation was not applied -to mainline binary (before PIE+OSX patches went in). - - -No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. - -OK to check-in also for gdb-7.1 (7.1.1)? - - -Thanks, -Jan - - -gdb/ -2010-03-23 Jan Kratochvil - - * symfile.c (addr_info_make_relative): Move sect declaration to the - outer block. Initialize it to NULL. Prefer SECT->next more than - bfd_get_section_by_name. - -gdb/testsuite/ -2010-03-23 Jan Kratochvil - - * gdb.base/dup-sect.exp, gdb.base/dup-sect.S: New. - ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -529,6 +529,7 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) - asection *lower_sect; - CORE_ADDR lower_offset; - int i; -+ asection *sect; - - /* Find lowest loadable section to be used as starting point for - continguous sections. */ -@@ -553,11 +554,23 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) - (the loadable section directly below it in memory). - this_offset = lower_offset = lower_addr - lower_orig_addr */ - -+ sect = NULL; - for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) - { - const char *sect_name = addrs->other[i].name; -- asection *sect = bfd_get_section_by_name (abfd, sect_name); - -+ /* Prefer the next section of that we have found last. The separate -+ debug info files have either the same section layout or just a few -+ sections are missing there. On the other hand the section name is not -+ unique and we could find an inappropraite section by its name. */ -+ -+ if (sect) -+ sect = sect->next; -+ if (sect && strcmp (sect_name, bfd_get_section_name (abfd, sect)) != 0) -+ sect = NULL; -+ -+ if (sect == NULL) -+ sect = bfd_get_section_by_name (abfd, sect_name); - if (sect) - { - /* This is the index used by BFD. */ ---- /dev/null -+++ b/gdb/testsuite/gdb.base/dup-sect.S -@@ -0,0 +1,22 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+ .section sect1, "a" -+var1: .byte 1 -+ -+ .section sect2, "a" -+var2: .byte 2 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/dup-sect.exp -@@ -0,0 +1,79 @@ -+# This testcase is part of GDB, the GNU debugger. -+ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Test inappropriate offseting of multiple sections with the same name. -+# When kept in object file (before final executable link) it still works. -+# When separate debug info file is not used it still works. -+# When the ELF symbol table is kept in the main binary it still works. -+# Used .S file as in .c file we would need __attriute__((section)) which is -+# a GCC extension. -+ -+# This test can only be run on targets which support ELF and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile dup-sect -+set srcfile ${testfile}.S -+set srcmainfile start.c -+set executable ${testfile} -+set binfile ${objdir}/${subdir}/${executable} -+ -+if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile}] {}] == -1} { -+ return -1 -+} -+ -+set test "rename section" -+set objcopy_program [transform objcopy] -+set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output] -+verbose "result is $result" -+verbose "output is $output" -+if {$result != 0} { -+ fail $test -+ return -+} -+pass $test -+ -+set test "split" -+if {[gdb_gnu_strip_debug $binfile] != 0} { -+ fail $test -+} else { -+ pass $test -+} -+ -+# gdb_gnu_strip_debug uses only --strip-debug and keeps the ELF symbol table -+# in $binfile. -+set test "strip" -+set strip_program [transform strip] -+set result [catch "exec $strip_program $binfile" output] -+verbose "result is $result" -+verbose "output is $output" -+if {$result != 0} { -+ fail $test -+ return -+} -+pass $test -+ -+clean_restart $executable -+ -+gdb_test "p/d *(const char *) &var1" " = 1" "var1 after strip" -+gdb_test "p/d *(const char *) &var2" " = 2" "var2 after strip" - - - -[patch] Fix breakpoint at *_start -http://sourceware.org/ml/gdb-patches/2010-04/msg00059.html -http://sourceware.org/ml/gdb-cvs/2010-04/msg00029.html - -### src/gdb/ChangeLog 2010/04/04 13:54:42 1.11568 -### src/gdb/ChangeLog 2010/04/04 22:12:04 1.11569 -## -1,5 +1,10 @@ - 2010-04-04 Jan Kratochvil - -+ * infcmd.c (run_command_1): Call proceed with regcache_read_pc address. -+ * config/djgpp/fnchange.lst: Add translation for break-entry.exp. -+ -+2010-04-04 Jan Kratochvil -+ - * breakpoint.c (bpstat_find_step_resume_breakpoint): Remove. - * breakpoint.h (bpstat_find_step_resume_breakpoint): Remove. - ---- src/gdb/infcmd.c 2010/03/25 20:48:53 1.263 -+++ src/gdb/infcmd.c 2010/04/04 22:12:04 1.264 -@@ -580,8 +580,9 @@ - has done its thing; now we are setting up the running program. */ - post_create_inferior (¤t_target, 0); - -- /* Start the target running. */ -- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0); -+ /* Start the target running. Do not use -1 continuation as it would skip -+ breakpoint right at the entry point. */ -+ proceed (regcache_read_pc (get_current_regcache ()), TARGET_SIGNAL_0, 0); - - /* Since there was no error, there's no need to finish the thread - states here. */ ---- src/gdb/config/djgpp/fnchange.lst 2010/02/01 19:27:55 1.108 -+++ src/gdb/config/djgpp/fnchange.lst 2010/04/04 22:12:07 1.109 -@@ -371,6 +371,7 @@ - @V@/gdb/testsuite/gdb.arch/powerpc-prologue.exp @V@/gdb/testsuite/gdb.arch/ppc-prologue.exp - @V@/gdb/testsuite/gdb.base/bitfields2.c @V@/gdb/testsuite/gdb.base/bitfiel2.c - @V@/gdb/testsuite/gdb.base/bitfields2.exp @V@/gdb/testsuite/gdb.base/bitfiel2.exp -+@V@/gdb/testsuite/gdb.base/break-entry.exp @V@/gdb/testsuite/gdb.base/brkentry.exp - @V@/gdb/testsuite/gdb.base/coremaker2.c @V@/gdb/testsuite/gdb.base/core2maker.c - @V@/gdb/testsuite/gdb.base/hashline1.exp @V@/gdb/testsuite/gdb.base/hash1line.exp - @V@/gdb/testsuite/gdb.base/hashline2.exp @V@/gdb/testsuite/gdb.base/hash2line.exp -### src/gdb/testsuite/ChangeLog 2010/04/02 05:13:07 1.2218 -### src/gdb/testsuite/ChangeLog 2010/04/04 22:12:09 1.2219 -## -1,3 +1,7 @@ -+2010-04-04 Jan Kratochvil -+ -+ * gdb.base/break-entry.exp: New. -+ - 2010-04-02 Hui Zhu - Michael Snyder - ---- src/gdb/testsuite/gdb.base/break-entry.exp -+++ src/gdb/testsuite/gdb.base/break-entry.exp 2010-04-05 20:17:39.234684000 +0000 -@@ -0,0 +1,43 @@ -+# Copyright (C) 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Test inferior can stop at its very first instruction, usually "_start". -+# Dynamic executables have first instruction in ld.so. -+ -+set testfile break-entry -+if { [prepare_for_testing ${testfile}.exp ${testfile} start.c {additional_flags=-static}] } { -+ return -1 -+} -+ -+set test "info files" -+set entry "" -+gdb_test_multiple $test $test { -+ -re "\r\n\[\t \]*Entry point:\[\t \]*(0x\[0-9a-f\]+)\r\n.*$gdb_prompt $" { -+ set entry $expect_out(1,string) -+ pass $test -+ } -+} -+if {$entry == ""} { -+ untested ${testfile}.exp -+ return -+} -+ -+if ![runto "*$entry"] { -+ return -+} -+gdb_test {p/x $pc} " = $entry" -+ -+gdb_breakpoint "main" -+gdb_continue_to_breakpoint "main" "main.*" - - - -https://bugzilla.redhat.com/show_bug.cgi?id=590648 -Re: [rfc] Work around invalid G++ DWARF for unnamed aggregates -http://sourceware.org/ml/gdb-patches/2010-03/msg00909.html -commit 5e40af195bd74a66d300d8f481cab1f2ba533f3a - -[ cut only a part of it ] - ---- a/gdb/completer.c -+++ b/gdb/completer.c -@@ -401,7 +401,7 @@ add_struct_fields (struct type *type, int *nextp, char **output, - computed_type_name = 1; - } - /* Omit constructors from the completion list. */ -- if (type_name && strcmp (type_name, name)) -+ if (!type_name || strcmp (type_name, name)) - { - output[*nextp] = xstrdup (name); - ++*nextp; - - - -https://bugzilla.redhat.com/show_bug.cgi?id=578136 -https://bugzilla.redhat.com/show_bug.cgi?id=593926 -http://sourceware.org/ml/gdb-patches/2010-04/msg00820.html -http://sourceware.org/ml/gdb-cvs/2010-04/msg00240.html - -### src/gdb/ChangeLog 2010/04/23 18:09:16 1.11678 -### src/gdb/ChangeLog 2010/04/23 21:44:19 1.11679 -## -1,3 +1,14 @@ -+2010-04-23 Daniel Jacobowitz -+ Paul Pluzhnikov -+ Jan Kratochvil -+ -+ Fix deadlock on looped list of loaded shared objects. -+ * solib-svr4.c (LM_PREV): New function. -+ (IGNORE_FIRST_LINK_MAP_ENTRY): Use it. -+ (svr4_current_sos): Check for correct l_prev. New variables prev_lm -+ and next_lm. Clear prev_lm for solib_svr4_r_ldsomap. -+ * config/djgpp/fnchange.lst: Add translation for solib-corrupted.exp. -+ - 2010-04-23 Doug Evans - - * configure.ac (CONFIG_SRCS): Add py-auto-load.o even if not using ---- src/gdb/solib-svr4.c 2010/03/11 22:07:02 1.130 -+++ src/gdb/solib-svr4.c 2010/04/23 21:44:19 1.131 -@@ -272,6 +272,16 @@ - } - - static CORE_ADDR -+LM_PREV (struct so_list *so) -+{ -+ struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); -+ struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; -+ -+ return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset, -+ ptr_type); -+} -+ -+static CORE_ADDR - LM_NAME (struct so_list *so) - { - struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); -@@ -284,16 +294,12 @@ - static int - IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so) - { -- struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); -- struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; -- - /* Assume that everything is a library if the dynamic loader was loaded - late by a static executable. */ - if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) - return 0; - -- return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset, -- ptr_type) == 0; -+ return LM_PREV (so) == 0; - } - - /* Per pspace SVR4 specific data. */ -@@ -1101,7 +1107,7 @@ - static struct so_list * - svr4_current_sos (void) - { -- CORE_ADDR lm; -+ CORE_ADDR lm, prev_lm; - struct so_list *head = 0; - struct so_list **link_ptr = &head; - CORE_ADDR ldsomap = 0; -@@ -1120,6 +1126,7 @@ - - /* Walk the inferior's link map list, and build our list of - `struct so_list' nodes. */ -+ prev_lm = 0; - lm = solib_svr4_r_map (info); - - while (lm) -@@ -1127,6 +1134,7 @@ - struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); - struct so_list *new = XZALLOC (struct so_list); - struct cleanup *old_chain = make_cleanup (xfree, new); -+ CORE_ADDR next_lm; - - new->lm_info = xmalloc (sizeof (struct lm_info)); - make_cleanup (xfree, new->lm_info); -@@ -1138,14 +1146,21 @@ - - read_memory (lm, new->lm_info->lm, lmo->link_map_size); - -- lm = LM_NEXT (new); -+ next_lm = LM_NEXT (new); -+ -+ if (LM_PREV (new) != prev_lm) -+ { -+ warning (_("Corrupted shared library list")); -+ free_so (new); -+ next_lm = 0; -+ } - - /* For SVR4 versions, the first entry in the link map is for the - inferior executable, so we must ignore it. For some versions of - SVR4, it has no name. For others (Solaris 2.3 for example), it - does have a name, so we can no longer use a missing name to - decide when to ignore it. */ -- if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0) -+ else if (IGNORE_FIRST_LINK_MAP_ENTRY (new) && ldsomap == 0) - { - info->main_lm_addr = new->lm_info->lm_addr; - free_so (new); -@@ -1182,12 +1197,18 @@ - } - } - -+ prev_lm = lm; -+ lm = next_lm; -+ - /* On Solaris, the dynamic linker is not in the normal list of - shared objects, so make sure we pick it up too. Having - symbol information for the dynamic linker is quite crucial - for skipping dynamic linker resolver code. */ - if (lm == 0 && ldsomap == 0) -- lm = ldsomap = solib_svr4_r_ldsomap (info); -+ { -+ lm = ldsomap = solib_svr4_r_ldsomap (info); -+ prev_lm = 0; -+ } - - discard_cleanups (old_chain); - } ---- src/gdb/config/djgpp/fnchange.lst 2010/04/09 15:15:05 1.112 -+++ src/gdb/config/djgpp/fnchange.lst 2010/04/23 21:44:19 1.113 -@@ -397,6 +397,7 @@ - @V@/gdb/testsuite/gdb.base/siginfo-obj.c @V@/gdb/testsuite/gdb.base/si-obj.c - @V@/gdb/testsuite/gdb.base/siginfo-addr.exp @V@/gdb/testsuite/gdb.base/si-addr.exp - @V@/gdb/testsuite/gdb.base/siginfo-obj.exp @V@/gdb/testsuite/gdb.base/si-obj.exp -+@V@/gdb/testsuite/gdb.base/solib-corrupted.exp @V@/gdb/testsuite/gdb.base/so-crptd.exp - @V@/gdb/testsuite/gdb.base/solib-disc.c @V@/gdb/testsuite/gdb.base/so-disc.c - @V@/gdb/testsuite/gdb.base/solib-display-lib.c @V@/gdb/testsuite/gdb.base/so-displib.c - @V@/gdb/testsuite/gdb.base/solib-display-main.c @V@/gdb/testsuite/gdb.base/so-dispmain.c -### src/gdb/testsuite/ChangeLog 2010/04/23 18:03:31 1.2252 -### src/gdb/testsuite/ChangeLog 2010/04/23 21:44:20 1.2253 -## -1,3 +1,8 @@ -+2010-04-23 Jan Kratochvil -+ -+ Fix deadlock on looped list of loaded shared objects. -+ * gdb.base/solib-corrupted.exp: New. -+ - 2010-04-23 Doug Evans - - * gdb.python/py-section-script.c: New file. ---- src/gdb/testsuite/gdb.base/solib-corrupted.exp -+++ src/gdb/testsuite/gdb.base/solib-corrupted.exp 2010-05-24 18:00:52.057995000 +0000 -@@ -0,0 +1,46 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile "solib-corrupted" -+set srcfile start.c -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { -+ untested ${testfile}.exp -+ return -1 -+} -+ -+if ![runto_main] { -+ fail "Can't run to main" -+ return -+} -+ -+gdb_test "info sharedlibrary" "" "normal list" -+ -+# GDB checks there for matching L_PREV. -+set test "make solibs looping" -+gdb_test_multiple "p/x _r_debug->r_map->l_next = _r_debug->r_map" $test { -+ -re "(No symbol \"_r_debug\" in current context\\.|Attempt to extract a component of a value that is not a structure pointer\\.)\r\n$gdb_prompt $" { -+ # glibc debug info is not available and it is too difficult to find and -+ # parse it from this testcase without the gdb supporting functions. -+ verbose -log "no _r_debug symbol has been found" -+ xfail $test -+ untested ${testfile}.exp -+ return -+ } -+ -re " = 0x\[0-9a-f\]+\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+gdb_test "info sharedlibrary" "warning: Corrupted shared library list\r\n.*" "corrupted list" - - - -Re: [patch] Fix crash on /proc/PID/stat race -http://sourceware.org/ml/gdb-patches/2010-05/msg00685.html -http://sourceware.org/ml/gdb-cvs/2010-05/msg00244.html - -### src/gdb/ChangeLog 2010/05/28 18:00:41 1.11855 -### src/gdb/ChangeLog 2010/05/28 18:23:13 1.11856 -## -1,5 +1,10 @@ - 2010-05-28 Jan Kratochvil - -+ * linux-nat.c (linux_nat_core_of_thread_1): Fix crash on invalid -+ CONTENT. -+ -+2010-05-28 Jan Kratochvil -+ - * linux-nat.c (linux_nat_wait_1): Do not call - linux_nat_core_of_thread_1 on TARGET_WAITKIND_EXITED or - TARGET_WAITKIND_SIGNALLED. ---- src/gdb/linux-nat.c 2010/05/28 18:00:46 1.169 -+++ src/gdb/linux-nat.c 2010/05/28 18:23:15 1.170 -@@ -5509,15 +5509,21 @@ - make_cleanup (xfree, content); - - p = strchr (content, '('); -- p = strchr (p, ')') + 2; /* skip ")" and a whitespace. */ -+ -+ /* Skip ")". */ -+ if (p != NULL) -+ p = strchr (p, ')'); -+ if (p != NULL) -+ p++; - - /* If the first field after program name has index 0, then core number is - the field with index 36. There's no constant for that anywhere. */ -- p = strtok_r (p, " ", &ts); -- for (i = 0; i != 36; ++i) -+ if (p != NULL) -+ p = strtok_r (p, " ", &ts); -+ for (i = 0; p != NULL && i != 36; ++i) - p = strtok_r (NULL, " ", &ts); - -- if (sscanf (p, "%d", &core) == 0) -+ if (p == NULL || sscanf (p, "%d", &core) == 0) - core = -1; - - do_cleanups (back_to); -### src/gdb/gdbserver/ChangeLog 2010/05/26 22:40:22 1.386 -### src/gdb/gdbserver/ChangeLog 2010/05/28 18:23:15 1.387 -## -1,3 +1,8 @@ -+2010-05-28 Jan Kratochvil -+ -+ * linux-low.c (linux_core_of_thread): Fix crash on invalid CONTENT. -+ New comment. -+ - 2010-05-26 Ozkan Sezer - - * gdbreplay.c (remote_open): Check error return from socket() call by ---- src/gdb/gdbserver/linux-low.c 2010/05/03 04:02:20 1.148 -+++ src/gdb/gdbserver/linux-low.c 2010/05/28 18:23:15 1.149 -@@ -4346,13 +4346,21 @@ - } - - p = strchr (content, '('); -- p = strchr (p, ')') + 2; /* skip ")" and a whitespace. */ - -- p = strtok_r (p, " ", &ts); -- for (i = 0; i != 36; ++i) -+ /* Skip ")". */ -+ if (p != NULL) -+ p = strchr (p, ')'); -+ if (p != NULL) -+ p++; -+ -+ /* If the first field after program name has index 0, then core number is -+ the field with index 36. There's no constant for that anywhere. */ -+ if (p != NULL) -+ p = strtok_r (p, " ", &ts); -+ for (i = 0; p != NULL && i != 36; ++i) - p = strtok_r (NULL, " ", &ts); - -- if (sscanf (p, "%d", &core) == 0) -+ if (p == NULL || sscanf (p, "%d", &core) == 0) - core = -1; - - free (content); - - - -Re: [patch] testsuite: watchthreads-reorder: Linux kernel compat. -http://sourceware.org/ml/gdb-patches/2010-05/msg00696.html -http://sourceware.org/ml/gdb-cvs/2010-05/msg00255.html - -### src/gdb/testsuite/ChangeLog 2010/05/28 23:47:40 1.2293 -### src/gdb/testsuite/ChangeLog 2010/05/31 03:31:16 1.2294 -## -1,3 +1,11 @@ -+2010-05-31 Jan Kratochvil -+ -+ Accept the new Linux kernel "t (tracing stop)" string. -+ * gdb.threads/watchthreads-reorder.c (thread1_func, thread2_func): -+ Update comment. -+ (state_wait) : New. -+ (main): Update the state_wait expect string. -+ - 2010-05-28 Pedro Alves - - * limits.c, limits.exp: Delete files. ---- src/gdb/testsuite/gdb.threads/watchthreads-reorder.c 2010/01/20 21:09:30 1.3 -+++ src/gdb/testsuite/gdb.threads/watchthreads-reorder.c 2010/05/31 03:31:17 1.4 -@@ -99,7 +99,7 @@ - - rwatch_store = thread1_rwatch; - -- /* Be sure the "T (tracing stop)" test can proceed for both threads. */ -+ /* Be sure the "t (tracing stop)" test can proceed for both threads. */ - timed_mutex_lock (&terminate_mutex); - i = pthread_mutex_unlock (&terminate_mutex); - assert (i == 0); -@@ -125,7 +125,7 @@ - - rwatch_store = thread2_rwatch; - -- /* Be sure the "T (tracing stop)" test can proceed for both threads. */ -+ /* Be sure the "t (tracing stop)" test can proceed for both threads. */ - timed_mutex_lock (&terminate_mutex); - i = pthread_mutex_unlock (&terminate_mutex); - assert (i == 0); -@@ -211,6 +211,13 @@ - do - { - state = proc_string (filename, "State:\t"); -+ -+ /* torvalds/linux-2.6.git 464763cf1c6df632dccc8f2f4c7e50163154a2c0 -+ has changed "T (tracing stop)" to "t (tracing stop)". Make the GDB -+ testcase backward compatible with older Linux kernels. */ -+ if (strcmp (state, "T (tracing stop)") == 0) -+ state = "t (tracing stop)"; -+ - if (strcmp (state, wanted) == 0) - { - free (filename); -@@ -336,9 +343,9 @@ - { - /* s390x-unknown-linux-gnu will fail with "R (running)". */ - -- state_wait (thread1_tid, "T (tracing stop)"); -+ state_wait (thread1_tid, "t (tracing stop)"); - -- state_wait (thread2_tid, "T (tracing stop)"); -+ state_wait (thread2_tid, "t (tracing stop)"); - } - - cleanup (); diff --git a/gdb-using-directive-leak.patch b/gdb-using-directive-leak.patch deleted file mode 100644 index 21faa91..0000000 --- a/gdb-using-directive-leak.patch +++ /dev/null @@ -1,214 +0,0 @@ -FSF GDB variant is at: -http://sourceware.org/ml/gdb-patches/2010-03/msg00789.html - -commit 56b45f494f647360f9d6ff84f12f59c08cbe05af -Author: Sami Wagiaalla -Date: Mon Mar 29 16:08:58 2010 -0400 - - Fix using_directive memory leak. - -diff --git a/gdb/buildsym.c b/gdb/buildsym.c -index ff2c9b1..35e4663 100644 ---- a/gdb/buildsym.c -+++ b/gdb/buildsym.c -@@ -387,6 +387,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, - } - - block_set_using (block, using_directives, &objfile->objfile_obstack); -+ using_directives = NULL; - - record_pending_block (objfile, block, opblock); - -diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c -index 6325ead..c6df91f 100644 ---- a/gdb/cp-namespace.c -+++ b/gdb/cp-namespace.c -@@ -120,7 +120,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) - anonymous namespace. So add symbols in it to the - namespace given by the previous component if there is - one, or to the global namespace if there isn't. */ -- cp_add_using_directive (dest, src, NULL, "", 0); -+ cp_add_using_directive (dest, src, NULL, "", 0, -+ &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack); - } - /* The "+ 2" is for the "::". */ - previous_component = next_component + 2; -@@ -132,11 +133,17 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) - } - - /* Add a using directive to using_list. If the using directive in question -- has already been added, don't add it twice. */ -+ has already been added, don't add it twice. -+ Create a new struct using_direct which imports the namespace SRC into the -+ scope DEST. ALIAS is the name of the imported namespace in the current -+ scope. If ALIAS is NULL then the namespace is known by its original name. -+ The arguments are copied into newly allocated memory so they can be -+ temporaries. */ - - void - cp_add_using_directive (const char *dest, const char *src, const char *alias, -- const char *declaration, const int line_number) -+ const char *declaration, const int line_number, -+ struct obstack *obstack) - { - struct using_direct *current; - struct using_direct *new; -@@ -146,12 +153,26 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias, - for (current = using_directives; current != NULL; current = current->next) - { - if (strcmp (current->import_src, src) == 0 -- && strcmp (current->import_dest, dest) == 0) -+ && strcmp (current->import_dest, dest) == 0 -+ && ((alias == NULL && current->alias == NULL) -+ || (alias != NULL && current->alias != NULL -+ && strcmp (alias, current->alias) == 0))) - return; - } - -- using_directives = cp_add_using (dest, src, alias, declaration, -- line_number, using_directives); -+ new = OBSTACK_ZALLOC (obstack, struct using_direct); -+ -+ new->import_src = obsavestring (src, strlen (src), obstack); -+ new->import_dest = obsavestring (dest, strlen (dest), obstack); -+ -+ if (alias != NULL) -+ new->alias = obsavestring (alias, strlen (alias), obstack); -+ -+ new->declaration = obsavestring (declaration, strlen (declaration), obstack); -+ new->line_number = line_number; -+ -+ new->next = using_directives; -+ using_directives = new; - - } - -@@ -203,42 +224,6 @@ cp_is_anonymous (const char *namespace) - != NULL); - } - --/* Create a new struct using direct which imports the namespace SRC -- into the scope DEST. ALIAS is the name of the imported namespace -- in the current scope. If ALIAS is NULL then the -- namespace is known by its original name. -- -- Set its next member in the linked list to NEXT; allocate all memory -- using xmalloc. It copies the strings, so NAME can be a temporary -- string. */ -- --struct using_direct * --cp_add_using (const char *dest, -- const char *src, -- const char *alias, -- const char *declaration, -- const int line_number, -- struct using_direct *next) --{ -- struct using_direct *retval; -- -- retval = xmalloc (sizeof (struct using_direct)); -- retval->import_src = savestring (src, strlen (src)); -- retval->import_dest = savestring (dest, strlen (dest)); -- -- if (alias != NULL) -- retval->alias = savestring (alias, strlen (alias)); -- else -- retval->alias = NULL; -- -- retval->declaration = savestring (declaration, strlen (declaration)); -- retval->line_number = line_number; -- retval->next = next; -- retval->searched = 0; -- -- return retval; --} -- - /* The C++-specific version of name lookup for static and global - names. This makes sure that names get looked for in all namespaces - that are in scope. NAME is the natural name of the symbol that -diff --git a/gdb/cp-support.h b/gdb/cp-support.h -index 57aa5e5..41f17fe 100644 ---- a/gdb/cp-support.h -+++ b/gdb/cp-support.h -@@ -101,14 +101,8 @@ extern void cp_add_using_directive (const char *dest, - const char *src, - const char *alias, - const char *declaration, -- const int line_number); -- --extern struct using_direct *cp_add_using (const char *dest, -- const char *src, -- const char *alias, -- const char *declaration, -- const int line_number, -- struct using_direct *next); -+ const int line_number, -+ struct obstack *obstack); - - extern void cp_initialize_namespace (void); - -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index e3a780e..b73f444 100644 ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -3563,12 +3563,12 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) - } - } - -- using_directives = cp_add_using (import_prefix, -- canonical_name, -- import_alias, -- imported_declaration, -- line_number, -- using_directives); -+ cp_add_using_directive (import_prefix, -+ canonical_name, -+ import_alias, -+ imported_declaration, -+ line_number, -+ &cu->objfile->objfile_obstack); - } - - static void -@@ -5703,7 +5703,12 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) - if (is_anonymous) - { - const char *previous_prefix = determine_prefix (die, cu); -- cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, "", dwarf2_read_decl_line(die, cu)); -+ cp_add_using_directive (previous_prefix, -+ TYPE_NAME (type), -+ NULL, -+ "", -+ dwarf2_read_decl_line(die, cu), -+ &objfile->objfile_obstack); - } - } - -diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.cc b/gdb/testsuite/gdb.cp/gdb2384-base.cc -index 09ed04e..b58f30d 100644 ---- a/gdb/testsuite/gdb.cp/gdb2384-base.cc -+++ b/gdb/testsuite/gdb.cp/gdb2384-base.cc -@@ -23,6 +23,8 @@ base::base (int _x) - { - } - -+using namespace B; -+ - int - base::meth () - { -diff --git a/gdb/testsuite/gdb.cp/gdb2384-base.h b/gdb/testsuite/gdb.cp/gdb2384-base.h -index b09701e..981943c 100644 ---- a/gdb/testsuite/gdb.cp/gdb2384-base.h -+++ b/gdb/testsuite/gdb.cp/gdb2384-base.h -@@ -16,6 +16,10 @@ - along with this program. If not, see . - */ - -+namespace B{ -+ int x; -+} -+ - class base - { - public: diff --git a/gdb.spec b/gdb.spec index 46c198a..d60c8fd 100644 --- a/gdb.spec +++ b/gdb.spec @@ -32,18 +32,18 @@ Name: gdb%{?_with_debug:-debug} # Set version to contents of gdb/version.in. # NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3 # and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch). -Version: 7.1 +Version: 7.1.90.20100721 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 29%{?_with_upstream:.upstream}%{dist} +Release: 1%{?_with_upstream:.upstream}%{dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain Group: Development/Debuggers # Do not provide URL for snapshots as the file lasts there only for 2 days. # ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2 # ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2 -Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2 +Source: ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2 Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) URL: http://gnu.org/software/gdb/ @@ -81,10 +81,6 @@ Source2: gdb-orphanripper.c # Man page for gstack(1). Source3: gdb-gstack.man -# libstdc++ pretty printers from GCC SVN HEAD (4.5 experimental). -%define libstdcxxpython libstdc++-v3-python-r155978 -Source4: %{libstdcxxpython}.tar.bz2 - # Work around out-of-date dejagnu that does not have KFAIL Patch1: gdb-6.3-rh-dummykfail-20041202.patch @@ -193,9 +189,6 @@ Patch190: gdb-6.5-dwarf-stack-overflow.patch # Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337). Patch194: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch -# Fix TLS symbols resolving for objects with separate .debug file (-debuginfo). -Patch195: gdb-6.5-tls-of-separate-debuginfo.patch - # Fix TLS symbols resolving for shared libraries with a relative pathname. # The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. Patch196: gdb-6.5-sharedlibrary-path.patch @@ -204,9 +197,6 @@ Patch196: gdb-6.5-sharedlibrary-path.patch # FIXME: It could be autodetected. Patch199: gdb-6.5-bz190810-gdbserver-arch-advice.patch -# Fix `gcore' command for 32bit inferiors on 64bit hosts. -Patch201: gdb-6.5-gcore-i386-on-amd64.patch - # Testcase for deadlocking on last address space byte; for corrupted backtraces. Patch211: gdb-6.5-last-address-space-byte-test.patch @@ -236,7 +226,7 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch # Backported fixups post the source tarball. -Patch232: gdb-upstream.patch +#Patch232: gdb-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch @@ -244,9 +234,6 @@ Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch # Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832) Patch235: gdb-6.3-bz231832-obstack-2gb.patch -# Fix prelink(8) testcase for non-root $PATH missing `/usr/sbin' (BZ 225783). -Patch240: gdb-6.6-bz225783-prelink-path.patch - # Fix debugging GDB itself - the compiled in source files paths (BZ 225783). Patch241: gdb-6.6-bz225783-gdb-debuginfo-paths.patch @@ -256,9 +243,6 @@ Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch # Notify user of a child forked process being detached (BZ 235197). Patch247: gdb-6.6-bz235197-fork-detach-info.patch -# New testcase for gcore of 32bit inferiors on 64bit hosts. -Patch249: gdb-6.6-gcore32-test.patch - # Avoid too long timeouts on failing cases of "annota1.exp annota3.exp". Patch254: gdb-6.6-testsuite-timeouts.patch @@ -330,9 +314,6 @@ Patch318: gdb-6.8-gcc35998-ada-memory-trash.patch # Test a crash on libraries missing the .text section. Patch320: gdb-6.5-section-num-fixup-test.patch -# Refuse creating watchpoints of an address value, suggested by Martin Stransky. -Patch322: gdb-6.8-constant-watchpoints.patch - # Fix compatibility with recent glibc headers. Patch324: gdb-6.8-glibc-headers-compat.patch @@ -397,9 +378,6 @@ Patch403: gdb-ccache-workaround.patch Patch404: gdb-fortran-common-reduce.patch Patch405: gdb-fortran-common.patch -# Fix Fortran logical-kind=8 (BZ 465310). -Patch406: gdb-fortran-logical8.patch - # Testcase for "Do not make up line information" fix by Daniel Jacobowitz. Patch407: gdb-lineno-makeup-test.patch @@ -412,118 +390,27 @@ Patch412: gdb-unused-revert.patch # Fix i386+x86_64 rwatch+awatch before run, regression against 6.8 (BZ 541866). Patch417: gdb-bz541866-rwatch-before-run.patch -# Remove false gdb_assert on $sp underflow. -Patch422: gdb-infcall-sp-underflow.patch - -# Fix double-free on std::terminate handler (Tom Tromey, BZ 562975). -Patch429: gdb-bz562975-std-terminate-double-free.patch - -# PIE: Fix back re-reun. -Patch430: gdb-pie-rerun.patch - -# Do not consider memory error on reading _r_debug->r_map as fatal (BZ 576742). -Patch432: gdb-solib-memory-error-nonfatal.patch - -# testsuite: Fix unstable results of gdb.base/prelink.exp. -Patch433: gdb-6.7-testsuite-stable-results-prelink.patch - -# [patch 1/6] PIE: Attach binary even after re-prelinked underneath -# [patch 2/6] PIE: Attach binary even after ld.so re-prelinked underneath -# [patch 3/6] PIE: Fix occasional error attaching i686 binary -Patch434: gdb-pie-1of6-reprelinked-bin.patch -Patch435: gdb-pie-2of6-reprelinked-ld.patch -Patch436: gdb-pie-3of6-relocate-once.patch - -# [expr-cumulative] using-directive: Fix memory leak (Sami Wagiaalla). -Patch437: gdb-using-directive-leak.patch - -# Fix dangling displays in separate debuginfo (BZ 574483). -Patch438: gdb-bz574483-display-sepdebug.patch - -# Support AVX registers (BZ 578250). -Patch439: gdb-bz578250-avx-01of10.patch -Patch440: gdb-bz578250-avx-02of10.patch -Patch441: gdb-bz578250-avx-03of10.patch -Patch442: gdb-bz578250-avx-04of10.patch -Patch443: gdb-bz578250-avx-05of10.patch -Patch444: gdb-bz578250-avx-06of10.patch -Patch445: gdb-bz578250-avx-07of10.patch -Patch446: gdb-bz578250-avx-08of10.patch -Patch447: gdb-bz578250-avx-09of10.patch -Patch448: gdb-bz578250-avx-10of10.patch -Patch449: gdb-bz578250-avx-10of10-ppc.patch - # Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz). # Temporarily workaround the crash of BZ 575292 as there was now BZ 585445. # Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch. Patch451: gdb-bz575292-delayed-physname.patch -Patch455: gdb-bz575292-void-workaround.patch - -# Pretty printers not well documented (BZ 570635, Tom Tromey, Jan Kratochvil). -Patch452: gdb-bz570635-prettyprint-doc1.patch -Patch453: gdb-bz570635-prettyprint-doc2.patch # Fix crash when using GNU IFUNC call from breakpoint condition. Patch454: gdb-bz539590-gnu-ifunc-fix-cond.patch -# Fail gracefully if the _Unwind_DebugHook arg. is optimized out (Tom Tromey). -# Make _Unwind_DebugHook independent from step-resume breakpoint (Tom Tromey). -Patch456: gdb-unwind-debughook-safe-fail.patch -Patch457: gdb-unwind-debughook-step-independent.patch - -# testsuite: Fix gdb.base/vla-overflow.exp FAILing on s390x (BZ 590635). -Patch458: gdb-archer-vla-test-oom.patch - # Workaround non-stop moribund locations exploited by kernel utrace (BZ 590623). Patch459: gdb-moribund-utrace-workaround.patch -# Fix crash on VLA bound referencing an optimized-out variable (BZ 591879). -Patch460: gdb-archer-vla-ref-optimizedout.patch - # Remove core file when starting a process (BZ 594560). Patch461: gdb-bz594560-core-vs-process.patch -# Import fix of TUI layout internal error (BZ 595475). -Patch462: gdb-bz595475-tui-layout.patch - -# Fix and support DW_OP_*piece (Tom Tromey, BZ 589467). -Patch463: gdb-bz589467-pieces01of4.patch -Patch464: gdb-bz589467-pieces02of4.patch -Patch465: gdb-bz589467-pieces03of4.patch -Patch466: gdb-bz589467-pieces1of4.patch -Patch467: gdb-bz589467-pieces2of4.patch -Patch468: gdb-bz589467-pieces3of4.patch -Patch469: gdb-bz589467-pieces4of4.patch -Patch471: gdb-bz589467-pieces-vla-compat.patch - # Fix follow-exec for C++ programs (bugreported by Martin Stransky). Patch470: gdb-archer-next-over-throw-cxx-exec.patch -# Fix ADL anonymous type crash (BZ 600746, Sami Wagiaalla). -Patch472: gdb-bz600746-koenig-crash.patch - # Backport DWARF-4 support (BZ 601887, Tom Tromey). -Patch473: gdb-bz601887-dwarf4-1of2.patch -Patch474: gdb-bz601887-dwarf4-2of2.patch Patch475: gdb-bz601887-dwarf4-rh-test.patch -# Fix obstack corruptions on C++ (BZ 606185, Chris Moller, Jan Kratochvil). -Patch476: gdb-bz606185-obstack-1of5.patch -Patch477: gdb-bz606185-obstack-2of5.patch -Patch478: gdb-bz606185-obstack-3of5.patch -Patch479: gdb-bz606185-obstack-4of5.patch -Patch480: gdb-bz606185-obstack-5of5.patch - -# Improve support for typedefs in classes (BZ 602314). -Patch481: gdb-bz602314-ptype-class-typedef-1of3.patch -Patch482: gdb-bz602314-ptype-class-typedef-2of3.patch -Patch483: gdb-bz602314-ptype-class-typedef-3of3.patch - -# Fix `set print object on' for some non-dynamic classes (BZ 606660). -Patch484: gdb-bz606660-print-object-nonvirtual.patch - # Print 2D C++ vectors as matrices (BZ 562763, sourceware10659, Chris Moller). -Patch485: gdb-bz562763-pretty-print-2d-vectors-prereq.patch Patch486: gdb-bz562763-pretty-print-2d-vectors.patch Patch487: gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch @@ -663,7 +550,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %if 0%{!?_with_upstream:1} -%patch232 -p1 +#patch232 -p1 %patch349 -p1 %patch420 -p1 %patch1 -p1 @@ -699,10 +586,8 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch188 -p1 %patch190 -p1 %patch194 -p1 -%patch195 -p1 %patch196 -p1 %patch199 -p1 -%patch201 -p1 %patch208 -p1 %patch209 -p1 %patch211 -p1 @@ -715,11 +600,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch231 -p1 %patch234 -p1 %patch235 -p1 -%patch240 -p1 %patch241 -p1 %patch245 -p1 %patch247 -p1 -%patch249 -p1 %patch254 -p1 %patch258 -p1 %patch260 -p1 @@ -746,7 +629,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch317 -p1 %patch318 -p1 %patch320 -p1 -%patch322 -p1 %patch324 -p1 %patch326 -p1 %patch329 -p1 @@ -767,80 +649,23 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch405 -p1 %patch389 -p1 %patch394 -p1 -%patch406 -p1 %patch407 -p1 %patch408 -p1 %patch412 -p1 %patch417 -p1 -%patch422 -p1 -%patch429 -p1 -%patch430 -p1 -%patch432 -p1 -%patch433 -p1 -%patch434 -p1 -%patch435 -p1 -%patch436 -p1 -%patch437 -p1 -%patch438 -p1 -%patch439 -p1 -%patch440 -p1 -%patch441 -p1 -%patch442 -p1 -%patch443 -p1 -%patch444 -p1 -%patch445 -p1 -%patch446 -p1 -%patch447 -p1 -%patch448 -p1 -%patch449 -p1 %patch451 -p1 -%patch452 -p1 -%patch453 -p1 %patch454 -p1 -%patch455 -p1 -%patch456 -p1 -%patch457 -p1 -%patch458 -p1 %patch459 -p1 -%patch460 -p1 %patch461 -p1 -%patch462 -p1 -%patch463 -p1 -%patch464 -p1 -%patch465 -p1 -%patch466 -p1 -%patch467 -p1 -%patch468 -p1 -%patch469 -p1 -%patch471 -p1 %patch470 -p1 -%patch472 -p1 -%patch473 -p1 -%patch474 -p1 %patch475 -p1 -%patch476 -p1 -%patch477 -p1 -%patch478 -p1 -%patch479 -p1 -%patch480 -p1 -%patch481 -p1 -%patch482 -p1 -%patch483 -p1 -%patch484 -p1 -%patch485 -p1 %patch486 -p1 -# Disabled now for F-14 before rebase. +# This patch should be applied to gcc-4.5+.src.rpm: #patch487 -p1 - %patch415 -p1 + %patch393 -p1 %patch335 -p1 -# Patch415: gdb-6.6-buildid-locate-core-as-arg.patch -# Currently disabled for RHEL as it is a new experimental feature not present -# in FSF GDB and possibly affecting new user scripts. -%if 0%{?rhel:1} -%patch415 -p1 -R -%endif %if 0%{!?el5:1} %patch393 -p1 -R %patch335 -p1 -R @@ -1161,9 +986,13 @@ fi %endif %{_bindir}/gdbserver %{_mandir}/*/gdbserver.1* +%{_libdir}/libinproctrace.so %endif %changelog +* Wed Jul 21 2010 Jan Kratochvil - 7.1.90.20100721-1.fc14 +- Rebase to FSF GDB 7.1.90.20100721 (which is 7.2 pre-release). + * Tue Jul 13 2010 Jan Kratochvil - 7.1-29.fc14 - Disable temporarily Python files before the new rebase is done (BZ 613710). diff --git a/sources b/sources index 9e405a8..82ced62 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -21dce610476c054687b52770d2ddc657 gdb-7.1.tar.bz2 -04e5c4b1b9e633422cc48990fe61958d libstdc++-v3-python-r155978.tar.bz2 +26c6432521efa296bf8bdcae465c048b gdb-7.1.90.20100721.tar.bz2