diff --git a/.cvsignore b/.cvsignore index c5c8046..65e2536 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,2 +1,2 @@ -gdb-7.0.1.tar.bz2 +gdb-7.0.50.20100116.tar.bz2 libstdc++-v3-python-r151798.tar.bz2 diff --git a/gdb-6.3-large-core-20051206.patch b/gdb-6.3-large-core-20051206.patch index 2876b75..6f94402 100644 --- a/gdb-6.3-large-core-20051206.patch +++ b/gdb-6.3-large-core-20051206.patch @@ -25,11 +25,11 @@ Port to GDB-6.7. -Index: gdb-6.8.50.20090909/gdb/symfile-mem.c +Index: gdb-7.0.50.20100115/gdb/symfile-mem.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/symfile-mem.c 2009-07-02 19:21:06.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/symfile-mem.c 2009-09-09 19:06:57.000000000 +0200 -@@ -56,6 +56,14 @@ +--- gdb-7.0.50.20100115.orig/gdb/symfile-mem.c 2010-01-01 08:31:42.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symfile-mem.c 2010-01-15 03:22:23.000000000 +0100 +@@ -57,6 +57,14 @@ #include "elf/common.h" @@ -44,7 +44,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile-mem.c /* Read inferior memory at ADDR to find the header of a loaded object file and read its in-core symbols out of inferior memory. TEMPL is a bfd representing the target's format. NAME is the name to use for this -@@ -76,7 +84,7 @@ symbol_file_add_from_memory (struct bfd +@@ -77,7 +85,7 @@ symbol_file_add_from_memory (struct bfd error (_("add-symbol-file-from-memory not supported for this target")); nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase, @@ -53,10 +53,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile-mem.c if (nbfd == NULL) error (_("Failed to read a valid object file image from memory.")); -Index: gdb-6.8.50.20090909/gdb/target.c +Index: gdb-7.0.50.20100115/gdb/target.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/target.c 2009-09-09 19:05:56.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/target.c 2009-09-09 19:08:11.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/target.c 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/target.c 2010-01-15 03:22:23.000000000 +0100 @@ -59,7 +59,7 @@ static int nosymbol (char *, CORE_ADDR * static void tcomplain (void) ATTR_NORETURN; @@ -66,7 +66,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c static int return_zero (void); -@@ -492,7 +492,7 @@ target_terminal_inferior (void) +@@ -494,7 +494,7 @@ target_terminal_inferior (void) (*current_target.to_terminal_inferior) (); } @@ -75,7 +75,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, struct target_ops *t) { -@@ -711,7 +711,7 @@ update_current_target (void) +@@ -726,7 +726,7 @@ update_current_target (void) (void (*) (struct regcache *)) noprocess); de_fault (deprecated_xfer_memory, @@ -84,7 +84,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c nomemory); de_fault (to_files_info, (void (*) (struct target_ops *)) -@@ -1443,7 +1443,7 @@ target_xfer_partial (struct target_ops * +@@ -1497,7 +1497,7 @@ target_xfer_partial (struct target_ops * it makes no progress, and then return how much was transferred). */ int @@ -93,7 +93,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -1459,7 +1459,7 @@ target_read_memory (CORE_ADDR memaddr, g +@@ -1513,7 +1513,7 @@ target_read_memory (CORE_ADDR memaddr, g the target's stack. This may trigger different cache behavior. */ int @@ -102,8 +102,8 @@ Index: gdb-6.8.50.20090909/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -1473,7 +1473,7 @@ target_read_stack (CORE_ADDR memaddr, gd - } +@@ -1532,7 +1532,7 @@ target_read_stack (CORE_ADDR memaddr, gd + Callers that can deal with partial writes should call target_write. */ int -target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len) @@ -111,7 +111,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -2964,8 +2964,8 @@ debug_to_prepare_to_store (struct regcac +@@ -3098,8 +3098,8 @@ debug_to_prepare_to_store (struct regcac fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n"); } @@ -122,7 +122,7 @@ Index: gdb-6.8.50.20090909/gdb/target.c int write, struct mem_attrib *attrib, struct target_ops *target) { -@@ -2975,8 +2975,8 @@ deprecated_debug_xfer_memory (CORE_ADDR +@@ -3109,8 +3109,8 @@ deprecated_debug_xfer_memory (CORE_ADDR attrib, target); fprintf_unfiltered (gdb_stdlog, @@ -133,11 +133,11 @@ Index: gdb-6.8.50.20090909/gdb/target.c write ? "write" : "read", retval); if (retval > 0) -Index: gdb-6.8.50.20090909/gdb/target.h +Index: gdb-7.0.50.20100115/gdb/target.h =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/target.h 2009-09-09 19:05:56.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/target.h 2009-09-09 19:07:36.000000000 +0200 -@@ -366,10 +366,10 @@ struct target_ops +--- gdb-7.0.50.20100115.orig/gdb/target.h 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/target.h 2010-01-15 03:22:23.000000000 +0100 +@@ -406,10 +406,10 @@ struct target_ops NOTE: cagney/2004-10-01: This has been entirely superseeded by to_xfer_partial and inferior inheritance. */ @@ -152,7 +152,7 @@ Index: gdb-6.8.50.20090909/gdb/target.h void (*to_files_info) (struct target_ops *); int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *); -@@ -680,12 +680,12 @@ extern void target_dcache_invalidate (vo +@@ -786,12 +786,12 @@ extern void target_dcache_invalidate (vo extern int target_read_string (CORE_ADDR, char **, int, int *); @@ -168,13 +168,13 @@ Index: gdb-6.8.50.20090909/gdb/target.h /* Fetches the target's memory map. If one is found it is sorted and returned, after some consistency checking. Otherwise, NULL -Index: gdb-6.8.50.20090909/gdb/dcache.c +Index: gdb-7.0.50.20100115/gdb/dcache.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/dcache.c 2009-08-31 22:18:45.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/dcache.c 2009-09-09 19:09:21.000000000 +0200 -@@ -390,10 +390,10 @@ dcache_free (DCACHE *dcache) - - The meaning of the result is the same as for target_write. */ +--- gdb-7.0.50.20100115.orig/gdb/dcache.c 2010-01-01 08:31:30.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/dcache.c 2010-01-15 03:22:23.000000000 +0100 +@@ -468,10 +468,10 @@ dcache_free (DCACHE *dcache) + NOTE: This is different than the to_xfer_partial interface, in which + positive values less than LEN mean further transfers may be possible. */ -int +LONGEST @@ -185,10 +185,10 @@ Index: gdb-6.8.50.20090909/gdb/dcache.c { int i; int res; -Index: gdb-6.8.50.20090909/gdb/dcache.h +Index: gdb-7.0.50.20100115/gdb/dcache.h =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/dcache.h 2009-08-31 22:18:45.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/dcache.h 2009-09-09 19:08:54.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/dcache.h 2010-01-01 08:31:30.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/dcache.h 2010-01-15 03:22:23.000000000 +0100 @@ -35,8 +35,8 @@ void dcache_free (DCACHE *); /* Simple to call from _xfer_memory */ @@ -200,11 +200,11 @@ Index: gdb-6.8.50.20090909/gdb/dcache.h void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len); -Index: gdb-6.8.50.20090909/gdb/exec.c +Index: gdb-7.0.50.20100115/gdb/exec.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/exec.c 2009-07-02 19:21:06.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/exec.c 2009-09-09 19:06:57.000000000 +0200 -@@ -560,7 +560,7 @@ map_vmap (bfd *abfd, bfd *arch) +--- gdb-7.0.50.20100115.orig/gdb/exec.c 2010-01-14 22:01:24.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/exec.c 2010-01-15 03:22:23.000000000 +0100 +@@ -578,7 +578,7 @@ map_vmap (bfd *abfd, bfd *arch) } @@ -213,11 +213,11 @@ Index: gdb-6.8.50.20090909/gdb/exec.c section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len, struct target_section *sections, -Index: gdb-6.8.50.20090909/gdb/linux-nat.c +Index: gdb-7.0.50.20100115/gdb/linux-nat.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/linux-nat.c 2009-09-09 19:06:46.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/linux-nat.c 2009-09-09 19:06:57.000000000 +0200 -@@ -4622,7 +4622,7 @@ linux_xfer_partial (struct target_ops *o +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:22:14.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:22:23.000000000 +0100 +@@ -5117,7 +5117,7 @@ linux_xfer_partial (struct target_ops *o #endif if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL) { /* This region contains ia64 rse registers, we have to re-read. */ @@ -226,10 +226,10 @@ Index: gdb-6.8.50.20090909/gdb/linux-nat.c /* Re-read register stack area. */ xxfer = super_xfer_partial (ops, object, annex, -Index: gdb-6.8.50.20090909/gdb/remote.c +Index: gdb-7.0.50.20100115/gdb/remote.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/remote.c 2009-08-18 18:17:16.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/remote.c 2009-09-09 19:06:57.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/remote.c 2010-01-12 22:40:24.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/remote.c 2010-01-15 03:22:23.000000000 +0100 @@ -25,6 +25,7 @@ #include "gdb_string.h" #include @@ -238,7 +238,7 @@ Index: gdb-6.8.50.20090909/gdb/remote.c #include "inferior.h" #include "bfd.h" #include "symfile.h" -@@ -5764,12 +5765,19 @@ handle_notification (char *buf, size_t l +@@ -6175,12 +6176,19 @@ handle_notification (char *buf, size_t l if SHOULD_WRITE is nonzero. Returns length of data written or read; 0 for error. TARGET is unused. */ @@ -260,7 +260,7 @@ Index: gdb-6.8.50.20090909/gdb/remote.c set_general_thread (inferior_ptid); -@@ -5778,7 +5786,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, +@@ -6189,7 +6197,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, else res = remote_read_bytes (mem_addr, buffer, mem_len); @@ -269,10 +269,10 @@ Index: gdb-6.8.50.20090909/gdb/remote.c } /* Sends a packet with content determined by the printf format string -Index: gdb-6.8.50.20090909/gdb/remote-sim.c +Index: gdb-7.0.50.20100115/gdb/remote-sim.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/remote-sim.c 2009-07-02 19:21:06.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/remote-sim.c 2009-09-09 19:06:57.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/remote-sim.c 2010-01-01 08:31:40.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/remote-sim.c 2010-01-15 03:22:23.000000000 +0100 @@ -752,11 +752,14 @@ gdbsim_prepare_to_store (struct regcache Returns the number of bytes transferred. */ @@ -290,11 +290,11 @@ Index: gdb-6.8.50.20090909/gdb/remote-sim.c /* If no program is running yet, then ignore the simulator for memory. Pass the request down to the next target, hopefully an exec file. */ -Index: gdb-6.8.50.20090909/gdb/exec.h +Index: gdb-7.0.50.20100115/gdb/exec.h =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/exec.h 2009-06-12 20:38:36.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/exec.h 2009-09-09 19:06:57.000000000 +0200 -@@ -56,7 +56,7 @@ extern int resize_section_table (struct +--- gdb-7.0.50.20100115.orig/gdb/exec.h 2010-01-01 08:31:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/exec.h 2010-01-15 03:22:23.000000000 +0100 +@@ -60,7 +60,7 @@ extern int resize_section_table (struct One, and only one, of readbuf or writebuf must be non-NULL. */ diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index 823c38f..433944d 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-6.8.50.20090811/gdb/doc/gdb.texinfo +Index: gdb-7.0.50.20100115/gdb/doc/gdb.texinfo =================================================================== ---- gdb-6.8.50.20090811.orig/gdb/doc/gdb.texinfo 2009-08-13 10:14:15.000000000 +0200 -+++ gdb-6.8.50.20090811/gdb/doc/gdb.texinfo 2009-08-13 10:14:18.000000000 +0200 -@@ -991,6 +991,12 @@ Read each symbol file's entire symbol ta +--- gdb-7.0.50.20100115.orig/gdb/doc/gdb.texinfo 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/doc/gdb.texinfo 2010-01-15 03:20:04.000000000 +0100 +@@ -995,6 +995,12 @@ Read each symbol file's entire symbol ta the default, which is to read it incrementally as it is needed. This makes startup slower, but makes future operations faster. @@ -28,10 +28,10 @@ Index: gdb-6.8.50.20090811/gdb/doc/gdb.texinfo @end table @node Mode Options -Index: gdb-6.8.50.20090811/gdb/main.c +Index: gdb-7.0.50.20100115/gdb/main.c =================================================================== ---- gdb-6.8.50.20090811.orig/gdb/main.c 2009-08-13 10:14:15.000000000 +0200 -+++ gdb-6.8.50.20090811/gdb/main.c 2009-08-13 10:14:18.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/main.c 2010-01-15 03:18:23.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/main.c 2010-01-15 03:20:04.000000000 +0100 @@ -382,6 +382,7 @@ captured_main (void *data) {"xdb", no_argument, &xdb_commands, 1}, {"dbx", no_argument, &dbx_commands, 1}, @@ -48,10 +48,10 @@ Index: gdb-6.8.50.20090811/gdb/main.c "), stream); fputs_unfiltered (_("\ --se=FILE Use FILE as symbol file and executable file.\n\ -Index: gdb-6.8.50.20090811/gdb/symfile.c +Index: gdb-7.0.50.20100115/gdb/symfile.c =================================================================== ---- gdb-6.8.50.20090811.orig/gdb/symfile.c 2009-08-13 10:14:15.000000000 +0200 -+++ gdb-6.8.50.20090811/gdb/symfile.c 2009-08-13 10:14:18.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/symfile.c 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symfile.c 2010-01-15 03:20:04.000000000 +0100 @@ -79,6 +79,7 @@ static void clear_symtab_users_cleanup ( /* Global variables owned by this file */ @@ -60,19 +60,19 @@ Index: gdb-6.8.50.20090811/gdb/symfile.c /* External variables and functions referenced. */ -Index: gdb-6.8.50.20090811/gdb/dwarf2read.c +Index: gdb-7.0.50.20100115/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090811.orig/gdb/dwarf2read.c 2009-08-13 10:14:15.000000000 +0200 -+++ gdb-6.8.50.20090811/gdb/dwarf2read.c 2009-08-13 10:14:29.000000000 +0200 -@@ -53,6 +53,7 @@ - #include "jv-lang.h" - #include "vec.h" +--- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 03:20:18.000000000 +0100 +@@ -50,6 +50,7 @@ + #include "addrmap.h" #include "block.h" + #include "f-lang.h" +#include "top.h" #include #include "gdb_string.h" -@@ -1245,7 +1246,8 @@ dwarf2_has_info (struct objfile *objfile +@@ -1226,7 +1227,8 @@ dwarf2_has_info (struct objfile *objfile bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL); } @@ -82,11 +82,11 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c && dwarf2_per_objfile->abbrev.asection != NULL); } -Index: gdb-6.8.50.20090811/gdb/top.h +Index: gdb-7.0.50.20100115/gdb/top.h =================================================================== ---- gdb-6.8.50.20090811.orig/gdb/top.h 2009-01-03 06:57:53.000000000 +0100 -+++ gdb-6.8.50.20090811/gdb/top.h 2009-08-13 10:14:18.000000000 +0200 -@@ -59,6 +59,7 @@ extern void set_prompt (char *); +--- gdb-7.0.50.20100115.orig/gdb/top.h 2010-01-01 08:31:42.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/top.h 2010-01-15 03:20:04.000000000 +0100 +@@ -63,6 +63,7 @@ extern void set_prompt (char *); /* From random places. */ extern int readnow_symbol_files; diff --git a/gdb-6.3-security-errata-20050610.patch b/gdb-6.3-security-errata-20050610.patch index 1092c31..56d75b9 100644 --- a/gdb-6.3-security-errata-20050610.patch +++ b/gdb-6.3-security-errata-20050610.patch @@ -19,19 +19,19 @@ Proposed upstream but never committed upstream. (source_command): Update documentation. Check permissions if FROM_TTY is -1. -Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c +Index: gdb-7.0.50.20100115/gdb/cli/cli-cmds.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/cli/cli-cmds.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/cli/cli-cmds.c 2009-02-28 07:17:49.000000000 +0100 -@@ -36,6 +36,7 @@ +--- gdb-7.0.50.20100115.orig/gdb/cli/cli-cmds.c 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/cli/cli-cmds.c 2010-01-15 03:19:13.000000000 +0100 +@@ -37,6 +37,7 @@ #include "objfiles.h" #include "source.h" #include "disasm.h" +#include "gdb_stat.h" + extern void disconnect_or_stop_tracing (int from_tty); #include "ui-out.h" - -@@ -466,7 +467,7 @@ source_script (char *file, int from_tty) +@@ -475,7 +476,7 @@ source_script (char *file, int from_tty) if (fd == -1) { @@ -40,7 +40,7 @@ Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c perror_with_name (file); else { -@@ -475,6 +476,29 @@ source_script (char *file, int from_tty) +@@ -484,6 +485,29 @@ source_script (char *file, int from_tty) } } @@ -70,7 +70,7 @@ Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c is_python = source_python; if (strlen (file) > 3 && !strcmp (&file[strlen (file) - 3], ".py")) is_python = 1; -@@ -486,6 +510,7 @@ source_script (char *file, int from_tty) +@@ -495,6 +519,7 @@ source_script (char *file, int from_tty) else script_from_file (stream, file); @@ -78,10 +78,10 @@ Index: gdb-6.8.50.20090226/gdb/cli/cli-cmds.c do_cleanups (old_cleanups); } -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gdbinit.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp 2009-02-28 07:15:57.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gdbinit.exp 2010-01-15 03:18:23.000000000 +0100 @@ -0,0 +1,98 @@ +# Copyright 2005 +# Free Software Foundation, Inc. @@ -181,17 +181,17 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.exp +} + +remote_exec build "rm .gdbinit" -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.sample +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gdbinit.sample =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.base/gdbinit.sample 2009-02-28 07:15:57.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gdbinit.sample 2010-01-15 03:18:23.000000000 +0100 @@ -0,0 +1 @@ +echo "\nin gdbinit" -Index: gdb-6.8.50.20090226/gdb/main.c +Index: gdb-7.0.50.20100115/gdb/main.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/main.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/main.c 2009-02-28 07:15:57.000000000 +0100 -@@ -855,7 +855,7 @@ Excess command line arguments ignored. ( +--- gdb-7.0.50.20100115.orig/gdb/main.c 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/main.c 2010-01-15 03:18:23.000000000 +0100 +@@ -815,7 +815,7 @@ Excess command line arguments ignored. ( debugging or what directory you are in. */ if (home_gdbinit && !inhibit_gdbinit) @@ -200,7 +200,7 @@ Index: gdb-6.8.50.20090226/gdb/main.c /* Now perform all the actions indicated by the arguments. */ if (cdarg != NULL) -@@ -924,7 +924,7 @@ Can't attach to process and specify a co +@@ -884,7 +884,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) diff --git a/gdb-6.5-gcore-i386-on-amd64.patch b/gdb-6.5-gcore-i386-on-amd64.patch index 7dae330..34ac13e 100644 --- a/gdb-6.5-gcore-i386-on-amd64.patch +++ b/gdb-6.5-gcore-i386-on-amd64.patch @@ -23,10 +23,10 @@ Port to GDB-6.8pre. -Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c +Index: gdb-7.0.50.20100115/gdb/amd64-linux-nat.c =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/amd64-linux-nat.c 2009-06-17 20:44:23.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/amd64-linux-nat.c 2009-08-03 15:49:33.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/amd64-linux-nat.c 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/amd64-linux-nat.c 2010-01-15 03:20:58.000000000 +0100 @@ -51,6 +51,9 @@ #include "i386-linux-tdep.h" #include "amd64-nat.h" @@ -170,7 +170,7 @@ Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c /* Transfering the general-purpose registers between GDB, inferiors and core files. */ -@@ -682,6 +804,11 @@ _initialize_amd64_linux_nat (void) +@@ -727,6 +849,11 @@ _initialize_amd64_linux_nat (void) t->to_fetch_registers = amd64_linux_fetch_inferior_registers; t->to_store_registers = amd64_linux_store_inferior_registers; @@ -182,11 +182,11 @@ Index: gdb-6.8.50.20090802/gdb/amd64-linux-nat.c /* Register the target. */ linux_nat_add_target (t); linux_nat_set_new_thread (t, amd64_linux_new_thread); -Index: gdb-6.8.50.20090802/gdb/config.in +Index: gdb-7.0.50.20100115/gdb/config.in =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/config.in 2009-08-03 09:50:57.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/config.in 2009-08-03 15:48:31.000000000 +0200 -@@ -146,6 +146,9 @@ +--- gdb-7.0.50.20100115.orig/gdb/config.in 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/config.in 2010-01-15 03:20:58.000000000 +0100 +@@ -149,6 +149,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ELF_HP_H @@ -196,7 +196,7 @@ Index: gdb-6.8.50.20090802/gdb/config.in /* Define to 1 if your system has the etext variable. */ #undef HAVE_ETEXT -@@ -487,6 +490,9 @@ +@@ -490,6 +493,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H @@ -206,7 +206,7 @@ Index: gdb-6.8.50.20090802/gdb/config.in /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PROCFS_H -@@ -514,6 +520,9 @@ +@@ -517,6 +523,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H @@ -216,11 +216,11 @@ Index: gdb-6.8.50.20090802/gdb/config.in /* Define to 1 if you have the header file. */ #undef HAVE_SYS_USER_H -Index: gdb-6.8.50.20090802/gdb/configure +Index: gdb-7.0.50.20100115/gdb/configure =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/configure 2009-08-03 09:50:57.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/configure 2009-08-03 15:48:31.000000000 +0200 -@@ -12545,6 +12545,268 @@ _ACEOF +--- gdb-7.0.50.20100115.orig/gdb/configure 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/configure 2010-01-15 03:20:58.000000000 +0100 +@@ -10043,6 +10043,268 @@ $as_echo "#define STDC_HEADERS 1" >>conf fi @@ -489,11 +489,11 @@ Index: gdb-6.8.50.20090802/gdb/configure # elf_hp.h is for HP/UX 64-bit shared library support. # FIXME: kettenis/20030102: In most cases we include these (ctype.h, time.h) # unconditionally, so what's the point in checking these? -Index: gdb-6.8.50.20090802/gdb/configure.ac +Index: gdb-7.0.50.20100115/gdb/configure.ac =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/configure.ac 2009-08-03 09:50:57.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/configure.ac 2009-08-03 15:48:31.000000000 +0200 -@@ -744,6 +744,11 @@ AC_SUBST(PYTHON_CFLAGS) +--- gdb-7.0.50.20100115.orig/gdb/configure.ac 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/configure.ac 2010-01-15 03:20:58.000000000 +0100 +@@ -758,6 +758,11 @@ AC_SUBST(PYTHON_CFLAGS) AC_HEADER_DIRENT AC_HEADER_STAT AC_HEADER_STDC @@ -505,11 +505,11 @@ Index: gdb-6.8.50.20090802/gdb/configure.ac # elf_hp.h is for HP/UX 64-bit shared library support. # FIXME: kettenis/20030102: In most cases we include these (ctype.h, time.h) # unconditionally, so what's the point in checking these? -Index: gdb-6.8.50.20090802/gdb/gcore.c +Index: gdb-7.0.50.20100115/gdb/gcore.c =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/gcore.c 2009-08-03 12:28:56.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/gcore.c 2009-08-03 15:48:31.000000000 +0200 -@@ -324,6 +324,11 @@ gcore_create_callback (CORE_ADDR vaddr, +--- gdb-7.0.50.20100115.orig/gdb/gcore.c 2010-01-15 03:17:59.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/gcore.c 2010-01-15 03:20:58.000000000 +0100 +@@ -376,6 +376,11 @@ gcore_create_callback (CORE_ADDR vaddr, asection *osec; flagword flags = SEC_ALLOC | SEC_HAS_CONTENTS | SEC_LOAD; @@ -521,10 +521,10 @@ Index: gdb-6.8.50.20090802/gdb/gcore.c /* If the memory segment has no permissions set, ignore it, otherwise when we later try to access it for read/write, we'll get an error or jam the kernel. */ -Index: gdb-6.8.50.20090802/gdb/gdb_procfs32.h +Index: gdb-7.0.50.20100115/gdb/gdb_procfs32.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/gdb_procfs32.h 2009-08-03 15:48:31.000000000 +0200 ++++ gdb-7.0.50.20100115/gdb/gdb_procfs32.h 2010-01-15 03:20:58.000000000 +0100 @@ -0,0 +1,128 @@ +#ifdef HAVE_SYS_PROCFS32_H +#include @@ -654,10 +654,10 @@ Index: gdb-6.8.50.20090802/gdb/gdb_procfs32.h +#endif /* _SYS_PROCFS32_H */ + +#endif /* HAVE_SYS_PROCFS32_H */ -Index: gdb-6.8.50.20090802/gdb/gdb_user32.h +Index: gdb-7.0.50.20100115/gdb/gdb_user32.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/gdb_user32.h 2009-08-03 15:48:31.000000000 +0200 ++++ gdb-7.0.50.20100115/gdb/gdb_user32.h 2010-01-15 03:20:58.000000000 +0100 @@ -0,0 +1,108 @@ +#ifdef HAVE_SYS_USER32_H +#include @@ -767,11 +767,11 @@ Index: gdb-6.8.50.20090802/gdb/gdb_user32.h +#endif /* _SYS_USER32_H */ + +#endif /* HAVE_SYS_USER32_H */ -Index: gdb-6.8.50.20090802/gdb/linux-nat.c +Index: gdb-7.0.50.20100115/gdb/linux-nat.c =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/linux-nat.c 2009-08-03 12:31:26.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/linux-nat.c 2009-08-03 15:48:31.000000000 +0200 -@@ -219,6 +219,21 @@ static LONGEST (*super_xfer_partial) (st +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:20:45.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:20:58.000000000 +0100 +@@ -225,6 +225,21 @@ static LONGEST (*super_xfer_partial) (st const gdb_byte *, ULONGEST, LONGEST); @@ -793,7 +793,7 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c static int debug_linux_nat; static void show_debug_linux_nat (struct ui_file *file, int from_tty, -@@ -3586,7 +3601,7 @@ linux_nat_do_thread_registers (bfd *obfd +@@ -4187,7 +4202,7 @@ linux_nat_do_thread_registers (bfd *obfd else fill_gregset (regcache, &gregs, -1); @@ -802,7 +802,7 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c note_data, note_size, lwp, -@@ -3636,10 +3651,10 @@ linux_nat_do_thread_registers (bfd *obfd +@@ -4237,10 +4252,10 @@ linux_nat_do_thread_registers (bfd *obfd else fill_fpregset (regcache, &fpregs, -1); @@ -815,7 +815,7 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c } return note_data; -@@ -3822,9 +3837,9 @@ linux_nat_make_corefile_notes (bfd *obfd +@@ -4423,9 +4438,9 @@ linux_nat_make_corefile_notes (bfd *obfd psargs_end - string_end); } } @@ -828,14 +828,14 @@ Index: gdb-6.8.50.20090802/gdb/linux-nat.c } /* Dump information for threads. */ -Index: gdb-6.8.50.20090802/gdb/linux-nat.h +Index: gdb-7.0.50.20100115/gdb/linux-nat.h =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/linux-nat.h 2009-08-03 10:52:00.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/linux-nat.h 2009-08-03 15:48:31.000000000 +0200 -@@ -144,3 +144,12 @@ void linux_nat_switch_fork (ptid_t new_p +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.h 2010-01-15 03:17:07.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.h 2010-01-15 03:21:26.000000000 +0100 +@@ -169,3 +169,12 @@ struct siginfo *linux_nat_get_siginfo (p - /* Return the saved siginfo associated with PTID. */ - struct siginfo *linux_nat_get_siginfo (ptid_t ptid); + /* Compute and return the processor core of a given thread. */ + int linux_nat_core_of_thread_1 (ptid_t ptid); + +/* These functions make elfcore note sections. + They may get overriden by code adjusting data for multi-target builds. */ diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index f07f7ec..1aae339 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,7 +1,7 @@ -Index: gdb-6.8.50.20090909/gdb/event-top.c +Index: gdb-7.0.50.20100115/gdb/event-top.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/event-top.c 2009-09-09 20:05:48.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/event-top.c 2009-09-09 20:08:04.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/event-top.c 2010-01-01 08:31:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/event-top.c 2010-01-15 11:45:20.000000000 +0100 @@ -33,6 +33,7 @@ #include "cli/cli-script.h" /* for reset_command_nest_depth */ #include "main.h" @@ -28,27 +28,19 @@ Index: gdb-6.8.50.20090909/gdb/event-top.c /* Each interpreter has its own rules on displaying the command prompt. */ if (!current_interp_display_prompt_p ()) -Index: gdb-6.8.50.20090909/gdb/symfile.c +Index: gdb-7.0.50.20100115/gdb/elfread.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200 -@@ -57,6 +57,7 @@ - #include "solib.h" - #include "remote.h" - #include "libbfd.h" +--- gdb-7.0.50.20100115.orig/gdb/elfread.c 2010-01-15 11:43:30.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/elfread.c 2010-01-15 11:45:34.000000000 +0100 +@@ -40,6 +40,7 @@ + #include "gdbcore.h" + #include "gdbcmd.h" + #include "observer.h" +#include "elf/external.h" - #include - #include -@@ -65,6 +66,7 @@ - #include - #include - #include -+#include + extern void _initialize_elfread (void); - - int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num); -@@ -1673,8 +1675,353 @@ build_id_to_filename (struct build_id *b +@@ -1119,8 +1120,353 @@ build_id_to_filename (struct build_id *b return retval; } @@ -403,7 +395,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c avoidance. */ struct missing_filepair -@@ -1728,11 +2074,17 @@ missing_filepair_change (void) +@@ -1174,11 +1520,17 @@ missing_filepair_change (void) /* All their memory came just from missing_filepair_OBSTACK. */ missing_filepair_hash = NULL; } @@ -421,7 +413,7 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c missing_filepair_change (); } -@@ -1799,14 +2151,34 @@ debug_print_missing (const char *binary, +@@ -1245,14 +1597,34 @@ debug_print_missing (const char *binary, *slot = missing_filepair; @@ -463,11 +455,11 @@ Index: gdb-6.8.50.20090909/gdb/symfile.c } static char * -Index: gdb-6.8.50.20090909/gdb/symfile.h +Index: gdb-7.0.50.20100115/gdb/symfile.h =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200 -@@ -387,6 +387,7 @@ extern struct build_id *build_id_addr_ge +--- gdb-7.0.50.20100115.orig/gdb/symfile.h 2010-01-15 11:12:33.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symfile.h 2010-01-15 11:45:20.000000000 +0100 +@@ -398,6 +398,7 @@ extern struct build_id *build_id_addr_ge extern char *build_id_to_filename (struct build_id *build_id, char **link_return, int add_debug_suffix); extern void debug_print_missing (const char *binary, const char *debug); @@ -475,10 +467,10 @@ Index: gdb-6.8.50.20090909/gdb/symfile.h /* From dwarf2read.c */ -Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/gdb.exp 2010-01-15 11:12:33.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp 2010-01-15 11:45:20.000000000 +0100 @@ -1248,7 +1248,7 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } @@ -488,10 +480,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp send_gdb "set build-id-verbose 0\n" gdb_expect 10 { -re "$gdb_prompt $" { -Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/mi-support.exp 2010-01-15 11:12:33.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp 2010-01-15 11:45:20.000000000 +0100 @@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } { } } @@ -501,10 +493,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp send_gdb "190-gdb-set build-id-verbose 0\n" gdb_expect 10 { -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { -Index: gdb-6.8.50.20090909/gdb/tui/tui-interp.c +Index: gdb-7.0.50.20100115/gdb/tui/tui-interp.c =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/tui/tui-interp.c 2009-09-09 20:05:48.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/tui/tui-interp.c 2009-09-09 20:08:04.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/tui/tui-interp.c 2010-01-01 08:32:07.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/tui/tui-interp.c 2010-01-15 11:45:20.000000000 +0100 @@ -30,6 +30,7 @@ #include "tui/tui.h" #include "tui/tui-io.h" @@ -522,10 +514,10 @@ Index: gdb-6.8.50.20090909/gdb/tui/tui-interp.c /* Tell readline what the prompt to display is and what function it will need to call after a whole line is read. This also displays the first prompt. */ -Index: gdb-6.8.50.20090909/gdb/aclocal.m4 +Index: gdb-7.0.50.20100115/gdb/aclocal.m4 =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/aclocal.m4 2009-09-09 20:05:48.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/aclocal.m4 2009-09-09 20:09:32.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/aclocal.m4 2009-11-11 05:42:39.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/aclocal.m4 2010-01-15 11:45:20.000000000 +0100 @@ -19,6 +19,162 @@ You have another version of autoconf. I If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) @@ -689,10 +681,10 @@ Index: gdb-6.8.50.20090909/gdb/aclocal.m4 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation -Index: gdb-6.8.50.20090909/gdb/config.in +Index: gdb-7.0.50.20100115/gdb/config.in =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:08:04.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/config.in 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/config.in 2010-01-15 11:45:20.000000000 +0100 @@ -42,6 +42,9 @@ /* Define to BFD's default target vector. */ #undef DEFAULT_BFD_VEC @@ -713,10 +705,10 @@ Index: gdb-6.8.50.20090909/gdb/config.in /* Define if libunwind library is being used. */ #undef HAVE_LIBUNWIND -Index: gdb-6.8.50.20090909/gdb/configure +Index: gdb-7.0.50.20100115/gdb/configure =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:09:35.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/configure 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/configure 2010-01-15 11:45:20.000000000 +0100 @@ -676,6 +676,9 @@ REPORT_BUGS_TO PKGVERSION TARGET_OBS @@ -727,7 +719,7 @@ Index: gdb-6.8.50.20090909/gdb/configure pythondir GDB_DATADIR_PATH GDB_DATADIR -@@ -886,6 +889,7 @@ with_separate_debug_dir +@@ -888,6 +891,7 @@ with_separate_debug_dir with_gdb_datadir with_relocated_sources with_pythondir @@ -735,7 +727,7 @@ Index: gdb-6.8.50.20090909/gdb/configure enable_targets enable_64_bit_bfd enable_gdbcli -@@ -925,6 +929,9 @@ LDFLAGS +@@ -928,6 +932,9 @@ LDFLAGS LIBS CPPFLAGS CPP @@ -745,7 +737,7 @@ Index: gdb-6.8.50.20090909/gdb/configure YACC YFLAGS XMKMF' -@@ -1588,6 +1595,8 @@ Optional Packages: +@@ -1593,6 +1600,8 @@ Optional Packages: [DATADIR/gdb] --with-pythondir install Python data files in this path [DATADIR/gdb/python] @@ -754,7 +746,7 @@ Index: gdb-6.8.50.20090909/gdb/configure --with-libunwind use libunwind frame unwinding support --with-curses use the curses library instead of the termcap library -@@ -1621,6 +1630,9 @@ Some influential environment variables: +@@ -1627,6 +1636,9 @@ Some influential environment variables: CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -764,7 +756,7 @@ Index: gdb-6.8.50.20090909/gdb/configure YACC The `Yet Another C Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. -@@ -6675,6 +6687,486 @@ _ACEOF +@@ -6760,6 +6772,486 @@ else fi @@ -933,7 +925,7 @@ Index: gdb-6.8.50.20090909/gdb/configure + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + -+/* Duplicate here the declarations to verify they match "symfile.c". */ ++/* Duplicate here the declarations to verify they match "elfread.c". */ +#include +#include +#include @@ -1187,7 +1179,7 @@ Index: gdb-6.8.50.20090909/gdb/configure + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + -+/* Duplicate here the declarations to verify they match "symfile.c". */ ++/* Duplicate here the declarations to verify they match "elfread.c". */ +#include +#include +#include @@ -1251,7 +1243,7 @@ Index: gdb-6.8.50.20090909/gdb/configure -@@ -9721,265 +10213,25 @@ $as_echo "#define STDC_HEADERS 1" >>conf +@@ -10043,265 +10535,25 @@ $as_echo "#define STDC_HEADERS 1" >>conf fi @@ -1527,11 +1519,11 @@ Index: gdb-6.8.50.20090909/gdb/configure fi -Index: gdb-6.8.50.20090909/gdb/configure.ac +Index: gdb-7.0.50.20100115/gdb/configure.ac =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200 -@@ -151,6 +151,199 @@ else +--- gdb-7.0.50.20100115.orig/gdb/configure.ac 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/configure.ac 2010-01-15 11:45:20.000000000 +0100 +@@ -152,6 +152,199 @@ else fi AC_SUBST(pythondir) @@ -1664,7 +1656,7 @@ Index: gdb-6.8.50.20090909/gdb/configure.ac + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ -+/* Duplicate here the declarations to verify they match "symfile.c". */ ++/* Duplicate here the declarations to verify they match "elfread.c". */ +#include +#include +#include @@ -1731,17 +1723,17 @@ Index: gdb-6.8.50.20090909/gdb/configure.ac AC_CONFIG_SUBDIRS(doc testsuite) -Index: gdb-6.8.50.20090909/gdb/acinclude.m4 +Index: gdb-7.0.50.20100115/gdb/acinclude.m4 =================================================================== ---- gdb-6.8.50.20090909.orig/gdb/acinclude.m4 2009-09-09 20:05:48.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/acinclude.m4 2009-09-09 20:08:04.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/acinclude.m4 2010-01-08 08:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/acinclude.m4 2010-01-15 11:45:20.000000000 +0100 @@ -1,3 +1,5 @@ +# serial 1 + dnl written by Rob Savoye for Cygnus Support dnl major rewriting for Tcl 7.5 by Don Libes -@@ -79,8 +81,6 @@ AC_MSG_RESULT(yes) +@@ -81,8 +83,6 @@ AC_MSG_RESULT(yes) # Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 5f2679c..77bbc7f 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,11 +1,11 @@ -Index: gdb-7.0/gdb/corelow.c +Index: gdb-7.0.50.20100115/gdb/corelow.c =================================================================== ---- gdb-7.0.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200 -+++ gdb-7.0/gdb/corelow.c 2009-10-23 00:17:29.000000000 +0200 -@@ -45,6 +45,10 @@ - #include "exceptions.h" +--- gdb-7.0.50.20100115.orig/gdb/corelow.c 2010-01-04 15:57:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/corelow.c 2010-01-15 11:14:05.000000000 +0100 +@@ -46,6 +46,10 @@ #include "solib.h" #include "filenames.h" + #include "progspace.h" +#include "auxv.h" +#include "elf/common.h" +#include "objfiles.h" @@ -13,7 +13,7 @@ Index: gdb-7.0/gdb/corelow.c #ifndef O_LARGEFILE -@@ -273,6 +277,52 @@ add_to_thread_list (bfd *abfd, asection +@@ -290,6 +294,52 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current */ } @@ -66,7 +66,7 @@ Index: gdb-7.0/gdb/corelow.c /* This routine opens and sets up the core file bfd. */ static void -@@ -371,6 +421,12 @@ core_open (char *filename, int from_tty) +@@ -387,6 +437,12 @@ core_open (char *filename, int from_tty) push_target (&core_ops); discard_cleanups (old_chain); @@ -76,10 +76,10 @@ Index: gdb-7.0/gdb/corelow.c + if (build_id_core_loads != 0) + build_id_locate_exec (from_tty); + - add_inferior_silent (corelow_pid); - /* Do this before acknowledging the inferior, so if -@@ -878,4 +934,11 @@ _initialize_corelow (void) + post_create_inferior throws (can happen easilly if you're loading + a core file with the wrong exec), we aren't left with threads +@@ -925,4 +981,11 @@ _initialize_corelow (void) init_core_ops (); add_target (&core_ops); @@ -91,11 +91,11 @@ Index: gdb-7.0/gdb/corelow.c + NULL, NULL, NULL, + &setlist, &showlist); } -Index: gdb-7.0/gdb/doc/gdb.texinfo +Index: gdb-7.0.50.20100115/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.0.orig/gdb/doc/gdb.texinfo 2009-10-23 00:12:39.000000000 +0200 -+++ gdb-7.0/gdb/doc/gdb.texinfo 2009-10-23 00:17:29.000000000 +0200 -@@ -13896,6 +13896,27 @@ information files. +--- gdb-7.0.50.20100115.orig/gdb/doc/gdb.texinfo 2010-01-15 03:23:50.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/doc/gdb.texinfo 2010-01-15 11:12:33.000000000 +0100 +@@ -14258,6 +14258,27 @@ information files. @end table @@ -123,11 +123,11 @@ Index: gdb-7.0/gdb/doc/gdb.texinfo @cindex @code{.gnu_debuglink} sections @cindex debug link sections A debug link is a special section of the executable file named -Index: gdb-7.0/gdb/solib-svr4.c +Index: gdb-7.0.50.20100115/gdb/solib-svr4.c =================================================================== ---- gdb-7.0.orig/gdb/solib-svr4.c 2009-10-23 00:12:38.000000000 +0200 -+++ gdb-7.0/gdb/solib-svr4.c 2009-10-23 00:17:29.000000000 +0200 -@@ -1101,9 +1101,49 @@ svr4_current_sos (void) +--- gdb-7.0.50.20100115.orig/gdb/solib-svr4.c 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/solib-svr4.c 2010-01-15 11:12:33.000000000 +0100 +@@ -1116,9 +1116,49 @@ svr4_current_sos (void) safe_strerror (errcode)); else { @@ -180,22 +180,25 @@ Index: gdb-7.0/gdb/solib-svr4.c } xfree (buffer); -Index: gdb-7.0/gdb/symfile.c +Index: gdb-7.0.50.20100115/gdb/elfread.c =================================================================== ---- gdb-7.0.orig/gdb/symfile.c 2009-10-23 00:12:38.000000000 +0200 -+++ gdb-7.0/gdb/symfile.c 2009-10-23 00:43:28.000000000 +0200 -@@ -56,6 +56,7 @@ - #include "elf-bfd.h" - #include "solib.h" - #include "remote.h" +--- gdb-7.0.50.20100115.orig/gdb/elfread.c 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/elfread.c 2010-01-15 11:43:30.000000000 +0100 +@@ -36,6 +36,10 @@ + #include "gdb-stabs.h" + #include "complaints.h" + #include "demangle.h" +#include "libbfd.h" ++#include "gdbcore.h" ++#include "gdbcmd.h" ++#include "observer.h" - #include - #include -@@ -1173,16 +1174,65 @@ symbol_file_clear (int from_tty) - printf_unfiltered (_("No symbol file now.\n")); + extern void _initialize_elfread (void); + +@@ -567,6 +571,20 @@ elf_symtab_read (struct objfile *objfile + } + } } - +/* Locate NT_GNU_BUILD_ID and return its matching debug filename. + FIXME: NOTE decoding should be unified with the BFD core notes decoding. */ + @@ -210,10 +213,10 @@ Index: gdb-7.0/gdb/symfile.c + fprintf_filtered (file, _("Verbosity level of the build-id locator is %s.\n"), + value); +} -+ + struct build_id { - size_t size; +@@ -574,10 +592,44 @@ struct build_id gdb_byte data[1]; }; @@ -260,7 +263,7 @@ Index: gdb-7.0/gdb/symfile.c { struct build_id *retval; -@@ -1198,6 +1248,348 @@ build_id_bfd_get (bfd *abfd) +@@ -593,6 +645,348 @@ build_id_bfd_get (bfd *abfd) return retval; } @@ -609,7 +612,7 @@ Index: gdb-7.0/gdb/symfile.c /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ static int -@@ -1215,7 +1607,7 @@ build_id_verify (const char *filename, s +@@ -607,7 +1001,7 @@ build_id_verify (const char *filename, s if (abfd == NULL) return 0; @@ -618,7 +621,7 @@ Index: gdb-7.0/gdb/symfile.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), filename); -@@ -1234,14 +1626,16 @@ build_id_verify (const char *filename, s +@@ -626,14 +1020,16 @@ build_id_verify (const char *filename, s return retval; } @@ -639,7 +642,7 @@ Index: gdb-7.0/gdb/symfile.c /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will cause "/.build-id/..." lookups. */ -@@ -1272,7 +1666,10 @@ build_id_to_debug_filename (struct build +@@ -664,7 +1060,10 @@ build_id_to_debug_filename (struct build *s++ = '/'; while (size-- > 0) s += sprintf (s, "%02x", (unsigned) *data++); @@ -651,7 +654,7 @@ Index: gdb-7.0/gdb/symfile.c /* lrealpath() is expensive even for the usually non-existent files. */ if (access (link, F_OK) == 0) -@@ -1285,15 +1682,185 @@ build_id_to_debug_filename (struct build +@@ -677,17 +1076,188 @@ build_id_to_debug_filename (struct build } if (retval != NULL) @@ -696,9 +699,9 @@ Index: gdb-7.0/gdb/symfile.c + xfree (link); + xfree (link_all); + -+ return retval; -+} -+ + return retval; + } + +/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages + Try to install the hash file ... + avoidance. */ @@ -721,9 +724,9 @@ Index: gdb-7.0/gdb/symfile.c + + retval = obstack_alloc (&missing_filepair_obstack, size); + memset (retval, 0, size); - return retval; - } - ++ return retval; ++} ++ +static hashval_t +missing_filepair_hash_func (const struct missing_filepair *elem) +{ @@ -836,70 +839,88 @@ Index: gdb-7.0/gdb/symfile.c +} + static char * - get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out) +-find_separate_debug_file_by_buildid (struct objfile *objfile) ++find_separate_debug_file_by_buildid (struct objfile *objfile, ++ char **build_id_filename_return) { -@@ -1384,13 +1951,14 @@ find_separate_debug_file (struct objfile - unsigned long crc32; + asection *sect; + char *basename, *name_copy, *debugdir; +@@ -699,12 +1269,16 @@ find_separate_debug_file_by_buildid (str int i; struct build_id *build_id; -+ char *build_id_filename = NULL; - build_id = build_id_bfd_get (objfile->obfd); ++ if (build_id_filename_return) ++ *build_id_filename_return = NULL; ++ + build_id = build_id_bfd_shdr_get (objfile->obfd); if (build_id != NULL) { char *build_id_name; - build_id_name = build_id_to_debug_filename (build_id); -+ build_id_name = build_id_to_filename (build_id, &build_id_filename, 1); ++ build_id_name = build_id_to_filename (build_id, build_id_filename_return, ++ 1); xfree (build_id); /* Prevent looping on a stripped .debug file. */ if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0) -@@ -1400,7 +1968,10 @@ find_separate_debug_file (struct objfile +@@ -714,7 +1288,7 @@ find_separate_debug_file_by_buildid (str xfree (build_id_name); } else if (build_id_name != NULL) - return build_id_name; -+ { -+ xfree (build_id_filename); -+ return build_id_name; -+ } ++ return build_id_name; } - - basename = get_debug_link_info (objfile, &crc32); -@@ -1501,8 +2072,10 @@ find_separate_debug_file (struct objfile - - xfree (debugfile); - debugfile = NULL; -+ debug_print_missing (objfile->name, build_id_filename); - - cleanup_return_debugfile: -+ xfree (build_id_filename); - xfree (canon_name); - xfree (basename); - xfree (dir); -@@ -4256,4 +4829,16 @@ each global debug-file-directory compone - NULL, - show_debug_file_directory, - &setlist, &showlist); -+ -+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, -+ _("\ -+ Set debugging level of the build-id locator."), _("\ -+ Show debugging level of the build-id locator."), _("\ -+ Level 1 (default) enables printing the missing debug filenames,\n\ -+ level 2 also prints the parsing of binaries to find the identificators."), -+ NULL, -+ show_build_id_verbose, -+ &setlist, &showlist); -+ -+ observer_attach_executable_changed (debug_print_executable_changed); + return NULL; } -Index: gdb-7.0/gdb/symfile.h +@@ -887,9 +1461,10 @@ elf_symfile_read (struct objfile *objfil + `.gnu_debuglink' may no longer be present with `.note.gnu.build-id'. */ + else + { +- char *debugfile; ++ char *debugfile, *build_id_filename; + +- debugfile = find_separate_debug_file_by_buildid (objfile); ++ debugfile = find_separate_debug_file_by_buildid (objfile, ++ &build_id_filename); + + if (debugfile == NULL) + debugfile = find_separate_debug_file_by_debuglink (objfile); +@@ -900,6 +1475,12 @@ elf_symfile_read (struct objfile *objfil + symbol_file_add_separate (abfd, symfile_flags, objfile); + xfree (debugfile); + } ++ /* Check if any separate debug info has been extracted out. */ ++ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") ++ != NULL) ++ debug_print_missing (objfile->name, build_id_filename); ++ ++ xfree (build_id_filename); + } + } + +@@ -1072,4 +1653,16 @@ void + _initialize_elfread (void) + { + add_symtab_fns (&elf_sym_fns); ++ ++ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, ++ _("\ ++Set debugging level of the build-id locator."), _("\ ++Show debugging level of the build-id locator."), _("\ ++Level 1 (default) enables printing the missing debug filenames,\n\ ++level 2 also prints the parsing of binaries to find the identificators."), ++ NULL, ++ show_build_id_verbose, ++ &setlist, &showlist); ++ ++ observer_attach_executable_changed (debug_print_executable_changed); + } +Index: gdb-7.0.50.20100115/gdb/symfile.h =================================================================== ---- gdb-7.0.orig/gdb/symfile.h 2009-10-23 00:12:38.000000000 +0200 -+++ gdb-7.0/gdb/symfile.h 2009-10-23 00:17:29.000000000 +0200 -@@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen +--- gdb-7.0.50.20100115.orig/gdb/symfile.h 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symfile.h 2010-01-15 11:12:33.000000000 +0100 +@@ -392,6 +392,13 @@ extern int symfile_map_offsets_to_segmen struct symfile_segment_data *get_symfile_segment_data (bfd *abfd); void free_symfile_segment_data (struct symfile_segment_data *data); @@ -913,10 +934,10 @@ Index: gdb-7.0/gdb/symfile.h /* From dwarf2read.c */ extern int dwarf2_has_info (struct objfile *); -Index: gdb-7.0/gdb/testsuite/lib/gdb.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.0.orig/gdb/testsuite/lib/gdb.exp 2009-10-23 00:12:38.000000000 +0200 -+++ gdb-7.0/gdb/testsuite/lib/gdb.exp 2009-10-23 00:17:29.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/gdb.exp 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/lib/gdb.exp 2010-01-15 11:12:33.000000000 +0100 @@ -1248,6 +1248,16 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } @@ -934,10 +955,10 @@ Index: gdb-7.0/gdb/testsuite/lib/gdb.exp return 0; } -Index: gdb-7.0/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-7.0.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200 -+++ gdb-7.0/gdb/testsuite/lib/mi-support.exp 2009-10-23 00:17:29.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/lib/mi-support.exp 2010-01-12 22:40:25.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/lib/mi-support.exp 2010-01-15 11:12:33.000000000 +0100 @@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } { } } @@ -955,11 +976,11 @@ Index: gdb-7.0/gdb/testsuite/lib/mi-support.exp detect_async -Index: gdb-7.0/gdb/objfiles.h +Index: gdb-7.0.50.20100115/gdb/objfiles.h =================================================================== ---- gdb-7.0.orig/gdb/objfiles.h 2009-10-23 00:12:38.000000000 +0200 -+++ gdb-7.0/gdb/objfiles.h 2009-10-23 00:17:29.000000000 +0200 -@@ -428,6 +428,10 @@ struct objfile +--- gdb-7.0.50.20100115.orig/gdb/objfiles.h 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/objfiles.h 2010-01-15 11:14:42.000000000 +0100 +@@ -440,6 +440,10 @@ struct objfile #define OBJF_MAIN (1 << 7) @@ -967,6 +988,6 @@ Index: gdb-7.0/gdb/objfiles.h + +#define OBJF_BUILD_ID_CORE_LOADED (1 << 12) + - /* The object file that the main symbol table was loaded from (e.g. the - argument to the "symbol-file" or "file" command). */ + /* The object file that contains the runtime common minimal symbols + for SunOS4. Note that this objfile has no associated BFD. */ diff --git a/gdb-6.6-bz235197-fork-detach-info.patch b/gdb-6.6-bz235197-fork-detach-info.patch index 9d17778..075e118 100644 --- a/gdb-6.6-bz235197-fork-detach-info.patch +++ b/gdb-6.6-bz235197-fork-detach-info.patch @@ -3,23 +3,23 @@ Port to GDB-6.8pre. Remove the `[' character from the GDB-6.8 default message. -Index: gdb-6.7.50.20080227/gdb/linux-nat.c +Index: gdb-7.0.50.20100115/gdb/linux-nat.c =================================================================== ---- gdb-6.7.50.20080227.orig/gdb/linux-nat.c 2008-03-01 10:30:48.000000000 +0100 -+++ gdb-6.7.50.20080227/gdb/linux-nat.c 2008-03-01 10:48:25.000000000 +0100 -@@ -415,7 +415,7 @@ linux_child_follow_fork (struct target_o - /* Detach new forked process? */ - if (detach_fork) - { +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:23:28.000000000 +0100 +@@ -724,7 +724,7 @@ holding the child stopped. Try \"set de + remove_breakpoints_pid (GET_PID (inferior_ptid)); + } + - if (info_verbose || debug_linux_nat) + if (1 /* Fedora Bug 235197 */ || info_verbose || debug_linux_nat) { target_terminal_ours (); fprintf_filtered (gdb_stdlog, -Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c 2008-03-01 10:30:49.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.c 2010-01-15 03:22:52.000000000 +0100 @@ -0,0 +1,57 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -78,10 +78,10 @@ Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.c + } + return 0; +} -Index: gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.7.50.20080227/gdb/testsuite/gdb.base/fork-detach.exp 2008-03-01 10:49:36.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/fork-detach.exp 2010-01-15 03:22:52.000000000 +0100 @@ -0,0 +1,43 @@ +# Copyright 2007 Free Software Foundation, Inc. + diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch index 5b5917d..4873608 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-6.8.50.20090803/gdb/inferior.h +Index: gdb-7.0.50.20100115/gdb/inferior.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/inferior.h 2009-06-28 02:20:22.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/inferior.h 2009-08-03 17:19:56.000000000 +0200 -@@ -181,7 +181,15 @@ extern void reopen_exec_file (void); +--- gdb-7.0.50.20100115.orig/gdb/inferior.h 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/inferior.h 2010-01-15 03:17:07.000000000 +0100 +@@ -188,7 +188,15 @@ extern void reopen_exec_file (void); /* The `resume' routine should only be called in special circumstances. Normally, use `proceed', which handles a lot of bookkeeping. */ @@ -42,11 +42,11 @@ Index: gdb-6.8.50.20090803/gdb/inferior.h /* From misc files */ -Index: gdb-6.8.50.20090803/gdb/infrun.c +Index: gdb-7.0.50.20100115/gdb/infrun.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/infrun.c 2009-07-31 01:01:27.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/infrun.c 2009-08-03 21:39:28.000000000 +0200 -@@ -74,7 +74,7 @@ static int follow_fork (void); +--- gdb-7.0.50.20100115.orig/gdb/infrun.c 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/infrun.c 2010-01-15 03:17:32.000000000 +0100 +@@ -77,7 +77,7 @@ static int follow_fork (void); static void set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c); @@ -55,7 +55,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c static int currently_stepping_or_nexting_callback (struct thread_info *tp, void *data); -@@ -1137,7 +1137,7 @@ maybe_software_singlestep (struct gdbarc +@@ -1363,7 +1363,7 @@ maybe_software_singlestep (struct gdbarc STEP nonzero if we should step (zero to continue instead). SIG is the signal to give the inferior (zero for none). */ void @@ -64,7 +64,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c { int should_resume = 1; struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); -@@ -1149,10 +1149,12 @@ resume (int step, enum target_signal sig +@@ -1376,10 +1376,12 @@ resume (int step, enum target_signal sig QUIT; if (debug_infrun) @@ -81,7 +81,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c /* Some targets (e.g. Solaris x86) have a kernel bug when stepping over an instruction that causes a page fault without triggering -@@ -1271,9 +1273,10 @@ a command like `return' or `jump' to con +@@ -1501,9 +1503,10 @@ a command like `return' or `jump' to con individually. */ resume_ptid = inferior_ptid; } @@ -94,16 +94,16 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c { /* User-settable 'scheduler' mode requires solo thread resume. */ resume_ptid = inferior_ptid; -@@ -1474,7 +1477,7 @@ proceed (CORE_ADDR addr, enum target_sig - struct gdbarch *gdbarch; +@@ -1709,7 +1712,7 @@ proceed (CORE_ADDR addr, enum target_sig struct thread_info *tp; CORE_ADDR pc; + struct address_space *aspace; - int oneproc = 0; + enum resume_step resume_step = RESUME_STEP_CONTINUE; /* If we're stopped at a fork/vfork, follow the branch set by the "set follow-fork-mode" command; otherwise, we'll just proceed -@@ -1508,13 +1511,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -1744,13 +1747,13 @@ proceed (CORE_ADDR addr, enum target_sig actually be executing the breakpoint insn anyway. We'll be (un-)executing the previous instruction. */ @@ -119,7 +119,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c } else { -@@ -1545,13 +1548,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -1781,13 +1784,13 @@ proceed (CORE_ADDR addr, enum target_sig is required it returns TRUE and sets the current thread to the old thread. */ if (prepare_to_proceed (step)) @@ -135,7 +135,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c { tp->trap_expected = 1; /* If displaced stepping is enabled, we can step over the -@@ -1637,8 +1640,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -1873,8 +1876,13 @@ proceed (CORE_ADDR addr, enum target_sig /* Reset to normal state. */ init_infwait_state (); @@ -150,7 +150,7 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c /* Wait for it to stop (if not standalone) and in any case decode why it stopped, and act accordingly. */ -@@ -4171,13 +4179,18 @@ infrun: not switching back to stepped th +@@ -4655,13 +4663,18 @@ infrun: not switching back to stepped th /* Is thread TP in the middle of single-stepping? */ @@ -174,11 +174,11 @@ Index: gdb-6.8.50.20090803/gdb/infrun.c } /* Returns true if any thread *but* the one passed in "data" is in the -Index: gdb-6.8.50.20090803/gdb/linux-nat.c +Index: gdb-7.0.50.20100115/gdb/linux-nat.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-07-31 17:25:21.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-03 21:39:10.000000000 +0200 -@@ -2351,7 +2351,10 @@ count_events_callback (struct lwp_info * +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:16:43.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 03:17:07.000000000 +0100 +@@ -2883,7 +2883,10 @@ count_events_callback (struct lwp_info * static int select_singlestep_lwp_callback (struct lwp_info *lp, void *data) { @@ -190,10 +190,10 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c return 1; else return 0; -Index: gdb-6.8.50.20090803/gdb/linux-nat.h +Index: gdb-7.0.50.20100115/gdb/linux-nat.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/linux-nat.h 2009-05-18 19:11:25.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/linux-nat.h 2009-08-03 21:39:09.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.h 2010-01-12 22:40:24.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.h 2010-01-15 03:17:07.000000000 +0100 @@ -55,8 +55,8 @@ struct lwp_info /* If non-zero, a pending wait status. */ int status; diff --git a/gdb-6.8-attach-signalled-detach-stopped.patch b/gdb-6.8-attach-signalled-detach-stopped.patch index 4c462e1..a518122 100644 --- a/gdb-6.8-attach-signalled-detach-stopped.patch +++ b/gdb-6.8-attach-signalled-detach-stopped.patch @@ -1,8 +1,8 @@ -Index: gdb-6.8.50.20090803/gdb/linux-nat.c +Index: gdb-7.0.50.20100115/gdb/linux-nat.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-03 17:24:03.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-03 17:27:23.000000000 +0200 -@@ -202,6 +202,9 @@ blocked. */ +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 11:53:34.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 12:13:53.000000000 +0100 +@@ -208,6 +208,9 @@ blocked. */ static struct target_ops *linux_ops; static struct target_ops linux_ops_saved; @@ -12,8 +12,8 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c /* The method to call, if any, when a new thread is attached. */ static void (*linux_nat_new_thread) (ptid_t); -@@ -790,7 +793,14 @@ linux_child_follow_fork (struct target_o - linux_parent_pid = parent_pid; +@@ -933,7 +936,14 @@ Attaching after process %d fork to child + parent_inf->waiting_for_vfork_done = 0; } else if (detach_fork) - target_detach (NULL, 0); @@ -26,9 +26,9 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c + target_detach (NULL, 0); + } - inferior_ptid = ptid_build (child_pid, child_pid, 0); - add_thread (inferior_ptid); -@@ -1231,6 +1241,7 @@ linux_nat_post_attach_wait (ptid_t ptid, + /* Note that the detach above makes PARENT_INF dangling. */ + +@@ -1427,6 +1437,7 @@ linux_nat_post_attach_wait (ptid_t ptid, if (debug_linux_nat) fprintf_unfiltered (gdb_stdlog, "LNPAW: Attaching to a stopped process\n"); @@ -36,8 +36,8 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c /* The process is definitely stopped. It is in a job control stop, unless the kernel predates the TASK_STOPPED / -@@ -1512,6 +1523,9 @@ GPT: lwp %s had signal %s, but it is in - *status = lp->status; +@@ -1757,6 +1768,9 @@ GPT: lwp %s had signal %s, but it is in + target_signal_to_string (signo)); } + if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped) @@ -46,7 +46,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c return 0; } -@@ -1621,6 +1635,8 @@ linux_nat_detach (struct target_ops *ops +@@ -1866,6 +1880,8 @@ linux_nat_detach (struct target_ops *ops } else linux_ops->to_detach (ops, args, from_tty); @@ -55,7 +55,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c } /* Resume LP. */ -@@ -1774,6 +1790,14 @@ linux_nat_resume (struct target_ops *ops +@@ -2031,6 +2047,14 @@ linux_nat_resume (struct target_ops *ops resume_callback. */ lp->stopped = 0; @@ -70,7 +70,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c if (resume_many) iterate_over_lwps (ptid, resume_callback, NULL); -@@ -3322,6 +3346,8 @@ linux_nat_mourn_inferior (struct target_ +@@ -3923,6 +3947,8 @@ linux_nat_mourn_inferior (struct target_ there are other viable forks to debug. Delete the exiting one and context-switch to the first available. */ linux_fork_mourn_inferior (); @@ -79,10 +79,10 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c } /* Convert a native/host siginfo object, into/from the siginfo in the -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attach-stopped.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2009-01-03 06:58:07.000000000 +0100 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attach-stopped.exp 2009-08-03 17:26:22.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-01 08:32:06.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attach-stopped.exp 2010-01-15 11:54:57.000000000 +0100 @@ -62,7 +62,65 @@ proc corefunc { threadtype } { gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} @@ -150,10 +150,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attach-stopped.exp set test "$threadtype: attach2 to stopped, after setting file" gdb_test_multiple "attach $testpid" "$test" { -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attachstop-mt.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attachstop-mt.exp =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.threads/attachstop-mt.exp 2009-01-03 06:58:07.000000000 +0100 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/attachstop-mt.exp 2009-08-03 17:26:22.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/attachstop-mt.exp 2010-01-01 08:32:06.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/attachstop-mt.exp 2010-01-15 11:54:57.000000000 +0100 @@ -176,12 +176,23 @@ gdb_test "bt" ".*sleep.*(func|main).*" " # Exit and detach the process. gdb_exit diff --git a/gdb-6.8-bz254229-gcore-prpsinfo.patch b/gdb-6.8-bz254229-gcore-prpsinfo.patch index 82e64f9..446691e 100644 --- a/gdb-6.8-bz254229-gcore-prpsinfo.patch +++ b/gdb-6.8-bz254229-gcore-prpsinfo.patch @@ -1,8 +1,8 @@ -Index: gdb-6.8.50.20090910/bfd/elf-bfd.h +Index: gdb-7.0.50.20100115/bfd/elf-bfd.h =================================================================== ---- gdb-6.8.50.20090910.orig/bfd/elf-bfd.h 2009-09-09 23:38:57.000000000 +0200 -+++ gdb-6.8.50.20090910/bfd/elf-bfd.h 2009-09-10 23:01:15.000000000 +0200 -@@ -2121,7 +2121,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find +--- gdb-7.0.50.20100115.orig/bfd/elf-bfd.h 2009-11-23 15:41:29.000000000 +0100 ++++ gdb-7.0.50.20100115/bfd/elf-bfd.h 2010-01-15 11:53:21.000000000 +0100 +@@ -2140,7 +2140,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find extern char *elfcore_write_note (bfd *, char *, int *, const char *, int, const void *, int); extern char *elfcore_write_prpsinfo @@ -11,11 +11,11 @@ Index: gdb-6.8.50.20090910/bfd/elf-bfd.h extern char *elfcore_write_prstatus (bfd *, char *, int *, long, int, const void *); extern char * elfcore_write_pstatus -Index: gdb-6.8.50.20090910/bfd/elf.c +Index: gdb-7.0.50.20100115/bfd/elf.c =================================================================== ---- gdb-6.8.50.20090910.orig/bfd/elf.c 2009-09-09 23:38:57.000000000 +0200 -+++ gdb-6.8.50.20090910/bfd/elf.c 2009-09-10 23:04:17.000000000 +0200 -@@ -8398,6 +8398,7 @@ char * +--- gdb-7.0.50.20100115.orig/bfd/elf.c 2010-01-05 01:40:07.000000000 +0100 ++++ gdb-7.0.50.20100115/bfd/elf.c 2010-01-15 11:53:21.000000000 +0100 +@@ -8439,6 +8439,7 @@ char * elfcore_write_prpsinfo (bfd *abfd, char *buf, int *bufsiz, @@ -23,7 +23,7 @@ Index: gdb-6.8.50.20090910/bfd/elf.c const char *fname, const char *psargs) { -@@ -8424,9 +8425,15 @@ elfcore_write_prpsinfo (bfd *abfd, +@@ -8465,9 +8466,15 @@ elfcore_write_prpsinfo (bfd *abfd, int note_type = NT_PRPSINFO; #endif @@ -42,7 +42,7 @@ Index: gdb-6.8.50.20090910/bfd/elf.c return elfcore_write_note (abfd, buf, bufsiz, note_name, note_type, &data, sizeof (data)); } -@@ -8441,9 +8448,15 @@ elfcore_write_prpsinfo (bfd *abfd, +@@ -8482,9 +8489,15 @@ elfcore_write_prpsinfo (bfd *abfd, int note_type = NT_PRPSINFO; #endif @@ -61,10 +61,10 @@ Index: gdb-6.8.50.20090910/bfd/elf.c return elfcore_write_note (abfd, buf, bufsiz, note_name, note_type, &data, sizeof (data)); } -Index: gdb-6.8.50.20090910/gdb/amd64-linux-nat.c +Index: gdb-7.0.50.20100115/gdb/amd64-linux-nat.c =================================================================== ---- gdb-6.8.50.20090910.orig/gdb/amd64-linux-nat.c 2009-09-10 23:01:07.000000000 +0200 -+++ gdb-6.8.50.20090910/gdb/amd64-linux-nat.c 2009-09-10 23:01:15.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/amd64-linux-nat.c 2010-01-15 11:46:29.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/amd64-linux-nat.c 2010-01-15 11:53:21.000000000 +0100 @@ -140,6 +140,7 @@ static int amd64_linux_gregset32_reg_off static char * @@ -98,10 +98,10 @@ Index: gdb-6.8.50.20090910/gdb/amd64-linux-nat.c } static void -Index: gdb-6.8.50.20090910/gdb/fbsd-nat.c +Index: gdb-7.0.50.20100115/gdb/fbsd-nat.c =================================================================== ---- gdb-6.8.50.20090910.orig/gdb/fbsd-nat.c 2009-07-02 19:21:06.000000000 +0200 -+++ gdb-6.8.50.20090910/gdb/fbsd-nat.c 2009-09-10 23:01:15.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/fbsd-nat.c 2010-01-01 08:31:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/fbsd-nat.c 2010-01-15 11:53:21.000000000 +0100 @@ -211,6 +211,7 @@ fbsd_make_corefile_notes (bfd *obfd, int psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL); @@ -110,19 +110,19 @@ Index: gdb-6.8.50.20090910/gdb/fbsd-nat.c fname, psargs); } -Index: gdb-6.8.50.20090910/gdb/linux-nat.c +Index: gdb-7.0.50.20100115/gdb/linux-nat.c =================================================================== ---- gdb-6.8.50.20090910.orig/gdb/linux-nat.c 2009-09-10 23:01:06.000000000 +0200 -+++ gdb-6.8.50.20090910/gdb/linux-nat.c 2009-09-10 23:01:15.000000000 +0200 -@@ -55,6 +55,7 @@ - #include "xml-support.h" +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 03:23:50.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 11:53:34.000000000 +0100 +@@ -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 -@@ -222,7 +223,7 @@ static LONGEST (*super_xfer_partial) (st +@@ -228,7 +229,7 @@ static LONGEST (*super_xfer_partial) (st /* This functions make elfcore note sections. They may get overriden by code adjusting data for multi-target builds. */ char *(*linux_elfcore_write_prpsinfo) @@ -131,7 +131,7 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.c char *(*linux_elfcore_write_prstatus) (bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus; static char * -@@ -3946,6 +3947,159 @@ linux_spu_make_corefile_notes (bfd *obfd +@@ -4441,6 +4442,159 @@ linux_spu_make_corefile_notes (bfd *obfd return args.note_data; } @@ -291,7 +291,7 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.c /* Fills the "to_make_corefile_note" target vector. Builds the note section for a corefile, and returns it in a malloc buffer. */ -@@ -3966,8 +4120,14 @@ linux_nat_make_corefile_notes (bfd *obfd +@@ -4461,8 +4615,14 @@ linux_nat_make_corefile_notes (bfd *obfd if (get_exec_file (0)) { @@ -306,7 +306,7 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.c if (get_inferior_args ()) { char *string_end; -@@ -3983,9 +4143,15 @@ linux_nat_make_corefile_notes (bfd *obfd +@@ -4478,9 +4638,15 @@ linux_nat_make_corefile_notes (bfd *obfd psargs_end - string_end); } } @@ -324,11 +324,11 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.c } /* Dump information for threads. */ -Index: gdb-6.8.50.20090910/gdb/linux-nat.h +Index: gdb-7.0.50.20100115/gdb/linux-nat.h =================================================================== ---- gdb-6.8.50.20090910.orig/gdb/linux-nat.h 2009-09-10 23:01:06.000000000 +0200 -+++ gdb-6.8.50.20090910/gdb/linux-nat.h 2009-09-10 23:01:15.000000000 +0200 -@@ -154,7 +154,7 @@ struct siginfo *linux_nat_get_siginfo (p +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.h 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.h 2010-01-15 11:53:21.000000000 +0100 +@@ -173,7 +173,7 @@ int linux_nat_core_of_thread_1 (ptid_t p /* These functions make elfcore note sections. They may get overriden by code adjusting data for multi-target builds. */ extern char *(*linux_elfcore_write_prpsinfo) @@ -337,11 +337,11 @@ Index: gdb-6.8.50.20090910/gdb/linux-nat.h extern char *(*linux_elfcore_write_prstatus) (bfd *, char *, int *, long, int, const void *); extern char *(*linux_elfcore_write_prfpreg) -Index: gdb-6.8.50.20090910/gdb/procfs.c +Index: gdb-7.0.50.20100115/gdb/procfs.c =================================================================== ---- gdb-6.8.50.20090910.orig/gdb/procfs.c 2009-08-01 02:02:04.000000000 +0200 -+++ gdb-6.8.50.20090910/gdb/procfs.c 2009-09-10 23:01:15.000000000 +0200 -@@ -6147,6 +6147,7 @@ procfs_make_note_section (bfd *obfd, int +--- gdb-7.0.50.20100115.orig/gdb/procfs.c 2010-01-14 22:15:00.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/procfs.c 2010-01-15 11:53:21.000000000 +0100 +@@ -6186,6 +6186,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-bz457187-largefile.patch b/gdb-6.8-bz457187-largefile.patch deleted file mode 100644 index 199d7a2..0000000 --- a/gdb-6.8-bz457187-largefile.patch +++ /dev/null @@ -1,265 +0,0 @@ -gdb/ -2009-03-02 Jan Kratochvil - - * configure.ac: Call AC_SYS_LARGEFILE. - * config.in: Regenerate. - * configure: Regenerate. - -Index: gdb-6.8.50.20090909/gdb/configure.ac -=================================================================== ---- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:11:04.000000000 +0200 -@@ -28,6 +28,7 @@ AM_MAINTAINER_MODE - AC_PROG_CC - AC_USE_SYSTEM_EXTENSIONS - gl_EARLY -+AC_SYS_LARGEFILE - AM_PROG_CC_STDC - - AC_CONFIG_AUX_DIR(..) -Index: gdb-6.8.50.20090909/gdb/config.in -=================================================================== ---- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:08:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:11:33.000000000 +0200 -@@ -751,10 +751,16 @@ - # endif - #endif - -+/* Number of bits in a file offset, on hosts where this is settable. */ -+#undef _FILE_OFFSET_BITS -+ - /* Define to 1 so gets a definition of anon_hdl. Works around a - problem on IRIX 5. */ - #undef _KMEMUSER - -+/* Define for large files, on AIX-style hosts. */ -+#undef _LARGE_FILES -+ - /* Define to 1 if on MINIX. */ - #undef _MINIX - -Index: gdb-6.8.50.20090909/gdb/configure -=================================================================== ---- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:10:45.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:11:07.000000000 +0200 -@@ -884,6 +884,7 @@ ac_subst_files='host_makefile_frag' - ac_user_opts=' - enable_option_checking - enable_maintainer_mode -+enable_largefile - enable_dependency_tracking - with_separate_debug_dir - with_gdb_datadir -@@ -1562,6 +1563,7 @@ Optional Features: - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer -+ --disable-largefile omit support for large files - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-targets=TARGETS -@@ -4100,6 +4102,204 @@ fi - - - -+# Check whether --enable-largefile was given. -+if test "${enable_largefile+set}" = set; then : -+ enableval=$enable_largefile; -+fi -+ -+if test "$enable_largefile" != no; then -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -+$as_echo_n "checking for special C compiler options needed for large files... " >&6; } -+if test "${ac_cv_sys_largefile_CC+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ ac_cv_sys_largefile_CC=no -+ if test "$GCC" != yes; then -+ ac_save_CC=$CC -+ while :; do -+ # IRIX 6.2 and later do not support large files by default, -+ # so use the C compiler's -n32 option if that helps. -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#include -+ /* Check that off_t can represent 2**63 - 1 correctly. -+ We can't simply define LARGE_OFF_T to be 9223372036854775807, -+ since some C++ compilers masquerading as C compilers -+ incorrectly reject 9223372036854775807. */ -+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) -+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 -+ && LARGE_OFF_T % 2147483647 == 1) -+ ? 1 : -1]; -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+ if ac_fn_c_try_compile "$LINENO"; then : -+ break -+fi -+rm -f core conftest.err conftest.$ac_objext -+ CC="$CC -n32" -+ if ac_fn_c_try_compile "$LINENO"; then : -+ ac_cv_sys_largefile_CC=' -n32'; break -+fi -+rm -f core conftest.err conftest.$ac_objext -+ break -+ done -+ CC=$ac_save_CC -+ rm -f conftest.$ac_ext -+ fi -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -+$as_echo "$ac_cv_sys_largefile_CC" >&6; } -+ if test "$ac_cv_sys_largefile_CC" != no; then -+ CC=$CC$ac_cv_sys_largefile_CC -+ fi -+ -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -+if test "${ac_cv_sys_file_offset_bits+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ while :; do -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#include -+ /* Check that off_t can represent 2**63 - 1 correctly. -+ We can't simply define LARGE_OFF_T to be 9223372036854775807, -+ since some C++ compilers masquerading as C compilers -+ incorrectly reject 9223372036854775807. */ -+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) -+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 -+ && LARGE_OFF_T % 2147483647 == 1) -+ ? 1 : -1]; -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_compile "$LINENO"; then : -+ ac_cv_sys_file_offset_bits=no; break -+fi -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#define _FILE_OFFSET_BITS 64 -+#include -+ /* Check that off_t can represent 2**63 - 1 correctly. -+ We can't simply define LARGE_OFF_T to be 9223372036854775807, -+ since some C++ compilers masquerading as C compilers -+ incorrectly reject 9223372036854775807. */ -+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) -+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 -+ && LARGE_OFF_T % 2147483647 == 1) -+ ? 1 : -1]; -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_compile "$LINENO"; then : -+ ac_cv_sys_file_offset_bits=64; break -+fi -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ ac_cv_sys_file_offset_bits=unknown -+ break -+done -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -+$as_echo "$ac_cv_sys_file_offset_bits" >&6; } -+case $ac_cv_sys_file_offset_bits in #( -+ no | unknown) ;; -+ *) -+cat >>confdefs.h <<_ACEOF -+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -+_ACEOF -+;; -+esac -+rm -rf conftest* -+ if test $ac_cv_sys_file_offset_bits = unknown; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -+if test "${ac_cv_sys_large_files+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ while :; do -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#include -+ /* Check that off_t can represent 2**63 - 1 correctly. -+ We can't simply define LARGE_OFF_T to be 9223372036854775807, -+ since some C++ compilers masquerading as C compilers -+ incorrectly reject 9223372036854775807. */ -+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) -+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 -+ && LARGE_OFF_T % 2147483647 == 1) -+ ? 1 : -1]; -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_compile "$LINENO"; then : -+ ac_cv_sys_large_files=no; break -+fi -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+#define _LARGE_FILES 1 -+#include -+ /* Check that off_t can represent 2**63 - 1 correctly. -+ We can't simply define LARGE_OFF_T to be 9223372036854775807, -+ since some C++ compilers masquerading as C compilers -+ incorrectly reject 9223372036854775807. */ -+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) -+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 -+ && LARGE_OFF_T % 2147483647 == 1) -+ ? 1 : -1]; -+int -+main () -+{ -+ -+ ; -+ return 0; -+} -+_ACEOF -+if ac_fn_c_try_compile "$LINENO"; then : -+ ac_cv_sys_large_files=1; break -+fi -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+ ac_cv_sys_large_files=unknown -+ break -+done -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -+$as_echo "$ac_cv_sys_large_files" >&6; } -+case $ac_cv_sys_large_files in #( -+ no | unknown) ;; -+ *) -+cat >>confdefs.h <<_ACEOF -+#define _LARGE_FILES $ac_cv_sys_large_files -+_ACEOF -+;; -+esac -+rm -rf conftest* -+ fi -+fi -+ - - - diff --git a/gdb-6.8-constant-watchpoints.patch b/gdb-6.8-constant-watchpoints.patch index df29d8d..154c0c7 100644 --- a/gdb-6.8-constant-watchpoints.patch +++ b/gdb-6.8-constant-watchpoints.patch @@ -18,11 +18,11 @@ gdb.base/watchpoint.c (global_ptr_ptr): New variable. (func4): New testing code for GLOBAL_PTR_PTR. -Index: gdb-6.8.50.20090803/gdb/breakpoint.c +Index: gdb-7.0.50.20100115/gdb/breakpoint.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/breakpoint.c 2009-08-04 06:29:47.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/breakpoint.c 2009-08-04 06:32:50.000000000 +0200 -@@ -823,7 +823,15 @@ is_hardware_watchpoint (struct breakpoin +--- gdb-7.0.50.20100115.orig/gdb/breakpoint.c 2010-01-15 11:46:29.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/breakpoint.c 2010-01-15 11:49:49.000000000 +0100 +@@ -947,7 +947,15 @@ is_hardware_watchpoint (struct breakpoin If VAL_CHAIN is non-NULL, *VAL_CHAIN will be released from the value chain. The caller must free the values individually. If VAL_CHAIN is NULL, all generated values will be left on the value @@ -39,8 +39,8 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c static void fetch_watchpoint_value (struct expression *exp, struct value **valp, -@@ -6301,7 +6309,7 @@ watch_command_1 (char *arg, int accessfl - struct symtab_and_line sal; +@@ -7264,7 +7272,7 @@ watch_command_1 (char *arg, int accessfl + struct breakpoint *b, *scope_breakpoint = NULL; struct expression *exp; struct block *exp_valid_block; - struct value *val, *mark; @@ -48,7 +48,7 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c struct frame_info *frame; char *exp_start = NULL; char *exp_end = NULL; -@@ -6392,6 +6400,27 @@ watch_command_1 (char *arg, int accessfl +@@ -7352,6 +7360,27 @@ watch_command_1 (char *arg, int accessfl exp_valid_block = innermost_block; mark = value_mark (); fetch_watchpoint_value (exp, &val, NULL, NULL); @@ -76,11 +76,11 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c if (val != NULL) release_value (val); -Index: gdb-6.8.50.20090803/gdb/gdbtypes.h +Index: gdb-7.0.50.20100115/gdb/gdbtypes.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/gdbtypes.h 2009-08-04 06:31:58.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/gdbtypes.h 2009-08-04 06:32:50.000000000 +0200 -@@ -71,7 +71,22 @@ enum type_code +--- gdb-7.0.50.20100115.orig/gdb/gdbtypes.h 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/gdbtypes.h 2010-01-15 11:49:26.000000000 +0100 +@@ -72,7 +72,22 @@ enum type_code TYPE_CODE_UNION, /* C union or Pascal variant part */ TYPE_CODE_ENUM, /* Enumeration type */ TYPE_CODE_FLAGS, /* Bit flags type */ @@ -104,11 +104,11 @@ Index: gdb-6.8.50.20090803/gdb/gdbtypes.h TYPE_CODE_INT, /* Integer type */ /* Floating type. This is *NOT* a complex type. Beware, there are parts -Index: gdb-6.8.50.20090803/gdb/doc/gdb.texinfo +Index: gdb-7.0.50.20100115/gdb/doc/gdb.texinfo =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/doc/gdb.texinfo 2009-08-04 06:32:39.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/doc/gdb.texinfo 2009-08-04 06:32:50.000000000 +0200 -@@ -3517,6 +3517,18 @@ This command prints a list of watchpoint +--- gdb-7.0.50.20100115.orig/gdb/doc/gdb.texinfo 2010-01-15 11:12:33.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/doc/gdb.texinfo 2010-01-15 11:49:26.000000000 +0100 +@@ -3723,6 +3723,18 @@ This command prints a list of watchpoint it is the same as @code{info break} (@pxref{Set Breaks}). @end table @@ -127,10 +127,10 @@ Index: gdb-6.8.50.20090803/gdb/doc/gdb.texinfo @value{GDBN} sets a @dfn{hardware watchpoint} if possible. Hardware watchpoints execute very quickly, and the debugger reports a change in value at the exact instruction where the change occurs. If @value{GDBN} -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.base/watchpoint.c 2008-03-03 14:24:12.000000000 +0100 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c 2009-08-04 06:32:50.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/watchpoint.c 2009-12-30 18:33:35.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.c 2010-01-15 11:49:26.000000000 +0100 @@ -40,6 +40,7 @@ struct foo struct1, struct2, *ptr1, *ptr int doread = 0; @@ -139,7 +139,7 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c void marker1 () { -@@ -118,6 +119,10 @@ func4 () +@@ -119,6 +120,10 @@ func4 () buf[0] = 3; global_ptr = buf; buf[0] = 7; @@ -150,10 +150,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.c } int main () -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.exp =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.base/watchpoint.exp 2009-01-03 06:58:03.000000000 +0100 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.exp 2009-08-04 06:32:50.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/watchpoint.exp 2010-01-01 08:32:01.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/watchpoint.exp 2010-01-15 11:50:21.000000000 +0100 @@ -641,7 +641,21 @@ proc test_watchpoint_and_breakpoint {} { } } @@ -216,10 +216,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.base/watchpoint.exp } } -@@ -842,6 +879,17 @@ if [initialize] then { - } - +@@ -851,6 +888,17 @@ if [initialize] then { test_watchpoint_and_breakpoint + + test_watchpoint_in_big_blob + + # See above. + if [istarget "mips-idt-*"] then { diff --git a/gdb-6.8-fortran-tag-constant.patch b/gdb-6.8-fortran-tag-constant.patch index a7cc1dd..b3d733b 100644 --- a/gdb-6.8-fortran-tag-constant.patch +++ b/gdb-6.8-fortran-tag-constant.patch @@ -1,8 +1,8 @@ -Index: gdb-6.8.50.20090811/gdb/dwarf2read.c +Index: gdb-7.0.50.20100115/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090811.orig/gdb/dwarf2read.c 2009-08-13 10:14:45.000000000 +0200 -+++ gdb-6.8.50.20090811/gdb/dwarf2read.c 2009-08-13 10:22:36.000000000 +0200 -@@ -2480,6 +2480,7 @@ scan_partial_symbols (struct partial_die +--- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 11:52:59.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 11:53:57.000000000 +0100 +@@ -2529,6 +2529,7 @@ scan_partial_symbols (struct partial_die add_partial_subprogram (pdi, lowpc, highpc, need_pc, cu); break; case DW_TAG_variable: @@ -10,7 +10,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c case DW_TAG_typedef: case DW_TAG_union_type: if (!pdi->is_declaration) -@@ -2675,6 +2676,7 @@ add_partial_symbol (struct partial_die_i +@@ -2719,6 +2720,7 @@ add_partial_symbol (struct partial_die_i } break; case DW_TAG_variable: @@ -18,15 +18,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c if (pdi->is_external) { /* Global Variable. -@@ -2805,6 +2807,7 @@ die_needs_namespace (struct die_info *di - return 1; - - case DW_TAG_variable: -+ case DW_TAG_constant: - { - struct attribute *attr; - attr = dwarf2_attr (die, DW_AT_specification, cu); -@@ -4741,7 +4744,8 @@ dwarf2_add_field (struct field_info *fip +@@ -4770,7 +4772,8 @@ dwarf2_add_field (struct field_info *fip fip->non_public_fields = 1; } } @@ -36,7 +28,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c { /* C++ static member. */ -@@ -5233,7 +5237,8 @@ read_structure_type (struct die_info *di +@@ -5339,7 +5342,8 @@ read_structure_type (struct die_info *di while (child_die && child_die->tag) { if (child_die->tag == DW_TAG_member @@ -46,7 +38,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c { /* NOTE: carlton/2002-11-05: A C++ static data member should be a DW_TAG_member that is a declaration, but -@@ -5352,6 +5357,7 @@ process_structure_scope (struct die_info +@@ -5459,6 +5463,7 @@ process_structure_scope (struct die_info { if (child_die->tag == DW_TAG_member || child_die->tag == DW_TAG_variable @@ -54,7 +46,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c || child_die->tag == DW_TAG_inheritance) { /* Do nothing. */ -@@ -6980,6 +6986,7 @@ load_partial_dies (bfd *abfd, gdb_byte * +@@ -7134,6 +7139,7 @@ load_partial_dies (bfd *abfd, gdb_byte * && abbrev->tag != DW_TAG_subprogram && abbrev->tag != DW_TAG_lexical_block && abbrev->tag != DW_TAG_variable @@ -62,7 +54,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c && abbrev->tag != DW_TAG_namespace && abbrev->tag != DW_TAG_module && abbrev->tag != DW_TAG_member) -@@ -7088,6 +7095,7 @@ load_partial_dies (bfd *abfd, gdb_byte * +@@ -7242,6 +7248,7 @@ load_partial_dies (bfd *abfd, gdb_byte * if (load_all || abbrev->tag == DW_TAG_subprogram || abbrev->tag == DW_TAG_variable @@ -70,7 +62,7 @@ Index: gdb-6.8.50.20090811/gdb/dwarf2read.c || abbrev->tag == DW_TAG_namespace || part_die->is_declaration) { -@@ -8901,6 +8909,11 @@ new_symbol (struct die_info *die, struct +@@ -9016,6 +9023,11 @@ new_symbol (struct die_info *die, struct /* Do not add the symbol to any lists. It will be found via BLOCK_FUNCTION from the blockvector. */ break; diff --git a/gdb-6.8-inlining-addon.patch b/gdb-6.8-inlining-addon.patch index 7e899ca..b41b807 100644 --- a/gdb-6.8-inlining-addon.patch +++ b/gdb-6.8-inlining-addon.patch @@ -5,10 +5,10 @@ causing: FAIL: gdb.base/unwindonsignal.exp: unwindonsignal, stack unwound resume() -> target_resume() move of clear_inline_frame_state() is for: gdb.mi/mi-nsmoribund.exp -Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-bt.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-bt.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-bt.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-bt.c 2009-09-17 12:49:01.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.opt/inline-bt.c 2010-01-01 08:32:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-bt.c 2010-01-15 11:50:59.000000000 +0100 @@ -13,10 +13,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -28,10 +28,10 @@ Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-bt.c inline int func1(void) { -Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-cmds.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-cmds.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.c 2009-09-17 12:49:01.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.opt/inline-cmds.c 2010-01-01 08:32:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-cmds.c 2010-01-15 11:50:59.000000000 +0100 @@ -13,13 +13,19 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -54,10 +54,10 @@ Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.c inline int func1(void) { bar (); -Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-cmds.exp =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-09-17 12:49:01.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2010-01-01 08:32:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-cmds.exp 2010-01-15 11:50:59.000000000 +0100 @@ -230,7 +230,7 @@ set line3 [gdb_get_line_number "set brea gdb_breakpoint $line3 gdb_continue_to_breakpoint "consecutive func1" @@ -110,10 +110,10 @@ Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.exp +gdb_test "info frame" "inlined into frame.*" "outer_inline2 inlined" +gdb_test "fini" "" "up from outer_inline2" +gdb_test "info frame" " in main \[^\n\]*\n source language.*" "main not inlined" -Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-locals.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-locals.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.c 2009-09-17 12:49:01.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.opt/inline-locals.c 2010-01-01 08:32:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-locals.c 2010-01-15 11:50:59.000000000 +0100 @@ -13,11 +13,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -133,10 +133,10 @@ Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.c inline int func1(int arg1) { -Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-locals.exp =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-locals.exp 2009-06-30 17:50:27.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.exp 2009-09-17 12:49:01.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.opt/inline-locals.exp 2010-01-01 08:32:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-locals.exp 2010-01-15 11:50:59.000000000 +0100 @@ -77,6 +77,9 @@ if { ! $no_frames } { # Make sure that locals on the stack are found. This is an array to @@ -155,11 +155,11 @@ Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.exp + setup_kfail *-*-* "gcc/debug.optimization" +} gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)" -Index: gdb-6.8.91.20090917/gdb/frame.c +Index: gdb-7.0.50.20100115/gdb/frame.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/frame.c 2009-09-17 12:48:49.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/frame.c 2009-09-17 12:49:01.000000000 +0200 -@@ -310,7 +310,7 @@ fprint_frame (struct ui_file *file, stru +--- gdb-7.0.50.20100115.orig/gdb/frame.c 2010-01-15 03:22:14.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/frame.c 2010-01-15 11:50:59.000000000 +0100 +@@ -316,7 +316,7 @@ fprint_frame (struct ui_file *file, stru static struct frame_info * skip_inlined_frames (struct frame_info *frame) { @@ -168,7 +168,7 @@ Index: gdb-6.8.91.20090917/gdb/frame.c frame = get_prev_frame (frame); return frame; -@@ -1778,6 +1778,7 @@ get_frame_address_in_block (struct frame +@@ -1792,6 +1792,7 @@ get_frame_address_in_block (struct frame { /* A draft address. */ CORE_ADDR pc = get_frame_pc (this_frame); @@ -176,7 +176,7 @@ Index: gdb-6.8.91.20090917/gdb/frame.c struct frame_info *next_frame = this_frame->next; -@@ -1820,6 +1821,9 @@ get_frame_address_in_block (struct frame +@@ -1834,6 +1835,9 @@ get_frame_address_in_block (struct frame while in an inlined function, then the code address of the "calling" normal function should not be adjusted either. */ @@ -186,7 +186,7 @@ Index: gdb-6.8.91.20090917/gdb/frame.c while (get_frame_type (next_frame) == INLINE_FRAME) next_frame = next_frame->next; -@@ -1851,7 +1855,7 @@ find_frame_sal (struct frame_info *frame +@@ -1865,7 +1869,7 @@ find_frame_sal (struct frame_info *frame sym = inline_skipped_symbol (inferior_ptid); init_sal (sal); @@ -195,10 +195,10 @@ Index: gdb-6.8.91.20090917/gdb/frame.c { sal->symtab = SYMBOL_SYMTAB (sym); sal->line = SYMBOL_LINE (sym); -Index: gdb-6.8.91.20090917/gdb/breakpoint.c +Index: gdb-7.0.50.20100115/gdb/breakpoint.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/breakpoint.c 2009-09-17 12:48:51.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/breakpoint.c 2009-09-17 12:49:12.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/breakpoint.c 2010-01-15 11:49:49.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/breakpoint.c 2010-01-15 11:52:20.000000000 +0100 @@ -62,6 +62,7 @@ #include "jit.h" #include "xml-syscall.h" @@ -207,7 +207,7 @@ Index: gdb-6.8.91.20090917/gdb/breakpoint.c /* readline include files */ #include "readline/readline.h" -@@ -3220,10 +3221,24 @@ bpstat_check_breakpoint_conditions (bpst +@@ -3560,10 +3561,24 @@ bpstat_check_breakpoint_conditions (bpst const struct bp_location *bl = bs->breakpoint_at; struct breakpoint *b = bl->owner; @@ -236,7 +236,7 @@ Index: gdb-6.8.91.20090917/gdb/breakpoint.c { int value_is_zero = 0; -@@ -3399,6 +3399,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p +@@ -3731,6 +3746,12 @@ bpstat_stop_status (struct address_space bs->print = 0; } bs->commands = copy_command_lines (bs->commands); @@ -248,8 +248,8 @@ Index: gdb-6.8.91.20090917/gdb/breakpoint.c + step_into_inline_frame (ptid); } - /* Print nothing for this entry if we dont stop or if we dont print. */ -@@ -5572,9 +5593,9 @@ set_momentary_breakpoint (struct gdbarch + /* Print nothing for this entry if we dont stop or dont print. */ +@@ -6039,9 +6060,9 @@ set_momentary_breakpoint (struct gdbarch { struct breakpoint *b; @@ -262,11 +262,11 @@ Index: gdb-6.8.91.20090917/gdb/breakpoint.c b = set_raw_breakpoint (gdbarch, sal, type); b->enable_state = bp_enabled; -Index: gdb-6.8.91.20090917/gdb/inline-frame.c +Index: gdb-7.0.50.20100115/gdb/inline-frame.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/inline-frame.c 2009-09-13 18:28:28.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/inline-frame.c 2009-09-17 12:49:01.000000000 +0200 -@@ -199,6 +199,12 @@ inline_frame_sniffer (const struct frame +--- gdb-7.0.50.20100115.orig/gdb/inline-frame.c 2010-01-01 08:31:36.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/inline-frame.c 2010-01-15 11:50:59.000000000 +0100 +@@ -213,6 +213,12 @@ inline_frame_sniffer (const struct frame if (frame_block == NULL) return 0; @@ -279,7 +279,7 @@ Index: gdb-6.8.91.20090917/gdb/inline-frame.c /* Calculate DEPTH, the number of inlined functions at this location. */ depth = 0; -@@ -208,6 +214,10 @@ inline_frame_sniffer (const struct frame +@@ -222,6 +228,10 @@ inline_frame_sniffer (const struct frame if (block_inlined_p (cur_block)) depth++; @@ -290,7 +290,7 @@ Index: gdb-6.8.91.20090917/gdb/inline-frame.c cur_block = BLOCK_SUPERBLOCK (cur_block); } -@@ -291,7 +301,6 @@ skip_inline_frames (ptid_t ptid) +@@ -300,7 +310,6 @@ skip_inline_frames (ptid_t ptid) { CORE_ADDR this_pc; struct block *frame_block, *cur_block; @@ -298,7 +298,7 @@ Index: gdb-6.8.91.20090917/gdb/inline-frame.c int skip_count = 0; struct inline_state *state; -@@ -312,10 +321,7 @@ skip_inline_frames (ptid_t ptid) +@@ -321,10 +330,7 @@ skip_inline_frames (ptid_t ptid) of BLOCK_START. */ if (BLOCK_START (cur_block) == this_pc || block_starting_point_at (this_pc, cur_block)) @@ -310,7 +310,7 @@ Index: gdb-6.8.91.20090917/gdb/inline-frame.c else break; } -@@ -327,7 +333,6 @@ skip_inline_frames (ptid_t ptid) +@@ -336,7 +342,6 @@ skip_inline_frames (ptid_t ptid) state = allocate_inline_frame_state (ptid); state->skipped_frames = skip_count; state->saved_pc = this_pc; @@ -318,7 +318,7 @@ Index: gdb-6.8.91.20090917/gdb/inline-frame.c if (skip_count != 0) reinit_frame_cache (); -@@ -345,6 +350,23 @@ step_into_inline_frame (ptid_t ptid) +@@ -354,6 +359,23 @@ step_into_inline_frame (ptid_t ptid) reinit_frame_cache (); } @@ -342,10 +342,10 @@ Index: gdb-6.8.91.20090917/gdb/inline-frame.c /* Return the number of hidden functions inlined into the current frame. */ -Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-markers.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-markers.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-markers.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-markers.c 2009-09-17 12:49:01.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.opt/inline-markers.c 2010-01-01 08:32:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.opt/inline-markers.c 2010-01-15 11:50:59.000000000 +0100 @@ -15,11 +15,6 @@ extern int x, y; @@ -358,14 +358,14 @@ Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-markers.c void marker(void) { x += y; /* set breakpoint 2 here */ -Index: gdb-6.8.91.20090917/gdb/gdbthread.h +Index: gdb-7.0.50.20100115/gdb/gdbthread.h =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/gdbthread.h 2009-09-17 12:47:07.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/gdbthread.h 2009-09-17 12:49:01.000000000 +0200 -@@ -191,6 +191,12 @@ struct thread_info - - /* Private data used by the target vector implementation. */ - struct private_thread_info *private; +--- gdb-7.0.50.20100115.orig/gdb/gdbthread.h 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/gdbthread.h 2010-01-15 11:51:19.000000000 +0100 +@@ -195,6 +195,12 @@ struct thread_info + /* Function that is called to free PRIVATE. If this is NULL, then + xfree will be called on PRIVATE. */ + void (*private_dtor) (struct private_thread_info *); + + /* Nonzero if the current frame PC should be unwound as the caller. It is + used to keep the backtrace upper levels existing after finish_command into @@ -375,11 +375,11 @@ Index: gdb-6.8.91.20090917/gdb/gdbthread.h }; /* Create an empty thread list, or empty the existing one. */ -Index: gdb-6.8.91.20090917/gdb/infcmd.c +Index: gdb-7.0.50.20100115/gdb/infcmd.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/infcmd.c 2009-09-17 12:47:07.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/infcmd.c 2009-09-17 12:49:01.000000000 +0200 -@@ -1434,11 +1434,11 @@ finish_command_continuation (void *arg) +--- gdb-7.0.50.20100115.orig/gdb/infcmd.c 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/infcmd.c 2010-01-15 11:51:53.000000000 +0100 +@@ -1438,11 +1438,11 @@ finish_command_continuation (void *arg) struct type *value_type; value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function)); @@ -393,7 +393,7 @@ Index: gdb-6.8.91.20090917/gdb/infcmd.c print_return_value (SYMBOL_TYPE (a->function), value_type); } -@@ -1546,6 +1546,16 @@ finish_forward (struct symbol *function, +@@ -1550,6 +1550,16 @@ finish_forward (struct symbol *function, tp->initiating_frame = get_frame_id (frame); make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); @@ -408,9 +408,9 @@ Index: gdb-6.8.91.20090917/gdb/infcmd.c + tp->current_pc_is_notcurrent = 1; + tp->proceed_to_finish = 1; /* We want stop_registers, please... */ - proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); + cargs = xmalloc (sizeof (*cargs)); -@@ -1567,7 +1577,9 @@ finish_forward (struct symbol *function, +@@ -1570,7 +1580,9 @@ finish_forward (struct symbol *function, static void finish_command (char *arg, int from_tty) { @@ -421,7 +421,7 @@ Index: gdb-6.8.91.20090917/gdb/infcmd.c struct symbol *function; int async_exec = 0; -@@ -1598,45 +1610,63 @@ finish_command (char *arg, int from_tty) +@@ -1601,45 +1613,63 @@ finish_command (char *arg, int from_tty) if (!target_has_execution) error (_("The program is not running.")); @@ -502,7 +502,7 @@ Index: gdb-6.8.91.20090917/gdb/infcmd.c /* Print info on the selected frame, including level number but not source. */ -@@ -1650,10 +1680,14 @@ finish_command (char *arg, int from_tty) +@@ -1653,10 +1683,14 @@ finish_command (char *arg, int from_tty) print_stack_frame (get_selected_frame (NULL), 1, LOCATION); } @@ -518,11 +518,11 @@ Index: gdb-6.8.91.20090917/gdb/infcmd.c } -Index: gdb-6.8.91.20090917/gdb/target.c +Index: gdb-7.0.50.20100115/gdb/target.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/target.c 2009-09-17 12:48:49.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/target.c 2009-09-17 12:49:01.000000000 +0200 -@@ -2187,6 +2187,7 @@ target_resume (ptid_t ptid, int step, en +--- gdb-7.0.50.20100115.orig/gdb/target.c 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/target.c 2010-01-15 11:50:59.000000000 +0100 +@@ -2241,6 +2241,7 @@ target_resume (ptid_t ptid, int step, en { struct target_ops *t; @@ -530,10 +530,10 @@ Index: gdb-6.8.91.20090917/gdb/target.c target_dcache_invalidate (); for (t = current_target.beneath; t != NULL; t = t->beneath) -Index: gdb-6.8.91.20090917/gdb/inline-frame.h +Index: gdb-7.0.50.20100115/gdb/inline-frame.h =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/inline-frame.h 2009-06-28 02:20:22.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/inline-frame.h 2009-09-17 12:49:01.000000000 +0200 +--- gdb-7.0.50.20100115.orig/gdb/inline-frame.h 2010-01-01 08:31:36.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/inline-frame.h 2010-01-15 11:50:59.000000000 +0100 @@ -43,6 +43,10 @@ void clear_inline_frame_state (ptid_t pt void step_into_inline_frame (ptid_t ptid); @@ -545,19 +545,19 @@ Index: gdb-6.8.91.20090917/gdb/inline-frame.h /* Return the number of hidden functions inlined into the current frame. */ -Index: gdb-6.8.91.20090917/gdb/dwarf2read.c +Index: gdb-7.0.50.20100115/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.91.20090917.orig/gdb/dwarf2read.c 2009-09-17 12:48:51.000000000 +0200 -+++ gdb-6.8.91.20090917/gdb/dwarf2read.c 2009-09-17 12:49:01.000000000 +0200 -@@ -4128,6 +4128,7 @@ read_func_scope (struct die_info *die, s +--- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 11:46:29.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 11:52:59.000000000 +0100 +@@ -4078,6 +4078,7 @@ read_func_scope (struct die_info *die, s + CORE_ADDR baseaddr; struct block *block; - unsigned die_children = 0; int inlined_func = (die->tag == DW_TAG_inlined_subroutine); + struct type *type; if (inlined_func) { -@@ -4169,7 +4170,10 @@ read_func_scope (struct die_info *die, s +@@ -4109,7 +4110,10 @@ read_func_scope (struct die_info *die, s add_to_cu_func_list (name, lowpc, highpc, cu); new = push_context (0, lowpc); diff --git a/gdb-7.0-upstream.patch b/gdb-7.0-upstream.patch deleted file mode 100644 index fbdd08e..0000000 --- a/gdb-7.0-upstream.patch +++ /dev/null @@ -1,229 +0,0 @@ - - - -http://sourceware.org/ml/gdb-patches/2009-11/msg00388.html -http://sourceware.org/ml/gdb-cvs/2009-11/msg00156.html -Subject: [patch] Fix crash on reading stabs - -Hi, - -there is a crash on reading stabs fpc binary: - https://bugzilla.redhat.com/show_bug.cgi?id=537837 - -Program received signal SIGSEGV, Segmentation fault. -0x000000000069db3d in read_dbx_symtab (objfile=0x1daf5f0) at dbxread.c:1369 -1369 if ((namestring[0] == '-' && namestring[1] == 'l') - -(gdb) p/x nlist.n_strx -$7 = 0xfffffff8 -(gdb) p sizeof(nlist.n_strx) -$10 = 8 - -Below the patch context is: - namestring = (nlist->n_strx + file_string_table_offset - + DBX_STRINGTAB (objfile)); - -so IMO the `(unsigned)' cast is excessive as it does not match the expression -below. Such cast is there since the GDB "Initial revision" (1999). - -`n_strx' type: -struct internal_nlist -{ - unsigned long n_strx; /* Index into string table of name. */ -... -}; - -Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu which does not -mean anything with the default DWARF debug info. It was hanging for stabs so -tried just a large part of gdb.base/*.exp on x86_64-m32 - `unix/-gstabs+/-m32'. - -If it isn't obviously approved please feel free to drop it as one should not -use STABS in the first place. - - -Regards, -Jan - - -gdb/ -2009-11-17 Jan Kratochvil - - * dbxread.c (set_namestring): Remove cast to unsigned. Check N_STRX - overflow. - ---- a/gdb/dbxread.c -+++ b/gdb/dbxread.c -@@ -965,8 +965,9 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist) - { - char *namestring; - -- if (((unsigned) nlist->n_strx + file_string_table_offset) -- >= DBX_STRINGTAB_SIZE (objfile)) -+ if (nlist->n_strx + file_string_table_offset -+ >= DBX_STRINGTAB_SIZE (objfile) -+ || nlist->n_strx + file_string_table_offset < nlist->n_strx) - { - complaint (&symfile_complaints, _("bad string table offset in symbol %d"), - symnum); - - - -Re: [RFA] Fix "show convenience" test -http://sourceware.org/ml/gdb-patches/2009-09/msg00565.html -http://sourceware.org/ml/gdb-cvs/2009-09/msg00099.html - -### src/gdb/testsuite/ChangeLog 2009/09/15 18:51:25 1.1960 -### src/gdb/testsuite/ChangeLog 2009/09/17 17:49:46 1.1961 -## -1,3 +1,7 @@ -+2009-09-17 Paul Pluzhnikov -+ -+ * gdb.base/default.exp: Fix "show convenience". -+ - 2009-09-15 Tom Tromey - - * lib/mi-support.exp (mi_create_varobj): Update. ---- src/gdb/testsuite/gdb.base/default.exp 2009/08/13 14:58:27 1.31 -+++ src/gdb/testsuite/gdb.base/default.exp 2009/09/17 17:49:46 1.32 -@@ -598,7 +598,7 @@ - #test show confirm - gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm" - #test show convenience --gdb_test "show convenience" "No debugger convenience variables now defined.(\[^\r\n\]*\[\r\n\])+Convenience variables have names starting with \".\";(\[^\r\n\]*\[\r\n\])+use \"set\" as in \"set .foo = 5\" to define them." "show convenience" -+gdb_test "show convenience" "\\\$_siginfo = void" "show convenience" - #test show directories - gdb_test "show directories" "Source directories searched: .cdir\[:;\].cwd" "show directories" - #test show editing -### src/gdb/doc/ChangeLog 2009/09/15 18:51:24 1.953 -### src/gdb/doc/ChangeLog 2009/09/17 17:49:46 1.954 -## -1,3 +1,8 @@ -+2009-09-17 Paul Pluzhnikov -+ -+ * gdb.texinfo (convenince variables): Mention -+ $_siginfo could be empty. -+ - 2009-09-15 Tom Tromey - - * gdb.texinfo (GDB/MI Variable Objects): Document ---- src/gdb/doc/gdb.texinfo 2009/09/15 18:51:25 1.624 -+++ src/gdb/doc/gdb.texinfo 2009/09/17 17:49:46 1.625 -@@ -7819,8 +7819,10 @@ - - @item $_siginfo - @vindex $_siginfo@r{, convenience variable} --The variable @code{$_siginfo} is bound to extra signal information --inspection (@pxref{extra signal information}). -+The variable @code{$_siginfo} contains extra signal information -+(@pxref{extra signal information}). Note that @code{$_siginfo} -+could be empty, if the application has not yet received any signals. -+For example, it will be empty before you execute the @code{run} command. - @end table - - On HP-UX systems, if you refer to a function or variable name that - - - -http://sourceware.org/ml/gdb-cvs/2009-12/msg00128.html - -### src/gdb/testsuite/ChangeLog 2009/12/23 23:18:08 1.2054 -### src/gdb/testsuite/ChangeLog 2009/12/24 21:57:06 1.2055 -## -1,3 +1,10 @@ -+2009-12-24 Jan Kratochvil -+ -+ Fix compatibility with G++-4.5. -+ * gdb.cp/expand-sals.cc (main): Remove the "exit-line" comment. -+ * gdb.cp/expand-sals.exp: Remove breakpoint on "exit-line". -+ (uncaught return): Remove. -+ - 2009-12-23 Jan Kratochvil - Phil Muldoon - ---- src/gdb/testsuite/gdb.cp/expand-sals.cc 2009/05/11 15:05:56 1.1 -+++ src/gdb/testsuite/gdb.cp/expand-sals.cc 2009/12/24 21:57:06 1.2 -@@ -49,5 +49,5 @@ - A a; - B b; - -- return 0; /* exit-line */ -+ return 0; - } ---- src/gdb/testsuite/gdb.cp/expand-sals.exp 2009/05/11 15:05:56 1.1 -+++ src/gdb/testsuite/gdb.cp/expand-sals.exp 2009/12/24 21:57:06 1.2 -@@ -23,8 +23,6 @@ - return -1 - } - --gdb_breakpoint [gdb_get_line_number "exit-line"] -- - gdb_breakpoint [gdb_get_line_number "func-line"] - gdb_continue_to_breakpoint "func" ".*func-line.*" - -@@ -52,7 +50,3 @@ - "bt from A" - - gdb_continue_to_breakpoint "next caller func" ".*func-line.*" -- --# Verify GDB really could not catch any other breakpoint location. -- --gdb_continue_to_breakpoint "uncaught return" ".*exit-line.*" - - - -http://sourceware.org/ml/gdb-cvs/2009-11/msg00213.html - -[ cut ] - ---- src/gdb/testsuite/gdb.base/condbreak.exp 2009/01/03 05:58:03 1.13 -+++ src/gdb/testsuite/gdb.base/condbreak.exp 2009/11/25 20:43:29 1.14 -@@ -207,10 +207,10 @@ - setup_xfail hppa2.0w-*-* 11512CLLbs - send_gdb "continue\n" - gdb_expect { -- -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { -+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" { - pass "run until breakpoint at marker2" - } -- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*" { -+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" { - xfail "run until breakpoint at marker2" - } - -re "$gdb_prompt $" { - - - -Fix for gfortran-4.1: - -PASS: gdb.mi/mi-var-child-f.exp: mi runto MAIN__ - +FAIL: gdb.mi/mi-var-child-f.exp: mi runto MAIN__ (unknown output after running) - -RFC: Move language-changed message to verbose -http://sourceware.org/ml/gdb-patches/2009-11/msg00031.html -http://sourceware.org/ml/gdb-cvs/2009-11/msg00034.html - -### src/gdb/ChangeLog 2009/11/05 19:53:03 1.11030 -### src/gdb/ChangeLog 2009/11/05 20:43:52 1.11031 -## -1,3 +1,8 @@ -+2009-11-05 Daniel Jacobowitz -+ -+ * top.c (execute_command): Select a frame before checking the current -+ language. Only output a message if verbose. -+ - 2009-11-05 Tom Tromey - - * symtab.h (SYMBOL_SET_LINKAGE_NAME): Update comment. ---- src/gdb/top.c 2009/10/19 09:51:42 1.172 -+++ src/gdb/top.c 2009/11/05 20:43:52 1.173 -@@ -457,10 +457,13 @@ - - } - -- /* Tell the user if the language has changed (except first time). */ -+ /* Tell the user if the language has changed (except first time). -+ First make sure that a new frame has been selected, in case this -+ command or the hooks changed the program state. */ -+ deprecated_safe_get_selected_frame (); - if (current_language != expected_language) - { -- if (language_mode == language_mode_auto) -+ if (language_mode == language_mode_auto && info_verbose) - { - language_info (1); /* Print what changed. */ - } diff --git a/gdb-archer-pie-0315-breakpoint_address_match.patch b/gdb-archer-pie-0315-breakpoint_address_match.patch new file mode 100644 index 0000000..0000597 --- /dev/null +++ b/gdb-archer-pie-0315-breakpoint_address_match.patch @@ -0,0 +1,77 @@ +[ Forward-ported context. ] + +http://sourceware.org/ml/gdb-patches/2009-11/msg00170.html +Subject: [patch 03/15] PIE: breakpoint_address_match gdbarch_addr_bit workaround + +Hi, + +there are already multiple cases of CORE_ADDR being masked by the width of +gdbarch_addr_bit. This specific new case was required the PIE support. + +Please read the C comment in attached patch. + +Checked that CORE_ADDR math operations are present on 6000+ lines of code of +GDB sources which makes it impossible to do some general fix by replacing all + a->addr < b->addr +by + addr_less_than (a->addr, b->addr) +etc. + +Even with this patch I think there are still many bugs left in the operation +of x86_64 gdb debugging i386 targets. Do you find the C++ way as a viable +one? + + +Thanks, +Jan + + +gdb/ + * breakpoint.c (breakpoint_address_match): New variables addr_bit and + addr_mask, initialize it. Mask addresses by ADDR_MASK. + * defs.h (CORE_ADDR): Extend the comment. + +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -4559,9 +4559,15 @@ static int + breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1, + struct address_space *aspace2, CORE_ADDR addr2) + { ++ int addr_bit = gdbarch_addr_bit (target_gdbarch); ++ CORE_ADDR addr_mask = CORE_ADDR_MAX; ++ ++ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) ++ addr_mask = ((CORE_ADDR) 1 << addr_bit) - 1; ++ + return ((gdbarch_has_global_breakpoints (target_gdbarch) + || aspace1 == aspace2) +- && addr1 == addr2); ++ && (addr1 & addr_mask) == (addr2 & addr_mask)); + } + + /* Assuming LOC1 and LOC2's types' have meaningful target addresses +--- a/gdb/defs.h ++++ b/gdb/defs.h +@@ -98,7 +98,20 @@ + /* A byte from the program being debugged. */ + typedef bfd_byte gdb_byte; + +-/* An address in the program being debugged. Host byte order. */ ++/* An address in the program being debugged. Host byte order. ++ ++ Its width is the maximum width of all the supported targets. That means ++ 32-bit target will run on such GDB using 64-bit CORE_ADDR cluttering the ++ bits 32...63 with random data from internal GDB calculations. GDB currently ++ in general truncates the address width only when it is being presented/used ++ externally (such as by the paddress function). ++ ++ FIXME: This is still not right as any GDB internal comparisons (such as >=) ++ of CORE_ADDR do not use the properly truncated width. As converting all the ++ CORE_ADDR operations to width-aware functions is not feasible the way out ++ could be a width-aware C++ class CORE_ADDR referencing gdbarch as its ++ constructor parameter. */ ++ + typedef bfd_vma CORE_ADDR; + + /* The largest CORE_ADDR value. */ + diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index 337a888..5a9e0c5 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -1,6 +1,8 @@ ---- ./gdb/breakpoint.c 2009-12-18 00:13:49.000000000 +0100 -+++ ./gdb/breakpoint.c 2009-12-18 00:13:16.000000000 +0100 -@@ -8563,6 +8563,49 @@ update_breakpoint_locations (struct brea +Index: gdb-7.0.50.20100115/gdb/breakpoint.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/breakpoint.c 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/breakpoint.c 2010-01-15 21:51:20.000000000 +0100 +@@ -9167,6 +9167,49 @@ update_breakpoint_locations (struct brea update_global_location_list (1); } @@ -45,14 +47,16 @@ + + if (changed) + qsort (bp_location, bp_location_count, sizeof (*bp_location), -+ bp_location_compare_for_qsort); ++ bp_location_compare); +} /* Reset a breakpoint given it's struct breakpoint * BINT. The value we return ends up being the return value from catch_errors. ---- ./gdb/breakpoint.h 2009-12-18 00:13:48.000000000 +0100 -+++ ./gdb/breakpoint.h 2009-12-17 22:11:10.000000000 +0100 -@@ -970,4 +970,7 @@ extern struct breakpoint *get_tracepoint +Index: gdb-7.0.50.20100115/gdb/breakpoint.h +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/breakpoint.h 2010-01-15 21:35:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/breakpoint.h 2010-01-15 21:50:12.000000000 +0100 +@@ -1015,4 +1015,7 @@ extern struct breakpoint *get_tracepoint is newly allocated; the caller should free when done with it. */ extern VEC(breakpoint_p) *all_tracepoints (void); @@ -60,63 +64,19 @@ + struct section_offsets *delta); + #endif /* !defined (BREAKPOINT_H) */ ---- ./gdb/objfiles.c 2009-12-18 00:13:48.000000000 +0100 -+++ ./gdb/objfiles.c 2009-12-17 23:19:22.000000000 +0100 -@@ -546,7 +546,7 @@ free_all_objfiles (void) - /* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS - entries in new_offsets. SEPARATE_DEBUG_OBJFILE is not touched here. */ - --static void -+static int - objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets) - { - struct obj_section *s; -@@ -565,7 +565,7 @@ objfile_relocate1 (struct objfile *objfi - something_changed = 1; - } - if (!something_changed) -- return; -+ return 0; - } - - /* OK, get all the symtabs. */ -@@ -706,6 +706,13 @@ objfile_relocate1 (struct objfile *objfi - exec_set_section_address (bfd_get_filename (objfile->obfd), idx, +Index: gdb-7.0.50.20100115/gdb/objfiles.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/objfiles.c 2010-01-15 21:35:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/objfiles.c 2010-01-15 21:50:45.000000000 +0100 +@@ -856,6 +856,11 @@ objfile_relocate1 (struct objfile *objfi obj_section_addr (s)); } -+ + + /* Final call of breakpoint_re_set can keep breakpoint locations disabled if + their addresses match. */ + if (objfile->separate_debug_objfile_backlink == NULL) + breakpoints_relocate (objfile, delta); + -+ return 1; + /* Data changed. */ + return 1; } - - /* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS -@@ -720,7 +727,9 @@ objfile_relocate1 (struct objfile *objfi - void - objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) - { -- objfile_relocate1 (objfile, new_offsets); -+ int changed = 0; -+ -+ changed |= objfile_relocate1 (objfile, new_offsets); - - if (objfile->separate_debug_objfile != NULL) - { -@@ -747,11 +756,12 @@ objfile_relocate (struct objfile *objfil - objfile_addrs); - do_cleanups (my_cleanups); - -- objfile_relocate1 (debug_objfile, new_debug_offsets); -+ changed |= objfile_relocate1 (debug_objfile, new_debug_offsets); - } - - /* Relocate breakpoints as necessary, after things are relocated. */ -- breakpoint_re_set (); -+ if (changed) -+ breakpoint_re_set (); - } - - /* Return non-zero if OBJFILE has partial symbols. */ diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index 3306c77..ae154ad 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -1,6 +1,8 @@ ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -5754,7 +5754,12 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) +Index: gdb-7.0.50.20100115/gdb/dwarf2read.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 21:41:32.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 21:42:19.000000000 +0100 +@@ -5821,7 +5821,12 @@ read_common_block (struct die_info *die, { struct attribute *attr; struct symbol *sym; @@ -14,15 +16,15 @@ attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) -@@ -5763,6 +5768,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) +@@ -5830,6 +5835,7 @@ read_common_block (struct die_info *die, if (attr_form_is_block (attr)) - { - base = decode_locdesc (DW_BLOCK (attr), cu); + { + base = decode_locdesc (DW_BLOCK (attr), cu); + base_p = 1; - } + } else if (attr_form_is_section_offset (attr)) - { -@@ -5824,12 +5830,15 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) + { +@@ -5891,12 +5897,15 @@ read_common_block (struct die_info *die, else dwarf2_complex_location_expr_complaint (); @@ -40,7 +42,7 @@ else SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym)); FIELD_TYPE (*field) = SYMBOL_TYPE (sym); -@@ -5843,7 +5852,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) +@@ -5910,7 +5919,7 @@ read_common_block (struct die_info *die, sym = new_symbol (die, type, cu); /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */ @@ -49,17 +51,19 @@ set_die_type (die, type, cu); } ---- a/gdb/exec.c -+++ b/gdb/exec.c -@@ -32,6 +32,7 @@ - #include "exec.h" - #include "observer.h" +Index: gdb-7.0.50.20100115/gdb/exec.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/exec.c 2010-01-15 21:35:14.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/exec.c 2010-01-15 21:47:19.000000000 +0100 +@@ -34,6 +34,7 @@ #include "arch-utils.h" + #include "gdbthread.h" + #include "progspace.h" +#include "solib.h" #include #include "readline/readline.h" -@@ -220,6 +221,10 @@ exec_file_attach (char *filename, int from_tty) +@@ -225,6 +226,10 @@ exec_file_attach (char *filename, int fr char *scratch_pathname; int scratch_chan; struct target_section *sections = NULL, *sections_end = NULL; @@ -70,7 +74,7 @@ scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename, write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY, -@@ -288,12 +293,23 @@ exec_file_attach (char *filename, int from_tty) +@@ -293,12 +298,23 @@ exec_file_attach (char *filename, int fr scratch_pathname, bfd_errmsg (bfd_get_error ())); } @@ -94,19 +98,37 @@ - set_gdbarch_from_file (exec_bfd); - /* Add the executable's sections to the current address spaces' - list of sections. */ - add_target_sections (sections, sections_end); ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -966,6 +966,7 @@ extern void allocate_cplus_struct_type (struct type *); + list of sections. This possibly pushes the exec_ops + target. */ +Index: gdb-7.0.50.20100115/gdb/gdbtypes.h +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/gdbtypes.h 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/gdbtypes.h 2010-01-15 21:44:24.000000000 +0100 +@@ -406,6 +406,7 @@ enum type_instance_flag_value + enum field_loc_kind + { + FIELD_LOC_KIND_BITPOS, /* bitpos */ ++ /* This address is unrelocated by the objfile's ANOFFSET. */ + FIELD_LOC_KIND_PHYSADDR, /* physaddr */ + FIELD_LOC_KIND_PHYSNAME /* physname */ + }; +@@ -582,6 +583,7 @@ struct main_type + is the location (in the target) of the static field. + Otherwise, physname is the mangled label of the static field. */ + ++ /* This address is unrelocated by the objfile's ANOFFSET. */ + CORE_ADDR physaddr; + char *physname; + } +@@ -1100,6 +1102,7 @@ extern void allocate_gnat_aux_type (stru #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind) #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) +/* This address is unrelocated by the objfile's ANOFFSET. */ #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) - #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) #define SET_FIELD_BITPOS(thisfld, bitpos) \ -@@ -974,6 +975,7 @@ extern void allocate_cplus_struct_type (struct type *); + (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \ +@@ -1107,6 +1110,7 @@ extern void allocate_gnat_aux_type (stru #define SET_FIELD_PHYSNAME(thisfld, name) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ FIELD_STATIC_PHYSNAME (thisfld) = (name)) @@ -114,17 +136,19 @@ #define SET_FIELD_PHYSADDR(thisfld, addr) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -@@ -989,6 +991,7 @@ extern void allocate_cplus_struct_type (struct type *); +@@ -1119,6 +1123,7 @@ extern void allocate_gnat_aux_type (stru #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) +/* This address is unrelocated by the objfile's ANOFFSET. */ #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) - #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) ---- a/gdb/jv-lang.c -+++ b/gdb/jv-lang.c -@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gdbarch, + #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n)) +Index: gdb-7.0.50.20100115/gdb/jv-lang.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/jv-lang.c 2010-01-15 21:35:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/jv-lang.c 2010-01-15 21:41:58.000000000 +0100 +@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gd fields = NULL; nfields--; /* First set up dummy "class" field. */ @@ -134,7 +158,7 @@ TYPE_FIELD_NAME (type, nfields) = "class"; TYPE_FIELD_TYPE (type, nfields) = value_type (clas); SET_TYPE_FIELD_PRIVATE (type, nfields); -@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gdbarch, +@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gd SET_TYPE_FIELD_PROTECTED (type, i); } if (accflags & 0x0008) /* ACC_STATIC */ @@ -144,22 +168,13 @@ else TYPE_FIELD_BITPOS (type, i) = 8 * boffset; if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ ---- a/gdb/solib-svr4.c -+++ b/gdb/solib-svr4.c -@@ -1672,15 +1672,20 @@ static CORE_ADDR - svr4_exec_displacement (void) - { - int found; -+ /* ENTRY_POINT is a possible function descriptor - before -+ a call to gdbarch_convert_from_func_ptr_addr. */ - CORE_ADDR entry_point; - - if (exec_bfd == NULL) - return 0; - +Index: gdb-7.0.50.20100115/gdb/solib-svr4.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/solib-svr4.c 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/solib-svr4.c 2010-01-15 21:44:55.000000000 +0100 +@@ -1689,7 +1689,10 @@ svr4_exec_displacement (void) if (target_auxv_search (¤t_target, AT_ENTRY, &entry_point) == 1) -- return entry_point - exec_entry_point (exec_bfd, ¤t_target); -+ return entry_point - bfd_get_start_address (exec_bfd); + return entry_point - bfd_get_start_address (exec_bfd); - return svr4_static_exec_displacement (); + if (!ptid_equal (inferior_ptid, null_ptid)) @@ -169,7 +184,7 @@ } /* Relocate the main executable. This function should be called upon -@@ -1632,7 +1635,7 @@ svr4_exec_displacement (void) +@@ -1700,7 +1703,7 @@ svr4_exec_displacement (void) static void svr4_relocate_main_executable (void) { @@ -178,7 +193,7 @@ /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new difference of in-memory vs. in-file addresses and we could already -@@ -1975,6 +1978,7 @@ _initialize_svr4_solib (void) +@@ -2054,6 +2057,7 @@ _initialize_svr4_solib (void) svr4_so_ops.free_so = svr4_free_so; svr4_so_ops.clear_solib = svr4_clear_solib; svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook; @@ -186,9 +201,11 @@ svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling; svr4_so_ops.current_sos = svr4_current_sos; svr4_so_ops.open_symbol_file_object = open_symbol_file_object; ---- a/gdb/solib.c -+++ b/gdb/solib.c -@@ -1014,6 +1014,19 @@ solib_create_inferior_hook (int from_tty) +Index: gdb-7.0.50.20100115/gdb/solib.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/solib.c 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/solib.c 2010-01-15 21:41:58.000000000 +0100 +@@ -1037,6 +1037,19 @@ solib_create_inferior_hook (int from_tty ops->solib_create_inferior_hook (from_tty); } @@ -208,9 +225,11 @@ /* GLOBAL FUNCTION in_solib_dynsym_resolve_code -- check to see if an address is in ---- a/gdb/solib.h -+++ b/gdb/solib.h -@@ -43,6 +43,8 @@ extern int solib_read_symbols (struct so_list *, int); +Index: gdb-7.0.50.20100115/gdb/solib.h +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/solib.h 2010-01-08 23:52:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/solib.h 2010-01-15 21:42:36.000000000 +0100 +@@ -44,6 +44,8 @@ extern int solib_read_symbols (struct so extern void solib_create_inferior_hook (int from_tty); @@ -218,10 +237,12 @@ + /* If ADDR lies in a shared library, return its name. */ - extern char *solib_name_from_address (CORE_ADDR); ---- a/gdb/solist.h -+++ b/gdb/solist.h -@@ -89,6 +89,9 @@ struct target_so_ops + extern char *solib_name_from_address (struct program_space *, CORE_ADDR); +Index: gdb-7.0.50.20100115/gdb/solist.h +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/solist.h 2010-01-08 23:52:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/solist.h 2010-01-15 21:41:58.000000000 +0100 +@@ -92,6 +92,9 @@ struct target_so_ops /* Target dependent code to run after child process fork. */ void (*solib_create_inferior_hook) (int from_tty); @@ -231,9 +252,11 @@ /* Do additional symbol handling, lookup, etc. after symbols for a shared object have been loaded. */ void (*special_symbol_handling) (void); ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -873,15 +873,36 @@ syms_from_objfile (struct objfile *objfile, +Index: gdb-7.0.50.20100115/gdb/symfile.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/symfile.c 2010-01-15 21:35:14.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symfile.c 2010-01-15 21:41:58.000000000 +0100 +@@ -832,15 +832,36 @@ syms_from_objfile (struct objfile *objfi if an error occurs during symbol reading. */ old_chain = make_cleanup_free_objfile (objfile); @@ -277,9 +300,11 @@ } /* Now either addrs or offsets is non-zero. */ ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -1890,7 +1890,8 @@ value_static_field (struct type *type, int fieldno) +Index: gdb-7.0.50.20100115/gdb/value.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/value.c 2010-01-15 21:35:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/value.c 2010-01-15 21:41:58.000000000 +0100 +@@ -1897,7 +1897,8 @@ value_static_field (struct type *type, i if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR) { retval = value_at (TYPE_FIELD_TYPE (type, fieldno), @@ -289,7 +314,7 @@ } else { -@@ -1920,7 +1921,8 @@ value_static_field (struct type *type, int fieldno) +@@ -1927,7 +1928,8 @@ value_static_field (struct type *type, i } if (retval && VALUE_LVAL (retval) == lval_memory) SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno), @@ -299,14 +324,3 @@ } return retval; } ---- gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp-orig 2009-12-21 16:50:42.000000000 +0100 -+++ gdb-7.0/gdb/testsuite/gdb.base/valgrind-db-attach.exp 2009-12-21 16:51:24.000000000 +0100 -@@ -67,6 +67,8 @@ gdb_test_multiple "" $test { - } - } - -+gdb_test "" "" "eat first prompt" -+ - # Initialization from default_gdb_start. - gdb_test "set height 0" - gdb_test "set width 0" diff --git a/gdb-archer-pie.patch b/gdb-archer-pie.patch deleted file mode 100644 index 0c8aabb..0000000 --- a/gdb-archer-pie.patch +++ /dev/null @@ -1,2647 +0,0 @@ -http://sourceware.org/gdb/wiki/ProjectArcher -http://sourceware.org/gdb/wiki/ArcherBranchManagement - -archer-jankratochvil-pie-fedora12 -GIT snapshot: -commit 2ae60b5156d43aabfe5757940eaf7b4370fb05d2 - - -diff --git a/gdb/auxv.c b/gdb/auxv.c -index 7b4ecbe..7df8eb5 100644 ---- a/gdb/auxv.c -+++ b/gdb/auxv.c -@@ -25,6 +25,7 @@ - #include "inferior.h" - #include "valprint.h" - #include "gdb_assert.h" -+#include "gdbcore.h" - - #include "auxv.h" - #include "elf/common.h" -@@ -33,15 +34,11 @@ - #include - - --/* This function is called like a to_xfer_partial hook, but must be -- called with TARGET_OBJECT_AUXV. It handles access via -- /proc/PID/auxv, which is a common method for native targets. */ -+/* This function handles access via /proc/PID/auxv, which is a common method -+ for native targets. */ - --LONGEST --procfs_xfer_auxv (struct target_ops *ops, -- enum target_object object, -- const char *annex, -- gdb_byte *readbuf, -+static LONGEST -+procfs_xfer_auxv (gdb_byte *readbuf, - const gdb_byte *writebuf, - ULONGEST offset, - LONGEST len) -@@ -50,9 +47,6 @@ procfs_xfer_auxv (struct target_ops *ops, - int fd; - LONGEST n; - -- gdb_assert (object == TARGET_OBJECT_AUXV); -- gdb_assert (readbuf || writebuf); -- - pathname = xstrprintf ("/proc/%d/auxv", PIDGET (inferior_ptid)); - fd = open (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY); - xfree (pathname); -@@ -72,6 +66,152 @@ procfs_xfer_auxv (struct target_ops *ops, - return n; - } - -+/* This function handles access via ld.so's symbol `_dl_auxv'. */ -+ -+static LONGEST -+ld_so_xfer_auxv (gdb_byte *readbuf, -+ const gdb_byte *writebuf, -+ ULONGEST offset, -+ LONGEST len) -+{ -+ struct minimal_symbol *msym; -+ CORE_ADDR data_address, pointer_address; -+ struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; -+ size_t ptr_size = TYPE_LENGTH (ptr_type); -+ size_t auxv_pair_size = 2 * ptr_size; -+ gdb_byte *ptr_buf = alloca (ptr_size); -+ LONGEST retval; -+ size_t block; -+ -+ msym = lookup_minimal_symbol ("_dl_auxv", NULL, NULL); -+ if (msym == NULL) -+ return -1; -+ -+ if (MSYMBOL_SIZE (msym) != ptr_size) -+ return -1; -+ -+ /* POINTER_ADDRESS is a location where the `_dl_auxv' variable resides. -+ DATA_ADDRESS is the inferior value present in `_dl_auxv', therefore the -+ real inferior AUXV address. */ -+ -+ pointer_address = SYMBOL_VALUE_ADDRESS (msym); -+ -+ data_address = read_memory_typed_address (pointer_address, ptr_type); -+ -+ /* Possibly still not initialized such as during an inferior startup. */ -+ if (data_address == 0) -+ return -1; -+ -+ data_address += offset; -+ -+ if (writebuf != NULL) -+ { -+ if (target_write_memory (data_address, writebuf, len) == 0) -+ return len; -+ else -+ return -1; -+ } -+ -+ /* Stop if trying to read past the existing AUXV block. The final AT_NULL -+ was already returned before. */ -+ -+ if (offset >= auxv_pair_size) -+ { -+ if (target_read_memory (data_address - auxv_pair_size, ptr_buf, -+ ptr_size) != 0) -+ return -1; -+ -+ if (extract_typed_address (ptr_buf, ptr_type) == AT_NULL) -+ return 0; -+ } -+ -+ retval = 0; -+ block = 0x400; -+ gdb_assert (block % auxv_pair_size == 0); -+ -+ while (len > 0) -+ { -+ if (block > len) -+ block = len; -+ -+ /* Reading sizes smaller than AUXV_PAIR_SIZE is not supported. Tails -+ unaligned to AUXV_PAIR_SIZE will not be read during a call (they -+ should be completed during next read with new/extended buffer). */ -+ -+ block &= -auxv_pair_size; -+ if (block == 0) -+ return retval; -+ -+ if (target_read_memory (data_address, readbuf, block) != 0) -+ { -+ if (block <= auxv_pair_size) -+ return retval; -+ -+ block = auxv_pair_size; -+ continue; -+ } -+ -+ data_address += block; -+ len -= block; -+ -+ /* Check terminal AT_NULL. This function is being called indefinitely -+ being extended its READBUF until it returns EOF (0). */ -+ -+ while (block >= auxv_pair_size) -+ { -+ retval += auxv_pair_size; -+ -+ if (extract_typed_address (readbuf, ptr_type) == AT_NULL) -+ return retval; -+ -+ readbuf += auxv_pair_size; -+ block -= auxv_pair_size; -+ } -+ } -+ -+ return retval; -+} -+ -+/* This function is called like a to_xfer_partial hook, but must be -+ called with TARGET_OBJECT_AUXV. It handles access to AUXV. */ -+ -+LONGEST -+memory_xfer_auxv (struct target_ops *ops, -+ enum target_object object, -+ const char *annex, -+ gdb_byte *readbuf, -+ const gdb_byte *writebuf, -+ ULONGEST offset, -+ LONGEST len) -+{ -+ /* Workaround gdb-7.0 bug where linux_nat_xfer_partial() does -+ inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid)); -+ and current_inferior() assertion fails not finding the LWP->PID. -+ It got fixed post-gdb-7.0 by: -+ Add base multi-executable/process support to GDB. -+ 40ff0a289e6165aa930af284df5c52162cb0cd5f -+ by introducing `current_inferior_'. */ -+ struct inferior *inf = find_inferior_pid (ptid_get_pid (inferior_ptid)); -+ -+ gdb_assert (object == TARGET_OBJECT_AUXV); -+ gdb_assert (readbuf || writebuf); -+ -+ /* 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. */ -+ -+ if (inf == NULL || inf->attach_flag != 0) -+ { -+ LONGEST retval; -+ -+ retval = ld_so_xfer_auxv (readbuf, writebuf, offset, len); -+ if (retval != -1) -+ return retval; -+ } -+ -+ return procfs_xfer_auxv (readbuf, writebuf, offset, len); -+} -+ - /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR. - Return 0 if *READPTR is already at the end of the buffer. - Return -1 if there is insufficient buffer for a whole entry. -diff --git a/gdb/auxv.h b/gdb/auxv.h -index 71e6562..87c24ae 100644 ---- a/gdb/auxv.h -+++ b/gdb/auxv.h -@@ -43,11 +43,7 @@ extern int target_auxv_search (struct target_ops *ops, - /* Print the contents of the target's AUXV on the specified file. */ - extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops); - --/* This function is called like a to_xfer_partial hook, but must be -- called with TARGET_OBJECT_AUXV. It handles access via -- /proc/PID/auxv, which is a common method for native targets. */ -- --extern LONGEST procfs_xfer_auxv (struct target_ops *ops, -+extern LONGEST memory_xfer_auxv (struct target_ops *ops, - enum target_object object, - const char *annex, - gdb_byte *readbuf, -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 0f35101..bffc5a6 100644 ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -4805,7 +4805,8 @@ disable_breakpoints_in_shlibs (void) - to insert those breakpoints and fail. */ - if (((b->type == bp_breakpoint) - || (b->type == bp_hardware_breakpoint) -- || (b->type == bp_tracepoint)) -+ || (b->type == bp_tracepoint) -+ || b->type == bp_shlib_event) - && !loc->shlib_disabled - #ifdef PC_SOLIB - && PC_SOLIB (loc->address) -diff --git a/gdb/defs.h b/gdb/defs.h -index 94674dc..57aaae2 100644 ---- a/gdb/defs.h -+++ b/gdb/defs.h -@@ -98,7 +98,20 @@ - /* A byte from the program being debugged. */ - typedef bfd_byte gdb_byte; - --/* An address in the program being debugged. Host byte order. */ -+/* An address in the program being debugged. Host byte order. -+ -+ Its width is the maximum width of all the supported targets. That means -+ 32-bit target will run on such GDB using 64-bit CORE_ADDR cluttering the -+ bits 32...63 with random data from internal GDB calculations. GDB currently -+ in general truncates the address width only when it is being presented/used -+ externally (such as by the paddress function). -+ -+ FIXME: This is still not right as any GDB internal comparisons (such as >=) -+ of CORE_ADDR do not use the properly truncated width. As converting all the -+ CORE_ADDR operations to width-aware functions is not feasible the way out -+ could be a width-aware C++ class CORE_ADDR referencing gdbarch as its -+ constructor parameter. */ -+ - typedef bfd_vma CORE_ADDR; - - /* The largest CORE_ADDR value. */ -diff --git a/gdb/exec.c b/gdb/exec.c -index 455151e..67f40d9 100644 ---- a/gdb/exec.c -+++ b/gdb/exec.c -@@ -656,8 +656,33 @@ print_section_info (struct target_section_table *t, bfd *abfd) - wrap_here (" "); - printf_filtered (_("file type %s.\n"), bfd_get_target (abfd)); - if (abfd == exec_bfd) -- printf_filtered (_("\tEntry point: %s\n"), -- paddress (gdbarch, bfd_get_start_address (abfd))); -+ { -+ bfd_vma displacement = 0; -+ -+ for (p = t->sections; p < t->sections_end; p++) -+ { -+ asection *asect = p->the_bfd_section; -+ -+ if ((bfd_get_section_flags (abfd, asect) & (SEC_ALLOC | SEC_LOAD)) -+ != (SEC_ALLOC | SEC_LOAD)) -+ continue; -+ -+ if (bfd_get_section_vma (abfd, asect) <= abfd->start_address -+ && abfd->start_address < bfd_get_section_vma (abfd, asect) -+ + bfd_get_section_size (asect)) -+ { -+ displacement = p->addr - bfd_get_section_vma (abfd, asect); -+ break; -+ } -+ } -+ if (p == t->sections_end) -+ warning (_("Cannot find section for the entry point of %s.\n"), -+ bfd_get_filename (abfd)); -+ -+ printf_filtered (_("\tEntry point: %s\n"), -+ paddress (gdbarch, bfd_get_start_address (abfd) -+ + displacement)); -+ } - for (p = t->sections; p < t->sections_end; p++) - { - printf_filtered ("\t%s", hex_string_custom (p->addr, wid)); -diff --git a/gdb/infcmd.c b/gdb/infcmd.c -index fab1892..fc0f05d 100644 ---- a/gdb/infcmd.c -+++ b/gdb/infcmd.c -@@ -395,22 +395,6 @@ post_create_inferior (struct target_ops *target, int from_tty) - /* Now that we know the register layout, retrieve current PC. */ - stop_pc = regcache_read_pc (get_current_regcache ()); - -- /* If the solist is global across processes, there's no need to -- refetch it here. */ -- if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch)) -- { -- /* Sometimes the platform-specific hook loads initial shared -- libraries, and sometimes it doesn't. Try to do so first, so -- that we can add them with the correct value for FROM_TTY. -- If we made all the inferior hook methods consistent, -- this call could be removed. */ --#ifdef SOLIB_ADD -- SOLIB_ADD (NULL, from_tty, target, auto_solib_add); --#else -- solib_add (NULL, from_tty, target, auto_solib_add); --#endif -- } -- - if (exec_bfd) - { - /* Create the hooks to handle shared library load and unload -@@ -418,7 +402,25 @@ post_create_inferior (struct target_ops *target, int from_tty) - #ifdef SOLIB_CREATE_INFERIOR_HOOK - SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); - #else -- solib_create_inferior_hook (); -+ solib_create_inferior_hook (from_tty); -+#endif -+ } -+ -+ /* If the solist is global across processes, there's no need to -+ refetch it here. */ -+ if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch)) -+ { -+ /* Sometimes the platform-specific hook loads initial shared -+ libraries, and sometimes it doesn't. If it doesn't FROM_TTY will be -+ incorrectly 0 but such solib targets should be fixed anyway. If we -+ made all the inferior hook methods consistent, this call could be -+ removed. Call it only after the solib target has been initialized by -+ solib_create_inferior_hook. */ -+ -+#ifdef SOLIB_ADD -+ SOLIB_ADD (NULL, 0, target, auto_solib_add); -+#else -+ solib_add (NULL, 0, target, auto_solib_add); - #endif - } - -diff --git a/gdb/infrun.c b/gdb/infrun.c -index 9d29b15..ed451d5 100644 ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -544,7 +544,7 @@ follow_exec (ptid_t pid, char *execd_pathname) - #ifdef SOLIB_CREATE_INFERIOR_HOOK - SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); - #else -- solib_create_inferior_hook (); -+ solib_create_inferior_hook (0); - #endif - - jit_inferior_created_hook (); -diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c -index 0907f03..1c18782 100644 ---- a/gdb/linux-nat.c -+++ b/gdb/linux-nat.c -@@ -4674,7 +4674,7 @@ linux_xfer_partial (struct target_ops *ops, enum target_object object, - LONGEST xfer; - - if (object == TARGET_OBJECT_AUXV) -- return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf, -+ return memory_xfer_auxv (ops, object, annex, readbuf, writebuf, - offset, len); - - if (object == TARGET_OBJECT_OSDATA) -diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c -index 6634703..37770f5 100644 ---- a/gdb/linux-tdep.c -+++ b/gdb/linux-tdep.c -@@ -18,12 +18,8 @@ - along with this program. If not, see . */ - - #include "defs.h" --#include "gdbcore.h" - #include "gdbtypes.h" - #include "linux-tdep.h" --#include "observer.h" -- --#include "elf-bfd.h" - - /* This function is suitable for architectures that don't - extend/override the standard siginfo structure. */ -@@ -138,30 +134,3 @@ linux_get_siginfo_type (struct gdbarch *gdbarch) - - return siginfo_type; - } -- --/* Observer for the executable_changed event, to check whether the new -- exec binary is a PIE (Position Independent Executable) specimen, which -- is currently unsupported. */ -- --static void --check_is_pie_binary (void) --{ -- Elf_Internal_Ehdr *elf_hdr; -- -- if (!exec_bfd) -- return; -- else if (bfd_get_flavour (exec_bfd) != bfd_target_elf_flavour) -- return; -- -- if (elf_tdata (exec_bfd)->elf_header->e_type == ET_DYN) -- warning (_("\ --The current binary is a PIE (Position Independent Executable), which\n\ --GDB does NOT currently support. Most debugger features will fail if used\n\ --in this session.\n")); --} -- --void --_initialize_linux_tdep (void) --{ -- observer_attach_executable_changed (check_is_pie_binary); --} -diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c -index 0adb045..ea89331 100644 ---- a/gdb/nto-procfs.c -+++ b/gdb/nto-procfs.c -@@ -652,7 +652,7 @@ static void - procfs_post_attach (pid_t pid) - { - if (exec_bfd) -- solib_create_inferior_hook (); -+ solib_create_inferior_hook (0); - } - - static ptid_t -@@ -1212,7 +1212,7 @@ procfs_create_inferior (struct target_ops *ops, char *exec_file, - - if (exec_bfd != NULL - || (symfile_objfile != NULL && symfile_objfile->obfd != NULL)) -- solib_create_inferior_hook (); -+ solib_create_inferior_hook (0); - } - - static void -diff --git a/gdb/objfiles.c b/gdb/objfiles.c -index e5442ca..fb0cea9 100644 ---- a/gdb/objfiles.c -+++ b/gdb/objfiles.c -@@ -544,9 +544,10 @@ free_all_objfiles (void) - } - - /* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS -- entries in new_offsets. */ --void --objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) -+ entries in new_offsets. SEPARATE_DEBUG_OBJFILE is not touched here. */ -+ -+static void -+objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets) - { - struct obj_section *s; - struct section_offsets *delta = -@@ -624,6 +625,10 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) - } - } - -+ if (objfile->psymtabs_addrmap) -+ addrmap_relocate (objfile->psymtabs_addrmap, -+ ANOFFSET (delta, SECT_OFF_TEXT (objfile))); -+ - { - struct partial_symtab *p; - -@@ -701,6 +706,49 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) - exec_set_section_address (bfd_get_filename (objfile->obfd), idx, - obj_section_addr (s)); - } -+} -+ -+/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS -+ entries in new_offsets. Process also OBJFILE's SEPARATE_DEBUG_OBJFILE. -+ -+ The number and ordering of sections does differ between the two objfiles. -+ Only their names match. Also the file offsets will differ (objfile being -+ possibly prelinked but separate_debug_objfile is probably not prelinked) but -+ the in-memory absolute address as specified by NEW_OFFSETS must match both -+ files. */ -+ -+void -+objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) -+{ -+ objfile_relocate1 (objfile, new_offsets); -+ -+ if (objfile->separate_debug_objfile != NULL) -+ { -+ struct objfile *debug_objfile = objfile->separate_debug_objfile; -+ struct section_addr_info *objfile_addrs; -+ struct section_offsets *new_debug_offsets; -+ int new_debug_num_sections; -+ struct cleanup *my_cleanups; -+ -+ objfile_addrs = build_section_addr_info_from_objfile (objfile); -+ my_cleanups = make_cleanup (xfree, objfile_addrs); -+ -+ /* Here OBJFILE_ADDRS contain the correct absolute addresses, the -+ relative ones must be already created according to debug_objfile. */ -+ -+ addr_info_make_relative (objfile_addrs, debug_objfile->obfd); -+ -+ gdb_assert (debug_objfile->num_sections -+ == bfd_count_sections (debug_objfile->obfd)); -+ new_debug_offsets = alloca (SIZEOF_N_SECTION_OFFSETS -+ (debug_objfile->num_sections)); -+ relative_addr_info_to_section_offsets (new_debug_offsets, -+ debug_objfile->num_sections, -+ objfile_addrs); -+ do_cleanups (my_cleanups); -+ -+ objfile_relocate1 (debug_objfile, new_debug_offsets); -+ } - - /* Relocate breakpoints as necessary, after things are relocated. */ - breakpoint_re_set (); -diff --git a/gdb/procfs.c b/gdb/procfs.c -index b569bac..15829c2 100644 ---- a/gdb/procfs.c -+++ b/gdb/procfs.c -@@ -4376,7 +4376,7 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object, - - #ifdef NEW_PROC_API - case TARGET_OBJECT_AUXV: -- return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf, -+ return memory_xfer_auxv (ops, object, annex, readbuf, writebuf, - offset, len); - #endif - -diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c -index 9428d92..3591168 100644 ---- a/gdb/solib-darwin.c -+++ b/gdb/solib-darwin.c -@@ -277,7 +277,7 @@ darwin_special_symbol_handling (void) - - /* Shared library startup support. See documentation in solib-svr4.c */ - static void --darwin_solib_create_inferior_hook (void) -+darwin_solib_create_inferior_hook (int from_tty) - { - struct minimal_symbol *msymbol; - char **bkpt_namep; -diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c -index b8d5528..002c589 100644 ---- a/gdb/solib-frv.c -+++ b/gdb/solib-frv.c -@@ -971,7 +971,7 @@ frv_relocate_main_executable (void) - */ - - static void --frv_solib_create_inferior_hook (void) -+frv_solib_create_inferior_hook (int from_tty) - { - /* Relocate main executable. */ - frv_relocate_main_executable (); -diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c -index a0c1cd2..f94f7dc 100644 ---- a/gdb/solib-irix.c -+++ b/gdb/solib-irix.c -@@ -386,7 +386,7 @@ enable_break (void) - - SYNOPSIS - -- void solib_create_inferior_hook () -+ void solib_create_inferior_hook (int from_tty) - - DESCRIPTION - -@@ -431,7 +431,7 @@ enable_break (void) - */ - - static void --irix_solib_create_inferior_hook (void) -+irix_solib_create_inferior_hook (int from_tty) - { - struct inferior *inf; - struct thread_info *tp; -diff --git a/gdb/solib-null.c b/gdb/solib-null.c -index b39ccdb..87f7848 100644 ---- a/gdb/solib-null.c -+++ b/gdb/solib-null.c -@@ -32,7 +32,7 @@ null_special_symbol_handling (void) - } - - static void --null_solib_create_inferior_hook (void) -+null_solib_create_inferior_hook (int from_tty) - { - } - -diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c -index c295335..0acc7fb 100644 ---- a/gdb/solib-osf.c -+++ b/gdb/solib-osf.c -@@ -306,7 +306,7 @@ osf_clear_solib (void) - Also, what if child has exit()ed? Must exit loop somehow. */ - - static void --osf_solib_create_inferior_hook (void) -+osf_solib_create_inferior_hook (int from_tty) - { - struct inferior *inf; - struct thread_info *tp; -diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c -index 637fc1a..16d4010 100644 ---- a/gdb/solib-pa64.c -+++ b/gdb/solib-pa64.c -@@ -329,7 +329,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname) - with shared libraries mapped shareable. */ - - static void --pa64_solib_create_inferior_hook (void) -+pa64_solib_create_inferior_hook (int from_tty) - { - struct minimal_symbol *msymbol; - unsigned int dld_flags, status; -diff --git a/gdb/solib-som.c b/gdb/solib-som.c -index 16f00a3..37ac8cd 100644 ---- a/gdb/solib-som.c -+++ b/gdb/solib-som.c -@@ -182,7 +182,7 @@ struct { - means running until the "_start" is called. */ - - static void --som_solib_create_inferior_hook (void) -+som_solib_create_inferior_hook (int from_tty) - { - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch); - struct minimal_symbol *msymbol; -diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c -index 9f06fa9..45e7e69 100644 ---- a/gdb/solib-spu.c -+++ b/gdb/solib-spu.c -@@ -52,25 +52,19 @@ - static void - spu_relocate_main_executable (int spufs_fd) - { -- struct objfile *objfile; -- struct cleanup *old_chain; - struct section_offsets *new_offsets; - int i; - -- for (objfile = symfile_objfile; -- objfile; -- objfile = objfile->separate_debug_objfile) -- { -- new_offsets = xcalloc (objfile->num_sections, -- sizeof (struct section_offsets)); -- old_chain = make_cleanup (xfree, new_offsets); -+ if (symfile_objfile == NULL) -+ return; - -- for (i = 0; i < objfile->num_sections; i++) -- new_offsets->offsets[i] = SPUADDR (spufs_fd, 0); -+ new_offsets = alloca (symfile_objfile->num_sections -+ * sizeof (struct section_offsets)); - -- objfile_relocate (objfile, new_offsets); -- do_cleanups (old_chain); -- } -+ for (i = 0; i < symfile_objfile->num_sections; i++) -+ new_offsets->offsets[i] = SPUADDR (spufs_fd, 0); -+ -+ objfile_relocate (symfile_objfile, new_offsets); - } - - /* When running a stand-alone SPE executable, we may need to skip one more -@@ -370,7 +364,7 @@ spu_enable_break (struct objfile *objfile) - - /* Create inferior hook. */ - static void --spu_solib_create_inferior_hook (void) -+spu_solib_create_inferior_hook (int from_tty) - { - /* Remove all previously installed solib breakpoints. Both the SVR4 - code and us will re-install all required breakpoints. */ -@@ -401,7 +395,7 @@ spu_solib_create_inferior_hook (void) - } - - /* Call SVR4 hook -- this will re-insert the SVR4 solib breakpoints. */ -- svr4_so_ops.solib_create_inferior_hook (); -+ svr4_so_ops.solib_create_inferior_hook (from_tty); - - /* If the inferior is statically linked against libspe, we need to install - our own solib breakpoint right now. Otherwise, it will be installed by -diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c -index 9b2a470..b2a147d 100644 ---- a/gdb/solib-sunos.c -+++ b/gdb/solib-sunos.c -@@ -740,7 +740,7 @@ sunos_special_symbol_handling (void) - */ - - static void --sunos_solib_create_inferior_hook (void) -+sunos_solib_create_inferior_hook (int from_tty) - { - struct thread_info *tp; - struct inferior *inf; -diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c -index 68aadc0..efbe717 100644 ---- a/gdb/solib-svr4.c -+++ b/gdb/solib-svr4.c -@@ -50,6 +50,7 @@ - - static struct link_map_offsets *svr4_fetch_link_map_offsets (void); - static int svr4_have_link_map_offsets (void); -+static void svr4_relocate_main_executable (void); - - /* Link map info to include in an allocated so_list entry */ - -@@ -599,11 +600,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) - { - int arch_size, step, sect_size; - long dyn_tag; -- CORE_ADDR dyn_ptr, dyn_addr; -+ CORE_ADDR dyn_ptr; - gdb_byte *bufend, *bufstart, *buf; - Elf32_External_Dyn *x_dynp_32; - Elf64_External_Dyn *x_dynp_64; - struct bfd_section *sect; -+ struct target_section *target_section; - - if (abfd == NULL) - return 0; -@@ -619,7 +621,13 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) - sect = bfd_get_section_by_name (abfd, ".dynamic"); - if (sect == NULL) - return 0; -- dyn_addr = bfd_section_vma (abfd, sect); -+ -+ for (target_section = target_get_section_table (&exec_ops)->sections; -+ target_section < target_get_section_table (&exec_ops)->sections_end; -+ target_section++) -+ if (sect == target_section->the_bfd_section) -+ break; -+ gdb_assert (target_section < target_get_section_table (&exec_ops)->sections_end); - - /* Read in .dynamic from the BFD. We will get the actual value - from memory later. */ -@@ -661,7 +669,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) - CORE_ADDR ptr_addr; - - ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; -- ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8; -+ ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8; - if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0) - dyn_ptr = extract_typed_address (ptr_buf, ptr_type); - *ptr = dyn_ptr; -@@ -1258,7 +1266,7 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ) - */ - - static int --enable_break (struct svr4_info *info) -+enable_break (struct svr4_info *info, int from_tty) - { - struct minimal_symbol *msymbol; - char **bkpt_namep; -@@ -1279,7 +1287,7 @@ enable_break (struct svr4_info *info) - mean r_brk has already been relocated. Assume the dynamic linker - is the object containing r_brk. */ - -- solib_add (NULL, 0, ¤t_target, auto_solib_add); -+ solib_add (NULL, from_tty, ¤t_target, auto_solib_add); - sym_addr = 0; - if (info->debug_base && solib_svr4_r_map (info) != 0) - sym_addr = solib_svr4_r_brk (info); -@@ -1339,6 +1347,11 @@ enable_break (struct svr4_info *info) - bfd *tmp_bfd = NULL; - struct target_ops *tmp_bfd_target; - volatile struct gdb_exception ex; -+ int addr_bit = gdbarch_addr_bit (target_gdbarch); -+ CORE_ADDR mask = CORE_ADDR_MAX; -+ -+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) -+ mask = ((CORE_ADDR) 1 << addr_bit) - 1; - - sym_addr = 0; - -@@ -1404,7 +1417,7 @@ enable_break (struct svr4_info *info) - info->debug_loader_name = xstrdup (interp_name); - info->debug_loader_offset_p = 1; - info->debug_loader_offset = load_addr; -- solib_add (NULL, 0, ¤t_target, auto_solib_add); -+ solib_add (NULL, from_tty, ¤t_target, auto_solib_add); - } - - /* Record the relocated start and end address of the dynamic linker -@@ -1414,16 +1427,20 @@ enable_break (struct svr4_info *info) - { - interp_text_sect_low = - bfd_section_vma (tmp_bfd, interp_sect) + load_addr; -+ interp_text_sect_low &= mask; - interp_text_sect_high = - interp_text_sect_low + bfd_section_size (tmp_bfd, interp_sect); -+ interp_text_sect_high &= mask; - } - interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt"); - if (interp_sect) - { - interp_plt_sect_low = - bfd_section_vma (tmp_bfd, interp_sect) + load_addr; -+ interp_text_sect_low &= mask; - interp_plt_sect_high = - interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect); -+ interp_text_sect_high &= mask; - } - - /* Now try to set a breakpoint in the dynamic linker. */ -@@ -1448,7 +1465,7 @@ enable_break (struct svr4_info *info) - - if (sym_addr != 0) - { -- create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr); -+ create_solib_event_breakpoint (target_gdbarch, (load_addr + sym_addr) & mask); - xfree (interp_name); - return 1; - } -@@ -1517,113 +1534,131 @@ enable_break (struct svr4_info *info) - static void - svr4_special_symbol_handling (void) - { -+ svr4_relocate_main_executable (); - } - --/* Relocate the main executable. This function should be called upon -- stopping the inferior process at the entry point to the program. -- The entry point from BFD is compared to the PC and if they are -- different, the main executable is relocated by the proper amount. -+/* Decide if the objfile needs to be relocated. As indicated above, -+ we will only be here when execution is stopped at the beginning -+ of the program. Relocation is necessary if the address at which -+ we are presently stopped differs from the start address stored in -+ the executable AND there's no interpreter section. The condition -+ regarding the interpreter section is very important because if -+ there *is* an interpreter section, execution will begin there -+ instead. When there is an interpreter section, the start address -+ is (presumably) used by the interpreter at some point to start -+ execution of the program. -+ -+ If there is an interpreter, it is normal for it to be set to an -+ arbitrary address at the outset. The job of finding it is -+ handled in enable_break(). -+ -+ So, to summarize, relocations are necessary when there is no -+ interpreter section and the start address obtained from the -+ executable is different from the address at which GDB is -+ currently stopped. - -- As written it will only attempt to relocate executables which -- lack interpreter sections. It seems likely that only dynamic -- linker executables will get relocated, though it should work -- properly for a position-independent static executable as well. */ -+ [ The astute reader will note that we also test to make sure that -+ the executable in question has the DYNAMIC flag set. It is my -+ opinion that this test is unnecessary (undesirable even). It -+ was added to avoid inadvertent relocation of an executable -+ whose e_type member in the ELF header is not ET_DYN. There may -+ be a time in the future when it is desirable to do relocations -+ on other types of files as well in which case this condition -+ should either be removed or modified to accomodate the new file -+ type. (E.g, an ET_EXEC executable which has been built to be -+ position-independent could safely be relocated by the OS if -+ desired. It is true that this violates the ABI, but the ABI -+ has been known to be bent from time to time.) - Kevin, Nov 2000. ] -+ */ - --static void --svr4_relocate_main_executable (void) -+static CORE_ADDR -+svr4_static_exec_displacement (void) - { - asection *interp_sect; - struct regcache *regcache - = get_thread_arch_regcache (inferior_ptid, target_gdbarch); - CORE_ADDR pc = regcache_read_pc (regcache); - -- /* Decide if the objfile needs to be relocated. As indicated above, -- we will only be here when execution is stopped at the beginning -- of the program. Relocation is necessary if the address at which -- we are presently stopped differs from the start address stored in -- the executable AND there's no interpreter section. The condition -- regarding the interpreter section is very important because if -- there *is* an interpreter section, execution will begin there -- instead. When there is an interpreter section, the start address -- is (presumably) used by the interpreter at some point to start -- execution of the program. -- -- If there is an interpreter, it is normal for it to be set to an -- arbitrary address at the outset. The job of finding it is -- handled in enable_break(). -- -- So, to summarize, relocations are necessary when there is no -- interpreter section and the start address obtained from the -- executable is different from the address at which GDB is -- currently stopped. -- -- [ The astute reader will note that we also test to make sure that -- the executable in question has the DYNAMIC flag set. It is my -- opinion that this test is unnecessary (undesirable even). It -- was added to avoid inadvertent relocation of an executable -- whose e_type member in the ELF header is not ET_DYN. There may -- be a time in the future when it is desirable to do relocations -- on other types of files as well in which case this condition -- should either be removed or modified to accomodate the new file -- type. (E.g, an ET_EXEC executable which has been built to be -- position-independent could safely be relocated by the OS if -- desired. It is true that this violates the ABI, but the ABI -- has been known to be bent from time to time.) - Kevin, Nov 2000. ] -- */ -- - interp_sect = bfd_get_section_by_name (exec_bfd, ".interp"); - if (interp_sect == NULL - && (bfd_get_file_flags (exec_bfd) & DYNAMIC) != 0 - && (exec_entry_point (exec_bfd, &exec_ops) != pc)) -+ return pc - exec_entry_point (exec_bfd, &exec_ops); -+ -+ return 0; -+} -+ -+/* We relocate all of the sections by the same amount. This -+ behavior is mandated by recent editions of the System V ABI. -+ According to the System V Application Binary Interface, -+ Edition 4.1, page 5-5: -+ -+ ... Though the system chooses virtual addresses for -+ individual processes, it maintains the segments' relative -+ positions. Because position-independent code uses relative -+ addressesing between segments, the difference between -+ virtual addresses in memory must match the difference -+ between virtual addresses in the file. The difference -+ between the virtual address of any segment in memory and -+ the corresponding virtual address in the file is thus a -+ single constant value for any one executable or shared -+ object in a given process. This difference is the base -+ address. One use of the base address is to relocate the -+ memory image of the program during dynamic linking. -+ -+ The same language also appears in Edition 4.0 of the System V -+ ABI and is left unspecified in some of the earlier editions. */ -+ -+static CORE_ADDR -+svr4_exec_displacement (void) -+{ -+ int found; -+ CORE_ADDR entry_point; -+ -+ if (exec_bfd == NULL) -+ return 0; -+ -+ if (target_auxv_search (¤t_target, AT_ENTRY, &entry_point) == 1) -+ return entry_point - exec_entry_point (exec_bfd, ¤t_target); -+ -+ return svr4_static_exec_displacement (); -+} -+ -+/* Relocate the main executable. This function should be called upon -+ stopping the inferior process at the entry point to the program. -+ The entry point from BFD is compared to the AT_ENTRY of AUXV and if they are -+ different, the main executable is relocated by the proper amount. */ -+ -+static void -+svr4_relocate_main_executable (void) -+{ -+ CORE_ADDR displacement = svr4_exec_displacement (); -+ -+ /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new -+ difference of in-memory vs. in-file addresses and we could already -+ relocate the executable at this function to improper address before. */ -+ -+ if (symfile_objfile) - { -- struct cleanup *old_chain; - struct section_offsets *new_offsets; -- int i, changed; -- CORE_ADDR displacement; -- -- /* It is necessary to relocate the objfile. The amount to -- relocate by is simply the address at which we are stopped -- minus the starting address from the executable. -- -- We relocate all of the sections by the same amount. This -- behavior is mandated by recent editions of the System V ABI. -- According to the System V Application Binary Interface, -- Edition 4.1, page 5-5: -- -- ... Though the system chooses virtual addresses for -- individual processes, it maintains the segments' relative -- positions. Because position-independent code uses relative -- addressesing between segments, the difference between -- virtual addresses in memory must match the difference -- between virtual addresses in the file. The difference -- between the virtual address of any segment in memory and -- the corresponding virtual address in the file is thus a -- single constant value for any one executable or shared -- object in a given process. This difference is the base -- address. One use of the base address is to relocate the -- memory image of the program during dynamic linking. -- -- The same language also appears in Edition 4.0 of the System V -- ABI and is left unspecified in some of the earlier editions. */ -- -- displacement = pc - exec_entry_point (exec_bfd, &exec_ops); -- changed = 0; -- -- new_offsets = xcalloc (symfile_objfile->num_sections, -- sizeof (struct section_offsets)); -- old_chain = make_cleanup (xfree, new_offsets); -+ int i; -+ -+ new_offsets = alloca (symfile_objfile->num_sections -+ * sizeof (*new_offsets)); - - for (i = 0; i < symfile_objfile->num_sections; i++) -- { -- if (displacement != ANOFFSET (symfile_objfile->section_offsets, i)) -- changed = 1; -- new_offsets->offsets[i] = displacement; -- } -+ new_offsets->offsets[i] = displacement; - -- if (changed) -- objfile_relocate (symfile_objfile, new_offsets); -+ objfile_relocate (symfile_objfile, new_offsets); -+ } -+ else if (exec_bfd) -+ { -+ asection *asect; - -- do_cleanups (old_chain); -+ for (asect = exec_bfd->sections; asect != NULL; asect = asect->next) -+ exec_set_section_address (bfd_get_filename (exec_bfd), asect->index, -+ bfd_section_vma (exec_bfd, asect) -+ + displacement); - } - } - -@@ -1635,7 +1670,7 @@ svr4_relocate_main_executable (void) - - SYNOPSIS - -- void svr4_solib_create_inferior_hook () -+ void svr4_solib_create_inferior_hook (int from_tty) - - DESCRIPTION - -@@ -1680,7 +1715,7 @@ svr4_relocate_main_executable (void) - */ - - static void --svr4_solib_create_inferior_hook (void) -+svr4_solib_create_inferior_hook (int from_tty) - { - struct inferior *inf; - struct thread_info *tp; -@@ -1689,12 +1724,13 @@ svr4_solib_create_inferior_hook (void) - info = get_svr4_info (PIDGET (inferior_ptid)); - - /* Relocate the main executable if necessary. */ -- svr4_relocate_main_executable (); -+ if (current_inferior ()->attach_flag == 0) -+ svr4_relocate_main_executable (); - - if (!svr4_have_link_map_offsets ()) - return; - -- if (!enable_break (info)) -+ if (!enable_break (info, from_tty)) - return; - - #if defined(_SCO_DS) -@@ -1910,8 +1946,19 @@ elf_lookup_lib_symbol (const struct objfile *objfile, - const char *name, - const domain_enum domain) - { -- if (objfile->obfd == NULL -- || scan_dyntag (DT_SYMBOLIC, objfile->obfd, NULL) != 1) -+ bfd *abfd; -+ -+ if (objfile == symfile_objfile) -+ abfd = exec_bfd; -+ else -+ { -+ /* OBJFILE should have been passed as the non-debug one. */ -+ gdb_assert (objfile->separate_debug_objfile_backlink == NULL); -+ -+ abfd = objfile->obfd; -+ } -+ -+ if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1) - return NULL; - - return lookup_global_symbol_from_objfile (objfile, name, domain); -diff --git a/gdb/solib-target.c b/gdb/solib-target.c -index 07415e4..d160a70 100644 ---- a/gdb/solib-target.c -+++ b/gdb/solib-target.c -@@ -306,7 +306,7 @@ solib_target_special_symbol_handling (void) - } - - static void --solib_target_solib_create_inferior_hook (void) -+solib_target_solib_create_inferior_hook (int from_tty) - { - /* Nothing needed. */ - } -diff --git a/gdb/solib.c b/gdb/solib.c -index 3574e62..7ea3663 100644 ---- a/gdb/solib.c -+++ b/gdb/solib.c -@@ -998,7 +998,7 @@ clear_solib (void) - - SYNOPSIS - -- void solib_create_inferior_hook () -+ void solib_create_inferior_hook (int from_tty) - - DESCRIPTION - -@@ -1008,10 +1008,10 @@ clear_solib (void) - SOLIB_CREATE_INFERIOR_HOOK. */ - - void --solib_create_inferior_hook (void) -+solib_create_inferior_hook (int from_tty) - { - struct target_so_ops *ops = solib_ops (target_gdbarch); -- ops->solib_create_inferior_hook(); -+ ops->solib_create_inferior_hook (from_tty); - } - - /* GLOBAL FUNCTION -@@ -1087,7 +1087,6 @@ reload_shared_libraries (char *ignored, int from_tty, - struct cmd_list_element *e) - { - no_shared_libraries (NULL, from_tty); -- solib_add (NULL, from_tty, NULL, auto_solib_add); - /* Creating inferior hooks here has two purposes. First, if we reload - shared libraries then the address of solib breakpoint we've computed - previously might be no longer valid. For example, if we forgot to set -@@ -1102,9 +1101,19 @@ reload_shared_libraries (char *ignored, int from_tty, - #ifdef SOLIB_CREATE_INFERIOR_HOOK - SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); - #else -- solib_create_inferior_hook (); -+ solib_create_inferior_hook (from_tty); - #endif - } -+ -+ /* Sometimes the platform-specific hook loads initial shared -+ libraries, and sometimes it doesn't. If it doesn't FROM_TTY will be -+ incorrectly 0 but such solib targets should be fixed anyway. If we -+ made all the inferior hook methods consistent, this call could be -+ removed. Call it only after the solib target has been initialized by -+ solib_create_inferior_hook. */ -+ -+ solib_add (NULL, 0, NULL, auto_solib_add); -+ - /* We have unloaded and then reloaded debug info for all shared libraries. - However, frames may still reference them, for example a frame's - unwinder might still point of DWARF FDE structures that are now freed. -diff --git a/gdb/solib.h b/gdb/solib.h -index ccc5b63..abe5e19 100644 ---- a/gdb/solib.h -+++ b/gdb/solib.h -@@ -41,7 +41,7 @@ extern int solib_read_symbols (struct so_list *, int); - addresses to which they are linked, and sufficient information to - read in their symbols at a later time. */ - --extern void solib_create_inferior_hook (void); -+extern void solib_create_inferior_hook (int from_tty); - - /* If ADDR lies in a shared library, return its name. */ - -diff --git a/gdb/solist.h b/gdb/solist.h -index 005e8f7..9724fe7 100644 ---- a/gdb/solist.h -+++ b/gdb/solist.h -@@ -87,7 +87,7 @@ struct target_so_ops - void (*clear_solib) (void); - - /* Target dependent code to run after child process fork. */ -- void (*solib_create_inferior_hook) (void); -+ void (*solib_create_inferior_hook) (int from_tty); - - /* Do additional symbol handling, lookup, etc. after symbols - for a shared object have been loaded. */ -diff --git a/gdb/symfile.c b/gdb/symfile.c -index c31b72a..6d7fa10 100644 ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -536,40 +536,151 @@ place_section (bfd *abfd, asection *sect, void *obj) - arg->lowest = start_addr + bfd_get_section_size (sect); - } - --/* Parse the user's idea of an offset for dynamic linking, into our idea -- of how to represent it for fast symbol reading. This is the default -- version of the sym_fns.sym_offsets function for symbol readers that -- don't need to do anything special. It allocates a section_offsets table -- for the objectfile OBJFILE and stuffs ADDR into all of the offsets. */ -+/* Build (allocate and populate) struct section_addr_info with absolute -+ addresses from OBJFILE->OBFD and OBJFILE->SECTION_OFFSETS. */ -+ -+struct section_addr_info * -+build_section_addr_info_from_objfile (struct objfile *objfile) -+{ -+ struct target_section *sections = NULL, *sections_end; -+ struct target_section *p; -+ int addr_bit = gdbarch_addr_bit (objfile->gdbarch); -+ CORE_ADDR mask = CORE_ADDR_MAX; -+ struct section_addr_info *retval; -+ struct cleanup *my_cleanups; -+ -+ if (build_section_table (objfile->obfd, §ions, §ions_end)) -+ error (_("Can't find the file sections in `%s': %s"), -+ bfd_get_filename (objfile->obfd), bfd_errmsg (bfd_get_error ())); -+ my_cleanups = make_cleanup (xfree, sections); -+ -+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) -+ mask = ((CORE_ADDR) 1 << addr_bit) - 1; -+ -+ for (p = sections; p < sections_end; p++) -+ { -+ CORE_ADDR baseaddr; -+ -+ gdb_assert (p->the_bfd_section->index < objfile->num_sections); -+ baseaddr = ANOFFSET (objfile->section_offsets, -+ p->the_bfd_section->index); -+ -+ p->addr = (p->addr + baseaddr) & mask; -+ p->endaddr = (p->endaddr + baseaddr) & mask; -+ } -+ -+ retval = build_section_addr_info_from_section_table (sections, sections_end); -+ -+ do_cleanups (my_cleanups); -+ -+ return retval; -+} -+ -+/* Store struct section_addr_info as prepared (made relative and with SECTINDEX -+ filled-in) by addr_info_make_relative into SECTION_OFFSETS of NUM_SECTIONS -+ entries. */ - - void --default_symfile_offsets (struct objfile *objfile, -- struct section_addr_info *addrs) -+relative_addr_info_to_section_offsets (struct section_offsets *section_offsets, -+ int num_sections, -+ struct section_addr_info *addrs) - { - int i; - -- objfile->num_sections = bfd_count_sections (objfile->obfd); -- objfile->section_offsets = (struct section_offsets *) -- obstack_alloc (&objfile->objfile_obstack, -- SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); -- memset (objfile->section_offsets, 0, -- SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); -+ memset (section_offsets, 0, SIZEOF_N_SECTION_OFFSETS (num_sections)); - -- /* Now calculate offsets for section that were specified by the -- caller. */ -+ /* Now calculate offsets for section that were specified by the caller. */ - for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) - { -- struct other_sections *osp ; -+ struct other_sections *osp; - -- osp = &addrs->other[i] ; -+ osp = &addrs->other[i]; - if (osp->addr == 0) - continue; - - /* Record all sections in offsets */ - /* The section_offsets in the objfile are here filled in using - the BFD index. */ -- (objfile->section_offsets)->offsets[osp->sectindex] = osp->addr; -+ section_offsets->offsets[osp->sectindex] = osp->addr; -+ } -+} -+ -+/* Relativize absolute addresses in ADDRS into offsets based on ABFD. Fill-in -+ also SECTINDEXes there. */ -+ -+void -+addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) -+{ -+ asection *lower_sect; -+ asection *sect; -+ CORE_ADDR lower_offset; -+ int i; -+ -+ /* Find lowest loadable section to be used as starting point for -+ continguous sections. FIXME!! won't work without call to find -+ .text first, but this assumes text is lowest section. */ -+ lower_sect = bfd_get_section_by_name (abfd, ".text"); -+ if (lower_sect == NULL) -+ bfd_map_over_sections (abfd, find_lowest_section, &lower_sect); -+ if (lower_sect == NULL) -+ { -+ warning (_("no loadable sections found in added symbol-file %s"), -+ bfd_get_filename (abfd)); -+ lower_offset = 0; -+ } -+ else -+ lower_offset = bfd_section_vma (bfd_get_filename (abfd), lower_sect); -+ -+ /* Calculate offsets for the loadable sections. -+ FIXME! Sections must be in order of increasing loadable section -+ so that contiguous sections can use the lower-offset!!! -+ -+ Adjust offsets if the segments are not contiguous. -+ If the section is contiguous, its offset should be set to -+ the offset of the highest loadable section lower than it -+ (the loadable section directly below it in memory). -+ this_offset = lower_offset = lower_addr - lower_orig_addr */ -+ -+ for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) -+ { -+ if (addrs->other[i].addr != 0) -+ { -+ sect = bfd_get_section_by_name (abfd, addrs->other[i].name); -+ if (sect) -+ { -+ addrs->other[i].addr -= bfd_section_vma (abfd, sect); -+ lower_offset = addrs->other[i].addr; -+ /* This is the index used by BFD. */ -+ addrs->other[i].sectindex = sect->index; -+ } -+ else -+ { -+ warning (_("section %s not found in %s"), addrs->other[i].name, -+ bfd_get_filename (abfd)); -+ addrs->other[i].addr = 0; -+ } -+ } -+ else -+ addrs->other[i].addr = lower_offset; - } -+} -+ -+/* Parse the user's idea of an offset for dynamic linking, into our idea -+ of how to represent it for fast symbol reading. This is the default -+ version of the sym_fns.sym_offsets function for symbol readers that -+ don't need to do anything special. It allocates a section_offsets table -+ for the objectfile OBJFILE and stuffs ADDR into all of the offsets. */ -+ -+void -+default_symfile_offsets (struct objfile *objfile, -+ struct section_addr_info *addrs) -+{ -+ objfile->num_sections = bfd_count_sections (objfile->obfd); -+ objfile->section_offsets = (struct section_offsets *) -+ obstack_alloc (&objfile->objfile_obstack, -+ SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)); -+ relative_addr_info_to_section_offsets (objfile->section_offsets, -+ objfile->num_sections, addrs); - - /* For relocatable files, all loadable sections will start at zero. - The zero is meaningless, so try to pick arbitrary addresses such -@@ -803,65 +914,8 @@ syms_from_objfile (struct objfile *objfile, - - We no longer warn if the lowest section is not a text segment (as - happens for the PA64 port. */ -- if (!mainline && addrs && addrs->other[0].name) -- { -- asection *lower_sect; -- asection *sect; -- CORE_ADDR lower_offset; -- int i; -- -- /* Find lowest loadable section to be used as starting point for -- continguous sections. FIXME!! won't work without call to find -- .text first, but this assumes text is lowest section. */ -- lower_sect = bfd_get_section_by_name (objfile->obfd, ".text"); -- if (lower_sect == NULL) -- bfd_map_over_sections (objfile->obfd, find_lowest_section, -- &lower_sect); -- if (lower_sect == NULL) -- { -- warning (_("no loadable sections found in added symbol-file %s"), -- objfile->name); -- lower_offset = 0; -- } -- else -- lower_offset = bfd_section_vma (objfile->obfd, lower_sect); -- -- /* Calculate offsets for the loadable sections. -- FIXME! Sections must be in order of increasing loadable section -- so that contiguous sections can use the lower-offset!!! -- -- Adjust offsets if the segments are not contiguous. -- If the section is contiguous, its offset should be set to -- the offset of the highest loadable section lower than it -- (the loadable section directly below it in memory). -- this_offset = lower_offset = lower_addr - lower_orig_addr */ -- -- for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) -- { -- if (addrs->other[i].addr != 0) -- { -- sect = bfd_get_section_by_name (objfile->obfd, -- addrs->other[i].name); -- if (sect) -- { -- addrs->other[i].addr -- -= bfd_section_vma (objfile->obfd, sect); -- lower_offset = addrs->other[i].addr; -- /* This is the index used by BFD. */ -- addrs->other[i].sectindex = sect->index ; -- } -- else -- { -- warning (_("section %s not found in %s"), -- addrs->other[i].name, -- objfile->name); -- addrs->other[i].addr = 0; -- } -- } -- else -- addrs->other[i].addr = lower_offset; -- } -- } -+ if (addrs && addrs->other[0].name) -+ addr_info_make_relative (addrs, objfile->obfd); - - /* Initialize symbol reading routines for this objfile, allow complaints to - appear for this new file, and record how verbose to be, then do the -@@ -959,7 +1013,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - struct objfile *objfile; - struct partial_symtab *psymtab; - char *debugfile = NULL; -- struct section_addr_info *orig_addrs = NULL; - struct cleanup *my_cleanups; - const char *name = bfd_get_filename (abfd); - const int from_tty = add_flags & SYMFILE_VERBOSE; -@@ -981,12 +1034,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - objfile->flags |= OBJF_MAIN; - discard_cleanups (my_cleanups); - -- if (addrs) -- { -- orig_addrs = copy_section_addr_info (addrs); -- make_cleanup_free_section_addr_info (orig_addrs); -- } -- - /* We either created a new mapped symbol table, mapped an existing - symbol table file which has not had initial symbol reading - performed, or need to read an unmapped symbol table. */ -@@ -1033,18 +1080,17 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - `.gnu_debuglink' may no longer be present with `.note.gnu.build-id'. */ - if (!has_any_debug_symbols (objfile)) - debugfile = find_separate_debug_file (objfile); -+ - if (debugfile) - { -- if (addrs != NULL) -- { -- objfile->separate_debug_objfile -- = symbol_file_add (debugfile, add_flags, orig_addrs, flags); -- } -- else -- { -- objfile->separate_debug_objfile -- = symbol_file_add (debugfile, add_flags, NULL, flags); -- } -+ struct section_addr_info *objfile_addrs; -+ -+ objfile_addrs = build_section_addr_info_from_objfile (objfile); -+ make_cleanup (xfree, objfile_addrs); -+ -+ objfile->separate_debug_objfile = symbol_file_add (debugfile, add_flags, -+ objfile_addrs, flags); -+ - objfile->separate_debug_objfile->separate_debug_objfile_backlink - = objfile; - -diff --git a/gdb/symfile.h b/gdb/symfile.h -index bf9d9e7..bff6bd8 100644 ---- a/gdb/symfile.h -+++ b/gdb/symfile.h -@@ -181,6 +181,16 @@ struct sym_fns - - }; - -+extern struct section_addr_info * -+ build_section_addr_info_from_objfile (struct objfile *objfile); -+ -+extern void relative_addr_info_to_section_offsets -+ (struct section_offsets *section_offsets, int num_sections, -+ struct section_addr_info *addrs); -+ -+extern void addr_info_make_relative (struct section_addr_info *addrs, -+ bfd *abfd); -+ - /* The default version of sym_fns.sym_offsets for readers that don't - do anything special. */ - -diff --git a/gdb/symtab.c b/gdb/symtab.c -index 82e0163..01117e3 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -1449,7 +1449,12 @@ lookup_objfile_from_block (const struct block *block) - /* Go through SYMTABS. */ - ALL_SYMTABS (obj, s) - if (block == BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK)) -- return obj; -+ { -+ if (obj->separate_debug_objfile_backlink) -+ obj = obj->separate_debug_objfile_backlink; -+ -+ return obj; -+ } - - return NULL; - } -diff --git a/gdb/testsuite/gdb.base/break-interp-lib.c b/gdb/testsuite/gdb.base/break-interp-lib.c -new file mode 100644 -index 0000000..9ca943e ---- /dev/null -+++ b/gdb/testsuite/gdb.base/break-interp-lib.c -@@ -0,0 +1,40 @@ -+/* 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 -+#include -+#include -+#include -+ -+void -+libfunc (const char *action) -+{ -+ assert (action != NULL); -+ -+ if (strcmp (action, "segv") == 0) -+ raise (SIGSEGV); -+ -+ if (strcmp (action, "sleep") == 0) -+ { -+ puts ("sleeping"); -+ fflush (stdout); -+ -+ sleep (60); -+ } -+ -+ assert (0); -+} -diff --git a/gdb/testsuite/gdb.base/break-interp-main.c b/gdb/testsuite/gdb.base/break-interp-main.c -new file mode 100644 -index 0000000..e12ec2b ---- /dev/null -+++ b/gdb/testsuite/gdb.base/break-interp-main.c -@@ -0,0 +1,30 @@ -+/* 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 void libfunc (const char *action); -+ -+int -+main (int argc, char **argv) -+{ -+ assert (argc == 2); -+ -+ libfunc (argv[1]); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp -new file mode 100644 -index 0000000..52f460c ---- /dev/null -+++ b/gdb/testsuite/gdb.base/break-interp.exp -@@ -0,0 +1,545 @@ -+# 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 . -+ -+# This test only works on GNU/Linux. -+if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} { -+ continue -+} -+ -+set test "break-interp" -+set binprefix ${objdir}/${subdir}/${test} -+# Only to get the $interp_system name. -+set srcfile_test "start.c" -+set binfile_test ${test}-test -+set binfile_lib ${objdir}/${subdir}/${test}.so -+set srcfile "${test}-main.c" -+set srcfile_lib "${test}-lib.c" -+ -+if [get_compiler_info ${binfile_lib}] { -+ return -1 -+} -+ -+# Use -soname so that it is listed with " => " by ldd and this testcase makes -+# a copy of ${binfile_lib} for each prelink variant. -+ -+if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} { -+ return -1 -+} -+ -+if {[build_executable ${test}.exp $binfile_test ${srcfile_test} {}] == -1} { -+ return -1 -+} -+ -+# Return the interpreter filename string. -+# Return "" if no interpreter was found. -+proc section_get {exec section} { -+ global objdir -+ global subdir -+ set tmp "${objdir}/${subdir}/break-interp.interp" -+ set objcopy_program [transform objcopy] -+ -+ set command "exec $objcopy_program -O binary --set-section-flags $section=A --change-section-address $section=0 -j $section $exec $tmp" -+ verbose -log "command is $command" -+ set result [catch $command output] -+ verbose -log "result is $result" -+ verbose -log "output is $output" -+ if {$result == 1} { -+ return "" -+ } -+ set fi [open $tmp] -+ fconfigure $fi -translation binary -+ set data [read $fi] -+ close $fi -+ #file delete $tmp -+ # .interp has size $len + 1 but .gnu_debuglink contains garbage after \000. -+ set len [string first \000 $data] -+ if {$len < 0} { -+ verbose -log "section $section not found" -+ return "" -+ } -+ set retval [string range $data 0 [expr $len - 1]] -+ verbose -log "section $section is <$retval>" -+ return $retval -+} -+ -+# Note: The separate debug info file content build-id/crc32 are not verified -+# contrary to the GDB search algorithm skipping non-matching ones. -+proc system_debug_get {exec} { -+ global debug_root -+ -+ set exec_build_id_debug [build_id_debug_filename_get $exec] -+ set debug_base "[file tail $exec].debug" -+ set exec_dir [file dirname $exec] -+ -+ # isfile returns 1 even for symlinks to files. -+ set retval $debug_root/$exec_build_id_debug -+ if [file isfile $retval] { -+ return $retval -+ } -+ set retval $exec_dir/$debug_base -+ if [file isfile $retval] { -+ return $retval -+ } -+ set retval $exec_dir/.debug/$debug_base -+ if [file isfile $retval] { -+ return $retval -+ } -+ set retval $debug_root/$exec_dir/$debug_base -+ if [file isfile $retval] { -+ return $retval -+ } -+ return "" -+} -+ -+gdb_exit -+gdb_start -+set debug_root "" -+set test "show debug-file-directory" -+gdb_test_multiple $test $test { -+ -re "The directory where separate debug symbols are searched for is \"(.*)\".\r\n$gdb_prompt $" { -+ set debug_root $expect_out(1,string) -+ } -+} -+ -+set interp_system [section_get ${objdir}/${subdir}/$binfile_test .interp] -+set interp_system_debug [system_debug_get $interp_system] -+verbose -log "$interp_system has debug $interp_system_debug" -+ -+proc prelinkNO_run {arg} { -+ set command "exec /usr/sbin/prelink -uN $arg" -+ verbose -log "command is $command" -+ set result [catch $command output] -+ verbose -log "result is $result" -+ verbose -log "output is $output" -+ return [list $result $output] -+} -+ -+proc prelinkNO {arg {name {}}} { -+ if {$name == ""} { -+ set name [file tail $arg] -+ } -+ set test "unprelink $name" -+ set run [prelinkNO_run $arg] -+ set result [lindex $run 0] -+ set output [lindex $run 1] -+ if {$result == 0 && $output == ""} { -+ verbose -log "$name has been now unprelinked" -+ set run [prelinkNO_run $arg] -+ set result [lindex $run 0] -+ set output [lindex $run 1] -+ } -+ # Last line does miss the trailing \n. -+ if {$result == 1 && [regexp {^(/usr/sbin/prelink: [^ ]* does not have .gnu.prelink_undo section\n?)*$} $output]} { -+ pass $test -+ return 1 -+ } else { -+ fail $test -+ return 0 -+ } -+} -+ -+proc prelinkYES {arg {name ""}} { -+ if {$name == ""} { -+ set name [file tail $arg] -+ } -+ set test "prelink $name" -+ set command "exec /usr/sbin/prelink -qNR --no-exec-shield $arg" -+ verbose -log "command is $command" -+ set result [catch $command output] -+ verbose -log "result is $result" -+ verbose -log "output is $output" -+ if {$result == 0 && $output == ""} { -+ pass $test -+ return 1 -+ } else { -+ fail $test -+ return 0 -+ } -+} -+ -+# Resolve symlinks. -+proc symlink_resolve {file} { -+ set loop 0 -+ while {[file type $file] == "link"} { -+ set target [file readlink $file] -+ if {[file pathtype $target] == "relative"} { -+ set src2 [file dirname $file]/$target -+ } else { -+ set src2 $target -+ } -+ verbose -log "Resolved symlink $file targetting $target as $src2" -+ set file $src2 -+ -+ set loop [expr $loop + 1] -+ if {$loop > 30} { -+ fail "Looping symlink resolution for $file" -+ return "" -+ } -+ } -+ return $file -+} -+ -+proc copy {src dest} { -+ set src [symlink_resolve $src] -+ # Test name would contain build-id hash for symlink-unresolved $src. -+ set test "copy [file tail $src] to [file tail $dest]" -+ set command "file copy -force $src $dest" -+ verbose -log "command is $command" -+ if [catch $command] { -+ fail $test -+ return 0 -+ } else { -+ pass $test -+ return 1 -+ } -+} -+ -+proc strip_debug {dest} { -+ set test "strip [file tail $dest]" -+ set strip_program [transform strip] -+ set command "exec $strip_program --strip-debug $dest" -+ verbose -log "command is $command" -+ if [catch $command] { -+ fail $test -+ return 0 -+ } else { -+ pass $test -+ return 1 -+ } -+} -+ -+# `runto' does not check we stopped really at the function we specified. -+proc reach {func command} { -+ global gdb_prompt -+ -+ if [gdb_breakpoint $func allow-pending] { -+ set test "reach $func" -+ gdb_test_multiple $command $test { -+ -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 $" { -+ pass $test -+ } -+ } -+ } -+} -+ -+proc test_core {file} { -+ global srcdir subdir gdb_prompt -+ -+ set corefile [core_find $file {} "segv"] -+ if {$corefile == ""} { -+ return -+ } -+ -+ gdb_exit -+ gdb_start -+ # Clear it to never find any separate debug infos in $debug_root. -+ gdb_test "set debug-file-directory" "" "set debug-file-directory for core" -+ 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" -+ -+ # Check there is no "argc=can't compute CFA for this frame". -+ gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "core main bt" -+} -+ -+proc test_attach {file} { -+ 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 -+ } -+ } -+ -+ gdb_exit -+ gdb_start -+ gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach" -+ # Check there is no "argc=can't compute CFA for this frame". -+ gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "attach main bt" -+ gdb_exit -+ -+ remote_exec host "kill -9 $pid" -+} -+ -+proc test_ld {file ifmain trynosym} { -+ global srcdir subdir gdb_prompt -+ -+ # First test normal `file'-command loaded $FILE with symbols. -+ -+ gdb_exit -+ gdb_start -+ # Clear it to never find any separate debug infos in $debug_root. -+ gdb_test "set debug-file-directory" -+ gdb_reinitialize_dir $srcdir/$subdir -+ gdb_load $file -+ -+ reach "dl_main" "run segv" -+ -+ gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt" -+ -+ if $ifmain { -+ reach "main" continue -+ -+ reach "libfunc" continue -+ -+ # Check there is no "argc=can't compute CFA for this frame". -+ gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "main bt" -+ -+ test_core $file -+ -+ test_attach $file -+ } -+ -+ if !$trynosym { -+ return -+ } -+ -+ global pf_prefix -+ set old_ldprefix $pf_prefix -+ lappend pf_prefix "symbol-less:" -+ -+ # Test also `exec-file'-command loaded $FILE - therefore without symbols. -+ # SYMBOL_OBJFILE is not available and only EXEC_BFD must be used. -+ -+ gdb_exit -+ gdb_start -+ # Clear it to never find any separate debug infos in $debug_root. -+ gdb_test "set debug-file-directory" -+ gdb_reinitialize_dir $srcdir/$subdir -+ -+ # 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 -+ -+ 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) -+ pass $test -+ } -+ } -+ if {$entrynohex != ""} { -+ gdb_test "break *0x$entrynohex" "" "break at entry point" -+ gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached" -+ } -+ } 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 pf_prefix $old_ldprefix -+} -+ -+# Create separate binaries for each testcase - to make the possible reported -+# problem reproducible after the whole test run finishes. -+ -+set old_ldprefix $pf_prefix -+foreach ldprelink {NO YES} { -+ foreach ldsepdebug {NO IN SEP} { -+ # Skip running the ldsepdebug test if we do not have system separate -+ # debug info available. -+ if {$interp_system_debug == "" && $ldsepdebug == "SEP"} { -+ continue -+ } -+ -+ set ldname "LDprelink${ldprelink}debug${ldsepdebug}" -+ set interp $binprefix-$ldname -+ -+ # prelink needs to always prelink all the dependencies to do any file -+ # modifications of its files. ld.so also needs all the dependencies to -+ # be prelinked to omit the relocation process. In-memory file offsets -+ # are not dependent whether ld.so went the prelink way or through the -+ # relocation process. -+ # -+ # For GDB we are not interested whether prelink succeeds as it is -+ # transparent to GDB. GDB is being tested for differences of file -+ # offsets vs. in-memory offsets. So we have to prelink even ld.so for -+ # the BIN modification to happen but we need to restore the original -+ # possibly unprelinked ld.so to test all the combinations for GDB. -+ set interp_saved ${interp}-saved -+ -+ set pf_prefix $old_ldprefix -+ lappend pf_prefix "$ldname:" -+ -+ if {$ldsepdebug == "NO"} { -+ copy $interp_system $interp -+ # Never call strip-debug before unprelink: -+ # prelink: ...: Section .note.gnu.build-id created after prelinking -+ if ![prelinkNO $interp] { -+ continue -+ } -+ strip_debug $interp -+ } elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} { -+ copy $interp_system $interp -+ } elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} { -+ copy $interp_system $interp -+ copy $interp_system_debug "${interp}.debug" -+ # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u -+ if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} { -+ continue -+ } -+ set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]" -+ set command "exec eu-unstrip -o $interp $interp ${interp}.debug" -+ verbose -log "command is $command" -+ if [catch $command] { -+ setup_xfail *-*-* -+ fail $test -+ continue -+ } else { -+ pass $test -+ } -+ } elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} { -+ copy $interp_system $interp -+ # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u -+ if ![prelinkNO $interp] { -+ continue -+ } -+ gdb_gnu_strip_debug $interp -+ } elseif {$ldsepdebug == "SEP" && $interp_system_debug != ""} { -+ copy $interp_system $interp -+ copy $interp_system_debug "${interp}.debug" -+ } -+ -+ if {$ldsepdebug == "SEP"} { -+ if ![prelinkNO "${interp}.debug"] { -+ continue -+ } -+ } else { -+ file delete "${interp}.debug" -+ } -+ -+ if ![prelink$ldprelink $interp] { -+ continue -+ } -+ test_ld $interp 0 [expr {$ldsepdebug == "NO"}] -+ -+ if ![copy $interp $interp_saved] { -+ continue -+ } -+ set old_binprefix $pf_prefix -+ foreach binprelink {NO YES} { -+ foreach binsepdebug {NO IN SEP} { -+ foreach binpie {NO YES} { -+ # This combination is not possible, non-PIE (fixed address) -+ # binary cannot be prelinked to any (other) address. -+ if {$binprelink == "YES" && $binpie == "NO"} { -+ continue -+ } -+ -+ set binname "BINprelink${binprelink}debug${binsepdebug}pie${binpie}" -+ set exec $binprefix-$binname -+ set dir ${exec}.d -+ -+ set pf_prefix $old_binprefix -+ lappend pf_prefix "$binname:" -+ -+ set opts "additional_flags=-Wl,--dynamic-linker,$interp,-rpath,$dir" -+ lappend opts "additional_flags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]" -+ if {$binsepdebug != "NO"} { -+ lappend opts {debug} -+ } -+ if {$binpie == "YES"} { -+ lappend opts {additional_flags=-fPIE -pie} -+ } -+ if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} { -+ continue; -+ } -+ if {$binsepdebug == "SEP"} { -+ gdb_gnu_strip_debug $exec -+ # Just a sanity check. As gdb_gnu_strip_debug uses the -+ # "[file dirname $exec]/.debug/[file tail $exec].debug" -+ # variant delete the higher-priority exec.debug file. -+ file delete "$exec.debug" -+ } -+ -+ # Supply a self-sufficent directory $dir with the required -+ # libraries. To make an executable properly prelinked all -+ # its dependencies on libraries must be also prelinked. If -+ # some of the system libraries is currently not prelinked -+ # we have no right to prelink (modify it) at its current -+ # system place. -+ -+ file delete -force $dir -+ file mkdir $dir -+ -+ set command "ldd $exec" -+ set result [catch "exec $command" output] -+ verbose -log "result of $command is $result" -+ verbose -log "output of $command is $output" -+ if {$result != 0 || $output == ""} { -+ fail $command -+ } else { -+ pass $command -+ } -+ -+ # gdb testsuite will put there also needless -lm. -+ set test "$command output contains libc" -+ set libc [regexp -all -inline -line {^.* => (/[^ ]+).*$} $output] -+ if {[llength $libc] == 0} { -+ fail $test -+ } else { -+ pass $test -+ } -+ -+ set dests {} -+ for {set i 1} {$i < [llength $libc]} {incr i 2} { -+ set abspath [lindex $libc $i] -+ set dest "$dir/[file tail $abspath]" -+ copy $abspath $dest -+ lappend dests $dest -+ } -+ -+ if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" $exec] -+ && [copy $interp_saved $interp]} { -+ test_ld $exec 1 [expr {$binsepdebug == "NO"}] -+ } -+ } -+ } -+ } -+ -+ file delete $interp_saved -+ } -+} -+set pf_prefix $old_ldprefix -diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp -index a1003e1..547a898 100644 ---- a/gdb/testsuite/gdb.base/corefile.exp -+++ b/gdb/testsuite/gdb.base/corefile.exp -@@ -42,65 +42,12 @@ if [get_compiler_info ${binfile}] { - return -1; - } - --# Create a core file named "corefile" rather than just "core", to --# avoid problems with sys admin types that like to regularly prune all --# files named "core" from the system. --# --# Arbitrarily try setting the core size limit to "unlimited" since --# this does not hurt on systems where the command does not work and --# allows us to generate a core on systems where it does. --# --# Some systems append "core" to the name of the program; others append --# the name of the program to "core"; still others (like Linux, as of --# May 2003) create cores named "core.PID". In the latter case, we --# could have many core files lying around, and it may be difficult to --# tell which one is ours, so let's run the program in a subdirectory. --set found 0 --set coredir "${objdir}/${subdir}/coredir.[getpid]" --file mkdir $coredir --catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\"" --# remote_exec host "${binfile}" --foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { -- if [remote_file build exists $i] { -- remote_exec build "mv $i ${objdir}/${subdir}/corefile" -- set found 1 -- } --} --# Check for "core.PID". --if { $found == 0 } { -- set names [glob -nocomplain -directory $coredir core.*] -- if {[llength $names] == 1} { -- set corefile [file join $coredir [lindex $names 0]] -- remote_exec build "mv $corefile ${objdir}/${subdir}/corefile" -- set found 1 -- } --} --if { $found == 0 } { -- # The braindamaged HPUX shell quits after the ulimit -c above -- # without executing ${binfile}. So we try again without the -- # ulimit here if we didn't find a core file above. -- # Oh, I should mention that any "braindamaged" non-Unix system has -- # the same problem. I like the cd bit too, it's really neat'n stuff. -- catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\"" -- foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" { -- if [remote_file build exists $i] { -- remote_exec build "mv $i ${objdir}/${subdir}/corefile" -- set found 1 -- } -- } -+set corefile [core_find $binfile {coremmap.data}] -+if {$corefile == ""} { -+ return 0; - } - --# Try to clean up after ourselves. --remote_file build delete [file join $coredir coremmap.data] --remote_exec build "rmdir $coredir" -- --if { $found == 0 } { -- warning "can't generate a core file - core tests suppressed - check ulimit -c" -- return 0 --} -- --# --# Test that we can simply startup with a "-core=corefile" command line arg -+# Test that we can simply startup with a "-core=$corefile" command line arg - # and recognize that the core file is a valid, usable core file. - # To do this, we must shutdown the currently running gdb and restart - # with the -core args. We can't use gdb_start because it looks for -@@ -114,27 +61,27 @@ if { $found == 0 } { - - gdb_exit - if $verbose>1 then { -- send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile\n" -+ send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$corefile\n" - } - - set oldtimeout $timeout - set timeout [expr "$timeout + 60"] - verbose "Timeout is now $timeout seconds" 2 --eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile" -+eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$corefile" - expect { - -re "Couldn't find .* registers in core file.*$gdb_prompt $" { -- fail "args: -core=corefile (couldn't find regs)" -+ fail "args: -core=[file tail $corefile] (couldn't find regs)" - } - -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -- pass "args: -core=corefile" -+ pass "args: -core=[file tail $corefile]" - } - -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -- pass "args: -core=corefile (with bad program name)" -+ pass "args: -core=[file tail $corefile] (with bad program name)" - } - -re ".*registers from core file: File in wrong format.* $" { -- fail "args: -core=corefile (could not read registers from core file)" -+ fail "args: -core=[file tail $corefile] (could not read registers from core file)" - } -- -re ".*$gdb_prompt $" { fail "args: -core=corefile" } -+ -re ".*$gdb_prompt $" { fail "args: -core=[file tail $corefile]" } - timeout { fail "(timeout) starting with -core" } - } - -@@ -147,22 +94,22 @@ expect { - close; - - if $verbose>1 then { -- send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n" -+ send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile\n" - } - - --eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile"; -+eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile"; - expect { - -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -- pass "args: execfile -core=corefile" -+ pass "args: execfile -core=[file tail $corefile]" - } - -re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" { -- pass "args: execfile -core=corefile (with bad program name)" -+ pass "args: execfile -core=[file tail $corefile] (with bad program name)" - } - -re ".*registers from core file: File in wrong format.* $" { -- fail "args: execfile -core=corefile (could not read registers from core file)" -+ fail "args: execfile -core=[file tail $corefile] (could not read registers from core file)" - } -- -re ".*$gdb_prompt $" { fail "args: execfile -core=corefile" } -+ -re ".*$gdb_prompt $" { fail "args: execfile -core=[file tail $corefile]" } - timeout { fail "(timeout) starting with -core" } - } - set timeout $oldtimeout -@@ -178,7 +125,7 @@ gdb_load ${binfile} - - # Test basic corefile recognition via core-file command. - --send_gdb "core-file $objdir/$subdir/corefile\n" -+send_gdb "core-file $corefile\n" - gdb_expect { - -re ".* program is being debugged already.*y or n. $" { - # gdb_load may connect us to a gdbserver. -diff --git a/gdb/testsuite/gdb.base/pie-support.c b/gdb/testsuite/gdb.base/pie-support.c -deleted file mode 100644 -index 63768b9..0000000 ---- a/gdb/testsuite/gdb.base/pie-support.c -+++ /dev/null -@@ -1,34 +0,0 @@ --/* 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 -- --void --f1 (int a) --{ -- printf ("a = %d\n", a); --} -- --int --main (int argc, char *argv[]) --{ -- f1 (1); -- -- return 0; --} -diff --git a/gdb/testsuite/gdb.base/pie-support.exp b/gdb/testsuite/gdb.base/pie-support.exp -deleted file mode 100644 -index 7d118c0..0000000 ---- a/gdb/testsuite/gdb.base/pie-support.exp -+++ /dev/null -@@ -1,58 +0,0 @@ --# 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 pie-support --set srcfile ${testfile}.c --set objfile ${objdir}/${subdir}/${testfile}.o --set binfile ${objdir}/${subdir}/${testfile} -- --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {quiet debug additional_flags=-fpie}] != "" } { -- untested "Couldn't compile test PIE object file." -- return -1 --} --if { [gdb_compile "${objfile}" "${binfile}" executable {quiet debug additional_flags=-pie}] != "" } { -- untested "Couldn't compile test PIE binary." -- return -1 --} -- --# Get things started. -- --gdb_exit --gdb_start --gdb_reinitialize_dir $srcdir/$subdir -- --if [is_remote host] { -- set binfile [remote_download host $binfile] -- if { $binfile == "" } { -- untested "Couldn't download remote test binary." -- return -1 -- } --} -- --# The file command used to kill the remote target. For the benefit --# of the testsuite, preserve this behavior. --send_gdb "kill\n" --gdb_expect 120 { -- -re "Kill the program being debugged. .y or n. $" { -- send_gdb "y\n" -- verbose "\t\tKilling previous program being debugged" -- exp_continue -- } -- -re "$gdb_prompt $" { -- # OK. -- } --} -- --gdb_test "file $binfile" "current binary is a PIE.*" "correctly detected PIE binary" -diff --git a/gdb/testsuite/gdb.base/valgrind-db-attach.c b/gdb/testsuite/gdb.base/valgrind-db-attach.c -new file mode 100644 -index 0000000..5faaaac ---- /dev/null -+++ b/gdb/testsuite/gdb.base/valgrind-db-attach.c -@@ -0,0 +1,30 @@ -+/* 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 -+ -+int main() -+{ -+ void *p; -+ -+ p = malloc (1); -+ if (p == NULL) -+ return 1; -+ free (p); -+ free (p); /* double-free */ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/valgrind-db-attach.exp b/gdb/testsuite/gdb.base/valgrind-db-attach.exp -new file mode 100644 -index 0000000..ac06fd3 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/valgrind-db-attach.exp -@@ -0,0 +1,74 @@ -+# 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 test valgrind-db-attach -+set srcfile $test.c -+set executable $test -+set binfile ${objdir}/${subdir}/${executable} -+if {[build_executable $test.exp $executable $srcfile {debug}] == -1} { -+ return -1 -+} -+ -+gdb_exit -+ -+# remote_spawn breaks the command on each whitespace despite possible quoting. -+# Use backslash-escaped whitespace there instead: -+ -+set db_command "--db-command=$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts] %f %p" -+regsub -all " " $db_command "\\ " db_command -+ -+set test "spawn valgrind" -+set cmd "valgrind --db-attach=yes $db_command $binfile" -+set res [remote_spawn host $cmd]; -+if { $res < 0 || $res == "" } { -+ verbose -log "Spawning $cmd failed." -+ setup_xfail *-*-* -+ fail $test -+ return -1 -+} -+pass $test -+# Declare GDB now as running. -+set gdb_spawn_id -1 -+ -+set test "valgrind started" -+# The trailing '.' differs for different memcheck versions. -+gdb_test_multiple "" $test { -+ -re "Memcheck, a memory error detector\\.?\r\n" { -+ pass $test -+ } -+ -re "valgrind: failed to start tool 'memcheck' for platform '.*': No such file or directory" { -+ setup_xfail *-*-* -+ fail $test -+ return -1 -+ } -+} -+ -+set double_free [gdb_get_line_number "double-free"] -+ -+gdb_test_multiple "" $test { -+ -re "Invalid free\\(\\) / delete / delete\\\[\\\]\r\n.*: main \\(${srcfile}:$double_free\\)\r\n.*---- Attach to debugger \\? --- \[^\r\n\]* ---- " { -+ send_gdb "y\r" -+ } -+ -re "---- Attach to debugger \\? --- \[^\r\n\]* ---- " { -+ send_gdb "n\r" -+ exp_continue -+ } -+} -+ -+# Initialization from default_gdb_start. -+gdb_test "set height 0" -+gdb_test "set width 0" -+ -+gdb_test "bt" "in main \\(.*\\) at .*${srcfile}:$double_free" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp -index 61e1fe4..9109030 100644 ---- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp -+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp -@@ -55,6 +55,12 @@ gdb_start - gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile} - -+# Test also objfile->psymtabs_addrmap relocations for -fPIE -pie builds below. -+# On some targets it may possibly fail but the program is being started only -+# for the PIE build so try it anyway. -+ -+runto_main -+ - # Correct output: - # Line 39 of "../.././gdb/testsuite/gdb.dwarf2/dw2-ranges.S" starts at address 0x4 and ends at 0x8. - # Wrong output: -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index d0c3493..fbf9124 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -2778,6 +2778,11 @@ proc gdb_gnu_strip_debug { dest args } { - return 1 - } - -+ # Workaround PR binutils/10802: -+ # Preserve the 'x' bit also for PIEs (Position Independent Executables). -+ set perm [file attributes ${dest} -permissions] -+ file attributes ${stripped_file} -permissions $perm -+ - # Get rid of everything but the debug info, and store result in debug_file - # This will be in the .debug subdirectory, see above. - set result [catch "exec $strip_to_file_program --only-keep-debug ${dest} -o ${debug_file}" output] -@@ -2814,7 +2819,12 @@ proc gdb_gnu_strip_debug { dest args } { - return 1 - } - -- return 0 -+ # Workaround PR binutils/10802: -+ # Preserve the 'x' bit also for PIEs (Position Independent Executables). -+ set perm [file attributes ${stripped_file} -permissions] -+ file attributes ${dest} -permissions $perm -+ -+ return 0 - } - - # Test the output of GDB_COMMAND matches the pattern obtained -@@ -3043,3 +3053,70 @@ if {[info exists TRANSCRIPT]} { - return [uplevel real_send_gdb $args] - } - } -+ -+proc core_find {binfile {deletefiles {}} {arg ""}} { -+ global objdir subdir -+ -+ set destcore "$binfile.core" -+ file delete $destcore -+ -+ # Create a core file named "$destcore" rather than just "core", to -+ # avoid problems with sys admin types that like to regularly prune all -+ # files named "core" from the system. -+ # -+ # Arbitrarily try setting the core size limit to "unlimited" since -+ # this does not hurt on systems where the command does not work and -+ # allows us to generate a core on systems where it does. -+ # -+ # Some systems append "core" to the name of the program; others append -+ # the name of the program to "core"; still others (like Linux, as of -+ # May 2003) create cores named "core.PID". In the latter case, we -+ # could have many core files lying around, and it may be difficult to -+ # tell which one is ours, so let's run the program in a subdirectory. -+ set found 0 -+ set coredir "${objdir}/${subdir}/coredir.[getpid]" -+ file mkdir $coredir -+ catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile} ${arg}; true) >/dev/null 2>&1\"" -+ # remote_exec host "${binfile}" -+ foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i $destcore" -+ set found 1 -+ } -+ } -+ # Check for "core.PID". -+ if { $found == 0 } { -+ set names [glob -nocomplain -directory $coredir core.*] -+ if {[llength $names] == 1} { -+ set corefile [file join $coredir [lindex $names 0]] -+ remote_exec build "mv $corefile $destcore" -+ set found 1 -+ } -+ } -+ if { $found == 0 } { -+ # The braindamaged HPUX shell quits after the ulimit -c above -+ # without executing ${binfile}. So we try again without the -+ # ulimit here if we didn't find a core file above. -+ # Oh, I should mention that any "braindamaged" non-Unix system has -+ # the same problem. I like the cd bit too, it's really neat'n stuff. -+ catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\"" -+ foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" { -+ if [remote_file build exists $i] { -+ remote_exec build "mv $i $destcore" -+ set found 1 -+ } -+ } -+ } -+ -+ # Try to clean up after ourselves. -+ foreach deletefile $deletefiles { -+ remote_file build delete [file join $coredir $deletefile] -+ } -+ remote_exec build "rmdir $coredir" -+ -+ if { $found == 0 } { -+ warning "can't generate a core file - core tests suppressed - check ulimit -c" -+ return "" -+ } -+ return $destcore -+} diff --git a/gdb-archer.patch b/gdb-archer.patch index c25844b..67e6510 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,38 +2,36 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit 6e73988f653ba986e8742f208f17ec084292cbd5 +commit 81810a20b2d2c3bf18e151de3cddfc96445b3c46 branch `archer' - the merge of branches: -archer-tromey-call-frame-cfa archer-tromey-delayed-symfile -archer-tromey-dw-op-value -archer-jankratochvil-vla -archer-jankratochvil-misc -archer-keiths-expr-cumulative archer-tromey-python +archer-pmuldoon-next-over-throw archer-jankratochvil-fortran-module archer-jankratochvil-watchpoint -archer-jankratochvil-bp_location-accel -archer-pmuldoon-next-over-throw +archer-jankratochvil-vla +TODO:archer-keiths-expr-cumulative diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index 7d53205..319fac4 100644 +index ff8b86e..f450a7b 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -169,6 +169,10 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ - # Did the user give us a --with-gdb-datadir option? - GDB_DATADIR = @GDB_DATADIR@ +@@ -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. - LIBGNU = gnulib/libgnu.a - INCGNU = -I$(srcdir)/gnulib -Ignulib -@@ -267,21 +271,37 @@ SUBDIR_TUI_CFLAGS= \ +@@ -267,23 +273,39 @@ SUBDIR_TUI_CFLAGS= \ # SUBDIR_PYTHON_OBS = \ python.o \ @@ -45,6 +43,7 @@ index 7d53205..319fac4 100644 + py-hooks.o \ + py-inferior.o \ + py-infthread.o \ + py-lazy-string.o \ py-objfile.o \ + py-param.o \ py-prettyprint.o \ @@ -63,6 +62,7 @@ index 7d53205..319fac4 100644 + 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 \ @@ -71,25 +71,17 @@ index 7d53205..319fac4 100644 python/py-type.c \ python/py-utils.c \ python/py-value.c -@@ -750,7 +770,7 @@ config/rs6000/nm-rs6000.h top.h bsd-kvm.h gdb-stabs.h reggroups.h \ +@@ -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 -+gdb_usleep.h jit.h xml-syscall.h ada-operator.inc python/python.h python/python-internal.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. -@@ -874,7 +894,7 @@ generated_files = config.h observer.h observer.inc ada-lex.c \ - $(COMPILE) $< - $(POSTCOMPILE) - --all: gdb$(EXEEXT) $(CONFIG_ALL) xml-syscall-copy -+all: gdb$(EXEEXT) $(CONFIG_ALL) xml-syscall-copy .gdbinit - @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do - .PHONY: all-tui - all-tui: $(TUI)$(EXEEXT) -@@ -1264,6 +1284,12 @@ stamp-h: $(srcdir)/config.in config.status +@@ -1270,6 +1293,12 @@ stamp-h: $(srcdir)/config.in config.status CONFIG_LINKS= \ $(SHELL) config.status @@ -102,7 +94,7 @@ index 7d53205..319fac4 100644 config.status: $(srcdir)/configure configure.tgt configure.host $(SHELL) config.status --recheck -@@ -1963,6 +1989,14 @@ python.o: $(srcdir)/python/python.c +@@ -1970,6 +1999,14 @@ python.o: $(srcdir)/python/python.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python.c $(POSTCOMPILE) @@ -117,7 +109,7 @@ index 7d53205..319fac4 100644 py-cmd.o: $(srcdir)/python/py-cmd.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-cmd.c $(POSTCOMPILE) -@@ -1975,14 +2009,38 @@ py-function.o: $(srcdir)/python/py-function.c +@@ -1982,6 +2019,18 @@ py-function.o: $(srcdir)/python/py-function.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c $(POSTCOMPILE) @@ -133,7 +125,10 @@ index 7d53205..319fac4 100644 + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-infthread.c + $(POSTCOMPILE) + - py-objfile.o: $(srcdir)/python/py-objfile.c + 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) @@ -156,7 +151,7 @@ index 7d53205..319fac4 100644 py-type.o: $(srcdir)/python/py-type.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-type.c $(POSTCOMPILE) -@@ -1995,6 +2053,36 @@ py-value.o: $(srcdir)/python/py-value.c +@@ -2006,6 +2067,36 @@ py-value.o: $(srcdir)/python/py-value.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-value.c $(POSTCOMPILE) @@ -194,10 +189,10 @@ index 7d53205..319fac4 100644 # 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/NEWS b/gdb/NEWS -index 8d32c34..f7ea21b 100644 +index 17d64fb..e0eb160 100644 --- a/gdb/NEWS +++ b/gdb/NEWS -@@ -476,6 +476,13 @@ x86/x86_64 Darwin i[34567]86-*-darwin* +@@ -669,6 +669,13 @@ x86/x86_64 Darwin i[34567]86-*-darwin* x86_64 MinGW x86_64-*-mingw* @@ -212,10 +207,10 @@ index 8d32c34..f7ea21b 100644 Lattice Mico32 lm32-* diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c -index 9b5d2c6..61676a9 100644 +index 24def95..4682045 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c -@@ -1621,7 +1621,7 @@ ada_type_of_array (struct value *arr, int bounds) +@@ -1644,7 +1644,7 @@ ada_type_of_array (struct value *arr, int bounds) return NULL; while (arity > 0) { @@ -224,23 +219,7 @@ index 9b5d2c6..61676a9 100644 struct type *array_type = alloc_type_copy (value_type (arr)); struct value *low = desc_one_bound (descriptor, arity, 0); struct value *high = desc_one_bound (descriptor, arity, 1); -@@ -4727,14 +4727,10 @@ ada_lookup_symbol (const char *name, const struct block *block0, - - 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); - } - - -@@ -10839,6 +10835,40 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp) +@@ -10937,6 +10937,40 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp) } } @@ -281,7 +260,7 @@ index 9b5d2c6..61676a9 100644 static char * ada_op_name (enum exp_opcode opcode) { -@@ -11227,6 +11257,7 @@ parse (void) +@@ -11325,6 +11359,7 @@ parse (void) static const struct exp_descriptor ada_exp_descriptor = { ada_print_subexp, ada_operator_length, @@ -290,74 +269,13 @@ index 9b5d2c6..61676a9 100644 ada_dump_subexp_body, ada_evaluate_subexp diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c -index 7d8461c..fc4b3e0 100644 +index 5c9e558..55a1873 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c -@@ -270,6 +270,8 @@ amd64_linux_dr_get (ptid_t ptid, int regnum) - return value; +@@ -350,6 +350,20 @@ amd64_linux_dr_unset_status (unsigned long mask) + } } -+/* Set debug register REGNUM to VALUE in only the one LWP of PTID. */ -+ - static void - amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) - { -@@ -286,6 +288,8 @@ amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) - perror_with_name (_("Couldn't write debug register")); - } - -+/* Set DR_CONTROL to ADDR in all LWPs of LWP_LIST. */ -+ - static void - amd64_linux_dr_set_control (unsigned long control) - { -@@ -297,6 +301,8 @@ amd64_linux_dr_set_control (unsigned long control) - amd64_linux_dr_set (ptid, DR_CONTROL, control); - } - -+/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */ -+ - static void - amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr) - { -@@ -310,18 +316,55 @@ amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr) - amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); - } - -+/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */ -+ - static void - amd64_linux_dr_reset_addr (int regnum) - { - amd64_linux_dr_set_addr (regnum, 0); - } - -+/* Get DR_STATUS from only the one LWP of INFERIOR_PTID. */ -+ - static unsigned long - amd64_linux_dr_get_status (void) - { - return amd64_linux_dr_get (inferior_ptid, DR_STATUS); - } - -+/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST. */ -+ -+static void -+amd64_linux_dr_unset_status (unsigned long mask) -+{ -+ struct lwp_info *lp; -+ ptid_t ptid; -+ -+ ALL_LWPS (lp, ptid) -+ { -+ unsigned long value; -+ -+ value = amd64_linux_dr_get (ptid, DR_STATUS); -+ value &= ~mask; -+ amd64_linux_dr_set (ptid, DR_STATUS, value); -+ } -+} -+ +/* See i386_dr_low_type.detach. Do not use wrappers amd64_linux_dr_set_control + or amd64_linux_dr_reset_addr as they would modify the register cache + (amd64_linux_dr). */ @@ -372,36 +290,22 @@ index 7d8461c..fc4b3e0 100644 + for (regnum = DR_FIRSTADDR; regnum <= DR_LASTADDR; regnum++) + amd64_linux_dr_set (inferior_ptid, regnum, 0); +} -+ + static void amd64_linux_new_thread (ptid_t ptid) - { -@@ -672,6 +715,8 @@ _initialize_amd64_linux_nat (void) - i386_dr_low.set_addr = amd64_linux_dr_set_addr; +@@ -702,6 +716,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; + i386_dr_low.unset_status = amd64_linux_dr_unset_status; + i386_dr_low.detach = amd64_linux_dr_detach; i386_set_debug_register_length (8); /* Override the GNU/Linux inferior startup hook. */ diff --git a/gdb/block.c b/gdb/block.c -index 97ea67a..b20beeb 100644 +index 48ac21b..80003b8 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) +@@ -318,6 +318,25 @@ allocate_block (struct obstack *obstack) BLOCK_SUPERBLOCK (bl) = NULL; BLOCK_DICT (bl) = NULL; BLOCK_NAMESPACE (bl) = NULL; @@ -428,7 +332,7 @@ index 97ea67a..b20beeb 100644 + return SYMBOL_SYMTAB (func)->objfile; +} diff --git a/gdb/block.h b/gdb/block.h -index 53e7371..d373f8a 100644 +index 7eedb6c..b147826 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -96,6 +96,15 @@ struct block @@ -463,7 +367,7 @@ index 53e7371..d373f8a 100644 + #endif /* BLOCK_H */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 811cdfb..0f35101 100644 +index 0dc8474..1a309b5 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -61,6 +61,7 @@ @@ -474,72 +378,7 @@ index 811cdfb..0f35101 100644 /* readline include files */ #include "readline/readline.h" -@@ -112,8 +113,6 @@ struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch, - struct symtab_and_line, - enum bptype); - --static void check_duplicates (struct breakpoint *); -- - static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int); - - static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch, -@@ -337,14 +336,14 @@ static int executing_startup; - B ? (TMP=B->next, 1): 0; \ - B = TMP) - --/* Similar iterators for the low-level breakpoints. */ -- --#define ALL_BP_LOCATIONS(B) for (B = bp_location_chain; B; B = B->global_next) -+/* Similar iterator for the low-level breakpoints. SAFE variant is not -+ provided so update_global_location_list must not be called while executing -+ the block of ALL_BP_LOCATIONS. */ - --#define ALL_BP_LOCATIONS_SAFE(B,TMP) \ -- for (B = bp_location_chain; \ -- B ? (TMP=B->global_next, 1): 0; \ -- B = TMP) -+#define ALL_BP_LOCATIONS(B,BP_TMP) \ -+ for (BP_TMP = bp_location; \ -+ BP_TMP < bp_location + bp_location_count && (B = *BP_TMP); \ -+ BP_TMP++) - - /* Iterator for tracepoints only. */ - -@@ -356,10 +355,31 @@ static int executing_startup; - - struct breakpoint *breakpoint_chain; - --struct bp_location *bp_location_chain; -+/* Array is sorted by bp_location_compare - primarily by the ADDRESS. */ -+ -+static struct bp_location **bp_location; -+ -+/* Number of elements of BP_LOCATION. */ -+ -+static unsigned bp_location_count; -+ -+/* Maximum alignment offset between bp_target_info.PLACED_ADDRESS and ADDRESS -+ for the current elements of BP_LOCATION which get a valid result from -+ bp_location_has_shadow. You can use it for roughly limiting the subrange of -+ BP_LOCATION to scan for shadow bytes for an address you need to read. */ -+ -+static CORE_ADDR bp_location_placed_address_before_address_max; -+ -+/* Maximum offset plus alignment between -+ bp_target_info.PLACED_ADDRESS + bp_target_info.SHADOW_LEN and ADDRESS for -+ the current elements of BP_LOCATION which get a valid result from -+ bp_location_has_shadow. You can use it for roughly limiting the subrange of -+ BP_LOCATION to scan for shadow bytes for an address you need to read. */ -+ -+static CORE_ADDR bp_location_shadow_len_after_address_max; - - /* The locations that no longer correspond to any breakpoint, -- unlinked from bp_location_chain, but for which a hit -+ unlinked from bp_location array, but for which a hit - may still be reported by a target. */ - VEC(bp_location_p) *moribund_locations = NULL; - -@@ -582,6 +602,53 @@ get_breakpoint (int num) +@@ -616,6 +617,53 @@ get_breakpoint (int num) } @@ -593,7 +432,7 @@ index 811cdfb..0f35101 100644 /* condition N EXP -- set break condition of breakpoint N to EXP. */ static void -@@ -602,42 +669,7 @@ condition_command (char *arg, int from_tty) +@@ -636,42 +684,7 @@ condition_command (char *arg, int from_tty) ALL_BREAKPOINTS (b) if (b->number == bnum) { @@ -637,181 +476,8 @@ index 811cdfb..0f35101 100644 return; } -@@ -735,35 +767,88 @@ commands_from_control_command (char *arg, struct command_line *cmd) - } - error (_("No breakpoint number %d."), bnum); - } -- -+ -+/* Return non-zero if BL->TARGET_INFO contains valid information. */ -+ -+static int -+bp_location_has_shadow (struct bp_location *bl) -+{ -+ if (bl->loc_type != bp_loc_software_breakpoint) -+ return 0; -+ if (!bl->inserted) -+ return 0; -+ if (bl->target_info.shadow_len == 0) -+ /* bp isn't valid, or doesn't shadow memory. */ -+ return 0; -+ return 1; -+} -+ - /* Update BUF, which is LEN bytes read from the target address MEMADDR, -- by replacing any memory breakpoints with their shadowed contents. */ -+ by replacing any memory breakpoints with their shadowed contents. -+ -+ The range of shadowed area by each bp_location is: -+ b->address - bp_location_placed_address_before_address_max -+ up to b->address + bp_location_shadow_len_after_address_max -+ The range we were requested to resolve shadows for is: -+ memaddr ... memaddr + le -+ Thus the safe cutoff boundaries for performance optimization are -+ memaddr + len <= b->address - bp_location_placed_address_before_address_max -+ and: -+ b->address + bp_location_shadow_len_after_address_max <= memaddr */ - - void - breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr, LONGEST len) - { -- struct bp_location *b; -- CORE_ADDR bp_addr = 0; -- int bp_size = 0; -- int bptoffset = 0; -+ /* Left boundary, right boundary and media element of our binary search. */ -+ unsigned bc_l, bc_r, bc; -+ -+ /* Find BC_L which is a leftmost element which may affect BUF content. It is -+ safe to report lower value but a failure to report higher one. */ - -- ALL_BP_LOCATIONS (b) -+ bc_l = 0; -+ bc_r = bp_location_count; -+ while (bc_l + 1 < bc_r) -+ { -+ struct bp_location *b; -+ -+ bc = (bc_l + bc_r) / 2; -+ b = bp_location[bc]; -+ -+ if (b->address + bp_location_shadow_len_after_address_max >= b->address -+ && b->address + bp_location_shadow_len_after_address_max <= memaddr) -+ bc_l = bc; -+ else -+ bc_r = bc; -+ } -+ -+ /* Now do full processing of the found relevant range of elements. */ -+ -+ for (bc = bc_l; bc < bp_location_count; bc++) - { -+ struct bp_location *b = bp_location[bc]; -+ CORE_ADDR bp_addr = 0; -+ int bp_size = 0; -+ int bptoffset = 0; -+ - if (b->owner->type == bp_none) - warning (_("reading through apparently deleted breakpoint #%d?"), - b->owner->number); - -- if (b->loc_type != bp_loc_software_breakpoint) -- continue; -- if (!b->inserted) -+ /* Performance optimization: any futher element can no longer affect BUF -+ content. */ -+ -+ if (b->address >= bp_location_placed_address_before_address_max -+ && memaddr + len <= b->address -+ - bp_location_placed_address_before_address_max) -+ break; -+ -+ if (!bp_location_has_shadow (b)) - continue; -+ - /* Addresses and length of the part of the breakpoint that - we need to copy. */ - bp_addr = b->target_info.placed_address; - bp_size = b->target_info.shadow_len; -- if (bp_size == 0) -- /* bp isn't valid, or doesn't shadow memory. */ -- continue; - - if (bp_addr + bp_size <= memaddr) - /* The breakpoint is entirely before the chunk of memory we -@@ -912,7 +997,7 @@ update_watchpoint (struct breakpoint *b, int reparse) - struct bp_location *loc; - bpstat bs; - -- /* We don't free locations. They are stored in bp_location_chain and -+ /* We don't free locations. They are stored in bp_location array and - update_global_locations will eventually delete them and remove - breakpoints if needed. */ - b->loc = NULL; -@@ -1347,7 +1432,7 @@ static void - insert_breakpoint_locations (void) - { - struct breakpoint *bpt; -- struct bp_location *b, *temp; -+ struct bp_location *b, **bp_tmp; - int error = 0; - int val = 0; - int disabled_breaks = 0; -@@ -1360,7 +1445,7 @@ insert_breakpoint_locations (void) - there was an error. */ - fprintf_unfiltered (tmp_error_stream, "Warning:\n"); - -- ALL_BP_LOCATIONS_SAFE (b, temp) -+ ALL_BP_LOCATIONS (b, bp_tmp) - { - if (!should_be_inserted (b) || b->inserted) - continue; -@@ -1434,10 +1519,10 @@ You may have requested too many hardware breakpoints/watchpoints.\n"); - int - remove_breakpoints (void) - { -- struct bp_location *b; -+ struct bp_location *b, **bp_tmp; - int val = 0; - -- ALL_BP_LOCATIONS (b) -+ ALL_BP_LOCATIONS (b, bp_tmp) - { - if (b->inserted) - val |= remove_breakpoint (b, mark_uninserted); -@@ -1448,10 +1533,10 @@ remove_breakpoints (void) - int - remove_hw_watchpoints (void) - { -- struct bp_location *b; -+ struct bp_location *b, **bp_tmp; - int val = 0; - -- ALL_BP_LOCATIONS (b) -+ ALL_BP_LOCATIONS (b, bp_tmp) - { - if (b->inserted && b->loc_type == bp_loc_hardware_watchpoint) - val |= remove_breakpoint (b, mark_uninserted); -@@ -1462,7 +1547,7 @@ remove_hw_watchpoints (void) - int - reattach_breakpoints (int pid) - { -- struct bp_location *b; -+ struct bp_location *b, **bp_tmp; - int val; - struct cleanup *old_chain = save_inferior_ptid (); - struct ui_file *tmp_error_stream = mem_fileopen (); -@@ -1471,7 +1556,7 @@ reattach_breakpoints (int pid) - make_cleanup_ui_file_delete (tmp_error_stream); - - inferior_ptid = pid_to_ptid (pid); -- ALL_BP_LOCATIONS (b) -+ ALL_BP_LOCATIONS (b, bp_tmp) - { - if (b->inserted) - { -@@ -1569,12 +1654,42 @@ create_longjmp_master_breakpoint (char *func_name) - update_global_location_list (1); +@@ -1870,6 +1883,36 @@ create_longjmp_master_breakpoint (char *func_name) + do_cleanups (old_chain); } +/* Install a master breakpoint on the unwinder's debug hook. */ @@ -847,23 +513,7 @@ index 811cdfb..0f35101 100644 void update_breakpoints_after_exec (void) { - struct breakpoint *b; - struct breakpoint *temp; -- struct bp_location *bploc; -+ struct bp_location *bploc, **bplocp_tmp; - - /* We're about to delete breakpoints from GDB's lists. If the - INSERTED flag is true, GDB will try to lift the breakpoints by -@@ -1584,7 +1699,7 @@ update_breakpoints_after_exec (void) - breakpoints out as soon as it detects an exec. We don't do that - here instead, because there may be other attempts to delete - breakpoints after detecting an exec and before reaching here. */ -- ALL_BP_LOCATIONS (bploc) -+ ALL_BP_LOCATIONS (bploc, bplocp_tmp) - gdb_assert (!bploc->inserted); - - ALL_BREAKPOINTS_SAFE (b, temp) -@@ -1606,7 +1721,7 @@ update_breakpoints_after_exec (void) +@@ -1911,7 +1954,7 @@ 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 @@ -872,7 +522,7 @@ index 811cdfb..0f35101 100644 { delete_breakpoint (b); continue; -@@ -1621,7 +1736,8 @@ update_breakpoints_after_exec (void) +@@ -1926,7 +1969,8 @@ update_breakpoints_after_exec (void) /* Longjmp and longjmp-resume breakpoints are also meaningless after an exec. */ @@ -882,7 +532,7 @@ index 811cdfb..0f35101 100644 { delete_breakpoint (b); continue; -@@ -1682,12 +1798,13 @@ update_breakpoints_after_exec (void) +@@ -1987,6 +2031,7 @@ update_breakpoints_after_exec (void) create_longjmp_master_breakpoint ("_longjmp"); create_longjmp_master_breakpoint ("siglongjmp"); create_longjmp_master_breakpoint ("_siglongjmp"); @@ -890,28 +540,15 @@ index 811cdfb..0f35101 100644 } int - detach_breakpoints (int pid) - { -- struct bp_location *b; -+ struct bp_location *b, **bp_tmp; - int val = 0; - struct cleanup *old_chain = save_inferior_ptid (); - -@@ -1696,11 +1813,12 @@ detach_breakpoints (int pid) - - /* Set inferior_ptid; remove_breakpoint uses this global. */ - inferior_ptid = pid_to_ptid (pid); -- ALL_BP_LOCATIONS (b) -+ ALL_BP_LOCATIONS (b, bp_tmp) - { +@@ -2010,6 +2055,7 @@ detach_breakpoints (int pid) if (b->inserted) - val |= remove_breakpoint (b, mark_inserted); + val |= remove_breakpoint_1 (b, mark_inserted); } + val |= target_detach_watchpoints (); do_cleanups (old_chain); return val; } -@@ -1793,12 +1911,14 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) +@@ -2109,12 +2155,14 @@ remove_breakpoint_1 (struct bp_location *b, insertion_state_t is) return val; b->inserted = (is == mark_inserted); } @@ -928,98 +565,7 @@ index 811cdfb..0f35101 100644 val = target_remove_watchpoint (b->address, b->length, b->watchpoint_type); -@@ -1827,9 +1947,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) - void - mark_breakpoints_out (void) - { -- struct bp_location *bpt; -+ struct bp_location *bpt, **bptp_tmp; - -- ALL_BP_LOCATIONS (bpt) -+ ALL_BP_LOCATIONS (bpt, bptp_tmp) - bpt->inserted = 0; - } - -@@ -1849,7 +1969,7 @@ void - breakpoint_init_inferior (enum inf_context context) - { - struct breakpoint *b, *temp; -- struct bp_location *bpt; -+ struct bp_location *bpt, **bptp_tmp; - int ix; - - /* If breakpoint locations are shared across processes, then there's -@@ -1857,7 +1977,7 @@ breakpoint_init_inferior (enum inf_context context) - if (gdbarch_has_global_breakpoints (target_gdbarch)) - return; - -- ALL_BP_LOCATIONS (bpt) -+ ALL_BP_LOCATIONS (bpt, bptp_tmp) - if (bpt->owner->enable_state != bp_permanent) - bpt->inserted = 0; - -@@ -1918,10 +2038,10 @@ breakpoint_init_inferior (enum inf_context context) - enum breakpoint_here - breakpoint_here_p (CORE_ADDR pc) - { -- const struct bp_location *bpt; -+ struct bp_location *bpt, **bptp_tmp; - int any_breakpoint_here = 0; - -- ALL_BP_LOCATIONS (bpt) -+ ALL_BP_LOCATIONS (bpt, bptp_tmp) - { - if (bpt->loc_type != bp_loc_software_breakpoint - && bpt->loc_type != bp_loc_hardware_breakpoint) -@@ -1961,16 +2081,16 @@ moribund_breakpoint_here_p (CORE_ADDR pc) - } - - /* Returns non-zero if there's a breakpoint inserted at PC, which is -- inserted using regular breakpoint_chain/bp_location_chain mechanism. -+ inserted using regular breakpoint_chain / bp_location array mechanism. - This does not check for single-step breakpoints, which are - inserted and removed using direct target manipulation. */ - - int - regular_breakpoint_inserted_here_p (CORE_ADDR pc) - { -- const struct bp_location *bpt; -+ struct bp_location *bpt, **bptp_tmp; - -- ALL_BP_LOCATIONS (bpt) -+ ALL_BP_LOCATIONS (bpt, bptp_tmp) - { - if (bpt->loc_type != bp_loc_software_breakpoint - && bpt->loc_type != bp_loc_hardware_breakpoint) -@@ -2011,10 +2131,10 @@ breakpoint_inserted_here_p (CORE_ADDR pc) - int - software_breakpoint_inserted_here_p (CORE_ADDR pc) - { -- const struct bp_location *bpt; -+ struct bp_location *bpt, **bptp_tmp; - int any_breakpoint_here = 0; - -- ALL_BP_LOCATIONS (bpt) -+ ALL_BP_LOCATIONS (bpt, bptp_tmp) - { - if (bpt->loc_type != bp_loc_software_breakpoint) - continue; -@@ -2044,12 +2164,12 @@ software_breakpoint_inserted_here_p (CORE_ADDR pc) - int - breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid) - { -- const struct bp_location *bpt; -+ struct bp_location *bpt, **bptp_tmp; - /* The thread and task IDs associated to PTID, computed lazily. */ - int thread = -1; - int task = 0; - -- ALL_BP_LOCATIONS (bpt) -+ ALL_BP_LOCATIONS (bpt, bptp_tmp) - { - if (bpt->loc_type != bp_loc_software_breakpoint - && bpt->loc_type != bp_loc_hardware_breakpoint) -@@ -2503,6 +2623,12 @@ print_it_typical (bpstat bs) +@@ -2894,6 +2942,12 @@ print_it_typical (bpstat bs) result = PRINT_NOTHING; break; @@ -1032,7 +578,7 @@ index 811cdfb..0f35101 100644 case bp_watchpoint: case bp_hardware_watchpoint: annotate_watchpoint (b->number); -@@ -2590,6 +2716,8 @@ print_it_typical (bpstat bs) +@@ -2981,6 +3035,8 @@ print_it_typical (bpstat bs) case bp_none: case bp_longjmp: case bp_longjmp_resume: @@ -1041,7 +587,7 @@ index 811cdfb..0f35101 100644 case bp_step_resume: case bp_watchpoint_scope: case bp_call_dummy: -@@ -2973,8 +3101,12 @@ bpstat_check_location (const struct bp_location *bl, CORE_ADDR bp_addr) +@@ -3385,8 +3441,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 @@ -1056,7 +602,7 @@ index 811cdfb..0f35101 100644 bpstat_check_watchpoint (bpstat bs) { const struct bp_location *bl = bs->breakpoint_at; -@@ -3063,8 +3195,10 @@ bpstat_check_watchpoint (bpstat bs) +@@ -3475,8 +3535,10 @@ bpstat_check_watchpoint (bpstat bs) anything for this watchpoint. */ bs->print_it = print_it_noop; bs->stop = 0; @@ -1067,93 +613,51 @@ index 811cdfb..0f35101 100644 } -@@ -3157,17 +3291,19 @@ bpstat - bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) - { - struct breakpoint *b = NULL; -- const struct bp_location *bl; -+ struct bp_location *bl, **blp_tmp; - struct bp_location *loc; - /* Root of the chain of bpstat's */ - struct bpstats root_bs[1]; - /* Pointer to the last thing in the chain currently. */ - bpstat bs = root_bs; - int ix; -- int need_remove_insert; -+ int need_remove_insert, update_locations = 0; +@@ -3590,6 +3652,8 @@ bpstat_stop_status (struct address_space *aspace, -- ALL_BP_LOCATIONS (bl) -+ ALL_BP_LOCATIONS (bl, blp_tmp) - { -+ bpstat bs_prev = bs; + for (bl = b->loc; bl != NULL; bl = bl->next) + { ++ bpstat bs_prev = bs; + - b = bl->owner; - gdb_assert (b); - if (!breakpoint_enabled (b) && b->enable_state != bp_permanent) -@@ -3188,6 +3324,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) - /* Come here if it's a watchpoint, or if the break address matches */ + /* 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 +@@ -3607,6 +3671,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 */ -+ gdb_assert (bs_prev->next == bs); + bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */ ++ gdb_assert (bs_prev->next == bs); - /* Assume we stop. Should we find watchpoint that is not actually - triggered, or if condition of breakpoint is false, we'll reset -@@ -3195,12 +3332,21 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) - bs->stop = 1; - bs->print = 1; + /* Assume we stop. Should we find watchpoint that is not actually + triggered, or if condition of breakpoint is false, we'll reset +@@ -3614,12 +3679,22 @@ bpstat_stop_status (struct address_space *aspace, + bs->stop = 1; + bs->print = 1; -- bpstat_check_watchpoint (bs); -- if (!bs->stop) -- continue; -+ if (!bpstat_check_watchpoint (bs)) -+ { -+ /* Ensure bpstat_explains_signal stays false if this BL could not be -+ the cause of this trap. */ +- bpstat_check_watchpoint (bs); +- if (!bs->stop) +- continue; ++ if (!bpstat_check_watchpoint (bs)) ++ { ++ /* Ensure bpstat_explains_signal stays false if this BL could not be ++ the cause of this trap. */ + -+ gdb_assert (bs->print_it == print_it_noop); -+ gdb_assert (!bs->stop); -+ xfree (bs); -+ bs = bs_prev; -+ bs->next = NULL; -+ continue; -+ } ++ gdb_assert (bs->print_it == print_it_noop); ++ gdb_assert (!bs->stop); ++ xfree (bs); ++ bs = bs_prev; ++ bs->next = NULL; ++ continue; ++ } - if (b->type == bp_thread_event || b->type == bp_overlay_event -- || b->type == bp_longjmp_master) -+ || b->type == bp_longjmp_master || b->type == bp_exception_master) - /* We do not stop for these. */ - bs->stop = 0; - else -@@ -3208,14 +3354,15 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) - - if (bs->stop) - { -- ++(b->hit_count); -+ if (b->enable_state != bp_disabled) -+ ++(b->hit_count); - - /* We will stop here */ - if (b->disposition == disp_disable) - { - if (b->enable_state != bp_permanent) - b->enable_state = bp_disabled; -- update_global_location_list (0); -+ update_locations = 1; - } - if (b->silent) - bs->print = 0; -@@ -3235,6 +3382,10 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) - bs->print_it = print_it_noop; - } - -+ /* Delay this call which would break the ALL_BP_LOCATIONS iteration above. */ -+ if (update_locations) -+ update_global_location_list (0); -+ - for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix) - { - if (loc->address == bp_addr) -@@ -3412,6 +3563,7 @@ bpstat_what (bpstat bs) + 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) + /* We do not stop for these. */ + bs->stop = 0; + else +@@ -3829,6 +3904,7 @@ bpstat_what (bpstat bs) struct bpstat_what retval; retval.call_dummy = 0; @@ -1161,7 +665,7 @@ index 811cdfb..0f35101 100644 for (; bs != NULL; bs = bs->next) { enum class bs_class = no_effect; -@@ -3458,10 +3610,15 @@ bpstat_what (bpstat bs) +@@ -3875,10 +3951,15 @@ bpstat_what (bpstat bs) bs_class = no_effect; break; case bp_longjmp: @@ -1177,7 +681,7 @@ index 811cdfb..0f35101 100644 break; case bp_step_resume: if (bs->stop) -@@ -3484,6 +3641,7 @@ bpstat_what (bpstat bs) +@@ -3901,6 +3982,7 @@ bpstat_what (bpstat bs) case bp_thread_event: case bp_overlay_event: case bp_longjmp_master: @@ -1185,7 +689,7 @@ index 811cdfb..0f35101 100644 bs_class = bp_nostop; break; case bp_catchpoint: -@@ -3605,6 +3763,8 @@ print_one_breakpoint_location (struct breakpoint *b, +@@ -4045,6 +4127,8 @@ print_one_breakpoint_location (struct breakpoint *b, {bp_access_watchpoint, "acc watchpoint"}, {bp_longjmp, "longjmp"}, {bp_longjmp_resume, "longjmp resume"}, @@ -1194,15 +698,15 @@ index 811cdfb..0f35101 100644 {bp_step_resume, "step resume"}, {bp_watchpoint_scope, "watchpoint scope"}, {bp_call_dummy, "call dummy"}, -@@ -3612,6 +3772,7 @@ print_one_breakpoint_location (struct breakpoint *b, +@@ -4052,6 +4136,7 @@ print_one_breakpoint_location (struct breakpoint *b, {bp_thread_event, "thread events"}, {bp_overlay_event, "overlay events"}, {bp_longjmp_master, "longjmp master"}, + {bp_exception_master, "exception master"}, {bp_catchpoint, "catchpoint"}, {bp_tracepoint, "tracepoint"}, - {bp_jit_event, "jit events"}, -@@ -3735,6 +3896,8 @@ print_one_breakpoint_location (struct breakpoint *b, + {bp_fast_tracepoint, "fast tracepoint"}, +@@ -4176,6 +4261,8 @@ print_one_breakpoint_location (struct breakpoint *b, case bp_finish: case bp_longjmp: case bp_longjmp_resume: @@ -1211,116 +715,15 @@ index 811cdfb..0f35101 100644 case bp_step_resume: case bp_watchpoint_scope: case bp_call_dummy: -@@ -3742,6 +3905,7 @@ print_one_breakpoint_location (struct breakpoint *b, +@@ -4183,6 +4270,7 @@ print_one_breakpoint_location (struct breakpoint *b, case bp_thread_event: case bp_overlay_event: case bp_longjmp_master: + case bp_exception_master: case bp_tracepoint: + case bp_fast_tracepoint: case bp_jit_event: - if (opts.addressprint) -@@ -4197,9 +4361,8 @@ set_default_breakpoint (int valid, CORE_ADDR addr, struct symtab *symtab, - (or use it for any other purpose either). - - More specifically, each of the following breakpoint types will always -- have a zero valued address and we don't want check_duplicates() to mark -- breakpoints of any of these types to be a duplicate of an actual -- breakpoint at address zero: -+ have a zero valued address and we don't want to mark breakpoints of any of -+ these types to be a duplicate of an actual breakpoint at address zero: - - bp_watchpoint - bp_hardware_watchpoint -@@ -4219,88 +4382,6 @@ breakpoint_address_is_meaningful (struct breakpoint *bpt) - && type != bp_catchpoint); - } - --/* Rescan breakpoints at the same address and section as BPT, -- marking the first one as "first" and any others as "duplicates". -- This is so that the bpt instruction is only inserted once. -- If we have a permanent breakpoint at the same place as BPT, make -- that one the official one, and the rest as duplicates. */ -- --static void --check_duplicates_for (CORE_ADDR address, struct obj_section *section) --{ -- struct bp_location *b; -- int count = 0; -- struct bp_location *perm_bp = 0; -- -- ALL_BP_LOCATIONS (b) -- if (b->owner->enable_state != bp_disabled -- && b->owner->enable_state != bp_call_disabled -- && b->owner->enable_state != bp_startup_disabled -- && b->enabled -- && !b->shlib_disabled -- && b->address == address /* address / overlay match */ -- && (!overlay_debugging || b->section == section) -- && breakpoint_address_is_meaningful (b->owner)) -- { -- /* Have we found a permanent breakpoint? */ -- if (b->owner->enable_state == bp_permanent) -- { -- perm_bp = b; -- break; -- } -- -- count++; -- b->duplicate = count > 1; -- } -- -- /* If we found a permanent breakpoint at this address, go over the -- list again and declare all the other breakpoints there (except -- other permanent breakpoints) to be the duplicates. */ -- if (perm_bp) -- { -- perm_bp->duplicate = 0; -- -- /* Permanent breakpoint should always be inserted. */ -- if (! perm_bp->inserted) -- internal_error (__FILE__, __LINE__, -- _("allegedly permanent breakpoint is not " -- "actually inserted")); -- -- ALL_BP_LOCATIONS (b) -- if (b != perm_bp) -- { -- if (b->owner->enable_state != bp_permanent -- && b->owner->enable_state != bp_disabled -- && b->owner->enable_state != bp_call_disabled -- && b->owner->enable_state != bp_startup_disabled -- && b->enabled && !b->shlib_disabled -- && b->address == address /* address / overlay match */ -- && (!overlay_debugging || b->section == section) -- && breakpoint_address_is_meaningful (b->owner)) -- { -- if (b->inserted) -- internal_error (__FILE__, __LINE__, -- _("another breakpoint was inserted on top of " -- "a permanent breakpoint")); -- -- b->duplicate = 1; -- } -- } -- } --} -- --static void --check_duplicates (struct breakpoint *bpt) --{ -- struct bp_location *bl = bpt->loc; -- -- if (! breakpoint_address_is_meaningful (bpt)) -- return; -- -- for (; bl; bl = bl->next) -- check_duplicates_for (bl->address, bl->section); --} -- - static void - breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr, - int bnum, int have_bnum) -@@ -4382,6 +4463,8 @@ allocate_bp_location (struct breakpoint *bpt) +@@ -4821,6 +4909,8 @@ allocate_bp_location (struct breakpoint *bpt) case bp_finish: case bp_longjmp: case bp_longjmp_resume: @@ -1329,7 +732,7 @@ index 811cdfb..0f35101 100644 case bp_step_resume: case bp_watchpoint_scope: case bp_call_dummy: -@@ -4390,6 +4473,7 @@ allocate_bp_location (struct breakpoint *bpt) +@@ -4829,6 +4919,7 @@ allocate_bp_location (struct breakpoint *bpt) case bp_overlay_event: case bp_jit_event: case bp_longjmp_master: @@ -1337,7 +740,7 @@ index 811cdfb..0f35101 100644 loc->loc_type = bp_loc_software_breakpoint; break; case bp_hardware_breakpoint: -@@ -4568,8 +4652,7 @@ make_breakpoint_permanent (struct breakpoint *b) +@@ -5015,8 +5106,7 @@ make_breakpoint_permanent (struct breakpoint *b) } /* Call this routine when stepping and nexting to enable a breakpoint @@ -1347,12 +750,13 @@ index 811cdfb..0f35101 100644 void set_longjmp_breakpoint (int thread) -@@ -4581,10 +4664,10 @@ set_longjmp_breakpoint (int thread) - longjmp "master" breakpoints. Here, we simply create momentary +@@ -5029,10 +5119,11 @@ set_longjmp_breakpoint (int thread) clones of those and enable them for the requested thread. */ ALL_BREAKPOINTS_SAFE (b, temp) -- if (b->type == bp_longjmp_master) -+ if (b->type == bp_longjmp_master || b->type == bp_exception_master) + if (b->pspace == current_program_space +- && b->type == bp_longjmp_master) ++ && (b->type == bp_longjmp_master ++ || b->type == bp_exception_master)) { struct breakpoint *clone = clone_momentary_breakpoint (b); - clone->type = bp_longjmp; @@ -1360,7 +764,7 @@ index 811cdfb..0f35101 100644 clone->thread = thread; } } -@@ -4596,7 +4679,7 @@ delete_longjmp_breakpoint (int thread) +@@ -5044,7 +5135,7 @@ delete_longjmp_breakpoint (int thread) struct breakpoint *b, *temp; ALL_BREAKPOINTS_SAFE (b, temp) @@ -1369,37 +773,7 @@ index 811cdfb..0f35101 100644 { if (b->thread == thread) delete_breakpoint (b); -@@ -4710,9 +4793,9 @@ create_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address) - void - disable_breakpoints_in_shlibs (void) - { -- struct bp_location *loc; -+ struct bp_location *loc, **locp_tmp; - -- ALL_BP_LOCATIONS (loc) -+ ALL_BP_LOCATIONS (loc, locp_tmp) - { - struct breakpoint *b = loc->owner; - /* We apply the check to all breakpoints, including disabled -@@ -4742,7 +4825,7 @@ disable_breakpoints_in_shlibs (void) - static void - disable_breakpoints_in_unloaded_shlib (struct so_list *solib) - { -- struct bp_location *loc; -+ struct bp_location *loc, **locp_tmp; - int disabled_shlib_breaks = 0; - - /* SunOS a.out shared libraries are always mapped, so do not -@@ -4753,7 +4836,7 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib) - && bfd_get_flavour (exec_bfd) == bfd_target_aout_flavour) - return; - -- ALL_BP_LOCATIONS (loc) -+ ALL_BP_LOCATIONS (loc, locp_tmp) - { - struct breakpoint *b = loc->owner; - if ((loc->loc_type == bp_loc_hardware_breakpoint -@@ -5648,6 +5731,8 @@ mention (struct breakpoint *b) +@@ -6119,6 +6210,8 @@ mention (struct breakpoint *b) case bp_finish: case bp_longjmp: case bp_longjmp_resume: @@ -1408,7 +782,7 @@ index 811cdfb..0f35101 100644 case bp_step_resume: case bp_call_dummy: case bp_watchpoint_scope: -@@ -5656,6 +5741,7 @@ mention (struct breakpoint *b) +@@ -6127,6 +6220,7 @@ mention (struct breakpoint *b) case bp_overlay_event: case bp_jit_event: case bp_longjmp_master: @@ -1416,7 +790,7 @@ index 811cdfb..0f35101 100644 break; } -@@ -6958,6 +7044,7 @@ struct until_break_command_continuation_args +@@ -7511,6 +7605,7 @@ struct until_break_command_continuation_args { struct breakpoint *breakpoint; struct breakpoint *breakpoint2; @@ -1424,7 +798,7 @@ index 811cdfb..0f35101 100644 }; /* This function is called by fetch_inferior_event via the -@@ -6972,6 +7059,7 @@ until_break_command_continuation (void *arg) +@@ -7525,6 +7620,7 @@ until_break_command_continuation (void *arg) delete_breakpoint (a->breakpoint); if (a->breakpoint2) delete_breakpoint (a->breakpoint2); @@ -1432,7 +806,7 @@ index 811cdfb..0f35101 100644 } void -@@ -6983,6 +7071,8 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -7536,6 +7632,8 @@ until_break_command (char *arg, int from_tty, int anywhere) struct breakpoint *breakpoint; struct breakpoint *breakpoint2 = NULL; struct cleanup *old_chain; @@ -1441,7 +815,7 @@ index 811cdfb..0f35101 100644 clear_proceed_status (); -@@ -7021,6 +7111,9 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -7574,6 +7672,9 @@ until_break_command (char *arg, int from_tty, int anywhere) old_chain = make_cleanup_delete_breakpoint (breakpoint); @@ -1451,7 +825,7 @@ index 811cdfb..0f35101 100644 /* Keep within the current frame, or in frames called by the current one. */ -@@ -7033,6 +7126,10 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -7586,6 +7687,10 @@ until_break_command (char *arg, int from_tty, int anywhere) frame_unwind_caller_id (frame), bp_until); make_cleanup_delete_breakpoint (breakpoint2); @@ -1462,7 +836,7 @@ index 811cdfb..0f35101 100644 } proceed (-1, TARGET_SIGNAL_DEFAULT, 0); -@@ -7049,6 +7146,7 @@ until_break_command (char *arg, int from_tty, int anywhere) +@@ -7602,6 +7707,7 @@ until_break_command (char *arg, int from_tty, int anywhere) args->breakpoint = breakpoint; args->breakpoint2 = breakpoint2; @@ -1470,342 +844,7 @@ index 811cdfb..0f35101 100644 discard_cleanups (old_chain); add_continuation (inferior_thread (), -@@ -7758,6 +7856,82 @@ do_vec_free (void *p) - VEC_free (bp_location_p, *vec); - } - -+/* A comparison function for bp_location A and B being interfaced to qsort. -+ Sort elements primarily by their ADDRESS (no matter what does -+ breakpoint_address_is_meaningful say for its OWNER), secondarily by ordering -+ first bp_permanent OWNERed elements and terciarily just ensuring the array -+ is sorted stable way despite qsort being an instable algorithm. */ -+ -+static int -+bp_location_compare (struct bp_location *a, struct bp_location *b) -+{ -+ int a_perm = a->owner->enable_state == bp_permanent; -+ int b_perm = b->owner->enable_state == bp_permanent; -+ -+ if (a->address != b->address) -+ return (a->address > b->address) - (a->address < b->address); -+ -+ /* Sort permanent breakpoints first. */ -+ if (a_perm != b_perm) -+ return (a_perm < b_perm) - (a_perm > b_perm); -+ -+ /* Make the user-visible order stable across GDB runs. Locations of the same -+ breakpoint can be sorted in arbitrary order. */ -+ -+ if (a->owner->number != b->owner->number) -+ return (a->owner->number > b->owner->number) -+ - (a->owner->number < b->owner->number); -+ -+ return (a > b) - (a < b); -+} -+ -+/* Interface bp_location_compare as the COMPAR parameter of qsort function. */ -+ -+static int -+bp_location_compare_for_qsort (const void *ap, const void *bp) -+{ -+ struct bp_location *a = *(void **) ap; -+ struct bp_location *b = *(void **) bp; -+ -+ return bp_location_compare (a, b); -+} -+ -+/* Set bp_location_placed_address_before_address_max and -+ bp_location_shadow_len_after_address_max according to the current content of -+ the bp_location array. */ -+ -+static void -+bp_location_target_extensions_update (void) -+{ -+ struct bp_location *bl, **blp_tmp; -+ -+ bp_location_placed_address_before_address_max = 0; -+ bp_location_shadow_len_after_address_max = 0; -+ -+ ALL_BP_LOCATIONS (bl, blp_tmp) -+ { -+ CORE_ADDR start, end, addr; -+ -+ if (!bp_location_has_shadow (bl)) -+ continue; -+ -+ start = bl->target_info.placed_address; -+ end = start + bl->target_info.shadow_len; -+ -+ gdb_assert (bl->address >= start); -+ addr = bl->address - start; -+ if (addr > bp_location_placed_address_before_address_max) -+ bp_location_placed_address_before_address_max = addr; -+ -+ /* Zero SHADOW_LEN would not pass bp_location_has_shadow. */ -+ -+ gdb_assert (bl->address < end); -+ addr = end - bl->address; -+ if (addr > bp_location_shadow_len_after_address_max) -+ bp_location_shadow_len_after_address_max = addr; -+ } -+} -+ - /* If SHOULD_INSERT is false, do not insert any breakpoint locations - into the inferior, only remove already-inserted locations that no - longer should be inserted. Functions that delete a breakpoint or -@@ -7777,49 +7951,78 @@ static void - update_global_location_list (int should_insert) - { - struct breakpoint *b; -- struct bp_location **next = &bp_location_chain; -- struct bp_location *loc; -- struct bp_location *loc2; -- VEC(bp_location_p) *old_locations = NULL; -- int ret; -- int ix; -+ struct bp_location **locp, *loc; - struct cleanup *cleanups; - -- cleanups = make_cleanup (do_vec_free, &old_locations); -- /* Store old locations for future reference. */ -- for (loc = bp_location_chain; loc; loc = loc->global_next) -- VEC_safe_push (bp_location_p, old_locations, loc); -+ /* The first bp_location being the only one non-DUPLICATE for the current run -+ of the same ADDRESS. */ -+ struct bp_location *loc_first; -+ -+ /* Saved former bp_location array which we compare against the newly built -+ bp_location from the current state of ALL_BREAKPOINTS. */ -+ struct bp_location **old_location, **old_locp; -+ unsigned old_location_count; -+ -+ old_location = bp_location; -+ old_location_count = bp_location_count; -+ bp_location = NULL; -+ bp_location_count = 0; -+ cleanups = make_cleanup (xfree, old_location); - -- bp_location_chain = NULL; - ALL_BREAKPOINTS (b) -- { -- for (loc = b->loc; loc; loc = loc->next) -- { -- *next = loc; -- next = &(loc->global_next); -- *next = NULL; -- } -- } -+ for (loc = b->loc; loc; loc = loc->next) -+ bp_location_count++; -+ -+ bp_location = xmalloc (sizeof (*bp_location) * bp_location_count); -+ locp = bp_location; -+ ALL_BREAKPOINTS (b) -+ for (loc = b->loc; loc; loc = loc->next) -+ *locp++ = loc; -+ qsort (bp_location, bp_location_count, sizeof (*bp_location), -+ bp_location_compare_for_qsort); -+ -+ bp_location_target_extensions_update (); - - /* Identify bp_location instances that are no longer present in the new - list, and therefore should be freed. Note that it's not necessary that - those locations should be removed from inferior -- if there's another - location at the same address (previously marked as duplicate), -- we don't need to remove/insert the location. */ -- for (ix = 0; VEC_iterate(bp_location_p, old_locations, ix, loc); ++ix) -+ we don't need to remove/insert the location. -+ -+ LOCP is kept in sync with OLD_LOCP, each pointing to the current and -+ former bp_location array state respectively. */ -+ -+ locp = bp_location; -+ for (old_locp = old_location; old_locp < old_location + old_location_count; -+ old_locp++) - { -- /* Tells if 'loc' is found amoung the new locations. If not, we -+ struct bp_location *old_loc = *old_locp; -+ struct bp_location **loc2p; -+ -+ /* Tells if 'old_loc' is found amoung the new locations. If not, we - have to free it. */ - int found_object = 0; - /* Tells if the location should remain inserted in the target. */ - int keep_in_target = 0; - int removed = 0; -- for (loc2 = bp_location_chain; loc2; loc2 = loc2->global_next) -- if (loc2 == loc) -- { -- found_object = 1; -- break; -- } -+ -+ /* Skip LOCP entries which will definitely never be needed. Stop either -+ at or being the one matching OLD_LOC. */ -+ while (locp < bp_location + bp_location_count -+ && (*locp)->address < old_loc->address) -+ locp++; -+ -+ for (loc2p = locp; -+ (loc2p < bp_location + bp_location_count -+ && (*loc2p)->address == old_loc->address); -+ loc2p++) -+ { -+ if (*loc2p == old_loc) -+ { -+ found_object = 1; -+ break; -+ } -+ } - - /* If this location is no longer present, and inserted, look if there's - maybe a new location at the same address. If so, mark that one -@@ -7827,11 +8030,11 @@ update_global_location_list (int should_insert) - don't have a time window where a breakpoint at certain location is not - inserted. */ - -- if (loc->inserted) -+ if (old_loc->inserted) - { - /* If the location is inserted now, we might have to remove it. */ - -- if (found_object && should_be_inserted (loc)) -+ if (found_object && should_be_inserted (old_loc)) - { - /* The location is still present in the location list, and still - should be inserted. Don't do anything. */ -@@ -7842,37 +8045,46 @@ update_global_location_list (int should_insert) - /* The location is either no longer present, or got disabled. - See if there's another location at the same address, in which - case we don't need to remove this one from the target. */ -- if (breakpoint_address_is_meaningful (loc->owner)) -- for (loc2 = bp_location_chain; loc2; loc2 = loc2->global_next) -- { -- /* For the sake of should_insert_location. The -- call to check_duplicates will fix up this later. */ -- loc2->duplicate = 0; -- if (should_be_inserted (loc2) -- && loc2 != loc && loc2->address == loc->address) -- { -- loc2->inserted = 1; -- loc2->target_info = loc->target_info; -- keep_in_target = 1; -- break; -- } -- } -+ -+ if (breakpoint_address_is_meaningful (old_loc->owner)) -+ { -+ for (loc2p = locp; -+ (loc2p < bp_location + bp_location_count -+ && (*loc2p)->address == old_loc->address); -+ loc2p++) -+ { -+ struct bp_location *loc2 = *loc2p; -+ -+ { -+ /* For the sake of should_be_inserted. -+ Duplicates check below will fix up this later. */ -+ loc2->duplicate = 0; -+ if (loc2 != old_loc && should_be_inserted (loc2)) -+ { -+ loc2->inserted = 1; -+ loc2->target_info = old_loc->target_info; -+ keep_in_target = 1; -+ break; -+ } -+ } -+ } -+ } - } - - if (!keep_in_target) - { -- if (remove_breakpoint (loc, mark_uninserted)) -+ if (remove_breakpoint (old_loc, mark_uninserted)) - { - /* This is just about all we can do. We could keep this - location on the global list, and try to remove it next - time, but there's no particular reason why we will - succeed next time. - -- Note that at this point, loc->owner is still valid, -+ Note that at this point, old_loc->owner is still valid, - as delete_breakpoint frees the breakpoint only - after calling us. */ - printf_filtered (_("warning: Error removing breakpoint %d\n"), -- loc->owner->number); -+ old_loc->owner->number); - } - removed = 1; - } -@@ -7894,19 +8106,59 @@ update_global_location_list (int should_insert) - longer need to keep this breakpoint. This is just a - heuristic, but if it's wrong, we'll report unexpected SIGTRAP, - which is usability issue, but not a correctness problem. */ -- loc->events_till_retirement = 3 * (thread_count () + 1); -- loc->owner = NULL; -+ old_loc->events_till_retirement = 3 * (thread_count () + 1); -+ old_loc->owner = NULL; - -- VEC_safe_push (bp_location_p, moribund_locations, loc); -+ VEC_safe_push (bp_location_p, moribund_locations, old_loc); - } - else -- free_bp_location (loc); -+ free_bp_location (old_loc); - } - } - -- ALL_BREAKPOINTS (b) -+ /* Rescan breakpoints at the same address and section, -+ marking the first one as "first" and any others as "duplicates". -+ This is so that the bpt instruction is only inserted once. -+ If we have a permanent breakpoint at the same place as BPT, make -+ that one the official one, and the rest as duplicates. Permanent -+ breakpoints are sorted first for the same address. */ -+ -+ loc_first = NULL; -+ ALL_BP_LOCATIONS (loc, locp) - { -- check_duplicates (b); -+ struct breakpoint *b = loc->owner; -+ -+ if (b->enable_state == bp_disabled -+ || b->enable_state == bp_call_disabled -+ || b->enable_state == bp_startup_disabled -+ || !loc->enabled -+ || loc->shlib_disabled -+ || !breakpoint_address_is_meaningful (b)) -+ continue; -+ -+ /* Permanent breakpoint should always be inserted. */ -+ if (b->enable_state == bp_permanent && ! loc->inserted) -+ internal_error (__FILE__, __LINE__, -+ _("allegedly permanent breakpoint is not " -+ "actually inserted")); -+ -+ if (loc_first == NULL -+ /* address / overlay match */ -+ || loc->address != loc_first->address -+ || (overlay_debugging && loc->section != loc_first->section)) -+ { -+ loc_first = loc; -+ loc->duplicate = 0; -+ continue; -+ } -+ -+ loc->duplicate = 1; -+ -+ if (loc_first->owner->enable_state == bp_permanent && loc->inserted -+ && b->enable_state != bp_permanent) -+ internal_error (__FILE__, __LINE__, -+ _("another breakpoint was inserted on top of " -+ "a permanent breakpoint")); - } - - if (breakpoints_always_inserted_mode () && should_insert -@@ -8083,6 +8335,7 @@ delete_command (char *arg, int from_tty) +@@ -8823,6 +8929,7 @@ delete_command (char *arg, int from_tty) && b->type != bp_thread_event && b->type != bp_overlay_event && b->type != bp_longjmp_master @@ -1813,7 +852,7 @@ index 811cdfb..0f35101 100644 && b->number >= 0) { breaks_to_delete = 1; -@@ -8102,6 +8355,7 @@ delete_command (char *arg, int from_tty) +@@ -8842,6 +8949,7 @@ delete_command (char *arg, int from_tty) && b->type != bp_jit_event && b->type != bp_overlay_event && b->type != bp_longjmp_master @@ -1821,7 +860,7 @@ index 811cdfb..0f35101 100644 && b->number >= 0) delete_breakpoint (b); } -@@ -8404,6 +8658,7 @@ breakpoint_re_set_one (void *bint) +@@ -9152,6 +9260,7 @@ breakpoint_re_set_one (void *bint) reset later by breakpoint_re_set. */ case bp_overlay_event: case bp_longjmp_master: @@ -1829,16 +868,16 @@ index 811cdfb..0f35101 100644 delete_breakpoint (b); break; -@@ -8427,6 +8682,8 @@ breakpoint_re_set_one (void *bint) +@@ -9174,6 +9283,8 @@ breakpoint_re_set_one (void *bint) + case bp_step_resume: case bp_longjmp: case bp_longjmp_resume: - case bp_jit_event: + case bp_exception: + case bp_exception_resume: + case bp_jit_event: break; } - -@@ -8462,6 +8719,7 @@ breakpoint_re_set (void) +@@ -9216,6 +9327,7 @@ breakpoint_re_set (void) create_longjmp_master_breakpoint ("_longjmp"); create_longjmp_master_breakpoint ("siglongjmp"); create_longjmp_master_breakpoint ("_siglongjmp"); @@ -1846,7 +885,7 @@ index 811cdfb..0f35101 100644 } /* Reset the thread number of this breakpoint: -@@ -9327,6 +9585,22 @@ all_tracepoints () +@@ -10177,6 +10289,22 @@ all_tracepoints () return tp_vec; } @@ -1869,14 +908,14 @@ index 811cdfb..0f35101 100644 /* This help string is used for the break, hbreak, tbreak and thbreak commands. It is defined as a macro to prevent duplication. -@@ -9850,4 +10124,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."), +@@ -10721,4 +10849,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 ba499c6..80f702f 100644 +index 6b373a3..59aa412 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -56,6 +56,13 @@ enum bptype @@ -1903,18 +942,7 @@ index ba499c6..80f702f 100644 bp_catchpoint, bp_tracepoint, -@@ -228,10 +238,6 @@ struct bp_location - the same parent breakpoint. */ - struct bp_location *next; - -- /* Pointer to the next breakpoint location, in a global -- list of all breakpoint locations. */ -- struct bp_location *global_next; -- - /* Type of this breakpoint location. */ - enum bp_loc_type loc_type; - -@@ -583,6 +589,10 @@ struct bpstat_what +@@ -603,6 +613,10 @@ struct bpstat_what continuing from a call dummy without popping the frame is not a useful one). */ int call_dummy; @@ -1925,7 +953,7 @@ index ba499c6..80f702f 100644 }; /* The possible return values for print_bpstat, print_it_normal, -@@ -946,6 +956,9 @@ extern int catching_syscall_number (int syscall_number); +@@ -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 *); @@ -1935,432 +963,20 @@ index ba499c6..80f702f 100644 /* 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 f8e4f12..5b47e2e 100644 ---- a/gdb/c-exp.y -+++ b/gdb/c-exp.y -@@ -117,6 +117,8 @@ static int yylex (void); - - void yyerror (char *); - -+/* Cleanup for 'nonempty_typelist' */ -+static struct cleanup *typelist_cleanup; - %} - - /* Although the yacc "value" of an expression is not used, -@@ -157,6 +159,7 @@ void yyerror (char *); - %{ - /* YYSTYPE gets defined by %union */ - static int parse_number (char *, int, int, YYSTYPE *); -+static struct stoken operator_stoken (const char *); - %} - - %type exp exp1 type_exp start variable qualified_name lcurly -@@ -199,9 +202,12 @@ static int parse_number (char *, int, int, YYSTYPE *); - - %token NAME_OR_INT - -+%token OPERATOR - %token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON - %token TEMPLATE - %token ERROR -+%token NEW DELETE -+%type operator - - /* Special type cases, put in to allow the parser to distinguish different - legal basetypes. */ -@@ -401,6 +407,36 @@ arglist : arglist ',' exp %prec ABOVE_COMMA - { arglist_len++; } - ; - -+exp : exp '(' nonempty_typelist ')' const_or_volatile -+ { int i; -+ 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); -+ } -+ ; -+ -+/* -+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; } - ; -@@ -703,6 +739,7 @@ variable: block COLONCOLON name - qualified_name: typebase COLONCOLON name - { - struct type *type = $1; -+ CHECK_TYPEDEF (type); - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION - && TYPE_CODE (type) != TYPE_CODE_NAMESPACE) -@@ -718,6 +755,7 @@ qualified_name: typebase COLONCOLON name - { - struct type *type = $1; - struct stoken tmp_token; -+ CHECK_TYPEDEF (type); - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION - && TYPE_CODE (type) != TYPE_CODE_NAMESPACE) -@@ -740,12 +778,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); -@@ -883,7 +922,7 @@ array_mod: '[' ']' - func_mod: '(' ')' - { $$ = 0; } - | '(' nonempty_typelist ')' -- { free ($2); $$ = 0; } -+ { do_cleanups (typelist_cleanup); $$ = 0; } - ; - - /* We used to try to recognize pointer to member types here, but -@@ -1088,12 +1127,15 @@ typename: TYPENAME - nonempty_typelist - : type - { $$ = (struct type **) malloc (sizeof (struct type *) * 2); -+ typelist_cleanup = make_cleanup (free, $$); - $$[0] = 1; /* Number of types in vector */ - $$[1] = $1; - } - | nonempty_typelist ',' type - { int len = sizeof (struct type *) * (++($1[0]) + 1); - $$ = (struct type **) realloc ((char *) $1, len); -+ discard_cleanups (typelist_cleanup); -+ typelist_cleanup = make_cleanup (free, $$); - $$[$$[0]] = $3; - } - ; -@@ -1117,10 +1159,135 @@ const_or_volatile_noopt: const_and_volatile - { push_type (tp_volatile); } - ; - -+operator: OPERATOR NEW -+ { $$ = operator_stoken (" new"); } -+ | OPERATOR DELETE -+ { $$ = operator_stoken (" delete"); } -+ | OPERATOR NEW '[' ']' -+ { $$ = operator_stoken (" new[]"); } -+ | OPERATOR DELETE '[' ']' -+ { $$ = operator_stoken (" delete[]"); } -+ | OPERATOR '+' -+ { $$ = operator_stoken ("+"); } -+ | OPERATOR '-' -+ { $$ = operator_stoken ("-"); } -+ | OPERATOR '*' -+ { $$ = operator_stoken ("*"); } -+ | OPERATOR '/' -+ { $$ = operator_stoken ("/"); } -+ | OPERATOR '%' -+ { $$ = operator_stoken ("%"); } -+ | OPERATOR '^' -+ { $$ = operator_stoken ("^"); } -+ | OPERATOR '&' -+ { $$ = operator_stoken ("&"); } -+ | OPERATOR '|' -+ { $$ = operator_stoken ("|"); } -+ | OPERATOR '~' -+ { $$ = operator_stoken ("~"); } -+ | OPERATOR '!' -+ { $$ = operator_stoken ("!"); } -+ | OPERATOR '=' -+ { $$ = operator_stoken ("="); } -+ | OPERATOR '<' -+ { $$ = operator_stoken ("<"); } -+ | OPERATOR '>' -+ { $$ = operator_stoken (">"); } -+ | OPERATOR ASSIGN_MODIFY -+ { const char *op = "unknown"; -+ switch ($2) -+ { -+ case BINOP_RSH: -+ op = ">>="; -+ break; -+ case BINOP_LSH: -+ op = "<<="; -+ break; -+ case BINOP_ADD: -+ op = "+="; -+ break; -+ case BINOP_SUB: -+ op = "-="; -+ break; -+ case BINOP_MUL: -+ op = "*="; -+ break; -+ case BINOP_DIV: -+ op = "/="; -+ break; -+ case BINOP_REM: -+ op = "%="; -+ break; -+ case BINOP_BITWISE_IOR: -+ op = "|="; -+ break; -+ case BINOP_BITWISE_AND: -+ op = "&="; -+ break; -+ case BINOP_BITWISE_XOR: -+ op = "^="; -+ break; -+ default: -+ break; -+ } -+ -+ $$ = operator_stoken (op); -+ } -+ | OPERATOR LSH -+ { $$ = operator_stoken ("<<"); } -+ | OPERATOR RSH -+ { $$ = operator_stoken (">>"); } -+ | OPERATOR EQUAL -+ { $$ = operator_stoken ("=="); } -+ | OPERATOR NOTEQUAL -+ { $$ = operator_stoken ("!="); } -+ | OPERATOR LEQ -+ { $$ = operator_stoken ("<="); } -+ | OPERATOR GEQ -+ { $$ = operator_stoken (">="); } -+ | OPERATOR ANDAND -+ { $$ = operator_stoken ("&&"); } -+ | OPERATOR OROR -+ { $$ = operator_stoken ("||"); } -+ | OPERATOR INCREMENT -+ { $$ = operator_stoken ("++"); } -+ | OPERATOR DECREMENT -+ { $$ = operator_stoken ("--"); } -+ | OPERATOR ',' -+ { $$ = operator_stoken (","); } -+ | OPERATOR ARROW_STAR -+ { $$ = operator_stoken ("->*"); } -+ | OPERATOR ARROW -+ { $$ = operator_stoken ("->"); } -+ | OPERATOR '(' ')' -+ { $$ = operator_stoken ("()"); } -+ | OPERATOR '[' ']' -+ { $$ = operator_stoken ("[]"); } -+ | OPERATOR ptype -+ { char *name, *canon; -+ long length; -+ struct ui_file *buf = mem_fileopen (); -+ -+ c_print_type ($2, NULL, buf, -1, 0); -+ name = ui_file_xstrdup (buf, &length); -+ canon = cp_canonicalize_string (name); -+ if (canon != NULL) -+ { -+ xfree (name); -+ name = canon; -+ } -+ ui_file_delete (buf); -+ $$ = operator_stoken (name); -+ } -+ ; -+ -+ -+ - name : NAME { $$ = $1.stoken; } - | BLOCKNAME { $$ = $1.stoken; } - | TYPENAME { $$ = $1.stoken; } - | NAME_OR_INT { $$ = $1.stoken; } -+ | operator { $$ = $1; } - ; - - name_not_typename : NAME -@@ -1136,6 +1303,20 @@ name_not_typename : NAME - - %% - -+/* Returns a stoken of the operator name given by OP (which does not -+ include the string "operator"). The result is xmalloc'd. */ -+static struct stoken -+operator_stoken (const char *op) -+{ -+ static const char *operator_string = "operator"; -+ struct stoken st = { NULL, 0 }; -+ st.length = strlen (operator_string) + strlen (op); -+ st.ptr = xmalloc (st.length + 1); -+ strcpy (st.ptr, operator_string); -+ strcat (st.ptr, op); -+ return st; -+}; -+ - /* Take care of parsing a number (anything that starts with a digit). - Set yylval and return the token type; update lexptr. - LEN is the number of characters in it. */ -@@ -1714,6 +1895,9 @@ static const struct token ident_tokens[] = - {"long", LONG, OP_NULL, 0}, - {"true", TRUEKEYWORD, OP_NULL, 1}, - {"int", INT_KEYWORD, OP_NULL, 0}, -+ {"new", NEW, OP_NULL, 1}, -+ {"delete", DELETE, OP_NULL, 1}, -+ {"operator", OPERATOR, OP_NULL, 1}, - - {"and", ANDAND, BINOP_END, 1}, - {"and_eq", ASSIGN_MODIFY, BINOP_BITWISE_AND, 1}, -@@ -1822,6 +2006,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; -@@ -1830,9 +2021,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 ()) - { -@@ -1868,10 +2069,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; - } - -@@ -1900,6 +2110,8 @@ yylex (void) - return 0; - - case ' ': -+ name_prefix_len++; -+ terminate_prefix = 0; - case '\t': - case '\n': - lexptr++; -@@ -2057,11 +2269,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'. */ - -@@ -2125,14 +2339,29 @@ 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 = savestring (name_prefix, name_prefix_len+namelen); -+ -+ 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). */ -@@ -2191,6 +2420,7 @@ 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; -+ - return NAME; - } - } diff --git a/gdb/c-lang.c b/gdb/c-lang.c -index d01490c..bc35a3e 100644 +index d620881..d4a229d 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c -@@ -715,7 +715,7 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length, +@@ -717,7 +717,7 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length, If length returned from read_string was > 0, return the number of characters read by dividing the number of bytes by width. */ if (*length != 0) - *length = *length / width; + *length = *length / width; - *charset = target_charset (); + *char_type = element_type; -@@ -1038,6 +1038,9 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp, +@@ -1040,6 +1040,9 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp, return evaluate_subexp_standard (expect_type, exp, pos, noside); } @@ -2370,7 +986,7 @@ index d01490c..bc35a3e 100644 /* Table mapping opcodes into strings for printing operators -@@ -1138,6 +1141,7 @@ static const struct exp_descriptor exp_descriptor_c = +@@ -1140,6 +1143,7 @@ static const struct exp_descriptor exp_descriptor_c = { print_subexp_standard, operator_length_standard, @@ -2379,95 +995,15 @@ index d01490c..bc35a3e 100644 dump_subexp_body_standard, evaluate_subexp_c diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c -index b193080..04cf3bc 100644 +index d1af481..1c930b5 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, -@@ -199,6 +198,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"); -+ } - } - - -@@ -355,10 +371,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; -@@ -370,13 +390,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; - } - -@@ -560,7 +586,12 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, +@@ -558,7 +558,12 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, fprintf_filtered (stream, ")"); fprintf_filtered (stream, "["); - if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0 -+ if (TYPE_ARRAY_BOUND_IS_DWARF_BLOCK (type, 1)) ++ if (TYPE_ARRAY_UPPER_BOUND_IS_DWARF_BLOCK (type)) + { + /* No _() - printed sources should not be locale dependent. */ + fprintf_filtered (stream, "variable"); @@ -2476,20 +1012,11 @@ index b193080..04cf3bc 100644 && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) fprintf_filtered (stream, "%d", (TYPE_LENGTH (type) -@@ -593,7 +624,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/cli/cli-cmds.c b/gdb/cli/cli-cmds.c -index ce7c2a6..6380fec 100644 +index 4833898..992c46f 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c -@@ -46,6 +46,8 @@ +@@ -47,6 +47,8 @@ extern void disconnect_or_stop_tracing (int from_tty); #include "cli/cli-setshow.h" #include "cli/cli-cmds.h" @@ -2498,7 +1025,7 @@ index ce7c2a6..6380fec 100644 #ifdef TUI #include "tui/tui.h" /* For tui_active et.al. */ #endif -@@ -183,6 +185,7 @@ struct cmd_list_element *showchecklist; +@@ -184,6 +186,7 @@ struct cmd_list_element *showchecklist; /* Command tracing state. */ @@ -2506,7 +1033,7 @@ index ce7c2a6..6380fec 100644 int source_verbose = 0; int trace_commands = 0; -@@ -444,6 +447,7 @@ source_script (char *file, int from_tty) +@@ -448,6 +451,7 @@ source_script (char *file, int from_tty) struct cleanup *old_cleanups; char *full_pathname = NULL; int fd; @@ -2514,7 +1041,7 @@ index ce7c2a6..6380fec 100644 if (file == NULL || *file == 0) { -@@ -476,8 +480,16 @@ source_script (char *file, int from_tty) +@@ -480,8 +484,16 @@ source_script (char *file, int from_tty) } } @@ -2532,7 +1059,7 @@ index ce7c2a6..6380fec 100644 do_cleanups (old_cleanups); } -@@ -491,15 +503,30 @@ source_verbose_cleanup (void *old_value) +@@ -495,15 +507,30 @@ source_verbose_cleanup (void *old_value) xfree (old_value); } @@ -2567,7 +1094,7 @@ index ce7c2a6..6380fec 100644 /* -v causes the source command to run in verbose mode. We still have to be able to handle filenames with spaces in a -@@ -507,23 +534,28 @@ source_command (char *args, int from_tty) +@@ -511,23 +538,28 @@ source_command (char *args, int from_tty) if (args) { @@ -2609,7 +1136,7 @@ index ce7c2a6..6380fec 100644 } -@@ -1307,7 +1339,9 @@ Read commands from a file named FILE.\n\ +@@ -1309,7 +1341,9 @@ Read commands from a file named FILE.\n\ Optional -v switch (before the filename) causes each command in\n\ FILE to be echoed as it is executed.\n\ Note that the file \"%s\" is read automatically in this way\n\ @@ -2621,19 +1148,10 @@ index ce7c2a6..6380fec 100644 source_help_text, &cmdlist); set_cmd_completer (c, filename_completer); diff --git a/gdb/coffread.c b/gdb/coffread.c -index 888f8b4..65494b8 100644 +index eca6618..0579ce6 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c -@@ -346,7 +346,7 @@ coff_alloc_type (int index) - We will fill it in later if we find out how. */ - if (type == NULL) - { -- type = alloc_type (current_objfile); -+ type = alloc_type (current_objfile, NULL); - *type_addr = type; - } - return type; -@@ -2121,6 +2121,7 @@ static struct sym_fns coff_sym_fns = +@@ -2126,6 +2126,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 */ @@ -2642,7 +1160,7 @@ index 888f8b4..65494b8 100644 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 4716524..0745c65 100644 +index ebde876..907b275 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -46,11 +46,10 @@ @@ -2659,7 +1177,7 @@ index 4716524..0745c65 100644 #undef GDB_DATADIR_RELOCATABLE /* Define to be a string naming the default host character set. */ -@@ -647,6 +646,9 @@ +@@ -653,6 +652,9 @@ 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX @@ -2911,7 +1429,7 @@ index 0000000..49ac420 +#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1 + diff --git a/gdb/configure b/gdb/configure -index 46e7bfe..ea667f0 100755 +index 7f26c64..0542f7e 100755 --- a/gdb/configure +++ b/gdb/configure @@ -676,6 +676,8 @@ REPORT_BUGS_TO @@ -2923,7 +1441,7 @@ index 46e7bfe..ea667f0 100755 GDB_DATADIR DEBUGDIR am__fastdepCC_FALSE -@@ -883,6 +885,7 @@ enable_dependency_tracking +@@ -885,6 +887,7 @@ enable_dependency_tracking with_separate_debug_dir with_gdb_datadir with_relocated_sources @@ -2931,7 +1449,7 @@ index 46e7bfe..ea667f0 100755 enable_targets enable_64_bit_bfd enable_gdbcli -@@ -1581,6 +1584,10 @@ Optional Packages: +@@ -1586,6 +1589,10 @@ Optional Packages: [DATADIR/gdb] --with-relocated-sources=PATH automatically relocate this path for source files @@ -2942,7 +1460,7 @@ index 46e7bfe..ea667f0 100755 --with-libunwind use libunwind frame unwinding support --with-curses use the curses library instead of the termcap library -@@ -6602,6 +6609,73 @@ _ACEOF +@@ -6866,6 +6873,73 @@ _ACEOF fi @@ -3016,7 +1534,7 @@ index 46e7bfe..ea667f0 100755 subdirs="$subdirs doc testsuite" -@@ -9282,6 +9356,8 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h +@@ -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)" @@ -3026,10 +1544,10 @@ index 46e7bfe..ea667f0 100755 # Flags needed to compile Python code (taken from python-config --cflags). diff --git a/gdb/configure.ac b/gdb/configure.ac -index 0e42182..e7f97cf 100644 +index ebb0a95..c8ebafe 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -107,6 +107,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat +@@ -108,6 +108,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat [Relocated directory for source files. ]) ]) @@ -3081,7 +1599,7 @@ index 0e42182..e7f97cf 100644 AC_CONFIG_SUBDIRS(doc testsuite) # Check whether to support alternative target configurations -@@ -658,6 +703,8 @@ if test "${have_libpython}" = yes; then +@@ -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)" @@ -3090,765 +1608,11 @@ index 0e42182..e7f97cf 100644 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" # Flags needed to compile Python code (taken from python-config --cflags). -diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y -index 62800b8..97d587b 100644 ---- a/gdb/cp-name-parser.y -+++ b/gdb/cp-name-parser.y -@@ -1,7 +1,6 @@ - /* YACC parser for C++ names, for GDB. - -- Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 -- Free Software Foundation, Inc. -+ Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. - - Parts of the lexer are based on c-exp.y from GDB. - -@@ -389,7 +388,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 d2d8f2e..db26a01 100644 ---- a/gdb/cp-namespace.c -+++ b/gdb/cp-namespace.c -@@ -36,14 +36,17 @@ static struct using_direct *cp_copy_usings (struct using_direct *using, - struct obstack *obstack); - - 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); -@@ -119,7 +122,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); -+ cp_add_using_directive (dest, src, "", "", 0); - } - /* The "+ 2" is for the "::". */ - previous_component = next_component + 2; -@@ -134,7 +137,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) -+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; -@@ -148,7 +152,8 @@ cp_add_using_directive (const char *dest, const char *src) - return; - } - -- using_directives = cp_add_using (dest, src, using_directives); -+ using_directives = cp_add_using (dest, src, alias, declaration, -+ line_number, using_directives); - - } - -@@ -201,7 +206,10 @@ cp_is_anonymous (const char *namespace) - } - - /* Create a new struct using direct which imports the namespace SRC -- into the scope DEST. -+ into the scope DEST. ALIAS is the name of the imported namespace -+ in the current scope. If ALIAS is an empty string 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,14 +217,21 @@ cp_is_anonymous (const char *namespace) - 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)); -+ retval->alias = savestring (alias, strlen (alias)); -+ retval->declaration = savestring (declaration, strlen (declaration)); -+ retval->line_number = line_number; - retval->next = next; -+ retval->searched = 0; - - return retval; - } -@@ -241,10 +256,18 @@ cp_copy_usings (struct using_direct *using, - obstack); - retval->import_dest = obsavestring (using->import_dest, strlen (using->import_dest), - obstack); -+ retval->alias = obsavestring (using->alias, strlen (using->alias), -+ obstack); -+ retval->declaration = obsavestring (using->declaration, strlen (using->declaration), -+ obstack); - retval->next = cp_copy_usings (using->next, obstack); - -+ retval->searched = using->searched; -+ - xfree (using->import_src); - xfree (using->import_dest); -+ xfree (using->alias); -+ xfree (using->declaration); - xfree (using); - - return retval; -@@ -261,12 +284,48 @@ cp_copy_usings (struct using_direct *using, - - struct symbol * - cp_lookup_symbol_nonlocal (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain) - { -- return lookup_namespace_scope (name, linkage_name, block, domain, -- block_scope (block), 0); -+ struct symbol *sym; -+ const char *scope = block_scope (block); -+ -+ sym = lookup_namespace_scope (name, block, domain, scope, 0); -+ if (sym != NULL) -+ return sym; -+ -+ 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 -@@ -284,9 +343,8 @@ cp_lookup_symbol_nonlocal (const char *name, - "A::x", and if that call fails, then the first call looks for - "x". */ - --static struct symbol * -+struct symbol * - lookup_namespace_scope (const char *name, -- const char *linkage_name, - const struct block *block, - const domain_enum domain, - const char *scope, -@@ -308,8 +366,7 @@ lookup_namespace_scope (const char *name, - new_scope_len += 2; - } - new_scope_len += cp_find_first_component (scope + new_scope_len); -- sym = lookup_namespace_scope (name, linkage_name, block, -- domain, scope, new_scope_len); -+ sym = lookup_namespace_scope (name, block, domain, scope, new_scope_len); - if (sym != NULL) - return sym; - } -@@ -320,25 +377,98 @@ lookup_namespace_scope (const char *name, - namespace = alloca (scope_len + 1); - strncpy (namespace, scope, scope_len); - namespace[scope_len] = '\0'; -- return cp_lookup_symbol_namespace (namespace, name, linkage_name, -- block, domain); -+ return cp_lookup_symbol_in_namespace (namespace, name,block, domain); - } - --/* Look up NAME in the C++ namespace NAMESPACE, applying the using -- directives that are active in BLOCK. Other arguments are as in -+/* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in - cp_lookup_symbol_nonlocal. */ - -+static struct symbol * -+cp_lookup_symbol_in_namespace (const char *namespace, -+ const char *name, -+ const struct block *block, -+ const domain_enum domain) -+{ -+ -+ if (namespace[0] == '\0') -+ { -+ return lookup_symbol_file (name, block,domain, 0); -+ } -+ else -+ { -+ 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, block, domain, -+ cp_is_anonymous (namespace)); -+ } -+} -+ -+/* Used for cleanups to reset the "searched" flag incase -+ of an error. */ -+ -+static void -+reset_directive_searched (void *data) -+{ -+ struct using_direct *direct = data; -+ direct->searched = 0; -+} -+ -+/* Search for NAME by applying all import statements belonging -+ 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 scopes. -+ Example: -+ -+ namespace A{ -+ using namespace X; -+ namespace B{ -+ using namespace Y; -+ } -+ } -+ -+ If SCOPE is "A::B" and SEARCH_PARENTS is true the imports of namespaces X -+ and Y will be considered. If SEARCH_PARENTS is false only the import of Y -+ is considered. */ -+ - struct symbol * --cp_lookup_symbol_namespace (const char *namespace, -- const char *name, -- const char *linkage_name, -- const struct block *block, -- const domain_enum domain) -+cp_lookup_symbol_imports (const char *scope, -+ const char *name, -+ const struct block *block, -+ const domain_enum domain, -+ int declaration_only, -+ int search_parents) - { -- const struct using_direct *current; -- struct symbol *sym; -+ struct using_direct *current; -+ struct symbol *sym = NULL; -+ int directive_match; -+ int current_line; -+ struct cleanup *searched_cleanup; -+ -+ if(!declaration_only) -+ /* First, try to find the symbol in the given namespace. */ -+ sym = cp_lookup_symbol_in_namespace (scope, name, block, domain); - -- /* First, go through the using directives. If any of them add new -+ 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. */ - -@@ -346,39 +476,78 @@ cp_lookup_symbol_namespace (const char *namespace, - current != NULL; - current = current->next) - { -- if (strcmp (namespace, current->import_dest) == 0) -+ -+ /* If the import destination is the current scope or one of its ancestors then -+ it is applicable. */ -+ directive_match = search_parents ? -+ strncmp (scope, current->import_dest, -+ strlen(current->import_dest)) == 0 : -+ strcmp (scope, current->import_dest) == 0; -+ -+ if (directive_match && -+ current->line_number < current_line && -+ !current->searched) - { -- sym = cp_lookup_symbol_namespace (current->import_src, -- name, -- linkage_name, -- block, -- domain); -+ 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 (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, -+ block, -+ domain); -+ } else if (strcmp ("", current->alias) == 0){ -+ /* 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, -+ block, -+ domain, -+ 0, -+ 0); -+ } -+ -+ current->searched = 0; -+ discard_cleanups (searched_cleanup); -+ - if (sym != NULL) - return sym; - } - } - -- /* We didn't find anything by applying any of the using directives -- that are still applicable; so let's see if we've got a match -- using the current namespace. */ -- -- if (namespace[0] == '\0') -- { -- return lookup_symbol_file (name, linkage_name, block, -- domain, 0); -- } -- else -- { -- char *concatenated_name -- = alloca (strlen (namespace) + 2 + strlen (name) + 1); -- strcpy (concatenated_name, namespace); -- strcat (concatenated_name, "::"); -- strcat (concatenated_name, name); -- sym = lookup_symbol_file (concatenated_name, linkage_name, -- block, domain, -- cp_is_anonymous (namespace)); -- return sym; -- } -+ return NULL; - } - - /* Look up NAME in BLOCK's static block and in global blocks. If -@@ -388,17 +557,15 @@ cp_lookup_symbol_namespace (const char *namespace, - - 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 -@@ -408,12 +575,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) -@@ -434,6 +600,7 @@ lookup_symbol_file (const char *name, - sym = lookup_possible_namespace_symbol (name); - if (sym != NULL) - return sym; -+ - } - - return NULL; -@@ -461,9 +628,8 @@ cp_lookup_nested_type (struct type *parent_type, - lookup_symbol_namespace works when looking them up. */ - - const char *parent_name = TYPE_TAG_NAME (parent_type); -- struct symbol *sym = cp_lookup_symbol_namespace (parent_name, -+ struct symbol *sym = cp_lookup_symbol_in_namespace (parent_name, - nested_name, -- NULL, - block, - VAR_DOMAIN); - if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF) -@@ -709,7 +875,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) - { -@@ -749,7 +915,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 f12d785..23b34c1 100644 ---- a/gdb/cp-support.c -+++ b/gdb/cp-support.c -@@ -32,6 +32,9 @@ - #include "block.h" - #include "complaints.h" - #include "gdbtypes.h" -+#include "exceptions.h" -+#include "expression.h" -+#include "value.h" - - #include "safe-ctype.h" - -@@ -70,6 +73,18 @@ struct cmd_list_element *maint_cplus_cmd_list = NULL; - static void maint_cplus_command (char *arg, int from_tty); - static void first_component_command (char *arg, int from_tty); - -+/* Operator validation. -+ NOTE: Multi-byte operators (usually the assignment variety operator) -+ must appear before the single byte version, i.e., "+=" before "+". */ -+static const char *operator_tokens[] = -+ { -+ "++", "+=", "+", "->*", "->", "--", "-=", "-", "*=", "*", "/=", "/", -+ "%=", "%", "!=", "==", "!", "&&", "<<=", "<<", ">>=", ">>", -+ "<=", "<", ">=", ">", "~", "&=", "&", "|=", "||", "|", "^=", "^", -+ "=", "()", "[]", ",", "new", "delete" -+ /* new[] and delete[] require special whitespace handling */ -+ }; -+ - /* Return 1 if STRING is clearly already in canonical form. This - function is conservative; things which it does not recognize are - assumed to be non-canonical, and the parser will sort them out -@@ -175,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) -@@ -825,9 +841,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); - } -@@ -909,6 +925,107 @@ first_component_command (char *arg, int from_tty) - - extern initialize_file_ftype _initialize_cp_support; /* -Wmissing-prototypes */ - -+#define SKIP_SPACE(P) \ -+ do \ -+ { \ -+ while (*(P) == ' ' || *(P) == '\t') \ -+ ++(P); \ -+ } \ -+ while (0) -+ -+/* Returns the length of the operator name or 0 if INPUT does not -+ point to a valid C++ operator. INPUT should start with "operator". */ -+int -+cp_validate_operator (const char *input) -+{ -+ int i; -+ char *copy; -+ const char *p; -+ struct expression *expr; -+ struct value *val; -+ struct gdb_exception except; -+ struct cleanup *old_chain; -+ -+ p = input; -+ -+ if (strncmp (p, "operator", 8) == 0) -+ { -+ int valid = 0; -+ p += 8; -+ -+ SKIP_SPACE (p); -+ for (i = 0; i < sizeof (operator_tokens) / sizeof (operator_tokens[0]); -+ ++i) -+ { -+ int length = strlen (operator_tokens[i]); -+ /* By using strncmp here, we MUST have operator_tokens ordered! -+ See additional notes where operator_tokens is defined above. */ -+ if (strncmp (p, operator_tokens[i], length) == 0) -+ { -+ const char *op = p; -+ valid = 1; -+ p += length; -+ -+ if (strncmp (op, "new", 3) == 0 -+ || strncmp (op, "delete", 6) == 0) -+ { -+ -+ /* Special case: new[] and delete[]. We must be careful -+ to swallow whitespace before/in "[]". */ -+ SKIP_SPACE (p); -+ -+ if (*p == '[') -+ { -+ ++p; -+ SKIP_SPACE (p); -+ if (*p == ']') -+ ++p; -+ else -+ valid = 0; -+ } -+ } -+ -+ if (valid) -+ return (p - input); -+ } -+ } -+ -+ /* Check input for a conversion operator. */ -+ -+ /* Skip past base typename */ -+ while (*p != '*' && *p != '&' && *p != 0 && *p != ' ') -+ ++p; -+ SKIP_SPACE (p); -+ -+ /* Add modifiers '*'/'&' */ -+ while (*p == '*' || *p == '&') -+ { -+ ++p; -+ SKIP_SPACE (p); -+ } -+ -+ /* Check for valid type. [Remember: input starts with -+ "operator".] */ -+ copy = savestring (input + 8, p - input - 8); -+ expr = NULL; -+ val = NULL; -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ expr = parse_expression (copy); -+ val = evaluate_type (expr); -+ } -+ -+ xfree (copy); -+ if (expr) -+ xfree (expr); -+ -+ if (val != NULL && value_type (val) != NULL) -+ return (p - input); -+ } -+ -+ return 0; -+} -+ - void - _initialize_cp_support (void) - { -diff --git a/gdb/cp-support.h b/gdb/cp-support.h -index b5a5c5f..3f48f98 100644 ---- a/gdb/cp-support.h -+++ b/gdb/cp-support.h -@@ -38,15 +38,33 @@ 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. IMPORT_DEST should always be a strict initial -- substring of IMPORT_SRC. These form a linked list; NEXT is the next element -- of the list. */ -+ namespace IMPORT_DEST. IMPORT_DEST should always be a strict initial -+ substring of IMPORT_SRC. 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; -+ -+ /* Used during import search to temporarly mark this node as searced. */ -+ int searched; - }; - - -@@ -54,6 +72,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); -@@ -72,15 +91,23 @@ extern struct symbol **make_symbol_overload_list (const char *, - extern struct type *cp_lookup_rtti_type (const char *name, - struct block *block); - -+extern int cp_validate_operator (const char *input); -+ - /* Functions/variables from cp-namespace.c. */ - - extern int cp_is_anonymous (const char *namespace); - - extern void cp_add_using_directive (const char *dest, -- const char *src); -+ 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); - - extern void cp_initialize_namespace (void); -@@ -97,15 +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 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 7cb016d..bb9e35a 100644 +index 816a355..e9f56f9 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c -@@ -3581,6 +3581,7 @@ static struct sym_fns aout_sym_fns = +@@ -3570,6 +3570,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 */ @@ -3857,10 +1621,10 @@ index 7cb016d..bb9e35a 100644 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 1f98fa5..9e24482 100644 +index 253e251..6d73fc5 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -959,8 +959,10 @@ Connect to process ID @var{number}, as with the @code{attach} command. +@@ -962,8 +962,10 @@ Connect to process ID @var{number}, as with the @code{attach} command. @itemx -x @var{file} @cindex @code{--command} @cindex @code{-x} @@ -3873,7 +1637,7 @@ index 1f98fa5..9e24482 100644 @item -eval-command @var{command} @itemx -ex @var{command} -@@ -1152,6 +1154,16 @@ for remote debugging. +@@ -1155,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. @@ -3890,7 +1654,7 @@ index 1f98fa5..9e24482 100644 @c resolve the situation of these eventually @item -tui @cindex @code{--tui} -@@ -18660,7 +18672,7 @@ command: +@@ -19101,7 +19113,7 @@ command: @table @code @kindex source @cindex execute commands from a file @@ -3899,7 +1663,7 @@ index 1f98fa5..9e24482 100644 Execute the command file @var{filename}. @end table -@@ -18677,6 +18689,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays +@@ -19118,6 +19130,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays each command as it is executed. The option must be given before @var{filename}, and is interpreted as part of the filename anywhere else. @@ -3911,7 +1675,7 @@ index 1f98fa5..9e24482 100644 Commands that would ask for confirmation if used interactively proceed without asking when used in a command file. Many @value{GDBN} commands that normally print messages to say what they are doing omit the messages -@@ -18938,8 +18955,6 @@ containing @code{end}. For example: +@@ -19379,8 +19396,6 @@ containing @code{end}. For example: @smallexample (@value{GDBP}) python @@ -3920,7 +1684,7 @@ index 1f98fa5..9e24482 100644 >print 23 >end 23 -@@ -18952,6 +18967,14 @@ in a Python script. This can be controlled using @code{maint set +@@ -19393,6 +19408,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. @@ -3935,7 +1699,7 @@ index 1f98fa5..9e24482 100644 @end table @node Python API -@@ -18959,6 +18982,14 @@ disabled. +@@ -19400,6 +19423,14 @@ disabled. @cindex python api @cindex programming in python @@ -3950,7 +1714,7 @@ index 1f98fa5..9e24482 100644 @cindex python stdout @cindex python pagination At startup, @value{GDBN} overrides Python's @code{sys.stdout} and -@@ -18971,13 +19002,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown. +@@ -19412,13 +19443,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown. * Basic Python:: Basic Python Functions. * Exception Handling:: * Auto-loading:: Automatically loading Python code. @@ -3967,9 +1731,9 @@ index 1f98fa5..9e24482 100644 * 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 - -@@ -19004,6 +19039,12 @@ command as having originated from the user invoking it interactively. +@@ -19446,6 +19481,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 @@ -3982,7 +1746,7 @@ index 1f98fa5..9e24482 100644 @findex gdb.parameter @defun parameter parameter Return the value of a @value{GDBN} parameter. @var{parameter} is a -@@ -19020,6 +19061,7 @@ a Python value of the appropriate type, and returned. +@@ -19462,6 +19503,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. @@ -3990,17 +1754,10 @@ index 1f98fa5..9e24482 100644 If @var{number} is negative, then @value{GDBN} will take its absolute value and count backward from the last element (i.e., the most recent element) to find the value to return. If @var{number} is zero, then @value{GDBN} will -@@ -19031,6 +19073,28 @@ If no exception is raised, the return value is always an instance of - @code{gdb.Value} (@pxref{Values From Inferior}). +@@ -19486,6 +19528,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.parse_and_eval -+@defun parse_and_eval expression -+Parse @var{expression} as an expression in the current language, -+evaluate it, and return the result as a @code{gdb.Value}. -+@var{expression} must be a string. -+@end defun -+ +@findex gdb.post_event +@defun post_event event +Put @var{event}, a callable object taking no arguments, into @@ -4019,7 +1776,7 @@ index 1f98fa5..9e24482 100644 @findex gdb.write @defun write string Print a string to @value{GDBN}'s paginated standard output stream. -@@ -19045,6 +19109,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing +@@ -19500,6 +19557,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing function. @end defun @@ -4031,21 +1788,7 @@ index 1f98fa5..9e24482 100644 @node Exception Handling @subsubsection Exception Handling @cindex python exceptions -@@ -19181,6 +19250,13 @@ The type of this @code{gdb.Value}. The value of this attribute is a - The following methods are provided: - - @table @code -+@defmethod Value cast type -+Cast the @code{gdb.Value} to the type represented by @var{type}, and -+return a new @code{gdb.Value}. @var{type} must be a @code{gdb.Type} -+object. If the cast cannot be performed for some reason, an exception -+is thrown. -+@end defmethod -+ - @defmethod Value dereference - For pointer data types, this method returns a new @code{gdb.Value} object - whose contents is the object pointed to by the pointer. For example, if -@@ -19252,6 +19328,9 @@ module: +@@ -19738,6 +19800,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. @@ -4055,20 +1798,7 @@ index 1f98fa5..9e24482 100644 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 -@@ -19304,6 +19383,12 @@ This is @code{True} if the field is artificial, usually meaning that - it was provided by the compiler and not the user. This attribute is - always provided, and is @code{False} if the field is not artificial. - -+@item is_base_class -+This is @code{True} if the field represents a base class of a C@t{++} -+structure. This attribute is always provided, and is @code{False} -+if the field is not a base class of the type on which @code{fields} was -+called, or if that type was not a C@t{++} class. -+ - @item bitsize - If the field is packed, or is a bitfield, then this will have a - non-zero value, which is the size of the field in bits. Otherwise, -@@ -19356,7 +19441,7 @@ If the type does not have a target, this method will throw an +@@ -19860,7 +19925,7 @@ If the type does not have a target, this method will throw an exception. @end defmethod @@ -4077,7 +1807,7 @@ index 1f98fa5..9e24482 100644 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. -@@ -19364,7 +19449,8 @@ return a new @code{gdb.Type} which represents the type of the +@@ -19868,7 +19933,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. @@ -4087,7 +1817,7 @@ index 1f98fa5..9e24482 100644 @end defmethod @end table -@@ -19718,6 +19804,121 @@ import gdb.libstdcxx.v6 +@@ -20222,6 +20288,121 @@ import gdb.libstdcxx.v6 gdb.libstdcxx.v6.register_printers (gdb.current_objfile ()) @end smallexample @@ -4095,9 +1825,9 @@ index 1f98fa5..9e24482 100644 +@subsubsection Inferiors In Python + +Programs which are being run under @value{GDBN} are called inferiors -+(@pxref{Inferiors}). Python scripts can access information about and -+manipulate inferiors controlled by @value{GDBN} via objects of the -+@code{gdb.Inferior} class. ++(@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: @@ -4209,7 +1939,7 @@ index 1f98fa5..9e24482 100644 @node Commands In Python @subsubsection Commands In Python -@@ -19970,6 +20171,135 @@ registration of the command with @value{GDBN}. Depending on how the +@@ -20474,6 +20655,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. @@ -4345,7 +2075,7 @@ index 1f98fa5..9e24482 100644 @node Functions In Python @subsubsection Writing new convenience functions -@@ -20074,6 +20404,82 @@ which is used to format the value. @xref{Pretty Printing}, for more +@@ -20578,6 +20888,82 @@ which is used to format the value. @xref{Pretty Printing}, for more information. @end defivar @@ -4428,7 +2158,7 @@ index 1f98fa5..9e24482 100644 @node Frames In Python @subsubsection Acessing inferior stack frames from Python. -@@ -20138,6 +20544,14 @@ function to a string. +@@ -20642,6 +21028,14 @@ function to a string. Returns the frame's resume address. @end defmethod @@ -4443,7 +2173,7 @@ index 1f98fa5..9e24482 100644 @defmethod Frame older Return the frame that called this frame. @end defmethod -@@ -20146,10 +20560,18 @@ Return the frame that called this frame. +@@ -20650,10 +21044,18 @@ Return the frame that called this frame. Return the frame called by this frame. @end defmethod @@ -4461,12 +2191,12 @@ index 1f98fa5..9e24482 100644 +@end defmethod @end table - @node Interpreters + @node Lazy Strings In Python diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo -index c2be3f7..a7811ab 100644 +index 347c860..5d7002e 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo -@@ -2114,6 +2114,18 @@ time, and so we attempt to handle symbols incrementally. For instance, +@@ -2107,6 +2107,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. @@ -4485,7 +2215,7 @@ index c2be3f7..a7811ab 100644 @section Symbol Reading @cindex symbol reading -@@ -2206,6 +2218,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and +@@ -2199,6 +2211,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 @@ -4493,7 +2223,7 @@ index c2be3f7..a7811ab 100644 @section Partial Symbol Tables @value{GDBN} has three types of symbol tables: -@@ -2301,6 +2314,7 @@ and all the psymbols themselves are allocated in a pair of large arrays +@@ -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. @@ -4501,7 +2231,7 @@ index c2be3f7..a7811ab 100644 @section Types @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}). -@@ -2323,6 +2337,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by +@@ -2316,6 +2330,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. @@ -4509,7 +2239,7 @@ index c2be3f7..a7811ab 100644 @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}). These are instances of type structs that roughly correspond to -@@ -2337,6 +2352,7 @@ only one instance exists, while @file{c-lang.c} builds as many +@@ -2330,6 +2345,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. @@ -4517,7 +2247,7 @@ index c2be3f7..a7811ab 100644 @section Object File Formats @cindex object file formats -@@ -2422,6 +2438,7 @@ SOM, which is a cross-language ABI). +@@ -2415,6 +2431,7 @@ SOM, which is a cross-language ABI). The SOM reader is in @file{somread.c}. @@ -4525,7 +2255,7 @@ index c2be3f7..a7811ab 100644 @section Debugging File Formats This section describes characteristics of debugging information that -@@ -2493,6 +2510,7 @@ DWARF 3 is an improved version of DWARF 2. +@@ -2486,6 +2503,7 @@ DWARF 3 is an improved version of DWARF 2. @cindex SOM debugging info Like COFF, the SOM definition includes debugging information. @@ -4533,7 +2263,7 @@ index c2be3f7..a7811ab 100644 @section Adding a New Symbol Reader to @value{GDBN} @cindex adding debugging info reader -@@ -2515,6 +2533,7 @@ will only ever be implemented by one object file format may be called +@@ -2508,6 +2526,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}. @@ -4541,7 +2271,7 @@ index c2be3f7..a7811ab 100644 @section Memory Management for Symbol Files Most memory associated with a loaded symbol file is stored on -@@ -2526,10 +2545,45 @@ released when the objfile is unloaded or reloaded. Therefore one +@@ -2519,10 +2538,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. @@ -4592,11 +2322,11 @@ index c2be3f7..a7811ab 100644 @node Language Support diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi -index 4984f31..fcf1b5d 100644 +index db3d114..759200f 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi -@@ -206,6 +206,11 @@ Either @value{GDBN} detached from the inferior, or the inferior - exited. The argument @var{pid} identifies the inferior. +@@ -213,6 +213,11 @@ Bytes from @var{data} to @var{data} + @var{len} have been written + to the current inferior at @var{addr}. @end deftypefun +@deftypefun void mark_used (void) @@ -4608,7 +2338,7 @@ index 4984f31..fcf1b5d 100644 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 668c434..c29c3a5 100644 +index 99100d7..5915249 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -38,6 +38,7 @@ @@ -4619,7 +2349,7 @@ index 668c434..c29c3a5 100644 struct comp_unit; -@@ -1574,6 +1575,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) +@@ -1582,6 +1583,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) CORE_ADDR offset; CORE_ADDR seek_pc; @@ -4635,7 +2365,7 @@ index 668c434..c29c3a5 100644 if (fde_table == NULL) continue; diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index 46bc9d7..e675575 100644 +index 5e27d38..628ba88 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -848,6 +848,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, @@ -4653,7 +2383,7 @@ index 46bc9d7..e675575 100644 error (_("Unhandled dwarf expression opcode 0x%x"), op); } diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index a9a8a05..d449012 100644 +index 437ca39..f7fce92 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h @@ -102,10 +102,10 @@ struct dwarf_expr_context @@ -4669,10 +2399,10 @@ index a9a8a05..d449012 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 3a81202..85f4487 100644 +index 6679d74..54d2bae 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -116,6 +116,9 @@ struct dwarf_expr_baton +@@ -121,6 +121,9 @@ struct dwarf_expr_baton { struct frame_info *frame; struct objfile *objfile; @@ -4682,9 +2412,9 @@ index 3a81202..85f4487 100644 }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -177,22 +180,33 @@ dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length) - *start = find_location_expression (symbaton, length, - get_frame_address_in_block (frame)); +@@ -189,22 +192,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, + symbaton = SYMBOL_LOCATION_BATON (framefunc); + *start = find_location_expression (symbaton, length, pc); } - else + else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_locexpr_funcs) @@ -4725,7 +2455,7 @@ index 3a81202..85f4487 100644 } /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for -@@ -215,6 +229,129 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset) +@@ -227,6 +241,129 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset) return target_translate_tls_address (debaton->objfile, offset); } @@ -4855,7 +2585,7 @@ index 3a81202..85f4487 100644 struct piece_closure { /* The number of pieces used to describe this variable. */ -@@ -382,9 +519,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, +@@ -408,9 +545,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, struct dwarf2_per_cu_data *per_cu) { struct value *retval; @@ -4866,14 +2596,13 @@ index 3a81202..85f4487 100644 if (size == 0) { -@@ -394,22 +530,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, +@@ -420,22 +556,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, return retval; } - baton.frame = frame; - baton.objfile = dwarf2_per_cu_objfile (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); - @@ -4885,12 +2614,13 @@ index 3a81202..85f4487 100644 - 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); + - dwarf_expr_eval (ctx, data, size); if (ctx->num_pieces > 0) { struct piece_closure *c; -@@ -439,6 +561,11 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, +@@ -465,6 +587,11 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, CORE_ADDR address = dwarf_expr_fetch (ctx, 0); int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); @@ -4902,7 +2632,7 @@ index 3a81202..85f4487 100644 retval = allocate_value (SYMBOL_TYPE (var)); VALUE_LVAL (retval) = lval_memory; set_value_lazy (retval, 1); -@@ -815,7 +942,7 @@ static int +@@ -872,7 +999,7 @@ static int loclist_describe_location (struct symbol *symbol, struct ui_file *stream) { /* FIXME: Could print the entire list of locations. */ @@ -4911,7 +2641,7 @@ index 3a81202..85f4487 100644 return 1; } -@@ -831,16 +958,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, +@@ -888,16 +1015,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, data = find_location_expression (dlbaton, &size, ax->scope); if (data == NULL) @@ -4972,10 +2702,10 @@ index 3a81202..85f4487 100644 + missing_tracepoint_var_ref +}; diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h -index 0bfcfca..01018d6 100644 +index fa0bd11..fdea2b4 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h -@@ -71,5 +71,11 @@ struct dwarf2_loclist_baton +@@ -72,5 +72,11 @@ struct dwarf2_loclist_baton extern const struct symbol_computed_ops dwarf2_locexpr_funcs; extern const struct symbol_computed_ops dwarf2_loclist_funcs; @@ -4988,23 +2718,19 @@ index 0bfcfca..01018d6 100644 #endif /* dwarf2loc.h */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 4cce36b..fb0a693 100644 +index 243859c..2fccec5 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -48,6 +48,12 @@ +@@ -48,6 +48,8 @@ #include "gdbcmd.h" #include "block.h" #include "addrmap.h" -+#include "f-lang.h" -+#include "c-lang.h" -+#include "typeprint.h" -+#include "jv-lang.h" -+#include "vec.h" +#include "block.h" ++#include "f-lang.h" #include #include "gdb_string.h" -@@ -93,7 +99,7 @@ typedef struct pubnames_header +@@ -96,7 +98,7 @@ typedef struct pubnames_header _PUBNAMES_HEADER; #define _ACTUAL_PUBNAMES_HEADER_SIZE 13 @@ -5013,7 +2739,7 @@ index 4cce36b..fb0a693 100644 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 -@@ -150,7 +156,10 @@ struct dwarf2_section_info +@@ -153,7 +155,10 @@ struct dwarf2_section_info asection *asection; gdb_byte *buffer; bfd_size_type size; @@ -5025,10 +2751,10 @@ index 4cce36b..fb0a693 100644 }; struct dwarf2_per_objfile -@@ -336,6 +345,19 @@ struct dwarf2_cu - - /* Field `ranges_offset' is filled in; flag as the value may be zero. */ - unsigned int has_ranges_offset : 1; +@@ -333,6 +338,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 @@ -5045,41 +2771,17 @@ index 4cce36b..fb0a693 100644 }; /* Persistent data held for a compilation unit, even when not -@@ -495,8 +517,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; - char *dirname; - -@@ -689,6 +710,11 @@ struct field_info - int nfnfields; - }; - -+/* A vector used during linkage name generation. */ -+typedef struct die_info *die_info_p; -+DEF_VEC_P (die_info_p); -+static VEC(die_info_p) *die_list; -+ - /* One item on the queue of compilation units to read in full symbols - for. */ - struct dwarf2_queue_item -@@ -800,7 +826,10 @@ static void scan_partial_symbols (struct partial_die_info *, +@@ -788,6 +806,9 @@ 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 int die_needs_namespace (struct die_info *, struct dwarf2_cu *); + static int pdi_needs_namespace (enum dwarf_tag tag); static void add_partial_namespace (struct partial_die_info *pdi, - CORE_ADDR *lowpc, CORE_ADDR *highpc, -@@ -825,6 +854,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *); +@@ -813,6 +834,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *); static void psymtab_to_symtab_1 (struct partial_symtab *); @@ -5090,42 +2792,7 @@ index 4cce36b..fb0a693 100644 static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu); static void dwarf2_free_abbrev_table (void *); -@@ -945,6 +978,11 @@ static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *); - - static struct type *read_type_die (struct die_info *, struct dwarf2_cu *); - -+static char *physname_prefix (struct die_info *die, struct dwarf2_cu *); -+ -+static void physname_prefix_1 (struct ui_file *, struct die_info *, -+ struct dwarf2_cu *); -+ - static char *determine_prefix (struct die_info *die, struct dwarf2_cu *); - - static char *typename_concat (struct obstack *, -@@ -964,7 +1002,8 @@ static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *, - struct dwarf2_cu *, struct partial_symtab *); - - static int dwarf2_get_pc_bounds (struct die_info *, -- CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *); -+ CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *, -+ struct partial_symtab *pst); - - static void get_scope_pc_bounds (struct die_info *, - CORE_ADDR *, CORE_ADDR *, -@@ -988,17 +1027,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); +@@ -995,6 +1020,15 @@ static void read_module (struct die_info *die, struct dwarf2_cu *cu); static void read_import_statement (struct die_info *die, struct dwarf2_cu *); @@ -5141,28 +2808,17 @@ index 4cce36b..fb0a693 100644 static const char *namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *); -@@ -1032,7 +1079,10 @@ static gdb_byte *read_full_die (const struct die_reader_specs *reader, +@@ -1030,6 +1064,9 @@ static void process_die (struct die_info *, struct dwarf2_cu *); - static void process_die (struct die_info *, struct dwarf2_cu *); + static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *); --static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *); -+static char *dwarf2_physname (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 *); -@@ -1076,7 +1126,7 @@ static int is_ref_attr (struct attribute *); - static unsigned int dwarf2_get_ref_die_offset (struct attribute *); - --static int dwarf2_get_attr_constant_value (struct attribute *, int); -+static CORE_ADDR dwarf2_get_attr_constant_value (struct attribute *, CORE_ADDR); - - static struct die_info *follow_die_ref_or_sig (struct die_info *, - struct attribute *, -@@ -1148,6 +1198,9 @@ static void age_cached_comp_units (void); +@@ -1144,6 +1181,9 @@ static void age_cached_comp_units (void); static void free_one_cached_comp_unit (void *); @@ -5172,7 +2828,7 @@ index 4cce36b..fb0a693 100644 static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); -@@ -1167,22 +1220,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); +@@ -1163,22 +1203,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); @@ -5213,7 +2869,7 @@ index 4cce36b..fb0a693 100644 } /* When loading sections, we can either look for ".", or for -@@ -1275,10 +1337,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) +@@ -1271,10 +1320,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) } /* Decompress a section that was compressed using zlib. Store the @@ -5229,7 +2885,7 @@ index 4cce36b..fb0a693 100644 gdb_byte **outbuf, bfd_size_type *outsize) { bfd *abfd = objfile->obfd; -@@ -1295,6 +1360,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -1291,6 +1343,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, z_stream strm; int rc; int header_size = 12; @@ -5237,7 +2893,7 @@ index 4cce36b..fb0a693 100644 if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 || bfd_bread (compressed_buffer, compressed_size, abfd) != compressed_size) -@@ -1324,8 +1390,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -1320,8 +1373,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; @@ -5253,7 +2909,7 @@ index 4cce36b..fb0a693 100644 rc = inflateInit (&strm); while (strm.avail_in > 0) { -@@ -1346,26 +1417,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -1342,26 +1400,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"), bfd_get_filename (abfd), rc); @@ -5435,7 +3091,7 @@ index 4cce36b..fb0a693 100644 if (info->asection == NULL || info->size == 0) return; -@@ -1378,7 +1599,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1374,7 +1582,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) { @@ -5444,7 +3100,7 @@ index 4cce36b..fb0a693 100644 &info->size); return; } -@@ -1401,7 +1622,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1397,7 +1605,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) if (retbuf != MAP_FAILED) { @@ -5453,7 +3109,7 @@ index 4cce36b..fb0a693 100644 info->buffer = retbuf + (sectp->filepos & (pagesize - 1)) ; return; } -@@ -1409,8 +1630,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1405,8 +1613,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) #endif /* If we get here, we are a normal, not-compressed section. */ @@ -5471,7 +3127,7 @@ index 4cce36b..fb0a693 100644 /* When debugging .o files, we may need to apply relocations; see http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . -@@ -1419,6 +1647,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1415,6 +1630,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) retbuf = symfile_relocate_debug_section (abfd, sectp, buf); if (retbuf != NULL) { @@ -5480,7 +3136,7 @@ index 4cce36b..fb0a693 100644 info->buffer = retbuf; return; } -@@ -1427,6 +1657,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1423,6 +1640,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)); @@ -5500,102 +3156,13 @@ index 4cce36b..fb0a693 100644 } /* Fill in SECTP, BUFP and SIZEP with section info, given OBJFILE and -@@ -1810,6 +2053,37 @@ lookup_signatured_type (struct objfile *objfile, ULONGEST sig) - return entry; - } - -+/* Find the base address of the compilation unit for range lists and -+ location lists. It will normally be specified by DW_AT_low_pc. -+ In DWARF-3 draft 4, the base address could be overridden by -+ DW_AT_entry_pc. It's been removed, but GCC still uses this for -+ compilation units with discontinuous ranges. */ -+ -+static void -+dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu) -+{ -+ struct attribute *attr; -+ -+ cu->base_known = 0; -+ cu->base_address = 0; -+ -+ attr = dwarf2_attr (die, DW_AT_entry_pc, cu); -+ if (attr) -+ { -+ cu->base_address = DW_ADDR (attr); -+ cu->base_known = 1; -+ } -+ else -+ { -+ attr = dwarf2_attr (die, DW_AT_low_pc, cu); -+ if (attr) -+ { -+ cu->base_address = DW_ADDR (attr); -+ cu->base_known = 1; -+ } -+ } -+} -+ - /* Subroutine of process_type_comp_unit and dwarf2_build_psymtabs_hard - to combine the common parts. - Process a compilation unit for a psymtab. -@@ -2359,7 +2633,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; - } - -@@ -2374,12 +2648,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 -@@ -2395,12 +2679,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; -@@ -2491,6 +2772,12 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) +@@ -2548,6 +2778,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); @@ -5603,70 +3170,7 @@ index 4cce36b..fb0a693 100644 case DW_TAG_class_type: case DW_TAG_interface_type: case DW_TAG_structure_type: -@@ -2532,34 +2819,17 @@ 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. */ -+/* Determine whether DIE 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) -+die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) - { -- switch (tag) -+ switch (die->tag) - { - case DW_TAG_namespace: - case DW_TAG_typedef: -@@ -2569,7 +2839,23 @@ pdi_needs_namespace (enum dwarf_tag tag) - 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; -+ attr = dwarf2_attr (die, DW_AT_specification, cu); -+ if (attr) -+ return 1; -+ attr = dwarf2_attr (die, DW_AT_external, cu); -+ if (attr == NULL && die->parent->tag != DW_TAG_namespace) -+ return 0; -+ return 1; -+ } -+ break; -+ - default: - return 0; - } -@@ -2602,12 +2888,12 @@ static void +@@ -2661,12 +2898,12 @@ static void add_partial_module (struct partial_die_info *pdi, CORE_ADDR *lowpc, CORE_ADDR *highpc, int need_pc, struct dwarf2_cu *cu) { @@ -5683,35 +3187,7 @@ index 4cce36b..fb0a693 100644 } /* Read a partial die corresponding to a subprogram and create a partial -@@ -2698,27 +2984,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->comp_unit_obstack); -- xfree (actual_class_name); -- } -- break; -- } -- -- child_pdi = child_pdi->die_sibling; -- } - } - } - -@@ -3295,6 +3560,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) +@@ -3330,6 +3567,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; @@ -5726,246 +3202,21 @@ index 4cce36b..fb0a693 100644 if (die->child != NULL && (die->tag == DW_TAG_imported_declaration || cu->language != language_fortran)) complaint (&symfile_complaints, _("Tag '%s' has unexpected children"), -@@ -3310,41 +3583,71 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) - /* 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. -+ -+ The output string will be canonicalized (if C++/Java). */ - - static const char * - dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu) - { -- struct attribute *attr; -- char *prefix, *name; -- struct ui_file *buf = NULL; -+ char *name; - - name = dwarf2_name (die, cu); -- if (!name) -- return NULL; - - /* These are the only languages we know how to qualify names in. */ -- if (cu->language != language_cplus -- && cu->language != language_java) -- return name; -+ 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; - -- /* 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; -+ buf = mem_fileopen (); -+ prefix = determine_prefix (die, cu); -+ if (*prefix != '\0') -+ { -+ char *prefixed_name = typename_concat (NULL, prefix, name, cu); -+ fputs_unfiltered (prefixed_name, buf); -+ xfree (prefixed_name); -+ } -+ else -+ fputs_unfiltered (name, buf); - -- prefix = determine_prefix (die, cu); -- if (*prefix != '\0') -- name = typename_concat (&cu->objfile->objfile_obstack, prefix, -- name, cu); -+ 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; - } - -+/* 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. */ - - static void -@@ -3354,9 +3657,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) - struct die_info *imported_die; - const char *imported_name; - const char *imported_name_prefix; -- 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) - { -@@ -3404,17 +3713,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) - return; - } - -- /* FIXME: dwarf2_name (die); for the local name after import. */ -- -- /* Figure out where the statement is being imported to. */ -+ /* Figure out the local name after import. */ -+ import_alias = dwarf2_name(die, cu); -+ if(import_alias == NULL){ -+ import_alias = ""; -+ } -+ -+ /* 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, cu); -- -- if (strlen (imported_name_prefix) > 0) -- { -+ -+ 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, "::"); -@@ -3425,8 +3744,14 @@ 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, using_directives); -+ } -+ -+ using_directives = cp_add_using (import_prefix, -+ canonical_name, -+ import_alias, -+ imported_declaration, -+ line_number, -+ using_directives); - } - - static void -@@ -3695,6 +4020,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; - -@@ -3793,6 +4126,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) -@@ -3811,13 +4145,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)) -+ 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; - -@@ -3844,14 +4188,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -3881,6 +4126,13 @@ 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); -@@ -3867,6 +4216,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) + if (die->child != NULL) + { + child_die = die->child; +@@ -3904,6 +4156,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) determine_prefix (die, cu), processing_has_namespace_info); @@ -5979,216 +3230,7 @@ index 4cce36b..fb0a693 100644 /* If we have address ranges, record them. */ dwarf2_record_block_ranges (die, block, baseaddr, cu); -@@ -3903,7 +4259,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) - as multiple lexical blocks? Handling children in a sane way would - be nasty. Might be easier to properly extend generic blocks to - describe ranges. */ -- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu)) -+ if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)) - return; - lowpc += baseaddr; - highpc += baseaddr; -@@ -3920,7 +4276,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) - } - new = pop_context (); - -- if (local_symbols != NULL) -+ if (local_symbols != NULL || using_directives != NULL) - { - struct block *block - = finish_block (0, &local_symbols, new->old_blocks, new->start_addr, -@@ -4075,7 +4431,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return, - discontinuous, i.e. derived from DW_AT_ranges information. */ - static int - dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, -- CORE_ADDR *highpc, struct dwarf2_cu *cu) -+ CORE_ADDR *highpc, struct dwarf2_cu *cu, -+ struct partial_symtab *pst) - { - struct attribute *attr; - CORE_ADDR low = 0; -@@ -4103,7 +4460,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, - { - /* Value of the DW_AT_ranges attribute is the offset in the - .debug_ranges section. */ -- if (!dwarf2_ranges_read (DW_UNSND (attr), &low, &high, cu, NULL)) -+ if (!dwarf2_ranges_read (DW_UNSND (attr), &low, &high, cu, pst)) - return 0; - /* Found discontinuous range of addresses. */ - ret = -1; -@@ -4142,7 +4499,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die, - CORE_ADDR low, high; - struct die_info *child = die->child; - -- if (dwarf2_get_pc_bounds (die, &low, &high, cu)) -+ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)) - { - *lowpc = min (*lowpc, low); - *highpc = max (*highpc, high); -@@ -4179,7 +4536,7 @@ get_scope_pc_bounds (struct die_info *die, - CORE_ADDR best_high = (CORE_ADDR) 0; - CORE_ADDR current_low, current_high; - -- if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu)) -+ if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu, NULL)) - { - best_low = current_low; - best_high = current_high; -@@ -4474,7 +4831,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, - return; - - /* Get physical name. */ -- physname = dwarf2_linkage_name (die, cu); -+ physname = dwarf2_physname (die, cu); - - /* The name is already allocated along with this objfile, so we don't - need to duplicate it for the type. */ -@@ -4617,7 +4974,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 = dwarf2_physname (die, cu); - - /* Look up member function name in fieldlist. */ - for (i = 0; i < fip->nfnfields; i++) -@@ -4661,7 +5018,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, - /* The name is already allocated along with this objfile, so we don't - need to duplicate it for the type. */ - fnp->physname = physname ? physname : ""; -- fnp->type = alloc_type (objfile); -+ fnp->type = alloc_type (objfile, NULL); - this_type = read_type_die (die, cu); - if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC) - { -@@ -4721,18 +5078,18 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, - { - /* Support the .debug_loc offsets */ - if (attr_form_is_block (attr)) -- { -- fnp->voffset = decode_locdesc (DW_BLOCK (attr), cu) + 2; -- } -+ { -+ fnp->voffset = decode_locdesc (DW_BLOCK (attr), cu) + 2; -+ } - else if (attr_form_is_section_offset (attr)) -- { -+ { - dwarf2_complex_location_expr_complaint (); -- } -+ } - else -- { -+ { - dwarf2_invalid_attrib_class_complaint ("DW_AT_vtable_elem_location", - fieldname); -- } -+ } - } - } - -@@ -4845,7 +5202,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu) - return NULL; - - domain_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0)); -- type = alloc_type (objfile); -+ type = alloc_type (objfile, NULL); - smash_to_method_type (type, domain_type, TYPE_TARGET_TYPE (pfn_type), - TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type), - TYPE_VARARGS (pfn_type)); -@@ -4898,7 +5255,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) - return set_die_type (die, type, cu); - } - -- type = alloc_type (objfile); -+ type = alloc_type (objfile, NULL); - INIT_CPLUS_SPECIFIC (type); - - name = dwarf2_name (die, cu); -@@ -4907,14 +5264,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 (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); - } - } - -@@ -5124,7 +5485,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) - return set_die_type (die, type, cu); - } - -- type = alloc_type (objfile); -+ type = alloc_type (objfile, NULL); - - TYPE_CODE (type) = TYPE_CODE_ENUM; - name = dwarf2_full_name (die, cu); -@@ -5152,51 +5513,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. -@@ -5274,6 +5590,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -5385,6 +5644,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) new_symbol (die, this_type, cu); } @@ -6218,7 +3260,7 @@ index 4cce36b..fb0a693 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. */ -@@ -5287,7 +5626,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5398,7 +5680,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; @@ -6227,7 +3269,7 @@ index 4cce36b..fb0a693 100644 struct cleanup *back_to; char *name; -@@ -5334,16 +5673,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5445,16 +5727,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) @@ -6249,122 +3291,7 @@ index 4cce36b..fb0a693 100644 /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -5410,12 +5744,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu) - return set_die_type (die, set_type, cu); - } - --/* First cut: install each common block member as a global variable. */ -+/* Create appropriate locally-scoped variables for all the DW_TAG_common_block -+ entries. Create also TYPE_CODE_STRUCT listing all such variables to be -+ available for `info common'. COMMON_BLOCK_DOMAIN is used to sepate the -+ common blocks name namespace from regular variable names. */ - - static void - read_common_block (struct die_info *die, struct dwarf2_cu *cu) - { -- struct die_info *child_die; - struct attribute *attr; - struct symbol *sym; - CORE_ADDR base = (CORE_ADDR) 0; -@@ -5425,25 +5761,55 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) - { - /* Support the .debug_loc offsets */ - if (attr_form_is_block (attr)) -- { -- base = decode_locdesc (DW_BLOCK (attr), cu); -- } -+ { -+ base = decode_locdesc (DW_BLOCK (attr), cu); -+ } - else if (attr_form_is_section_offset (attr)) -- { -+ { - dwarf2_complex_location_expr_complaint (); -- } -+ } - else -- { -+ { - dwarf2_invalid_attrib_class_complaint ("DW_AT_location", - "common block member"); -- } -+ } - } - if (die->child != NULL) - { -+ struct objfile *objfile = cu->objfile; -+ struct die_info *child_die; -+ struct type *type; -+ struct field *field; -+ char *name; -+ struct symbol *sym; -+ -+ type = alloc_type (objfile, NULL); -+ TYPE_CODE (type) = TYPE_CODE_STRUCT; -+ /* Artificial type to be used only by `info common'. */ -+ TYPE_NAME (type) = ""; -+ - child_die = die->child; - while (child_die && child_die->tag) - { -+ TYPE_NFIELDS (type)++; -+ child_die = sibling_die (child_die); -+ } -+ -+ TYPE_FIELDS (type) = obstack_alloc (&objfile->objfile_obstack, -+ sizeof (*TYPE_FIELDS (type)) -+ * TYPE_NFIELDS (type)); -+ memset (TYPE_FIELDS (type), 0, sizeof (*TYPE_FIELDS (type)) -+ * TYPE_NFIELDS (type)); -+ -+ field = TYPE_FIELDS (type); -+ child_die = die->child; -+ while (child_die && child_die->tag) -+ { -+ /* Create the symbol in the DW_TAG_common_block block in the current -+ symbol scope. */ - sym = new_symbol (child_die, NULL, cu); -+ -+ /* Undocumented in DWARF3, when it can be present? */ - attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu); - if (attr) - { -@@ -5461,8 +5827,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) - SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset; - add_symbol_to_list (sym, &global_symbols); - } -+ -+ if (SYMBOL_CLASS (sym) == LOC_STATIC) -+ SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym)); -+ else -+ SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym)); -+ FIELD_TYPE (*field) = SYMBOL_TYPE (sym); -+ FIELD_NAME (*field) = SYMBOL_NATURAL_NAME (sym); -+ field++; - child_die = sibling_die (child_die); - } -+ -+ /* TYPE_LENGTH (type) is left 0 - it is only a virtual structure even -+ with no consecutive address space. */ -+ -+ sym = new_symbol (die, type, cu); -+ /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */ -+ SYMBOL_VALUE_ADDRESS (sym) = base; -+ -+ set_die_type (die, type, cu); - } - } - -@@ -5530,7 +5913,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)); -+ cp_add_using_directive (previous_prefix, TYPE_NAME (type), "", "", dwarf2_read_decl_line(die, cu)); - } - } - -@@ -5546,20 +5929,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) +@@ -5659,20 +5936,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) } } @@ -6377,13 +3304,14 @@ index 4cce36b..fb0a693 100644 { - struct die_info *child_die = die->child; + struct type *type; -+ + +- /* FIXME: Support the separate Fortran module namespaces. */ + 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 @@ -6412,10 +3340,9 @@ index 4cce36b..fb0a693 100644 + type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile); + + /* Create a context for reading the module variables. */ - -- /* FIXME: Support the separate Fortran module namespaces. */ ++ + new = push_context (0, 0); - ++ + save_file_symbols = file_symbols; + file_symbols = NULL; + save_global_symbols = global_symbols; @@ -6519,11 +3446,11 @@ index 4cce36b..fb0a693 100644 + sym = new_symbol (imported_die, NULL, cu); + + if (sym && rename) -+ (sym)->ginfo.language_specific.cplus_specific.demangled_name = rename; ++ SYMBOL_CPLUS_DEMANGLED_NAME (sym) = rename; } /* Return the name of the namespace represented by DIE. Set -@@ -5724,29 +6242,113 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5837,29 +6249,113 @@ 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; @@ -6532,7 +3459,7 @@ index 4cce36b..fb0a693 100644 + + index_type = objfile_type (objfile)->builtin_int; + /* RANGE_TYPE is allocated from OBJFILE, not as a permanent type. */ -+ range_type = alloc_type (objfile, NULL); ++ range_type = alloc_type (objfile); + /* LOW_BOUND and HIGH_BOUND are set for real below. */ + range_type = create_range_type (range_type, index_type, 0, -1); + @@ -6608,8 +3535,8 @@ index 4cce36b..fb0a693 100644 + } + } + -+ TYPE_RANGE_BOUND_SET_DWARF_BLOCK (range_type, 1); -+ TYPE_FIELD_DWARF_BLOCK (range_type, 1) = length_baton; ++ TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1; ++ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = length_baton; + TYPE_DYNAMIC (range_type) = 1; + } } @@ -6632,8 +3559,8 @@ index 4cce36b..fb0a693 100644 - } + if (attr && attr_form_is_block (attr)) + { -+ TYPE_RANGE_BOUND_SET_DWARF_BLOCK (range_type, 1); -+ TYPE_FIELD_DWARF_BLOCK (range_type, 1) = ++ TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1; ++ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = + dwarf2_attr_to_locexpr_baton (attr, cu); + TYPE_DYNAMIC (range_type) = 1; + } @@ -6651,7 +3578,7 @@ index 4cce36b..fb0a693 100644 char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -5841,7 +6443,6 @@ static struct type * +@@ -5959,7 +6455,6 @@ static struct type * read_typedef (struct die_info *die, struct dwarf2_cu *cu) { struct objfile *objfile = cu->objfile; @@ -6659,17 +3586,17 @@ index 4cce36b..fb0a693 100644 const char *name = NULL; struct type *this_type; -@@ -5949,8 +6550,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -6067,8 +6562,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; -- int low = 0; -- int high = -1; -+ int low; +- LONGEST low = 0; +- LONGEST high = -1; ++ LONGEST low; char *name; + LONGEST negative_mask; - base_type = die_type (die, cu); -@@ -5963,42 +6563,89 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -6082,49 +6576,101 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) 0, NULL, cu->objfile); } @@ -6680,6 +3607,9 @@ index 4cce36b..fb0a693 100644 - } + /* LOW_BOUND and HIGH_BOUND are set for real below. */ + range_type = create_range_type (NULL, base_type, 0, -1); ++ ++ negative_mask = ++ (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); - /* FIXME: For variable sized arrays either of these could be - a variable rather than a constant value. We'll allow it, @@ -6689,9 +3619,9 @@ index 4cce36b..fb0a693 100644 - low = dwarf2_get_attr_constant_value (attr, 0); + if (attr && attr_form_is_block (attr)) + { -+ TYPE_RANGE_BOUND_SET_DWARF_BLOCK (range_type, 0); -+ TYPE_FIELD_DWARF_BLOCK (range_type, 0) = dwarf2_attr_to_locexpr_baton -+ (attr, cu); ++ TYPE_LOW_BOUND_IS_DWARF_BLOCK (range_type) = 1; ++ TYPE_RANGE_DATA (range_type)->low.u.dwarf_block = ++ dwarf2_attr_to_locexpr_baton (attr, cu); + TYPE_DYNAMIC (range_type) = 1; + /* For setting a default if DW_AT_UPPER_BOUND would be missing. */ + low = 0; @@ -6714,6 +3644,8 @@ index 4cce36b..fb0a693 100644 + low = 0; + } + } ++ if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) ++ low |= negative_mask; + TYPE_LOW_BOUND (range_type) = low; + if (low >= 0) + TYPE_UNSIGNED (range_type) = 1; @@ -6737,6 +3669,8 @@ index 4cce36b..fb0a693 100644 - the lower bound we've computed above. */ - high = low - 1; - } +- else +- high = dwarf2_get_attr_constant_value (attr, 1); + if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr))) + { + attr = dwarf2_attr (die, DW_AT_count, cu); @@ -6747,35 +3681,47 @@ index 4cce36b..fb0a693 100644 + TYPE_DYNAMIC (range_type) = 1; + } + /* Pass it now as the regular DW_AT_upper_bound. */ -+ } -+ + } + +- negative_mask = +- (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); +- if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) +- low |= negative_mask; +- if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) +- high |= negative_mask; + if (attr && attr_form_is_block (attr)) + { -+ TYPE_RANGE_BOUND_SET_DWARF_BLOCK (range_type, 1); -+ TYPE_FIELD_DWARF_BLOCK (range_type, 1) = dwarf2_attr_to_locexpr_baton -+ (attr, cu); ++ TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1; ++ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = ++ dwarf2_attr_to_locexpr_baton (attr, cu); + TYPE_DYNAMIC (range_type) = 1; + } + else + { + if (attr && attr_form_is_constant (attr)) -+ TYPE_HIGH_BOUND (range_type) = dwarf2_get_attr_constant_value (attr, 0); - else -- high = dwarf2_get_attr_constant_value (attr, 1); + { -+ TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (range_type) = 1; -+ TYPE_HIGH_BOUND (range_type) = low - 1; -+ } - } ++ LONGEST high; - range_type = create_range_type (NULL, base_type, low, 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 ++ { ++ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; ++ TYPE_HIGH_BOUND (range_type) = low - 1; ++ } ++ } ++ + /* 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)) + { -+ TYPE_RANGE_BOUND_SET_DWARF_BLOCK (range_type, 2); -+ TYPE_FIELD_DWARF_BLOCK (range_type, 2) = dwarf2_attr_to_locexpr_baton -+ (attr, cu); ++ TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (range_type) = 1; ++ TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_block = ++ dwarf2_attr_to_locexpr_baton (attr, cu); + TYPE_DYNAMIC (range_type) = 1; + } + else if (attr && attr_form_is_constant (attr)) @@ -6788,7 +3734,7 @@ index 4cce36b..fb0a693 100644 name = dwarf2_name (die, cu); if (name) -@@ -6469,6 +7116,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr, +@@ -6583,6 +7129,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 @@ -6796,27 +3742,7 @@ index 4cce36b..fb0a693 100644 && abbrev->tag != DW_TAG_member) { /* Otherwise we skip to the next sibling, if any. */ -@@ -6689,9 +7337,6 @@ read_partial_die (struct partial_die_info *part_die, - if (part_die->dirname == NULL) - part_die->dirname = DW_STRING (&attr); - break; -- case DW_AT_MIPS_linkage_name: -- part_die->name = DW_STRING (&attr); -- break; - case DW_AT_low_pc: - has_low_pc_attr = 1; - part_die->lowpc = DW_ADDR (&attr); -@@ -6923,7 +7568,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; - -@@ -8265,10 +8911,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, +@@ -8331,10 +8878,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 @@ -6831,57 +3757,27 @@ index 4cce36b..fb0a693 100644 } /* Given a pointer to a DWARF information entry, figure out if we need -@@ -8290,21 +8938,30 @@ 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, +@@ -8367,10 +8916,17 @@ 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)); + /* Some methods are called w/o checking SYMBOL_COMPUTED_OPS validity. */ + SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs; -- /* Cache this symbol's name and the name's demangled form (if any). */ + /* 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), objfile); -+ -+ /* Cache this symbol's name and the name's demangled form (if any). */ -+ -+ linkagename = dwarf2_physname (die, cu); -+ SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), objfile); + SYMBOL_SET_NAMES (sym, name, strlen (name), 0, objfile); + if (cu->language == language_fortran) + { -+ (sym)->ginfo.language_specific.cplus_specific.demangled_name = -+ SYMBOL_LINKAGE_NAME (sym); ++ 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. */ -@@ -8402,9 +9059,28 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - if (attr) - { +@@ -8470,7 +9026,18 @@ 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); -+ -+ /* Fortran explicitely imports any global symbols to the local -+ scope by DW_TAG_common_block. */ -+ if (cu->language == language_fortran && die->parent -+ && die->parent->tag == DW_TAG_common_block) -+ attr2 = NULL; -+ if (attr2 && (DW_UNSND (attr2) != 0)) - add_symbol_to_list (sym, &global_symbols); + { @@ -6899,24 +3795,10 @@ index 4cce36b..fb0a693 100644 else add_symbol_to_list (sym, cu->list_in_scope); } -@@ -8534,7 +9210,7 @@ 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_name (die, cu); - attr = dwarf2_attr (die, DW_AT_const_value, cu); - if (attr) - { -@@ -8558,6 +9234,16 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -8631,6 +9198,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_common_block: -+ SYMBOL_CLASS (sym) = LOC_STATIC; -+ SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN; -+ add_symbol_to_list (sym, cu->list_in_scope); -+ break; + case DW_TAG_module: + SYMBOL_CLASS (sym) = LOC_STATIC; + SYMBOL_DOMAIN (sym) = MODULE_DOMAIN; @@ -6925,17 +3807,7 @@ index 4cce36b..fb0a693 100644 default: /* Not a tag we recognize. Hopefully we aren't processing trash data, but since we must specifically ignore things -@@ -8571,8 +9257,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); -@@ -8823,12 +9508,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) +@@ -8957,12 +9529,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) case DW_TAG_namespace: this_type = read_namespace_type (die, cu); break; @@ -6954,188 +3826,10 @@ index 4cce36b..fb0a693 100644 return this_type; } -@@ -8910,10 +9601,100 @@ 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); - } +@@ -9110,6 +9688,39 @@ dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) + return dwarf2_name (die, cu); } -+/* Determines the prefix for a symbol's physname. Unlike determine_prefix, -+ this method does not simply look at the DIE's immediate parent. -+ It will compute the symbol's physname by scanning through all parent -+ DIEs until it gets to the compilation unit's DIE. */ -+ -+static char * -+physname_prefix (struct die_info *die, struct dwarf2_cu *cu) -+{ -+ long length; -+ struct ui_file *buf; -+ struct die_info *d, *spec_die; -+ struct dwarf2_cu *spec_cu; -+ char *name; -+ -+ /* Construct a stack containing all of the DIE's parents. Caution -+ must be observed for dealing with DW_AT_specification. */ -+ spec_cu = cu; -+ spec_die = die_specification (die, &spec_cu); -+ if (spec_die != NULL) -+ d = spec_die->parent; -+ else -+ d = die->parent; -+ while (d != NULL && d->tag != DW_TAG_compile_unit) -+ { -+ struct attribute *attr; -+ -+ spec_die = die_specification (d, &spec_cu); -+ if (spec_die != NULL) -+ d = spec_die; -+ -+ VEC_quick_push (die_info_p, die_list, d); -+ d = d->parent; -+ } -+ -+ /* Now pop all the elements, printing their names as we go. */ -+ buf = mem_fileopen (); -+ while (!VEC_empty (die_info_p, die_list)) -+ { -+ d = VEC_pop (die_info_p, die_list); -+ physname_prefix_1 (buf, d, cu); -+ -+ if (!VEC_empty (die_info_p, die_list)) -+ { -+ if (cu->language == language_cplus) -+ fputs_unfiltered ("::", buf); -+ else -+ fputs_unfiltered (".", buf); -+ } -+ } -+ -+ name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack, &length); -+ ui_file_delete (buf); -+ return name; -+} -+ -+static void -+physname_prefix_1 (struct ui_file *buf, struct die_info *die, -+ struct dwarf2_cu *cu) -+{ -+ const char *name = NULL; -+ gdb_assert (buf != NULL); -+ -+ if (die != NULL) -+ { -+ switch (die->tag) -+ { -+ case DW_TAG_namespace: -+ name = dwarf2_name (die, cu); -+ if (name == NULL) -+ name = "(anonymous namespace)"; -+ break; -+ -+ case DW_TAG_class_type: -+ case DW_TAG_structure_type: -+ case DW_TAG_union_type: -+ case DW_TAG_enumeration_type: -+ case DW_TAG_interface_type: -+ case DW_TAG_subprogram: -+ name = dwarf2_name (die, cu); -+ break; -+ -+ default: -+ break; -+ } -+ } -+ -+ if (name != NULL) -+ fputs_unfiltered (name, buf); -+} -+ - /* Return a newly-allocated string formed by concatenating PREFIX and - SUFFIX with appropriate separator. If PREFIX or SUFFIX is NULL or empty, then - simply copy the SUFFIX or PREFIX, respectively. If OBS is non-null, -@@ -8963,17 +9744,111 @@ sibling_die (struct die_info *die) - return die->sibling; - } - --/* Get linkage name of a die, return NULL if not found. */ -+/* Construct a physname for the given DIE in CU. */ - - static char * --dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) -+dwarf2_physname (struct die_info *die, struct dwarf2_cu *cu) - { - struct attribute *attr; -+ char *name; -+ -+ name = dwarf2_name (die, cu); -+ -+ /* These are the only languages we know how to qualify names in. */ -+ if (cu->language != language_cplus -+ && cu->language != language_java) -+ return name; -+ -+ if (die_needs_namespace (die, cu)) -+ { -+ long length; -+ char *prefix; -+ struct ui_file *buf; -+ -+ prefix = physname_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 ((cu->language == language_cplus || cu->language == language_java) -+ && die->tag == DW_TAG_subprogram) -+ { -+ 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) -+ { -+ /* c_type_print_args adds argument types, but it does -+ not add any necessary "const". */ -+ 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 .symtab name for symbols contained in Fortran + modules. Return DWARF2_NAME otherwise. */ + @@ -7155,11 +3849,7 @@ index 4cce36b..fb0a693 100644 + 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) @@ -7171,241 +3861,12 @@ index 4cce36b..fb0a693 100644 + } + + return name; - } - - /* Get name of a die, return NULL if not found. */ -@@ -10200,11 +11075,11 @@ dwarf2_get_ref_die_offset (struct attribute *attr) - return 0; - } - --/* Return the constant value held by the given attribute. Return -1 -+/* Return the constant value held by the given attribute. Return DEFAULT_VALUE - if the value held by the attribute is not constant. */ - --static int --dwarf2_get_attr_constant_value (struct attribute *attr, int default_value) -+static CORE_ADDR -+dwarf2_get_attr_constant_value (struct attribute *attr, CORE_ADDR default_value) - { - if (attr->form == DW_FORM_sdata) - return DW_SND (attr); -@@ -11009,8 +11884,6 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, - { - gdb_byte *mac_ptr, *mac_end; - struct macro_source_file *current_file = 0; -- enum dwarf_macinfo_record_type macinfo_type; -- int at_commandline; - - if (dwarf2_per_objfile->macinfo.buffer == NULL) - { -@@ -11018,29 +11891,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, - return; - } - -- /* First pass: Find the name of the base filename. -- This filename is needed in order to process all macros whose definition -- (or undefinition) comes from the command line. These macros are defined -- before the first DW_MACINFO_start_file entry, and yet still need to be -- associated to the base file. -- -- To determine the base file name, we scan the macro definitions until we -- reach the first DW_MACINFO_start_file entry. We then initialize -- CURRENT_FILE accordingly so that any macro definition found before the -- first DW_MACINFO_start_file can still be associated to the base file. */ -- - mac_ptr = dwarf2_per_objfile->macinfo.buffer + offset; - mac_end = dwarf2_per_objfile->macinfo.buffer - + dwarf2_per_objfile->macinfo.size; - -- do -+ for (;;) - { -+ enum dwarf_macinfo_record_type macinfo_type; ++} + - /* Do we at least have room for a macinfo type byte? */ - if (mac_ptr >= mac_end) - { -- /* Complaint is printed during the second pass as GDB will probably -- stop the first pass earlier upon finding DW_MACINFO_start_file. */ -- break; -+ dwarf2_macros_too_long_complaint (); -+ return; - } + /* Get name of a die, return NULL if not found. */ - macinfo_type = read_1_byte (abfd, mac_ptr); -@@ -11051,92 +11914,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, - /* A zero macinfo type indicates the end of the macro - information. */ - case 0: -- break; -- -- case DW_MACINFO_define: -- case DW_MACINFO_undef: -- /* Only skip the data by MAC_PTR. */ -- { -- unsigned int bytes_read; -- -- read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- read_string (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- } -- break; -- -- case DW_MACINFO_start_file: -- { -- unsigned int bytes_read; -- int line, file; -- -- line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- -- current_file = macro_start_file (file, line, current_file, comp_dir, -- lh, cu->objfile); -- } -- break; -- -- case DW_MACINFO_end_file: -- /* No data to skip by MAC_PTR. */ -- break; -- -- case DW_MACINFO_vendor_ext: -- /* Only skip the data by MAC_PTR. */ -- { -- unsigned int bytes_read; -- -- read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- read_string (abfd, mac_ptr, &bytes_read); -- mac_ptr += bytes_read; -- } -- break; -- -- default: -- break; -- } -- } while (macinfo_type != 0 && current_file == NULL); -- -- /* Second pass: Process all entries. -- -- Use the AT_COMMAND_LINE flag to determine whether we are still processing -- command-line macro definitions/undefinitions. This flag is unset when we -- reach the first DW_MACINFO_start_file entry. */ -- -- mac_ptr = dwarf2_per_objfile->macinfo.buffer + offset; -- -- /* Determines if GDB is still before first DW_MACINFO_start_file. If true -- GDB is still reading the definitions from command line. First -- DW_MACINFO_start_file will need to be ignored as it was already executed -- to create CURRENT_FILE for the main source holding also the command line -- definitions. On first met DW_MACINFO_start_file this flag is reset to -- normally execute all the remaining DW_MACINFO_start_file macinfos. */ -- -- at_commandline = 1; -- -- do -- { -- /* Do we at least have room for a macinfo type byte? */ -- if (mac_ptr >= mac_end) -- { -- dwarf2_macros_too_long_complaint (); -- break; -- } -- -- macinfo_type = read_1_byte (abfd, mac_ptr); -- mac_ptr++; -- -- switch (macinfo_type) -- { -- /* A zero macinfo type indicates the end of the macro -- information. */ -- case 0: -- break; -+ return; - - case DW_MACINFO_define: - case DW_MACINFO_undef: -@@ -11151,31 +11929,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, - mac_ptr += bytes_read; - - if (! current_file) -- { -- /* DWARF violation as no main source is present. */ -- complaint (&symfile_complaints, -- _("debug info with no main source gives macro %s " -- "on line %d: %s"), -- macinfo_type == -- DW_MACINFO_define ? _("definition") : macinfo_type == -- DW_MACINFO_undef ? _("undefinition") : -- "something-or-other", line, body); -- break; -- } -- if ((line == 0 && !at_commandline) || (line != 0 && at_commandline)) - complaint (&symfile_complaints, -- _("debug info gives %s macro %s with %s line %d: %s"), -- at_commandline ? _("command-line") : _("in-file"), -+ _("debug info gives macro %s outside of any file: %s"), - macinfo_type == -- DW_MACINFO_define ? _("definition") : macinfo_type == -- DW_MACINFO_undef ? _("undefinition") : -- "something-or-other", -- line == 0 ? _("zero") : _("non-zero"), line, body); -- -- if (macinfo_type == DW_MACINFO_define) -- parse_macro_definition (current_file, line, body); -- else if (macinfo_type == DW_MACINFO_undef) -- macro_undef (current_file, line, body); -+ DW_MACINFO_define ? "definition" : macinfo_type == -+ DW_MACINFO_undef ? "undefinition" : -+ "something-or-other", body); -+ else -+ { -+ if (macinfo_type == DW_MACINFO_define) -+ parse_macro_definition (current_file, line, body); -+ else if (macinfo_type == DW_MACINFO_undef) -+ macro_undef (current_file, line, body); -+ } - } - break; - -@@ -11189,22 +11955,9 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, - file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); - mac_ptr += bytes_read; - -- if ((line == 0 && !at_commandline) || (line != 0 && at_commandline)) -- complaint (&symfile_complaints, -- _("debug info gives source %d included " -- "from %s at %s line %d"), -- file, at_commandline ? _("command-line") : _("file"), -- line == 0 ? _("zero") : _("non-zero"), line); -- -- if (at_commandline) -- { -- /* This DW_MACINFO_start_file was executed in the pass one. */ -- at_commandline = 0; -- } -- else -- current_file = macro_start_file (file, line, -- current_file, comp_dir, -- lh, cu->objfile); -+ current_file = macro_start_file (file, line, -+ current_file, comp_dir, -+ lh, cu->objfile); - } - break; - -@@ -11258,7 +12011,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, - } - break; - } -- } while (macinfo_type != 0); -+ } - } - - /* Check if the attribute's form is a DW_FORM_block* -@@ -11318,6 +12071,34 @@ attr_form_is_constant (struct attribute *attr) + static char * +@@ -11455,6 +12066,34 @@ attr_form_is_constant (struct attribute *attr) } } @@ -7440,7 +3901,7 @@ index 4cce36b..fb0a693 100644 static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu) -@@ -11347,35 +12128,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, +@@ -11484,35 +12123,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs; SYMBOL_LOCATION_BATON (sym) = baton; } @@ -7491,7 +3952,7 @@ index 4cce36b..fb0a693 100644 } } -@@ -11663,6 +12434,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) +@@ -11800,6 +12429,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) return ofs_lhs->offset == ofs_rhs->offset; } @@ -7523,16 +3984,16 @@ index 4cce36b..fb0a693 100644 /* Set the type associated with DIE to TYPE. Save it in CU's hash table if necessary. For convenience, return TYPE. */ -@@ -11671,6 +12467,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -11808,6 +12462,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { struct dwarf2_offset_and_type **slot, ofs; + fetch_die_type_attrs (die, type, cu); + - if (cu->type_hash == NULL) - { - gdb_assert (cu->per_cu != NULL); -@@ -11813,23 +12611,13 @@ show_dwarf2_cmd (char *args, int from_tty) + /* 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 +@@ -11963,23 +12619,13 @@ show_dwarf2_cmd (char *args, int from_tty) cmd_show_list (show_dwarf2_cmdlist, from_tty, ""); } @@ -7560,7 +4021,7 @@ index 4cce36b..fb0a693 100644 } /* munmap debug sections for OBJFILE, if necessary. */ -@@ -11838,15 +12626,15 @@ static void +@@ -11988,15 +12634,15 @@ static void dwarf2_per_objfile_free (struct objfile *objfile, void *d) { struct dwarf2_per_objfile *data = d; @@ -7585,39 +4046,56 @@ index 4cce36b..fb0a693 100644 } void _initialize_dwarf2_read (void); -@@ -11854,6 +12642,7 @@ void _initialize_dwarf2_read (void); - void - _initialize_dwarf2_read (void) - { -+ die_list = VEC_alloc (die_info_p, 32); - dwarf2_objfile_data_key - = register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free); - diff --git a/gdb/elfread.c b/gdb/elfread.c -index 6e79d4a..198bae3 100644 +index 78e9163..4e208d1 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -728,10 +728,18 @@ elf_symfile_read (struct objfile *objfile, int mainline) +@@ -879,20 +879,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 +903,20 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) + } + } + +static void +read_psyms (struct objfile *objfile) +{ - if (dwarf2_has_info (objfile)) - { - /* DWARF 2 sections */ -- dwarf2_build_psymtabs (objfile, mainline); -+ dwarf2_build_psymtabs (objfile, 0); - } - - /* FIXME: kettenis/20030504: This still needs to be integrated with -@@ -881,6 +889,7 @@ static struct sym_fns elf_sym_fns = ++ 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); ++} ++ + /* 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 +1059,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 */ @@ -7626,60 +4104,23 @@ index 6e79d4a..198bae3 100644 default_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */ elf_symfile_segments, /* sym_segments: Get segment information from diff --git a/gdb/eval.c b/gdb/eval.c -index 2926465..b53f895 100644 +index 3dbbc8b..4deb82d 100644 --- a/gdb/eval.c +++ b/gdb/eval.c -@@ -39,8 +39,12 @@ +@@ -39,10 +39,12 @@ #include "exceptions.h" #include "regcache.h" #include "user-regs.h" +#include "python/python.h" #include "valprint.h" -+#include "gdb_obstack.h" -+#include "objfiles.h" + #include "gdb_obstack.h" + #include "objfiles.h" #include "python/python.h" +#include "dwarf2loc.h" #include "gdb_assert.h" -@@ -651,6 +655,36 @@ ptrmath_type_p (struct type *type) - } - } - -+/* Constructs a fake method with the given parameter types. */ -+static void -+free_param_types (void *arg) -+{ -+ struct type *type = (struct type *) arg; -+ xfree (TYPE_FIELDS (type)); -+ xfree (TYPE_MAIN_TYPE (type)); -+ xfree (type); -+} -+ -+static struct type * -+make_params (int num_types, struct type **param_types) -+{ -+ struct type *type = XZALLOC (struct type); -+ TYPE_MAIN_TYPE (type) = XZALLOC (struct main_type); -+ TYPE_LENGTH (type) = 1; -+ TYPE_CODE (type) = TYPE_CODE_METHOD; -+ TYPE_VPTR_FIELDNO (type) = -1; -+ TYPE_CHAIN (type) = type; -+ TYPE_NFIELDS (type) = num_types; -+ TYPE_FIELDS (type) = (struct field *) -+ TYPE_ZALLOC (type, sizeof (struct field) * num_types); -+ -+ while (num_types-- > 0) -+ TYPE_FIELD_TYPE (type, num_types) = param_types[num_types]; -+ -+ make_cleanup (free_param_types, type); -+ return type; -+} -+ - struct value * - evaluate_subexp_standard (struct type *expect_type, - struct expression *exp, int *pos, -@@ -671,6 +705,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -696,6 +698,7 @@ evaluate_subexp_standard (struct type *expect_type, long mem_offset; struct type **arg_types; int save_pos1; @@ -7687,87 +4128,7 @@ index 2926465..b53f895 100644 pc = (*pos)++; op = exp->elts[pc].opcode; -@@ -684,7 +719,7 @@ evaluate_subexp_standard (struct type *expect_type, - goto nosideret; - arg1 = value_aggregate_elt (exp->elts[pc + 1].type, - &exp->elts[pc + 3].string, -- 0, noside); -+ expect_type, 0, noside); - if (arg1 == NULL) - error (_("There is no field named %s"), &exp->elts[pc + 3].string); - return arg1; -@@ -1293,7 +1328,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)++; - -@@ -1317,21 +1351,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")); - } -- 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) - { -@@ -1457,8 +1510,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) - { -@@ -1549,6 +1601,8 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1588,6 +1591,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); @@ -7776,7 +4137,7 @@ index 2926465..b53f895 100644 type = check_typedef (value_type (arg1)); code = TYPE_CODE (type); -@@ -1569,6 +1623,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1608,6 +1613,7 @@ evaluate_subexp_standard (struct type *expect_type, code = TYPE_CODE (type); } } @@ -7784,45 +4145,7 @@ index 2926465..b53f895 100644 switch (code) { -@@ -1716,6 +1771,37 @@ evaluate_subexp_standard (struct type *expect_type, - error (_("non-pointer-to-member value used in pointer-to-member construct")); - } - -+ case TYPE_INSTANCE: -+ nargs = longest_to_int (exp->elts[pc + 1].longconst); -+ arg_types = (struct type **) alloca (nargs * sizeof (struct type *)); -+ for (ix = 0; ix < nargs; ++ix) -+ arg_types[ix] = exp->elts[pc + 1 + ix + 1].type; -+ -+ expect_type = make_params (nargs, arg_types); -+ *(pos) += 3 + nargs; -+ return evaluate_subexp_standard (expect_type, exp, pos, noside); -+ -+ case TYPE_INSTANCE_LOOKUP: -+ { -+ int i; -+ struct symbol *sym; -+ struct type **arg_types; -+ (*pos) += 3; -+ printf ("TYPE_INSTANCE_LOOKUP\n"); -+ 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); -@@ -1987,13 +2073,19 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2040,13 +2046,19 @@ evaluate_subexp_standard (struct type *expect_type, { int subscript_array[MAX_FORTRAN_DIMS]; int array_size_array[MAX_FORTRAN_DIMS]; @@ -7842,7 +4165,7 @@ index 2926465..b53f895 100644 tmp_type = check_typedef (value_type (arg1)); ndimensions = calc_f77_array_dims (type); -@@ -2023,6 +2115,9 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2076,6 +2088,9 @@ evaluate_subexp_standard (struct type *expect_type, upper = f77_get_upperbound (tmp_type); lower = f77_get_lowerbound (tmp_type); @@ -7852,7 +4175,7 @@ index 2926465..b53f895 100644 array_size_array[nargs - i - 1] = upper - lower + 1; /* Zero-normalize subscripts so that offsetting will work. */ -@@ -2041,13 +2136,25 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2094,13 +2109,25 @@ evaluate_subexp_standard (struct type *expect_type, tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type)); } @@ -7864,10 +4187,7 @@ index 2926465..b53f895 100644 - offset_item = subscript_array[ndimensions - 1]; + offset_item = 0; + offset_byte = 0; - -- for (i = ndimensions - 1; i > 0; --i) -- offset_item = -- array_size_array[i - 1] * offset_item + subscript_array[i - 1]; ++ + for (i = ndimensions - 1; i >= 0; --i) + { + offset_item *= array_size_array[i]; @@ -7876,13 +4196,16 @@ index 2926465..b53f895 100644 + else + offset_byte += subscript_array[i] * byte_stride_array[i]; + } -+ + +- for (i = ndimensions - 1; i > 0; --i) +- offset_item = +- array_size_array[i - 1] * offset_item + subscript_array[i - 1]; + element_size = TYPE_LENGTH (TYPE_TARGET_TYPE (tmp_type)); + offset_byte += offset_item * element_size; /* Let us now play a dirty trick: we will take arg1 which is a value node pointing to the topmost level -@@ -2057,7 +2164,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2110,7 +2137,7 @@ evaluate_subexp_standard (struct type *expect_type, returns the correct type value */ deprecated_set_value_type (arg1, tmp_type); @@ -7891,7 +4214,7 @@ index 2926465..b53f895 100644 } case BINOP_LOGICAL_AND: -@@ -2291,14 +2398,22 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2344,14 +2371,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); @@ -7916,7 +4239,7 @@ index 2926465..b53f895 100644 else if (noside == EVAL_AVOID_SIDE_EFFECTS) { type = check_typedef (value_type (arg1)); -@@ -2307,12 +2422,18 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2360,12 +2395,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 ) @@ -7940,7 +4263,7 @@ index 2926465..b53f895 100644 else error (_("Attempt to take contents of a non-pointer value.")); } -@@ -2322,9 +2443,14 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2375,9 +2416,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) @@ -7958,16 +4281,7 @@ index 2926465..b53f895 100644 case UNOP_ADDR: /* C++: check for and handle pointer to members. */ -@@ -2598,7 +2724,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos, - (*pos) += 5 + BYTES_TO_EXP_ELEM (tem + 1); - x = value_aggregate_elt (exp->elts[pc + 1].type, - &exp->elts[pc + 3].string, -- 1, noside); -+ NULL, 1, noside); - if (x == NULL) - error (_("There is no field named %s"), &exp->elts[pc + 3].string); - return x; -@@ -2643,7 +2769,7 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -2696,7 +2742,7 @@ evaluate_subexp_with_coercion (struct expression *exp, { enum exp_opcode op; int pc; @@ -7976,7 +4290,7 @@ index 2926465..b53f895 100644 struct symbol *var; struct type *type; -@@ -2654,12 +2780,17 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -2707,12 +2753,17 @@ evaluate_subexp_with_coercion (struct expression *exp, { case OP_VAR_VALUE: var = exp->elts[pc + 2].symbol; @@ -7995,7 +4309,7 @@ index 2926465..b53f895 100644 return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val); } -@@ -2711,9 +2842,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) +@@ -2764,9 +2815,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) case OP_VAR_VALUE: (*pos) += 4; @@ -8013,63 +4327,17 @@ index 2926465..b53f895 100644 default: val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); diff --git a/gdb/expression.h b/gdb/expression.h -index effe1f0..3e083ca 100644 +index e4e8598..ca96b9b 100644 --- a/gdb/expression.h +++ b/gdb/expression.h -@@ -88,6 +88,16 @@ enum exp_opcode - when X is a pointer instead of an aggregate. */ - STRUCTOP_MPTR, - -+ /* TYPE_INSTANCE is used when the user specifies a specific -+ type instantiation for overloaded methods/functions. The format -+ is: 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 */ -@@ -438,4 +448,5 @@ extern char *op_string (enum exp_opcode); +@@ -445,4 +445,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-exp.y b/gdb/f-exp.y -index c04c8f4..ddcd460 100644 ---- 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 }, diff --git a/gdb/f-lang.c b/gdb/f-lang.c -index 19c1316..4cc2a40 100644 +index b914b49..79b46d2 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -31,6 +31,8 @@ @@ -8081,45 +4349,7 @@ index 19c1316..4cc2a40 100644 /* Following is dubious stuff that had been in the xcoff reader. */ -@@ -55,20 +57,6 @@ typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR; - /* Local functions */ - - extern void _initialize_f_language (void); --#if 0 --static void clear_function_list (void); --static long get_bf_for_fcn (long); --static void clear_bf_list (void); --static void patch_all_commons_by_name (char *, CORE_ADDR, int); --static SAVED_F77_COMMON_PTR find_first_common_named (char *); --static void add_common_entry (struct symbol *); --static void add_common_block (char *, CORE_ADDR, int, char *); --static SAVED_FUNCTION *allocate_saved_function_node (void); --static SAVED_BF_PTR allocate_saved_bf_node (void); --static COMMON_ENTRY_PTR allocate_common_entry_node (void); --static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node (void); --static void patch_common_entries (SAVED_F77_COMMON_PTR, CORE_ADDR, int); --#endif - - static void f_printchar (int c, struct type *type, struct ui_file * stream); - static void f_emit_char (int c, struct type *type, -@@ -259,6 +247,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 +278,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] -@@ -306,6 +297,46 @@ f_language_arch_info (struct gdbarch *gdbarch, +@@ -306,6 +308,48 @@ f_language_arch_info (struct gdbarch *gdbarch, lai->bool_type_default = builtin->builtin_logical_s2; } @@ -8131,6 +4361,7 @@ index 19c1316..4cc2a40 100644 + +static struct symbol * +f_lookup_symbol_nonlocal (const char *name, ++ const char *linkage_name, + const struct block *block, + const domain_enum domain) +{ @@ -8145,7 +4376,7 @@ index 19c1316..4cc2a40 100644 + struct type *type; + struct symbol *retval; + -+ sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN); ++ sym = lookup_symbol_global (use->module_name, NULL, block, MODULE_DOMAIN); + + /* Module name lookup should not fail with correct debug info. */ + if (sym == NULL) @@ -8155,7 +4386,8 @@ index 19c1316..4cc2a40 100644 + 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); ++ retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, ++ linkage_name, domain); + if (retval) + return retval; + } @@ -8166,7 +4398,7 @@ index 19c1316..4cc2a40 100644 /* 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 +364,7 @@ const struct language_defn f_language_defn = +@@ -333,7 +377,7 @@ const struct language_defn f_language_defn = c_value_print, /* FIXME */ NULL, /* Language specific skip_trampoline */ NULL, /* name_of_this */ @@ -8175,415 +4407,8 @@ index 19c1316..4cc2a40 100644 basic_lookup_transparent_type,/* lookup_transparent_type */ NULL, /* Language specific symbol demangler */ NULL, /* Language specific class_name_from_physname */ -@@ -372,6 +403,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"); -@@ -418,395 +453,3 @@ _initialize_f_language (void) - - add_language (&f_language_defn); - } -- --#if 0 --static SAVED_BF_PTR --allocate_saved_bf_node (void) --{ -- SAVED_BF_PTR new; -- -- new = (SAVED_BF_PTR) xmalloc (sizeof (SAVED_BF)); -- return (new); --} -- --static SAVED_FUNCTION * --allocate_saved_function_node (void) --{ -- SAVED_FUNCTION *new; -- -- new = (SAVED_FUNCTION *) xmalloc (sizeof (SAVED_FUNCTION)); -- return (new); --} -- --static SAVED_F77_COMMON_PTR --allocate_saved_f77_common_node (void) --{ -- SAVED_F77_COMMON_PTR new; -- -- new = (SAVED_F77_COMMON_PTR) xmalloc (sizeof (SAVED_F77_COMMON)); -- return (new); --} -- --static COMMON_ENTRY_PTR --allocate_common_entry_node (void) --{ -- COMMON_ENTRY_PTR new; -- -- new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY)); -- return (new); --} --#endif -- --SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */ --SAVED_F77_COMMON_PTR tail_common_list = NULL; /* Ptr to last saved COMMON */ --SAVED_F77_COMMON_PTR current_common = NULL; /* Ptr to current COMMON */ -- --#if 0 --static SAVED_BF_PTR saved_bf_list = NULL; /* Ptr to (.bf,function) -- list */ --static SAVED_BF_PTR saved_bf_list_end = NULL; /* Ptr to above list's end */ --static SAVED_BF_PTR current_head_bf_list = NULL; /* Current head of above list -- */ -- --static SAVED_BF_PTR tmp_bf_ptr; /* Generic temporary for use -- in macros */ -- --/* The following function simply enters a given common block onto -- the global common block chain */ -- --static void --add_common_block (char *name, CORE_ADDR offset, int secnum, char *func_stab) --{ -- SAVED_F77_COMMON_PTR tmp; -- char *c, *local_copy_func_stab; -- -- /* If the COMMON block we are trying to add has a blank -- name (i.e. "#BLNK_COM") then we set it to __BLANK -- because the darn "#" character makes GDB's input -- parser have fits. */ -- -- -- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0 -- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0) -- { -- -- xfree (name); -- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1); -- strcpy (name, BLANK_COMMON_NAME_LOCAL); -- } -- -- tmp = allocate_saved_f77_common_node (); -- -- local_copy_func_stab = xmalloc (strlen (func_stab) + 1); -- strcpy (local_copy_func_stab, func_stab); -- -- tmp->name = xmalloc (strlen (name) + 1); -- -- /* local_copy_func_stab is a stabstring, let us first extract the -- function name from the stab by NULLing out the ':' character. */ -- -- -- c = NULL; -- c = strchr (local_copy_func_stab, ':'); -- -- if (c) -- *c = '\0'; -- else -- error (_("Malformed function STAB found in add_common_block()")); -- -- -- tmp->owning_function = xmalloc (strlen (local_copy_func_stab) + 1); -- -- strcpy (tmp->owning_function, local_copy_func_stab); -- -- strcpy (tmp->name, name); -- tmp->offset = offset; -- tmp->next = NULL; -- tmp->entries = NULL; -- tmp->secnum = secnum; -- -- current_common = tmp; -- -- if (head_common_list == NULL) -- { -- head_common_list = tail_common_list = tmp; -- } -- else -- { -- tail_common_list->next = tmp; -- tail_common_list = tmp; -- } --} --#endif -- --/* The following function simply enters a given common entry onto -- the "current_common" block that has been saved away. */ -- --#if 0 --static void --add_common_entry (struct symbol *entry_sym_ptr) --{ -- COMMON_ENTRY_PTR tmp; -- -- -- -- /* The order of this list is important, since -- we expect the entries to appear in decl. -- order when we later issue "info common" calls */ -- -- tmp = allocate_common_entry_node (); -- -- tmp->next = NULL; -- tmp->symbol = entry_sym_ptr; -- -- if (current_common == NULL) -- error (_("Attempt to add COMMON entry with no block open!")); -- else -- { -- if (current_common->entries == NULL) -- { -- current_common->entries = tmp; -- current_common->end_of_entries = tmp; -- } -- else -- { -- current_common->end_of_entries->next = tmp; -- current_common->end_of_entries = tmp; -- } -- } --} --#endif -- --/* This routine finds the first encountred COMMON block named "name" */ -- --#if 0 --static SAVED_F77_COMMON_PTR --find_first_common_named (char *name) --{ -- -- SAVED_F77_COMMON_PTR tmp; -- -- tmp = head_common_list; -- -- while (tmp != NULL) -- { -- if (strcmp (tmp->name, name) == 0) -- return (tmp); -- else -- tmp = tmp->next; -- } -- return (NULL); --} --#endif -- --/* This routine finds the first encountred COMMON block named "name" -- that belongs to function funcname */ -- --SAVED_F77_COMMON_PTR --find_common_for_function (char *name, char *funcname) --{ -- -- SAVED_F77_COMMON_PTR tmp; -- -- tmp = head_common_list; -- -- while (tmp != NULL) -- { -- if (strcmp (tmp->name, name) == 0 -- && strcmp (tmp->owning_function, funcname) == 0) -- return (tmp); -- else -- tmp = tmp->next; -- } -- return (NULL); --} -- -- --#if 0 -- --/* The following function is called to patch up the offsets -- for the statics contained in the COMMON block named -- "name." */ -- --static void --patch_common_entries (SAVED_F77_COMMON_PTR blk, CORE_ADDR offset, int secnum) --{ -- COMMON_ENTRY_PTR entry; -- -- blk->offset = offset; /* Keep this around for future use. */ -- -- entry = blk->entries; -- -- while (entry != NULL) -- { -- SYMBOL_VALUE (entry->symbol) += offset; -- SYMBOL_SECTION (entry->symbol) = secnum; -- -- entry = entry->next; -- } -- blk->secnum = secnum; --} -- --/* Patch all commons named "name" that need patching.Since COMMON -- blocks occur with relative infrequency, we simply do a linear scan on -- the name. Eventually, the best way to do this will be a -- hashed-lookup. Secnum is the section number for the .bss section -- (which is where common data lives). */ -- --static void --patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum) --{ -- -- SAVED_F77_COMMON_PTR tmp; -- -- /* For blank common blocks, change the canonical reprsentation -- of a blank name */ -- -- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0 -- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0) -- { -- xfree (name); -- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1); -- strcpy (name, BLANK_COMMON_NAME_LOCAL); -- } -- -- tmp = head_common_list; -- -- while (tmp != NULL) -- { -- if (COMMON_NEEDS_PATCHING (tmp)) -- if (strcmp (tmp->name, name) == 0) -- patch_common_entries (tmp, offset, secnum); -- -- tmp = tmp->next; -- } --} --#endif -- --/* This macro adds the symbol-number for the start of the function -- (the symbol number of the .bf) referenced by symnum_fcn to a -- list. This list, in reality should be a FIFO queue but since -- #line pragmas sometimes cause line ranges to get messed up -- we simply create a linear list. This list can then be searched -- first by a queueing algorithm and upon failure fall back to -- a linear scan. */ -- --#if 0 --#define ADD_BF_SYMNUM(bf_sym,fcn_sym) \ -- \ -- if (saved_bf_list == NULL) \ --{ \ -- tmp_bf_ptr = allocate_saved_bf_node(); \ -- \ -- tmp_bf_ptr->symnum_bf = (bf_sym); \ -- tmp_bf_ptr->symnum_fcn = (fcn_sym); \ -- tmp_bf_ptr->next = NULL; \ -- \ -- current_head_bf_list = saved_bf_list = tmp_bf_ptr; \ -- saved_bf_list_end = tmp_bf_ptr; \ -- } \ --else \ --{ \ -- tmp_bf_ptr = allocate_saved_bf_node(); \ -- \ -- tmp_bf_ptr->symnum_bf = (bf_sym); \ -- tmp_bf_ptr->symnum_fcn = (fcn_sym); \ -- tmp_bf_ptr->next = NULL; \ -- \ -- saved_bf_list_end->next = tmp_bf_ptr; \ -- saved_bf_list_end = tmp_bf_ptr; \ -- } --#endif -- --/* This function frees the entire (.bf,function) list */ -- --#if 0 --static void --clear_bf_list (void) --{ -- -- SAVED_BF_PTR tmp = saved_bf_list; -- SAVED_BF_PTR next = NULL; -- -- while (tmp != NULL) -- { -- next = tmp->next; -- xfree (tmp); -- tmp = next; -- } -- saved_bf_list = NULL; --} --#endif -- --int global_remote_debug; -- --#if 0 -- --static long --get_bf_for_fcn (long the_function) --{ -- SAVED_BF_PTR tmp; -- int nprobes = 0; -- -- /* First use a simple queuing algorithm (i.e. look and see if the -- item at the head of the queue is the one you want) */ -- -- if (saved_bf_list == NULL) -- internal_error (__FILE__, __LINE__, -- _("cannot get .bf node off empty list")); -- -- if (current_head_bf_list != NULL) -- if (current_head_bf_list->symnum_fcn == the_function) -- { -- if (global_remote_debug) -- fprintf_unfiltered (gdb_stderr, "*"); -- -- tmp = current_head_bf_list; -- current_head_bf_list = current_head_bf_list->next; -- return (tmp->symnum_bf); -- } -- -- /* If the above did not work (probably because #line directives were -- used in the sourcefile and they messed up our internal tables) we now do -- the ugly linear scan */ -- -- if (global_remote_debug) -- fprintf_unfiltered (gdb_stderr, "\ndefaulting to linear scan\n"); -- -- nprobes = 0; -- tmp = saved_bf_list; -- while (tmp != NULL) -- { -- nprobes++; -- if (tmp->symnum_fcn == the_function) -- { -- if (global_remote_debug) -- fprintf_unfiltered (gdb_stderr, "Found in %d probes\n", nprobes); -- current_head_bf_list = tmp->next; -- return (tmp->symnum_bf); -- } -- tmp = tmp->next; -- } -- -- return (-1); --} -- --static SAVED_FUNCTION_PTR saved_function_list = NULL; --static SAVED_FUNCTION_PTR saved_function_list_end = NULL; -- --static void --clear_function_list (void) --{ -- SAVED_FUNCTION_PTR tmp = saved_function_list; -- SAVED_FUNCTION_PTR next = NULL; -- -- while (tmp != NULL) -- { -- next = tmp->next; -- xfree (tmp); -- tmp = next; -- } -- -- saved_function_list = NULL; --} --#endif diff --git a/gdb/f-lang.h b/gdb/f-lang.h -index 711bdba..9d7d92b 100644 +index b98c556..c68379a 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 */ @@ -8597,57 +4422,7 @@ index 711bdba..9d7d92b 100644 extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, struct ui_file *, int, const struct value_print_options *); -@@ -47,41 +51,8 @@ enum f90_range_type - NONE_BOUND_DEFAULT /* "(low:high)" */ - }; - --struct common_entry -- { -- struct symbol *symbol; /* The symbol node corresponding -- to this component */ -- struct common_entry *next; /* The next component */ -- }; -- --struct saved_f77_common -- { -- char *name; /* Name of COMMON */ -- char *owning_function; /* Name of parent function */ -- int secnum; /* Section # of .bss */ -- CORE_ADDR offset; /* Offset from .bss for -- this block */ -- struct common_entry *entries; /* List of block's components */ -- struct common_entry *end_of_entries; /* ptr. to end of components */ -- struct saved_f77_common *next; /* Next saved COMMON block */ -- }; -- --typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR; -- --typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR; -- --extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */ --extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */ --extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */ -- --extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *); -- --#define UNINITIALIZED_SECNUM -1 --#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM) -- - #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */ - #define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */ --#define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */ - - /* When reasonable array bounds cannot be fetched, such as when - you ask to 'mt print symbols' and there is no stack frame and -@@ -113,6 +84,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; -@@ -125,3 +97,10 @@ struct builtin_f_type +@@ -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); @@ -8659,10 +4434,10 @@ index 711bdba..9d7d92b 100644 + char module_name[1]; + }; diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c -index 6c9668f..852b9a8 100644 +index 0332932..6e8668c 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c -@@ -31,7 +31,7 @@ +@@ -32,7 +32,7 @@ #include "gdbcore.h" #include "target.h" #include "f-lang.h" @@ -8671,7 +4446,7 @@ index 6c9668f..852b9a8 100644 #include "gdb_string.h" #include -@@ -48,6 +48,34 @@ void f_type_print_varspec_prefix (struct type *, struct ui_file *, +@@ -49,6 +49,34 @@ void f_type_print_varspec_prefix (struct type *, struct ui_file *, void f_type_print_base (struct type *, struct ui_file *, int, int); @@ -8706,7 +4481,7 @@ index 6c9668f..852b9a8 100644 /* LEVEL is the depth to indent lines by. */ void -@@ -57,6 +85,9 @@ f_print_type (struct type *type, char *varstring, struct ui_file *stream, +@@ -58,6 +86,9 @@ f_print_type (struct type *type, char *varstring, struct ui_file *stream, enum type_code code; int demangled_args; @@ -8716,7 +4491,7 @@ index 6c9668f..852b9a8 100644 f_type_print_base (type, stream, show, level); code = TYPE_CODE (type); if ((varstring != NULL && *varstring != '\0') -@@ -166,6 +197,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, +@@ -165,6 +196,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, QUIT; @@ -8727,23 +4502,10 @@ index 6c9668f..852b9a8 100644 { case TYPE_CODE_ARRAY: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 0a57404..a9ccc77 100644 +index 9bd3640..f52b858 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c -@@ -34,10 +34,8 @@ - #include "gdbcore.h" - #include "command.h" - #include "block.h" -- --#if 0 --static int there_is_a_visible_common_named (char *); --#endif -+#include "dictionary.h" -+#include "gdb_assert.h" - - extern void _initialize_f_valprint (void); - static void info_common_command (char *, int); -@@ -54,15 +52,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; +@@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; /* The following macro gives us the size of the nth dimension, Where n is 1 based. */ @@ -8764,7 +4526,7 @@ index 0a57404..a9ccc77 100644 if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type)) error (_("Lower bound may not be '*' in F77")); -@@ -72,14 +72,17 @@ f77_get_lowerbound (struct type *type) +@@ -72,14 +74,17 @@ f77_get_lowerbound (struct type *type) int f77_get_upperbound (struct type *type) { @@ -8787,7 +4549,7 @@ index 0a57404..a9ccc77 100644 } return TYPE_ARRAY_UPPER_BOUND_VALUE (type); -@@ -135,24 +138,29 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) +@@ -135,24 +140,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); @@ -8823,7 +4585,7 @@ index 0a57404..a9ccc77 100644 } } -@@ -172,34 +180,34 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, +@@ -172,34 +182,34 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, if (nss != ndimensions) { @@ -8867,7 +4629,7 @@ index 0a57404..a9ccc77 100644 fprintf_filtered (stream, "..."); } } -@@ -253,6 +261,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +@@ -253,6 +263,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR addr; int index; @@ -8877,244 +4639,8 @@ index 0a57404..a9ccc77 100644 CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { -@@ -467,22 +478,54 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, - return 0; - } - --static void --list_all_visible_commons (char *funname) -+static int -+info_common_command_for_block (struct block *block, struct frame_info *frame, -+ const char *comname) - { -- SAVED_F77_COMMON_PTR tmp; -- -- tmp = head_common_list; -- -- printf_filtered (_("All COMMON blocks visible at this level:\n\n")); -- -- while (tmp != NULL) -- { -- if (strcmp (tmp->owning_function, funname) == 0) -- printf_filtered ("%s\n", tmp->name); -- -- tmp = tmp->next; -- } -+ struct dict_iterator iter; -+ struct symbol *sym; -+ int values_printed = 0; -+ const char *name; -+ struct value_print_options opts; -+ -+ get_user_print_options (&opts); -+ -+ ALL_BLOCK_SYMBOLS (block, iter, sym) -+ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN) -+ { -+ struct type *type = SYMBOL_TYPE (sym); -+ int index; -+ -+ gdb_assert (SYMBOL_CLASS (sym) == LOC_STATIC); -+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT); -+ -+ if (comname && (!SYMBOL_LINKAGE_NAME (sym) -+ || strcmp (comname, SYMBOL_LINKAGE_NAME (sym)) != 0)) -+ continue; -+ -+ values_printed = 1; -+ if (SYMBOL_PRINT_NAME (sym)) -+ printf_filtered (_("Contents of F77 COMMON block '%s':\n"), -+ SYMBOL_PRINT_NAME (sym)); -+ else -+ printf_filtered (_("Contents of blank COMMON block:\n")); -+ -+ for (index = 0; index < TYPE_NFIELDS (type); index++) -+ { -+ struct value *val; -+ -+ gdb_assert (field_is_static (&TYPE_FIELD (type, index))); -+ val = value_static_field (type, index); -+ -+ printf_filtered ("%s = ", TYPE_FIELD_NAME (type, index)); -+ value_print (val, gdb_stdout, &opts); -+ putchar_filtered ('\n'); -+ } -+ -+ putchar_filtered ('\n'); -+ } -+ -+ return values_printed; - } - - /* This function is used to print out the values in a given COMMON -@@ -492,11 +535,9 @@ list_all_visible_commons (char *funname) - static void - info_common_command (char *comname, int from_tty) - { -- SAVED_F77_COMMON_PTR the_common; -- COMMON_ENTRY_PTR entry; - struct frame_info *fi; -- char *funname = 0; -- struct symbol *func; -+ struct block *block; -+ int values_printed = 0; - - /* We have been told to display the contents of F77 COMMON - block supposedly visible in this function. Let us -@@ -508,136 +549,32 @@ info_common_command (char *comname, int from_tty) - /* The following is generally ripped off from stack.c's routine - print_frame_info() */ - -- func = find_pc_function (get_frame_pc (fi)); -- if (func) -- { -- /* In certain pathological cases, the symtabs give the wrong -- function (when we are in the first function in a file which -- is compiled without debugging symbols, the previous function -- is compiled with debugging symbols, and the "foo.o" symbol -- that is supposed to tell us where the file with debugging symbols -- ends has been truncated by ar because it is longer than 15 -- characters). -- -- So look in the minimal symbol tables as well, and if it comes -- up with a larger address for the function use that instead. -- I don't think this can ever cause any problems; there shouldn't -- be any minimal symbols in the middle of a function. -- FIXME: (Not necessarily true. What about text labels) */ -- -- struct minimal_symbol *msymbol = -- lookup_minimal_symbol_by_pc (get_frame_pc (fi)); -- -- if (msymbol != NULL -- && (SYMBOL_VALUE_ADDRESS (msymbol) -- > BLOCK_START (SYMBOL_BLOCK_VALUE (func)))) -- funname = SYMBOL_LINKAGE_NAME (msymbol); -- else -- funname = SYMBOL_LINKAGE_NAME (func); -- } -- else -- { -- struct minimal_symbol *msymbol = -- lookup_minimal_symbol_by_pc (get_frame_pc (fi)); -- -- if (msymbol != NULL) -- funname = SYMBOL_LINKAGE_NAME (msymbol); -- else /* Got no 'funname', code below will fail. */ -- error (_("No function found for frame.")); -- } -- -- /* If comname is NULL, we assume the user wishes to see the -- which COMMON blocks are visible here and then return */ -- -- if (comname == 0) -+ block = get_frame_block (fi, 0); -+ if (block == NULL) - { -- list_all_visible_commons (funname); -+ printf_filtered (_("No symbol table info available.\n")); - return; - } - -- the_common = find_common_for_function (comname, funname); -- -- if (the_common) -+ while (block) - { -- if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0) -- printf_filtered (_("Contents of blank COMMON block:\n")); -- else -- printf_filtered (_("Contents of F77 COMMON block '%s':\n"), comname); -- -- printf_filtered ("\n"); -- entry = the_common->entries; -- -- while (entry != NULL) -- { -- print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0); -- entry = entry->next; -- } -+ if (info_common_command_for_block (block, fi, comname)) -+ values_printed = 1; -+ /* After handling the function's top-level block, stop. Don't -+ continue to its superblock, the block of per-file symbols. */ -+ if (BLOCK_FUNCTION (block)) -+ break; -+ block = BLOCK_SUPERBLOCK (block); - } -- else -- printf_filtered (_("Cannot locate the common block %s in function '%s'\n"), -- comname, funname); --} -- --/* This function is used to determine whether there is a -- F77 common block visible at the current scope called 'comname'. */ -- --#if 0 --static int --there_is_a_visible_common_named (char *comname) --{ -- SAVED_F77_COMMON_PTR the_common; -- struct frame_info *fi; -- char *funname = 0; -- struct symbol *func; -- -- if (comname == NULL) -- error (_("Cannot deal with NULL common name!")); - -- fi = get_selected_frame (_("No frame selected")); -- -- /* The following is generally ripped off from stack.c's routine -- print_frame_info() */ -- -- func = find_pc_function (fi->pc); -- if (func) -+ if (!values_printed) - { -- /* In certain pathological cases, the symtabs give the wrong -- function (when we are in the first function in a file which -- is compiled without debugging symbols, the previous function -- is compiled with debugging symbols, and the "foo.o" symbol -- that is supposed to tell us where the file with debugging symbols -- ends has been truncated by ar because it is longer than 15 -- characters). -- -- So look in the minimal symbol tables as well, and if it comes -- up with a larger address for the function use that instead. -- I don't think this can ever cause any problems; there shouldn't -- be any minimal symbols in the middle of a function. -- FIXME: (Not necessarily true. What about text labels) */ -- -- struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); -- -- if (msymbol != NULL -- && (SYMBOL_VALUE_ADDRESS (msymbol) -- > BLOCK_START (SYMBOL_BLOCK_VALUE (func)))) -- funname = SYMBOL_LINKAGE_NAME (msymbol); -+ if (comname) -+ printf_filtered (_("No common block '%s'.\n"), comname); - else -- funname = SYMBOL_LINKAGE_NAME (func); -+ printf_filtered (_("No common blocks.\n")); - } -- else -- { -- struct minimal_symbol *msymbol = -- lookup_minimal_symbol_by_pc (fi->pc); -- -- if (msymbol != NULL) -- funname = SYMBOL_LINKAGE_NAME (msymbol); -- } -- -- the_common = find_common_for_function (comname, funname); -- -- return (the_common ? 1 : 0); - } --#endif - - void - _initialize_f_valprint (void) diff --git a/gdb/findcmd.c b/gdb/findcmd.c -index 1d28914..d176341 100644 +index c752316..df2687c 100644 --- a/gdb/findcmd.c +++ b/gdb/findcmd.c @@ -27,7 +27,7 @@ @@ -9287,7 +4813,7 @@ index 1d28914..d176341 100644 /* Record and print the results. */ diff --git a/gdb/findvar.c b/gdb/findvar.c -index 8c027c9..d201f76 100644 +index e117a8e..6bd3724 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -35,6 +35,7 @@ @@ -9296,9 +4822,9 @@ index 8c027c9..d201f76 100644 #include "objfiles.h" +#include "dwarf2loc.h" - /* Basic byte-swapping routines. GDB has needed these for a long time... - All extract a target-format integer at ADDR which is LEN bytes long. */ -@@ -394,27 +395,16 @@ symbol_read_needs_frame (struct symbol *sym) + /* 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) /* 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. @@ -9330,7 +4856,7 @@ index 8c027c9..d201f76 100644 if (symbol_read_needs_frame (var)) gdb_assert (frame); -@@ -422,32 +412,40 @@ read_var_value (struct symbol *var, struct frame_info *frame) +@@ -425,32 +415,40 @@ read_var_value (struct symbol *var, struct frame_info *frame) switch (SYMBOL_CLASS (var)) { case LOC_CONST: @@ -9391,7 +4917,7 @@ index 8c027c9..d201f76 100644 return v; } -@@ -489,12 +487,23 @@ read_var_value (struct symbol *var, struct frame_info *frame) +@@ -492,12 +490,23 @@ read_var_value (struct symbol *var, struct frame_info *frame) break; case LOC_BLOCK: @@ -9421,7 +4947,7 @@ index 8c027c9..d201f76 100644 case LOC_REGISTER: case LOC_REGPARM_ADDR: -@@ -513,7 +522,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) +@@ -516,7 +525,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) error (_("Value of register variable not available.")); addr = value_as_address (regval); @@ -9429,7 +4955,7 @@ index 8c027c9..d201f76 100644 } else { -@@ -556,18 +564,33 @@ read_var_value (struct symbol *var, struct frame_info *frame) +@@ -559,18 +567,33 @@ read_var_value (struct symbol *var, struct frame_info *frame) break; case LOC_OPTIMIZED_OUT: @@ -9469,7 +4995,7 @@ index 8c027c9..d201f76 100644 } /* Install default attributes for register values. */ -@@ -604,10 +627,11 @@ struct value * +@@ -607,10 +630,11 @@ struct value * value_from_register (struct type *type, int regnum, struct frame_info *frame) { struct gdbarch *gdbarch = get_frame_arch (frame); @@ -9483,7 +5009,7 @@ index 8c027c9..d201f76 100644 { /* The ISA/ABI need to something weird when obtaining the specified value from this register. It might need to -@@ -621,7 +645,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) +@@ -624,7 +648,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, @@ -9492,25 +5018,6 @@ index 8c027c9..d201f76 100644 } else { -diff --git a/gdb/frame.c b/gdb/frame.c -index 7932b48..4e7c434 100644 ---- a/gdb/frame.c -+++ b/gdb/frame.c -@@ -1171,6 +1171,14 @@ has_stack_frames (void) - if (ptid_equal (inferior_ptid, null_ptid)) - return 0; - -+ /* FIXME: Workaround archer-tromey-python crash in -+ add_inferior_object->get_current_arch on FSF GDB update: -+ is_thread_state would assertion check here as -+ remote_start_remote->add_inferior_silent->observer_notify_new_inferior is -+ before remote_start_remote->add_thread_silent. */ -+ if (find_thread_ptid (inferior_ptid) == NULL) -+ return 0; -+ - /* Don't try to read from a dead thread. */ - if (is_exited (inferior_ptid)) - return 0; diff --git a/gdb/gdbinit.in b/gdb/gdbinit.in index ffb7f53..a2e7e94 100644 --- a/gdb/gdbinit.in @@ -9938,7 +5445,7 @@ index 0000000..b8213f5 + NULL, +}; diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h -index 79d33fe..d3b4fa1 100644 +index cd24eaf..119af7d 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -185,6 +185,10 @@ struct thread_info @@ -9951,8 +5458,8 @@ index 79d33fe..d3b4fa1 100644 + /* Private data used by the target vector implementation. */ struct private_thread_info *private; - }; -@@ -249,6 +253,9 @@ extern struct thread_info *any_thread_of_process (int pid); + +@@ -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); @@ -9963,10 +5470,10 @@ index 79d33fe..d3b4fa1 100644 once for each known thread. */ typedef int (*thread_callback_func) (struct thread_info *, void *); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 2f77dca..90abf2c 100644 +index 16b34ca..b5e6110 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -38,6 +38,9 @@ +@@ -39,6 +39,9 @@ #include "cp-abi.h" #include "gdb_assert.h" #include "hashtab.h" @@ -9976,7 +5483,7 @@ index 2f77dca..90abf2c 100644 /* Floatformat pairs. */ -@@ -118,13 +121,31 @@ static void print_arg_types (struct field *, int, int); +@@ -119,6 +122,24 @@ 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); @@ -10001,15 +5508,7 @@ index 2f77dca..90abf2c 100644 /* Allocate a new OBJFILE-associated type structure and fill it with some defaults. Space for the type structure is allocated - on the objfile's objfile_obstack. */ - - struct type * --alloc_type (struct objfile *objfile) -+alloc_type (struct objfile *objfile, struct type *parent) - { - struct type *type; - -@@ -148,6 +169,39 @@ alloc_type (struct objfile *objfile) +@@ -149,6 +170,39 @@ alloc_type (struct objfile *objfile) return type; } @@ -10049,16 +5548,7 @@ index 2f77dca..90abf2c 100644 /* Allocate a new GDBARCH-associated type structure and fill it with some defaults. Space for the type structure is allocated on the heap. */ -@@ -184,7 +238,7 @@ struct type * - alloc_type_copy (const struct type *type) - { - if (TYPE_OBJFILE_OWNED (type)) -- return alloc_type (TYPE_OWNER (type).objfile); -+ return alloc_type (TYPE_OWNER (type).objfile, (struct type *) type); - else - return alloc_type_arch (TYPE_OWNER (type).gdbarch); - } -@@ -273,7 +327,7 @@ make_pointer_type (struct type *type, struct type **typeptr) +@@ -274,7 +328,7 @@ make_pointer_type (struct type *type, struct type **typeptr) if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -10067,7 +5557,7 @@ index 2f77dca..90abf2c 100644 if (typeptr) *typeptr = ntype; } -@@ -350,7 +404,7 @@ make_reference_type (struct type *type, struct type **typeptr) +@@ -351,7 +405,7 @@ make_reference_type (struct type *type, struct type **typeptr) if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -10076,22 +5566,15 @@ index 2f77dca..90abf2c 100644 if (typeptr) *typeptr = ntype; } -@@ -721,12 +775,13 @@ create_range_type (struct type *result_type, struct type *index_type, - TYPE_TARGET_STUB (result_type) = 1; - else - TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type)); -- TYPE_NFIELDS (result_type) = 2; -+ TYPE_NFIELDS (result_type) = 3; - TYPE_FIELDS (result_type) = TYPE_ZALLOC (result_type, - TYPE_NFIELDS (result_type) - * sizeof (struct field)); +@@ -726,6 +780,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; + TYPE_BYTE_STRIDE (result_type) = 0; if (low_bound >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -826,26 +881,45 @@ create_array_type (struct type *result_type, +@@ -825,26 +880,45 @@ create_array_type (struct type *result_type, TYPE_CODE (result_type) = TYPE_CODE_ARRAY; TYPE_TARGET_TYPE (result_type) = element_type; @@ -10116,10 +5599,10 @@ index 2f77dca..90abf2c 100644 + /* DWARF blocks may depend on runtime information like + DW_OP_PUSH_OBJECT_ADDRESS not being available during the + CREATE_ARRAY_TYPE time. */ -+ if (TYPE_RANGE_BOUND_IS_DWARF_BLOCK (range_type, 0) -+ || TYPE_RANGE_BOUND_IS_DWARF_BLOCK (range_type, 1) -+ || TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (range_type) -+ || TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (range_type) ++ if (TYPE_LOW_BOUND_IS_DWARF_BLOCK (range_type) ++ || TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) ++ || TYPE_LOW_BOUND_UNDEFINED (range_type) ++ || TYPE_HIGH_BOUND_UNDEFINED (range_type) + || get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) + { + low_bound = 0; @@ -10150,7 +5633,7 @@ index 2f77dca..90abf2c 100644 return result_type; } -@@ -1331,6 +1405,84 @@ stub_noname_complaint (void) +@@ -1331,6 +1405,105 @@ stub_noname_complaint (void) complaint (&symfile_complaints, _("stub type has NULL name")); } @@ -10162,13 +5645,12 @@ index 2f77dca..90abf2c 100644 + cleared FULL_SPAN return value (the expected SIZEOF) for non-zero + TYPE_BYTE_STRIDE values. */ + -+static CORE_ADDR ++static LONGEST +type_length_get (struct type *type, struct type *target_type, int full_span) +{ + struct type *range_type; -+ int count; -+ CORE_ADDR byte_stride = 0; /* `= 0' for a false GCC warning. */ -+ CORE_ADDR element_size; ++ LONGEST byte_stride = 0; /* `= 0' for a false GCC warning. */ ++ LONGEST count, element_size, retval; + + if (TYPE_CODE (type) != TYPE_CODE_ARRAY + && TYPE_CODE (type) != TYPE_CODE_STRING) @@ -10181,15 +5663,15 @@ index 2f77dca..90abf2c 100644 + return 0; + + range_type = TYPE_INDEX_TYPE (type); -+ if (TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (range_type) -+ || TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (range_type)) ++ if (TYPE_LOW_BOUND_UNDEFINED (range_type) ++ || TYPE_HIGH_BOUND_UNDEFINED (range_type)) + return 0; + count = TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type) + 1; + /* It may happen for wrong DWARF annotations returning garbage data. */ + if (count < 0) -+ warning (_("Range for type %s has invalid bounds %d..%d"), -+ TYPE_NAME (type), TYPE_LOW_BOUND (range_type), -+ TYPE_HIGH_BOUND (range_type)); ++ warning (_("Range for type %s has invalid bounds %s..%s"), ++ TYPE_NAME (type), plongest (TYPE_LOW_BOUND (range_type)), ++ plongest (TYPE_HIGH_BOUND (range_type))); + /* The code below does not handle count == 0 right. */ + if (count <= 0) + return 0; @@ -10205,12 +5687,34 @@ index 2f77dca..90abf2c 100644 + byte_stride = type_length_get (target_type, NULL, 1); + } + } ++ ++ /* 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. ++ */ ++ + if (full_span) -+ return count * byte_stride; ++ { ++ retval = count * byte_stride; ++ if (count == 0 || retval / count != byte_stride || retval > UINT_MAX) ++ retval = 0; ++ return retval; ++ } + if (target_type == NULL) + target_type = check_typedef (TYPE_TARGET_TYPE (type)); + element_size = type_length_get (target_type, NULL, 1); -+ return (count - 1) * byte_stride + element_size; ++ retval = (count - 1) * byte_stride + element_size; ++ if (retval < element_size ++ || (byte_stride != 0 ++ && (retval - element_size) / byte_stride != count - 1) ++ || retval > UINT_MAX) ++ retval = 0; ++ return retval; +} + +/* Prepare TYPE after being read in by the backend. Currently this function @@ -10235,17 +5739,7 @@ index 2f77dca..90abf2c 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 -@@ -1347,7 +1499,8 @@ stub_noname_complaint (void) - /* Find the real type of TYPE. This function returns the real type, - after removing all layers of typedefs and completing opaque or stub - types. Completion changes the TYPE argument, but stripping of -- typedefs does not. */ -+ typedefs does not. Still original passed TYPE will have TYPE_LENGTH -+ updated. FIXME: Remove this dependency (only ada_to_fixed_type?). */ - - struct type * - check_typedef (struct type *type) -@@ -1457,34 +1610,37 @@ check_typedef (struct type *type) +@@ -1462,51 +1635,36 @@ check_typedef (struct type *type) } } @@ -10264,8 +5758,7 @@ index 2f77dca..90abf2c 100644 + gdb_assert (TYPE_DYNAMIC (type) == 0); + } + -+ if (!currently_reading_symtab -+ && (TYPE_TARGET_STUB (type) || TYPE_DYNAMIC (type))) ++ if (TYPE_TARGET_STUB (type) || TYPE_DYNAMIC (type)) { - struct type *range_type; struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); @@ -10285,23 +5778,40 @@ index 2f77dca..90abf2c 100644 /* Now recompute the length of the array type, based on its - number of elements and the target type's length. - Watch out for Ada null Ada arrays where the high bound -- is smaller than the low bound. */ -- const int low_bound = TYPE_LOW_BOUND (range_type); -- const int high_bound = TYPE_HIGH_BOUND (range_type); -- int nb_elements; -- +- is smaller than the low bound. */ +- const LONGEST low_bound = TYPE_LOW_BOUND (range_type); +- const LONGEST high_bound = TYPE_HIGH_BOUND (range_type); +- ULONGEST len; +- - if (high_bound < low_bound) -- nb_elements = 0; -- else -- nb_elements = high_bound - low_bound + 1; -- -- TYPE_LENGTH (type) = nb_elements * TYPE_LENGTH (target_type); +- 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); +- +- 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) -@@ -1492,9 +1648,12 @@ check_typedef (struct type *type) +@@ -1514,9 +1672,12 @@ check_typedef (struct type *type) TYPE_LENGTH (type) = TYPE_LENGTH (target_type); TYPE_TARGET_STUB (type) = 0; } @@ -10314,37 +5824,15 @@ index 2f77dca..90abf2c 100644 return type; } -@@ -1716,7 +1875,7 @@ init_type (enum type_code code, int length, int flags, - { - struct type *type; - -- type = alloc_type (objfile); -+ type = alloc_type (objfile, NULL); - TYPE_CODE (type) = code; - TYPE_LENGTH (type) = length; - -@@ -1760,6 +1919,10 @@ init_type (enum type_code code, int length, int flags, - { - INIT_CPLUS_SPECIFIC (type); +@@ -1809,6 +1970,7 @@ init_type (enum type_code code, int length, int flags, + TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CALLING_CONVENTION; + break; } -+ -+ if (!objfile) -+ type_incref (type); + return type; } -@@ -2004,7 +2167,8 @@ rank_one_type (struct type *parm, struct type *arg) - switch (TYPE_CODE (arg)) - { - case TYPE_CODE_PTR: -- if (TYPE_CODE (TYPE_TARGET_TYPE (parm)) == TYPE_CODE_VOID) -+ if (TYPE_CODE (TYPE_TARGET_TYPE (parm)) == TYPE_CODE_VOID -+ && TYPE_CODE (TYPE_TARGET_TYPE (arg)) != TYPE_CODE_VOID) - return VOID_PTR_CONVERSION_BADNESS; - else - return rank_one_type (TYPE_TARGET_TYPE (parm), -@@ -2820,33 +2984,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) +@@ -2889,33 +3051,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) } /* Allocate the hash table used by copy_type_recursive to walk @@ -10402,7 +5890,7 @@ index 2f77dca..90abf2c 100644 return type; /* This type shouldn't be pointing to any types in other objfiles; -@@ -2861,8 +3034,10 @@ copy_type_recursive (struct objfile *objfile, +@@ -2930,8 +3101,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 @@ -10415,7 +5903,7 @@ index 2f77dca..90abf2c 100644 stored->old = type; stored->new = new_type; *slot = stored; -@@ -2873,6 +3048,19 @@ copy_type_recursive (struct objfile *objfile, +@@ -2942,6 +3115,19 @@ copy_type_recursive (struct objfile *objfile, TYPE_OBJFILE_OWNED (new_type) = 0; TYPE_OWNER (new_type).gdbarch = get_type_arch (type); @@ -10435,7 +5923,7 @@ index 2f77dca..90abf2c 100644 if (TYPE_NAME (type)) TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); if (TYPE_TAG_NAME (type)) -@@ -2881,12 +3069,45 @@ copy_type_recursive (struct objfile *objfile, +@@ -2950,12 +3136,45 @@ copy_type_recursive (struct objfile *objfile, TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); @@ -10481,7 +5969,7 @@ index 2f77dca..90abf2c 100644 TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); for (i = 0; i < nfields; i++) { -@@ -2895,8 +3116,8 @@ copy_type_recursive (struct objfile *objfile, +@@ -2964,8 +3183,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) @@ -10492,40 +5980,68 @@ index 2f77dca..90abf2c 100644 if (TYPE_FIELD_NAME (type, i)) TYPE_FIELD_NAME (new_type, i) = xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -2915,6 +3136,16 @@ copy_type_recursive (struct objfile *objfile, - xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type, - i))); - break; -+ case FIELD_LOC_KIND_DWARF_BLOCK: -+ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. */ -+ if (TYPE_NOT_ALLOCATED (new_type) -+ || TYPE_NOT_ASSOCIATED (new_type)) -+ SET_FIELD_DWARF_BLOCK (TYPE_FIELD (new_type, i), NULL); -+ else -+ SET_FIELD_BITPOS (TYPE_FIELD (new_type, i), -+ dwarf_locexpr_baton_eval (TYPE_FIELD_DWARF_BLOCK (type, i))); -+ break; - default: - internal_error (__FILE__, __LINE__, - _("Unexpected type field location kind: %d"), -@@ -2923,17 +3154,30 @@ copy_type_recursive (struct objfile *objfile, +@@ -2992,24 +3211,75 @@ copy_type_recursive (struct objfile *objfile, } } -+ /* Convert TYPE_RANGE_HIGH_BOUND_IS_COUNT into a regular bound. */ -+ if (TYPE_CODE (type) == TYPE_CODE_RANGE -+ && TYPE_RANGE_HIGH_BOUND_IS_COUNT (type)) -+ { -+ TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type) = 0; -+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (type) -+ + TYPE_HIGH_BOUND (type) - 1; -+ } -+ + /* Both FIELD_LOC_KIND_DWARF_BLOCK and TYPE_RANGE_HIGH_BOUND_IS_COUNT were + possibly converted. */ + TYPE_DYNAMIC (new_type) = 0; + + /* For range types, copy the bounds information. */ + if (TYPE_CODE (type) == TYPE_CODE_RANGE) + { + TYPE_RANGE_DATA (new_type) = xmalloc (sizeof (struct range_bounds)); + *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type); ++ ++ if (TYPE_LOW_BOUND_IS_DWARF_BLOCK (type)) ++ { ++ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so ++ it is expected to be made constant by CHECK_TYPEDEF. */ ++ if (TYPE_NOT_ALLOCATED (type) ++ || TYPE_NOT_ASSOCIATED (type)) ++ TYPE_RANGE_DATA (new_type)->low.u.dwarf_block = NULL; ++ else ++ TYPE_LOW_BOUND (new_type) = dwarf_locexpr_baton_eval ++ (TYPE_RANGE_DATA (new_type)->low.u.dwarf_block); ++ TYPE_LOW_BOUND_IS_DWARF_BLOCK (new_type) = 0; ++ } ++ ++ if (TYPE_HIGH_BOUND_IS_DWARF_BLOCK (type)) ++ { ++ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so ++ it is expected to be made constant by CHECK_TYPEDEF. */ ++ if (TYPE_NOT_ALLOCATED (type) ++ || TYPE_NOT_ASSOCIATED (type)) ++ TYPE_RANGE_DATA (new_type)->high.u.dwarf_block = NULL; ++ else ++ TYPE_HIGH_BOUND (new_type) = dwarf_locexpr_baton_eval ++ (TYPE_RANGE_DATA (new_type)->high.u.dwarf_block); ++ TYPE_HIGH_BOUND_IS_DWARF_BLOCK (new_type) = 0; ++ } ++ ++ if (TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (type)) ++ { ++ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so ++ it is expected to be made constant by CHECK_TYPEDEF. */ ++ if (TYPE_NOT_ALLOCATED (type) ++ || TYPE_NOT_ASSOCIATED (type)) ++ TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block = NULL; ++ else ++ TYPE_BYTE_STRIDE (new_type) = dwarf_locexpr_baton_eval ++ (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block); ++ TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (new_type) = 0; ++ } ++ ++ /* Convert TYPE_RANGE_HIGH_BOUND_IS_COUNT into a regular bound. */ ++ if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (type)) ++ { ++ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (type) ++ + TYPE_HIGH_BOUND (type) - 1; ++ TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type) = 0; ++ } + } + /* Copy pointers to other types. */ if (TYPE_TARGET_TYPE (type)) TYPE_TARGET_TYPE (new_type) = @@ -10546,7 +6062,7 @@ index 2f77dca..90abf2c 100644 /* Maybe copy the type_specific bits. NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -2951,6 +3195,17 @@ copy_type_recursive (struct objfile *objfile, +@@ -3027,6 +3297,17 @@ copy_type_recursive (struct objfile *objfile, return new_type; } @@ -10564,7 +6080,7 @@ index 2f77dca..90abf2c 100644 /* Make a copy of the given TYPE, except that the pointer & reference types are not preserved. -@@ -2973,6 +3228,217 @@ copy_type (const struct type *type) +@@ -3049,6 +3330,199 @@ copy_type (const struct type *type) return new_type; } @@ -10593,7 +6109,7 @@ index 2f77dca..90abf2c 100644 + /* `struct cplus_struct_type' handling is unsupported by this function. */ + gdb_assert ((TYPE_CODE (type) != TYPE_CODE_STRUCT + && TYPE_CODE (type) != TYPE_CODE_UNION) -+ || !HAVE_CPLUS_STRUCT (type) || !TYPE_CPLUS_SPECIFIC (type)); ++ || !HAVE_CPLUS_STRUCT (type)); + + if (!(*iter) (type, data)) + return; @@ -10641,10 +6157,7 @@ index 2f77dca..90abf2c 100644 + } + xfree (TYPE_FIELDS (type)); + -+ /* `struct cplus_struct_type' handling is unsupported by this function. */ -+ gdb_assert ((TYPE_CODE (type) != TYPE_CODE_STRUCT -+ && TYPE_CODE (type) != TYPE_CODE_UNION) -+ || !HAVE_CPLUS_STRUCT (type) || !TYPE_CPLUS_SPECIFIC (type)); ++ gdb_assert (!HAVE_CPLUS_STRUCT (type)); + + xfree (TYPE_MAIN_TYPE (type)); +} @@ -10725,21 +6238,6 @@ index 2f77dca..90abf2c 100644 + main_type_crawl (type, type_mark_used_crawl, NULL); +} + -+/* Increment the reference count for TYPE. */ -+ -+void -+type_incref (struct type *type) -+{ -+} -+ -+/* Decrement the reference count for TYPE. If TYPE has no more -+ references, delete it. */ -+ -+void -+type_decref (struct type *type) -+{ -+} -+ +/* A traverse callback for type_discardable_table which removes any + type_discardable whose reference count is now zero (unused link). */ + @@ -10782,7 +6280,7 @@ index 2f77dca..90abf2c 100644 /* Helper functions to initialize architecture-specific types. */ -@@ -3463,6 +3929,11 @@ void +@@ -3539,6 +4013,11 @@ void _initialize_gdbtypes (void) { gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); @@ -10795,10 +6293,10 @@ index 2f77dca..90abf2c 100644 add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index be6ed55..6a51a4e 100644 +index 8e73ca0..85888e1 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -137,6 +137,8 @@ enum type_code +@@ -138,6 +138,8 @@ enum type_code TYPE_CODE_DECFLOAT, /* Decimal floating point. */ @@ -10807,7 +6305,7 @@ index be6ed55..6a51a4e 100644 /* Internal function type. */ TYPE_CODE_INTERNAL_FUNCTION }; -@@ -213,6 +215,11 @@ enum type_instance_flag_value +@@ -214,6 +216,11 @@ enum type_instance_flag_value #define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) @@ -10819,7 +6317,7 @@ index be6ed55..6a51a4e 100644 /* Static type. If this is set, the corresponding type had * a static modifier. * Note: This may be unnecessary, since static data members -@@ -278,6 +285,48 @@ enum type_instance_flag_value +@@ -279,6 +286,48 @@ enum type_instance_flag_value #define TYPE_OWNER(t) TYPE_MAIN_TYPE(t)->owner #define TYPE_OBJFILE(t) (TYPE_OBJFILE_OWNED(t)? TYPE_OWNER(t).objfile : NULL) @@ -10868,7 +6366,17 @@ index be6ed55..6a51a4e 100644 /* Constant type. If this is set, the corresponding type has a * const modifier. */ -@@ -365,6 +414,13 @@ struct main_type +@@ -336,8 +385,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 +@@ -386,6 +434,13 @@ struct main_type unsigned int flag_nottext : 1; unsigned int flag_fixed_instance : 1; unsigned int flag_objfile_owned : 1; @@ -10880,9 +6388,9 @@ index be6ed55..6a51a4e 100644 + unsigned int flag_not_associated : 1; + unsigned int flag_data_location_is_addr : 1; - /* Number of fields described for this type. This field appears at - this location because it packs nicely here. */ -@@ -431,6 +487,20 @@ struct main_type + /* A discriminant telling us which field of the type_specific union + is being used for this type, if any. */ +@@ -456,6 +511,20 @@ struct main_type struct type *target_type; @@ -10903,7 +6411,48 @@ index be6ed55..6a51a4e 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. -@@ -538,6 +608,9 @@ struct main_type +@@ -492,12 +561,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; + +@@ -535,13 +598,22 @@ struct main_type + + struct range_bounds + { ++ struct ++ { ++ union ++ { ++ struct dwarf2_locexpr_baton *dwarf_block; ++ LONGEST constant; ++ } ++ u; ++ unsigned is_dwarf_block : 1; ++ } + /* Low bound of range. */ +- +- LONGEST low; +- ++ low, + /* High bound of range. */ +- +- LONGEST high; ++ high, ++ /* Byte stride of range. */ ++ byte_stride; + + /* Flags indicating whether the values of low and high are + valid. When true, the respective range value is +@@ -593,6 +665,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; @@ -10913,7 +6462,7 @@ index be6ed55..6a51a4e 100644 } type_specific; }; -@@ -812,9 +885,9 @@ extern void allocate_cplus_struct_type (struct type *); +@@ -900,9 +975,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 @@ -10926,9 +6475,9 @@ index be6ed55..6a51a4e 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 -@@ -823,23 +896,44 @@ extern void allocate_cplus_struct_type (struct type *); +@@ -911,15 +986,26 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields - #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->fields + #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 @@ -10936,42 +6485,41 @@ index be6ed55..6a51a4e 100644 +#define TYPE_ASSOCIATED(thistype) TYPE_MAIN_TYPE (thistype)->associated #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0) - #define TYPE_LOW_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 0) - #define TYPE_HIGH_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 1) -- --/* Moto-specific stuff for FORTRAN arrays */ -- --#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \ -- (TYPE_FIELD_ARTIFICIAL(TYPE_INDEX_TYPE((arraytype)),1)) -+#define TYPE_BYTE_STRIDE(range_type) TYPE_FIELD_BITPOS (range_type, 2) -+ -+/* Whether we should use TYPE_FIELD_DWARF_BLOCK (and not TYPE_FIELD_BITPOS). */ -+#define TYPE_RANGE_BOUND_IS_DWARF_BLOCK(range_type, fieldno) \ -+ (TYPE_FIELD_LOC_KIND (range_type, fieldno) == FIELD_LOC_KIND_DWARF_BLOCK) -+#define TYPE_RANGE_BOUND_SET_DWARF_BLOCK(range_type, fieldno) \ -+ (TYPE_FIELD_LOC_KIND (range_type, fieldno) = FIELD_LOC_KIND_DWARF_BLOCK) -+#define TYPE_ARRAY_BOUND_IS_DWARF_BLOCK(array_type, fieldno) \ -+ TYPE_RANGE_BOUND_IS_DWARF_BLOCK (TYPE_INDEX_TYPE (array_type), fieldno) -+ -+/* Unbound arrays, such as GCC array[]; at end of struct. */ -+#define TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED(rangetype) \ -+ TYPE_FIELD_ARTIFICIAL((rangetype),0) -+#define TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED(rangetype) \ -+ TYPE_FIELD_ARTIFICIAL((rangetype),1) + #define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds +-#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low +-#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high ++#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low.u.constant ++#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high.u.constant ++#define TYPE_BYTE_STRIDE(range_type) TYPE_RANGE_DATA(range_type)->byte_stride.u.constant + #define TYPE_LOW_BOUND_UNDEFINED(range_type) \ + TYPE_RANGE_DATA(range_type)->low_undefined + #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \ + TYPE_RANGE_DATA(range_type)->high_undefined ++#define TYPE_LOW_BOUND_IS_DWARF_BLOCK(range_type) \ ++ TYPE_RANGE_DATA(range_type)->low.is_dwarf_block ++#define TYPE_HIGH_BOUND_IS_DWARF_BLOCK(range_type) \ ++ TYPE_RANGE_DATA(range_type)->high.is_dwarf_block ++#define TYPE_BYTE_STRIDE_IS_DWARF_BLOCK(range_type) \ ++ TYPE_RANGE_DATA(range_type)->byte_stride.is_dwarf_block + + /* Moto-specific stuff for FORTRAN arrays */ + +@@ -928,11 +1014,23 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ -- (TYPE_FIELD_ARTIFICIAL(TYPE_INDEX_TYPE((arraytype)),0)) -- --#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ -- (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) -+ TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (TYPE_INDEX_TYPE (arraytype)) -+#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \ -+ TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (TYPE_INDEX_TYPE (arraytype)) + TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) + ++#define TYPE_ARRAY_UPPER_BOUND_IS_DWARF_BLOCK(arraytype) \ ++ TYPE_HIGH_BOUND_IS_DWARF_BLOCK(TYPE_INDEX_TYPE(arraytype)) ++#define TYPE_ARRAY_LOWER_BOUND_IS_DWARF_BLOCK(arraytype) \ ++ TYPE_LOW_BOUND_IS_DWARF_BLOCK(TYPE_INDEX_TYPE(arraytype)) ++ + #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ + (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ - (TYPE_LOW_BOUND(TYPE_INDEX_TYPE((arraytype)))) + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (arraytype)) -+#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ -+ TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (arraytype)) ++ +/* TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) with a fallback to the + element size if no specific stride value is known. */ +#define TYPE_ARRAY_BYTE_STRIDE_VALUE(arraytype) \ @@ -10981,24 +6529,41 @@ index be6ed55..6a51a4e 100644 /* C++ */ -@@ -855,6 +949,7 @@ extern void allocate_cplus_struct_type (struct type *); - #define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff - #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat +@@ -961,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_MAIN_TYPE(thistype)->fields[index].type + #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_MAIN_TYPE(thistype)->fields[index].name -@@ -1131,7 +1226,7 @@ extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN - Use alloc_type_arch to allocate a type owned by an architecture. - Use alloc_type_copy to allocate a type with the same owner as a - pre-existing template type, no matter whether objfile or gdbarch. */ --extern struct type *alloc_type (struct objfile *); -+extern struct type *alloc_type (struct objfile *, struct type *); - extern struct type *alloc_type_arch (struct gdbarch *); - extern struct type *alloc_type_copy (const struct type *); + #define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index) +@@ -979,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)) +@@ -989,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) -@@ -1226,6 +1321,18 @@ extern struct type *create_array_type (struct type *, struct type *, +@@ -1002,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) +@@ -1333,6 +1427,18 @@ extern struct type *create_array_type (struct type *, struct type *, struct type *); extern struct type *lookup_array_range_type (struct type *, int, int); @@ -11017,7 +6582,7 @@ index be6ed55..6a51a4e 100644 extern struct type *create_string_type (struct type *, struct type *, struct type *); extern struct type *lookup_string_range_type (struct type *, int, int); -@@ -1262,6 +1369,8 @@ extern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *); +@@ -1369,6 +1475,8 @@ extern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *); extern int is_ancestor (struct type *, struct type *); @@ -11026,7 +6591,7 @@ index be6ed55..6a51a4e 100644 /* Overload resolution */ #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1324,10 +1433,15 @@ extern void maintenance_print_type (char *, int); +@@ -1431,10 +1539,11 @@ extern void maintenance_print_type (char *, int); extern htab_t create_copied_types_hash (struct objfile *objfile); @@ -11038,141 +6603,16 @@ index be6ed55..6a51a4e 100644 extern struct type *copy_type (const struct type *type); +extern void free_all_types (void); -+ -+extern void type_incref (struct type *type); -+ -+extern void type_decref (struct type *type); + #endif /* GDBTYPES_H */ -diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c -index 0f9d44e..c910e88 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" -@@ -459,10 +460,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; -@@ -590,15 +589,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/i386-linux-nat.c b/gdb/i386-linux-nat.c -index fe848ff..905dcc3 100644 +index ff837f2..1710487 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c -@@ -586,6 +586,8 @@ i386_linux_store_inferior_registers (struct target_ops *ops, - - static unsigned long i386_linux_dr[DR_CONTROL + 1]; - -+/* Get debug register REGNUM value from only the one LWP of PTID. */ -+ - static unsigned long - i386_linux_dr_get (ptid_t ptid, int regnum) - { -@@ -614,6 +616,8 @@ i386_linux_dr_get (ptid_t ptid, int regnum) - return value; +@@ -696,6 +696,21 @@ i386_linux_dr_unset_status (unsigned long mask) + } } -+/* Set debug register REGNUM to VALUE in only the one LWP of PTID. */ -+ - static void - i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) - { -@@ -630,6 +634,8 @@ i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) - perror_with_name (_("Couldn't write debug register")); - } - -+/* Set DR_CONTROL to ADDR in all LWPs of LWP_LIST. */ -+ - static void - i386_linux_dr_set_control (unsigned long control) - { -@@ -641,6 +647,8 @@ i386_linux_dr_set_control (unsigned long control) - i386_linux_dr_set (ptid, DR_CONTROL, control); - } - -+/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */ -+ - static void - i386_linux_dr_set_addr (int regnum, CORE_ADDR addr) - { -@@ -654,18 +662,55 @@ i386_linux_dr_set_addr (int regnum, CORE_ADDR addr) - i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); - } - -+/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */ -+ - static void - i386_linux_dr_reset_addr (int regnum) - { - i386_linux_dr_set_addr (regnum, 0); - } - -+/* Get DR_STATUS from only the one LWP of INFERIOR_PTID. */ -+ - static unsigned long - i386_linux_dr_get_status (void) - { - return i386_linux_dr_get (inferior_ptid, DR_STATUS); - } - -+/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST. */ -+ -+static void -+i386_linux_dr_unset_status (unsigned long mask) -+{ -+ struct lwp_info *lp; -+ ptid_t ptid; -+ -+ ALL_LWPS (lp, ptid) -+ { -+ unsigned long value; -+ -+ value = i386_linux_dr_get (ptid, DR_STATUS); -+ value &= ~mask; -+ i386_linux_dr_set (ptid, DR_STATUS, value); -+ } -+} -+ +/* See i386_dr_low_type.detach. Do not use wrappers i386_linux_dr_set_control + or i386_linux_dr_reset_addr as they would modify the register cache + (i386_linux_dr). */ @@ -11191,56 +6631,19 @@ index fe848ff..905dcc3 100644 static void i386_linux_new_thread (ptid_t ptid) { -@@ -837,6 +882,8 @@ _initialize_i386_linux_nat (void) - i386_dr_low.set_addr = i386_linux_dr_set_addr; +@@ -868,6 +883,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; + i386_dr_low.unset_status = i386_linux_dr_unset_status; + i386_dr_low.detach = i386_linux_dr_detach; i386_set_debug_register_length (4); /* Override the default ptrace resume method. */ diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c -index 325b4df..631ccd6 100644 +index fa0cce6..42dfd1c 100644 --- a/gdb/i386-nat.c +++ b/gdb/i386-nat.c -@@ -137,8 +137,11 @@ struct i386_dr_low_type i386_dr_low; - #define I386_DR_GET_RW_LEN(i) \ - ((dr_control_mirror >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f) - -+/* Mask that this I'th watchpoint has triggered. */ -+#define I386_DR_WATCH_MASK(i) (1 << (i)) -+ - /* Did the watchpoint whose address is in the I'th register break? */ --#define I386_DR_WATCH_HIT(i) (dr_status_mirror & (1 << (i))) -+#define I386_DR_WATCH_HIT(i) (dr_status_mirror & I386_DR_WATCH_MASK (i)) - - /* A macro to loop over all debug registers. */ - #define ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++) -@@ -358,6 +361,10 @@ i386_insert_aligned_watchpoint (CORE_ADDR addr, unsigned len_rw_bits) - i386_dr_low.set_addr (i, addr); - i386_dr_low.set_control (dr_control_mirror); - -+ /* Only a sanity check for leftover bits (set possibly only by inferior). */ -+ if (i386_dr_low.unset_status) -+ i386_dr_low.unset_status (I386_DR_WATCH_MASK (i)); -+ - return 0; - } - -@@ -387,6 +394,11 @@ i386_remove_aligned_watchpoint (CORE_ADDR addr, unsigned len_rw_bits) - i386_dr_low.set_control (dr_control_mirror); - if (i386_dr_low.reset_addr) - i386_dr_low.reset_addr (i); -+ -+ /* Status must be already queried for each LWP. Otherwise it will -+ be lost in all-stop mode + breakpoint always-inserted off. */ -+ if (i386_dr_low.unset_status) -+ i386_dr_low.unset_status (I386_DR_WATCH_MASK (i)); - } - retval = 0; - } -@@ -520,6 +532,17 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type) +@@ -527,6 +527,17 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type) return retval; } @@ -11258,37 +6661,7 @@ index 325b4df..631ccd6 100644 /* Return non-zero if we can watch a memory region that starts at address ADDR and whose length is LEN bytes. */ -@@ -578,28 +601,7 @@ static int - i386_stopped_by_watchpoint (void) - { - CORE_ADDR addr = 0; -- return i386_stopped_data_address (¤t_target, &addr); --} -- --/* Return non-zero if the inferior has some break/watchpoint that -- triggered. */ -- --static int --i386_stopped_by_hwbp (void) --{ -- int i; -- -- dr_status_mirror = i386_dr_low.get_status (); -- if (maint_show_dr) -- i386_show_dr ("stopped_by_hwbp", 0, 0, hw_execute); -- -- ALL_DEBUG_REGISTERS(i) -- { -- if (I386_DR_WATCH_HIT (i)) -- return 1; -- } -- -- return 0; -+ return target_stopped_data_address (¤t_target, &addr); - } - - /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. -@@ -693,6 +695,7 @@ i386_use_watchpoints (struct target_ops *t) +@@ -679,6 +690,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; @@ -11297,84 +6670,33 @@ index 325b4df..631ccd6 100644 t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint; } diff --git a/gdb/i386-nat.h b/gdb/i386-nat.h -index f49b9f6..cd31958 100644 +index 7317e7d..ea914a5 100644 --- a/gdb/i386-nat.h +++ b/gdb/i386-nat.h -@@ -49,16 +49,23 @@ extern void i386_use_watchpoints (struct target_ops *); - functions are: +@@ -62,6 +62,10 @@ extern void i386_use_watchpoints (struct target_ops *); + unset_status -- unset the specified bits of the debug + status (DR6) register for all LWPs - set_control -- set the debug control (DR7) -- register to a given value -+ register to a given value for all LWPs - - set_addr -- put an address into one debug -- register -+ register for all LWPs - - reset_addr -- reset the address stored in -- one debug register -+ one debug register for all LWPs - - get_status -- return the value of the debug -- status (DR6) register. -+ status (DR6) register for current LWP -+ -+ unset_status -- unset the specified bits of the debug -+ status (DR6) register for all LWPs -+ + detach -- clear all debug registers of only the + INFERIOR_PTID task without affecting any + register caches. - ++ Additionally, the native file should set the debug_register_length field to 4 or 8 depending on the number of bytes used for -@@ -70,6 +77,8 @@ struct i386_dr_low_type - void (*set_addr) (int, CORE_ADDR); + deubg registers. */ +@@ -73,6 +77,7 @@ struct i386_dr_low_type void (*reset_addr) (int); unsigned long (*get_status) (void); -+ void (*unset_status) (unsigned long); + void (*unset_status) (unsigned long); + void (*detach) (void); int debug_register_length; }; -diff --git a/gdb/infcall.c b/gdb/infcall.c -index c9d98cf..277399a 100644 ---- a/gdb/infcall.c -+++ b/gdb/infcall.c -@@ -441,6 +441,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) - struct gdbarch *gdbarch; - struct breakpoint *terminate_bp = NULL; - struct minimal_symbol *tm; -+ struct cleanup *terminate_bp_cleanup = NULL; - ptid_t call_thread_ptid; - struct gdb_exception e; - const char *name; -@@ -772,7 +773,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) - - /* Register a clean-up for unwind_on_terminating_exception_breakpoint. */ - if (terminate_bp) -- make_cleanup_delete_breakpoint (terminate_bp); -+ terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp); - - /* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - - If you're looking to implement asynchronous dummy-frames, then -@@ -987,6 +988,11 @@ When the function is done executing, GDB will silently stop."), - internal_error (__FILE__, __LINE__, _("... should not be here")); - } - -+ /* If we get here and the std::terminate() breakpoint has been set, -+ it has to be cleaned manually. */ -+ if (terminate_bp) -+ do_cleanups (terminate_bp_cleanup); -+ - /* If we get here the called FUNCTION ran to completion, - and the dummy frame has already been popped. */ - diff --git a/gdb/infcmd.c b/gdb/infcmd.c -index 9e98290..fab1892 100644 +index 21a2233..34a3718 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c -@@ -801,7 +801,7 @@ nexti_command (char *count_string, int from_tty) +@@ -805,7 +805,7 @@ nexti_command (char *count_string, int from_tty) step_1 (1, 1, count_string); } @@ -11383,7 +6705,7 @@ index 9e98290..fab1892 100644 delete_longjmp_breakpoint_cleanup (void *arg) { int thread = * (int *) arg; -@@ -841,10 +841,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) +@@ -845,10 +845,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) if (!single_inst || skip_subroutines) /* leave si command alone */ { @@ -11397,7 +6719,7 @@ index 9e98290..fab1892 100644 make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); } -@@ -1193,6 +1196,15 @@ signal_command (char *signum_exp, int from_tty) +@@ -1197,6 +1200,15 @@ signal_command (char *signum_exp, int from_tty) proceed ((CORE_ADDR) -1, oursig, 0); } @@ -11413,7 +6735,7 @@ index 9e98290..fab1892 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. -@@ -1209,6 +1221,8 @@ until_next_command (int from_tty) +@@ -1213,6 +1225,8 @@ until_next_command (int from_tty) struct symbol *func; struct symtab_and_line sal; struct thread_info *tp = inferior_thread (); @@ -11422,7 +6744,7 @@ index 9e98290..fab1892 100644 clear_proceed_status (); set_step_frame (); -@@ -1244,7 +1258,19 @@ until_next_command (int from_tty) +@@ -1248,7 +1262,19 @@ until_next_command (int from_tty) tp->step_multi = 0; /* Only one call to proceed */ @@ -11442,7 +6764,7 @@ index 9e98290..fab1892 100644 } static void -@@ -1421,6 +1447,7 @@ finish_command_continuation (void *arg) +@@ -1425,6 +1451,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); @@ -11450,7 +6772,7 @@ index 9e98290..fab1892 100644 } static void -@@ -1504,6 +1531,7 @@ finish_forward (struct symbol *function, struct frame_info *frame) +@@ -1508,6 +1535,7 @@ finish_forward (struct symbol *function, struct frame_info *frame) struct breakpoint *breakpoint; struct cleanup *old_chain; struct finish_command_continuation_args *cargs; @@ -11458,7 +6780,7 @@ index 9e98290..fab1892 100644 sal = find_pc_line (get_frame_pc (frame), 0); sal.pc = get_frame_pc (frame); -@@ -1514,6 +1542,10 @@ finish_forward (struct symbol *function, struct frame_info *frame) +@@ -1518,6 +1546,10 @@ finish_forward (struct symbol *function, struct frame_info *frame) old_chain = make_cleanup_delete_breakpoint (breakpoint); @@ -11467,13 +6789,13 @@ index 9e98290..fab1892 100644 + make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); + tp->proceed_to_finish = 1; /* We want stop_registers, please... */ - proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); + cargs = xmalloc (sizeof (*cargs)); diff --git a/gdb/inferior.h b/gdb/inferior.h -index f1b5d17..31add7d 100644 +index 9798ef1..e9783fb 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h -@@ -272,6 +272,8 @@ extern void interrupt_target_command (char *args, int from_tty); +@@ -279,6 +279,8 @@ extern void interrupt_target_command (char *args, int from_tty); extern void interrupt_target_1 (int all_threads); @@ -11483,7 +6805,7 @@ index f1b5d17..31add7d 100644 extern void notice_new_inferior (ptid_t, int, int); diff --git a/gdb/infrun.c b/gdb/infrun.c -index ff7c6b9..9d29b15 100644 +index 426b816..bd65258 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -45,6 +45,8 @@ @@ -11495,7 +6817,7 @@ index ff7c6b9..9d29b15 100644 #include "gdb_assert.h" #include "mi/mi-common.h" #include "event-top.h" -@@ -1782,6 +1784,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, +@@ -2013,6 +2015,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); @@ -11504,7 +6826,7 @@ index ff7c6b9..9d29b15 100644 static void stop_stepping (struct execution_control_state *ecs); static void prepare_to_wait (struct execution_control_state *ecs); -@@ -2687,6 +2691,10 @@ handle_inferior_event (struct execution_control_state *ecs) +@@ -2942,6 +2946,10 @@ handle_inferior_event (struct execution_control_state *ecs) stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); @@ -11512,10 +6834,10 @@ index ff7c6b9..9d29b15 100644 + confuse bpstat_stop_status and bpstat_explains_signal. */ + watchpoints_triggered (&ecs->ws); + - ecs->event_thread->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid); - - ecs->random_signal = !bpstat_explains_signal (ecs->event_thread->stop_bpstat); -@@ -2724,6 +2732,10 @@ handle_inferior_event (struct execution_control_state *ecs) + ecs->event_thread->stop_bpstat + = bpstat_stop_status (get_regcache_aspace (get_current_regcache ()), + stop_pc, ecs->ptid); +@@ -3026,6 +3034,10 @@ handle_inferior_event (struct execution_control_state *ecs) stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); @@ -11523,29 +6845,10 @@ index ff7c6b9..9d29b15 100644 + confuse bpstat_stop_status and bpstat_explains_signal. */ + watchpoints_triggered (&ecs->ws); + - /* This causes the eventpoints and symbol table to be reset. - Must do this now, before trying to determine whether to - stop. */ -@@ -2845,6 +2857,9 @@ targets should add new threads to the thread list themselves in non-stop mode.") - { - struct regcache *regcache = get_thread_regcache (ecs->ptid); - struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ struct cleanup *old_chain = save_inferior_ptid (); -+ -+ inferior_ptid = ecs->ptid; + /* Do whatever is necessary to the parent branch of the vfork. */ + handle_vfork_child_exec_or_exit (1); - fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = %s\n", - paddress (gdbarch, stop_pc)); -@@ -2861,6 +2876,8 @@ targets should add new threads to the thread list themselves in non-stop mode.") - fprintf_unfiltered (gdb_stdlog, - "infrun: (no data address available)\n"); - } -+ -+ do_cleanups (old_chain); - } - - if (stepping_past_singlestep_breakpoint) -@@ -3468,23 +3485,33 @@ process_event_stop_test: +@@ -3784,23 +3796,33 @@ process_event_stop_test: ecs->event_thread->stepping_over_breakpoint = 1; @@ -11591,7 +6894,7 @@ index ff7c6b9..9d29b15 100644 keep_going (ecs); return; -@@ -3496,6 +3523,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); +@@ -3812,6 +3834,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); @@ -11645,7 +6948,7 @@ index ff7c6b9..9d29b15 100644 ecs->event_thread->stop_step = 1; print_stop_reason (END_STEPPING_RANGE, 0); stop_stepping (ecs); -@@ -4500,6 +4574,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) +@@ -4831,6 +4900,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume); } @@ -11742,17 +7045,8 @@ index ff7c6b9..9d29b15 100644 static void stop_stepping (struct execution_control_state *ecs) { -@@ -4568,6 +4732,8 @@ keep_going (struct execution_control_state *ecs) - } - if (e.reason < 0) - { -+ if (debug_infrun) -+ exception_fprintf (gdb_stdlog, e, "infrun: exception while inserting breakpoints: "); - stop_stepping (ecs); - return; - } diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c -index 6b68e7d..5095180 100644 +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 = @@ -11763,228 +7057,14 @@ index 6b68e7d..5095180 100644 op_name_standard, dump_subexp_body_standard, evaluate_subexp_java -diff --git a/gdb/language.h b/gdb/language.h -index c650e07..660fdf6 100644 ---- a/gdb/language.h -+++ b/gdb/language.h -@@ -237,7 +237,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 3e943a1..b96d425 100644 ---- a/gdb/linespec.c -+++ b/gdb/linespec.c -@@ -30,6 +30,7 @@ - #include "value.h" - #include "completer.h" - #include "cp-abi.h" -+#include "cp-support.h" - #include "parser-defs.h" - #include "block.h" - #include "objc-lang.h" -@@ -839,13 +840,33 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, - } - else if (paren_pointer != NULL) - { -- p = paren_pointer + 1; -+ /* We need to deal with method and function overloads -+ with no parameters. Gdb and gcc (and who knows about other -+ compilers) are very inconsistent with the keyword "void". -+ Canonicalizing C++ types is insufficient in this case, since -+ we still need to enforce the presence (or lack thereof) of -+ "void". For simplicity, omit the keyword "void" if present. */ -+ if (strncmp (paren_pointer - 5, "(void)", 6) == 0) -+ { -+ char *a, *b; -+ a = paren_pointer - 4; -+ b = paren_pointer; -+ while ((*(a++) = *(b++)) != '\0') ; -+ *a = '\0'; -+ p = paren_pointer - 3; -+ } -+ else -+ p = paren_pointer + 1; - } - else - { - p = skip_quoted (*argptr); - } - -+ /* Make sure we keep important kewords like "const" */ -+ if (strncmp (p, " const", 6) == 0) -+ p += 6; -+ - /* Keep any template parameters */ - if (*p == '<') - p = find_template_name_end (p); -@@ -1257,6 +1278,9 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, - /* Move pointer ahead to next double-colon. */ - while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'')) - { -+ if (current_language->la_language == language_cplus) -+ p += cp_validate_operator (p); -+ - if (p[0] == '<') - { - temp_end = find_template_name_end (p); -@@ -1334,6 +1358,15 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, - while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':') - p++; - /* At this point p->"". String ended. */ -+ /* Nope, C++ operators could have spaces in them -+ ("foo::operator <" or "foo::operator delete []"). -+ I apologize, this is a bit hacky... */ -+ if (current_language->la_language == language_cplus -+ && *p == ' ' && p - 8 - *argptr + 1 > 0) -+ { -+ /* The above loop has already swallowed "operator". */ -+ p += cp_validate_operator (p - 8) - 8; -+ } - } - - /* Allocate our own copy of the substring between argptr and -@@ -1407,6 +1440,7 @@ lookup_prefix_sym (char **argptr, char *p) - { - char *p1; - char *copy; -+ struct symbol *sym; - - /* Extract the class name. */ - p1 = p; -@@ -1425,7 +1459,26 @@ lookup_prefix_sym (char **argptr, char *p) - /* At this point p1->"::inA::fun", p->"inA::fun" copy->"AAA", - argptr->"inA::fun" */ - -- return lookup_symbol (copy, 0, STRUCT_DOMAIN, 0); -+ sym = lookup_symbol (copy, 0, STRUCT_DOMAIN, 0); -+ if (sym == NULL) -+ { -+ /* Typedefs are in VAR_DOMAIN so the above symbol lookup will -+ fail when the user attempts to lookup a method of a class -+ via a typedef'd name (NOT via the classes name, which is already -+ handled in symbol_matches_domain). So try the lookup again -+ using VAR_DOMAIN (where typedefs live) and double-check that we -+ found a struct/class type. */ -+ struct symbol *s = lookup_symbol (copy, 0, VAR_DOMAIN, 0); -+ if (s != NULL) -+ { -+ struct type *t = SYMBOL_TYPE (s); -+ CHECK_TYPEDEF (t); -+ if (TYPE_CODE (t) == TYPE_CODE_STRUCT) -+ return s; -+ } -+ } -+ -+ return sym; - } - - /* This finds the method COPY in the class whose type is T and whose -@@ -1474,26 +1527,16 @@ find_method (int funfirstline, char ***canonical, char *saved_arg, - } - else - { -- char *tmp; -- -- if (is_operator_name (copy)) -- { -- tmp = (char *) alloca (strlen (copy + 3) + 9); -- strcpy (tmp, "operator "); -- strcat (tmp, copy + 3); -- } -- else -- tmp = copy; - if (not_found_ptr) - *not_found_ptr = 1; -- if (tmp[0] == '~') -+ if (copy[0] == '~') - cplusplus_error (saved_arg, - "the class `%s' does not have destructor defined\n", - SYMBOL_PRINT_NAME (sym_class)); - else - cplusplus_error (saved_arg, - "the class %s does not have any method named %s\n", -- SYMBOL_PRINT_NAME (sym_class), tmp); -+ SYMBOL_PRINT_NAME (sym_class), copy); - } - } - -@@ -1780,7 +1823,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 98f6347..0907f03 100644 +index 03563cd..8145629 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c -@@ -1710,6 +1710,7 @@ resume_callback (struct lwp_info *lp, void *data) - lp->stopped = 0; - lp->step = 0; - memset (&lp->siginfo, 0, sizeof (lp->siginfo)); -+ lp->watchpoint_hit_set = 0; - } - else if (lp->stopped && debug_linux_nat) - fprintf_unfiltered (gdb_stdlog, "RC: Not resuming sibling %s (has pending)\n", -@@ -1847,6 +1848,7 @@ linux_nat_resume (struct target_ops *ops, - - linux_ops->to_resume (linux_ops, ptid, step, signo); - memset (&lp->siginfo, 0, sizeof (lp->siginfo)); -+ lp->watchpoint_hit_set = 0; - - if (debug_linux_nat) - fprintf_unfiltered (gdb_stdlog, -@@ -2286,6 +2288,78 @@ maybe_clear_ignore_sigint (struct lwp_info *lp) - } +@@ -2643,6 +2643,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) + return lp->stopped_data_address_p; } -+/* Fetch the possible triggered data watchpoint info and store it to LP. -+ The hardware data watchpoint trigger gets cleared during this fetch. */ -+ -+static void -+save_sigtrap (struct lwp_info *lp) -+{ -+ struct cleanup *old_chain; -+ -+ /* linux_nat_stopped_data_address is not even installed in this case. */ -+ if (linux_ops->to_stopped_data_address == NULL) -+ return; -+ -+ old_chain = save_inferior_ptid (); -+ inferior_ptid = lp->ptid; -+ -+ lp->watchpoint_hit_set = -+ linux_ops->to_stopped_data_address (¤t_target, &lp->watchpoint_hit); -+ -+ do_cleanups (old_chain); -+} -+ -+/* Wrap target_stopped_data_address where the GNU/Linux native target may be -+ directed by the watchpoint/debug register number. Base the reported value -+ on the triggered data address instead. During inferior stop the assignment -+ of watchpoint/debug registers may change making the register number specific -+ trigger info stale. */ -+ -+static int -+linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) -+{ -+ struct lwp_info *lp = find_lwp_pid (inferior_ptid); -+ -+ gdb_assert (lp != NULL); -+ -+ *addr_p = lp->watchpoint_hit; -+ -+ return lp->watchpoint_hit_set; -+} -+ +/* In `set follow-fork-mode child' with multithreaded parent we need to detach + watchpoints from all the LWPs. In such case INFERIOR_PTID will be the + non-threaded new child while LWP_LIST will still contain all the threads of @@ -12021,62 +7101,17 @@ index 98f6347..0907f03 100644 /* Wait until LP is stopped. */ static int -@@ -2337,6 +2411,8 @@ stop_wait_callback (struct lwp_info *lp, void *data) - /* Save the trap's siginfo in case we need it later. */ - save_siginfo (lp); - -+ save_sigtrap (lp); -+ - /* Now resume this LWP and get the SIGSTOP event. */ - errno = 0; - ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); -@@ -2701,10 +2777,14 @@ linux_nat_filter_event (int lwpid, int status, int options) - add_thread (lp->ptid); - } - -- /* Save the trap's siginfo in case we need it later. */ - if (WIFSTOPPED (status) - && (WSTOPSIG (status) == SIGTRAP || WSTOPSIG (status) == TRAP_IS_SYSCALL)) -- save_siginfo (lp); -+ { -+ /* Save the trap's siginfo in case we need it later. */ -+ save_siginfo (lp); -+ -+ save_sigtrap (lp); -+ } - - /* Handle GNU/Linux's extended waitstatus for trace events. - It is necessary to check if WSTOPSIG is signaling that -@@ -4999,6 +5079,10 @@ linux_nat_add_target (struct target_ops *t) - t->to_thread_alive = linux_nat_thread_alive; - t->to_pid_to_str = linux_nat_pid_to_str; - t->to_has_thread_control = tc_schedlock; -+ if (linux_ops->to_stopped_data_address) -+ t->to_stopped_data_address = linux_nat_stopped_data_address; +@@ -5519,6 +5552,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; + if (linux_ops->to_detach_watchpoints) + t->to_detach_watchpoints = linux_nat_detach_watchpoints; 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-nat.h b/gdb/linux-nat.h -index eae74f3..73204fc 100644 ---- a/gdb/linux-nat.h -+++ b/gdb/linux-nat.h -@@ -62,6 +62,12 @@ struct lwp_info - be the address of a hardware watchpoint. */ - struct siginfo siginfo; - -+ /* WATCHPOINT_HIT_SET is non-zero if this LWP stopped with a trap and a data -+ watchpoint has been found as triggered. In such case WATCHPOINT_HIT -+ contains data address of the triggered data watchpoint. */ -+ unsigned watchpoint_hit_set : 1; -+ CORE_ADDR watchpoint_hit; -+ - /* Non-zero if we expect a duplicated SIGINT. */ - int ignore_sigint; - diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c -index 88c7e5e..2d0b3ca 100644 +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 = @@ -12088,19 +7123,19 @@ index 88c7e5e..2d0b3ca 100644 dump_subexp_body_standard, evaluate_subexp_modula2 diff --git a/gdb/machoread.c b/gdb/machoread.c -index 5f9a0fe..66fa067 100644 +index 02b61d3..13ab595 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c -@@ -681,6 +681,7 @@ static struct sym_fns macho_sym_fns = { +@@ -755,6 +755,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 */ - NULL /* next: pointer to next struct sym_fns */ + default_symfile_segments, /* sym_segments: Get segment information from diff --git a/gdb/main.c b/gdb/main.c -index 55411a8..ac9a540 100644 +index 0cc0f75..e3fc2e6 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -40,6 +40,7 @@ @@ -12122,7 +7157,7 @@ index 55411a8..ac9a540 100644 static int print_version; @@ -434,10 +437,14 @@ captured_main (void *data) {"args", no_argument, &set_args, 1}, - {"l", required_argument, 0, 'l'}, + {"l", required_argument, 0, 'l'}, {"return-child-result", no_argument, &return_child_result, 1}, +#if HAVE_PYTHON + {"python", no_argument, 0, 'P'}, @@ -12251,7 +7286,7 @@ index 55411a8..ac9a540 100644 --readnow Fully read symbol files on first access.\n\ "), stream); diff --git a/gdb/maint.c b/gdb/maint.c -index ecbae12..80fc36e 100644 +index 4316d66..fe8a069 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -914,4 +914,12 @@ When enabled GDB is profiled."), @@ -12267,21 +7302,8 @@ index ecbae12..80fc36e 100644 + &maintenance_set_cmdlist, + &maintenance_show_cmdlist); } -diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c -index aac82e9..626292c 100644 ---- a/gdb/mdebugread.c -+++ b/gdb/mdebugread.c -@@ -4802,7 +4802,7 @@ new_type (char *name) - { - struct type *t; - -- t = alloc_type (current_objfile); -+ t = alloc_type (current_objfile, NULL); - TYPE_NAME (t) = name; - TYPE_CPLUS_SPECIFIC (t) = (struct cplus_struct_type *) &cplus_struct_default; - return t; diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c -index 0baaa83..94ebfeb 100644 +index b227411..3b932f0 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) @@ -12293,10 +7315,10 @@ index 0baaa83..94ebfeb 100644 varobj_update_one (var, print_values, 1 /* explicit */); diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c -index 857a5d5..6181002 100644 +index dde0062..832cfcc 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c -@@ -1130,7 +1130,7 @@ mi_cmd_list_features (char *command, char **argv, int argc) +@@ -1400,7 +1400,7 @@ mi_cmd_list_features (char *command, char **argv, int argc) ui_out_field_string (uiout, NULL, "frozen-varobjs"); ui_out_field_string (uiout, NULL, "pending-breakpoints"); ui_out_field_string (uiout, NULL, "thread-info"); @@ -12306,7 +7328,7 @@ index 857a5d5..6181002 100644 ui_out_field_string (uiout, NULL, "python"); #endif diff --git a/gdb/mipsread.c b/gdb/mipsread.c -index a84003f..924c1c5 100644 +index 4ef817e..1c53574 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -394,6 +394,7 @@ static struct sym_fns ecoff_sym_fns = @@ -12318,14 +7340,13 @@ index a84003f..924c1c5 100644 default_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */ default_symfile_segments, /* sym_segments: Get segment information from diff --git a/gdb/objfiles.c b/gdb/objfiles.c -index 8dcca70..e5442ca 100644 +index 0b07e37..5de5300 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c -@@ -634,6 +634,11 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets) +@@ -789,6 +789,10 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets) } } -+ /* Alread QUICK_ADDRMAP tiself assumes all sections have the same offset. */ + if (objfile->quick_addrmap) + addrmap_relocate (objfile->quick_addrmap, + ANOFFSET (delta, SECT_OFF_TEXT (objfile))); @@ -12333,7 +7354,16 @@ index 8dcca70..e5442ca 100644 { struct partial_symbol **psym; -@@ -731,6 +736,20 @@ have_partial_symbols (void) +@@ -914,7 +918,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. */ +@@ -954,6 +958,20 @@ have_partial_symbols (void) if (objfile_has_partial_symbols (ofp)) return 1; } @@ -12355,10 +7385,10 @@ index 8dcca70..e5442ca 100644 } diff --git a/gdb/objfiles.h b/gdb/objfiles.h -index 62fa498..1fc9c6a 100644 +index c689622..eb3ae10 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h -@@ -212,6 +212,11 @@ struct objfile +@@ -213,6 +213,11 @@ struct objfile struct partial_symtab *psymtabs; @@ -12370,7 +7400,7 @@ index 62fa498..1fc9c6a 100644 /* 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 -@@ -414,6 +419,15 @@ struct objfile +@@ -426,6 +431,15 @@ struct objfile #define OBJF_USERLOADED (1 << 3) /* User loaded */ @@ -12383,10 +7413,10 @@ index 62fa498..1fc9c6a 100644 + +#define OBJF_MAIN (1 << 7) + - /* The object file that the main symbol table was loaded from (e.g. the - argument to the "symbol-file" or "file" command). */ + /* The object file that contains the runtime common minimal symbols + for SunOS4. Note that this objfile has no associated BFD. */ -@@ -568,6 +582,13 @@ extern void gdb_bfd_unref (struct bfd *abfd); +@@ -606,6 +620,13 @@ extern void gdb_bfd_unref (struct bfd *abfd); ALL_OBJFILES (objfile) \ ALL_OBJFILE_PSYMTABS (objfile, p) @@ -12397,14 +7427,14 @@ index 62fa498..1fc9c6a 100644 + ALL_OBJFILES (objfile) \ + ALL_OBJFILE_PSYMTABS (require_partial_symbols (objfile), p) + - /* Traverse all minimal symbols in all objfiles. */ - - #define ALL_MSYMBOLS(objfile, m) \ + #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 ef938e3..c243bd8 100644 +index 2885506..779b819 100644 --- a/gdb/parse.c +++ b/gdb/parse.c -@@ -63,6 +63,7 @@ const struct exp_descriptor exp_descriptor_standard = +@@ -62,6 +62,7 @@ const struct exp_descriptor exp_descriptor_standard = { print_subexp_standard, operator_length_standard, @@ -12412,23 +7442,7 @@ index ef938e3..c243bd8 100644 op_name_standard, dump_subexp_body_standard, evaluate_subexp_standard -@@ -837,6 +838,15 @@ operator_length_standard (struct expression *expr, int endpos, - args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); - break; - -+ case TYPE_INSTANCE: -+ oplen = 4 + longest_to_int (expr->elts[endpos - 2].longconst); -+ args = 1; -+ break; -+ -+ case TYPE_INSTANCE_LOOKUP: -+ oplen = 3; -+ break; -+ - case OP_OBJC_MSGCALL: /* Objective C message (method) call */ - oplen = 4; - args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); -@@ -1355,6 +1365,150 @@ parser_fprintf (FILE *x, const char *y, ...) +@@ -1359,6 +1360,150 @@ parser_fprintf (FILE *x, const char *y, ...) va_end (args); } @@ -12580,10 +7594,10 @@ index ef938e3..c243bd8 100644 _initialize_parse (void) { diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h -index cbda9c3..a07e6f2 100644 +index 6fcf7ae..3f5efe8 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h -@@ -189,6 +189,13 @@ extern void operator_length (struct expression *, int, int *, int *); +@@ -190,6 +190,13 @@ extern void operator_length (struct expression *, int, int *, int *); extern void operator_length_standard (struct expression *, int, int *, int *); @@ -12597,7 +7611,7 @@ index cbda9c3..a07e6f2 100644 extern char *op_name_standard (enum exp_opcode); extern struct type *follow_types (struct type *); -@@ -267,6 +274,20 @@ struct exp_descriptor +@@ -268,6 +275,20 @@ struct exp_descriptor the number of subexpressions it takes. */ void (*operator_length) (struct expression*, int, int*, int *); @@ -12618,7 +7632,7 @@ index cbda9c3..a07e6f2 100644 /* Name of this operator for dumping purposes. */ char *(*op_name) (enum exp_opcode); -@@ -299,4 +320,8 @@ extern void print_subexp_standard (struct expression *, int *, +@@ -300,4 +321,8 @@ extern void print_subexp_standard (struct expression *, int *, extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3); @@ -12628,7 +7642,7 @@ index cbda9c3..a07e6f2 100644 + #endif /* PARSER_DEFS_H */ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c -index 47b74ad..22fb2fc 100644 +index 10ff73d..5b68f56 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) @@ -12665,7 +7679,7 @@ index 47b74ad..22fb2fc 100644 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/printcmd.c b/gdb/printcmd.c -index 5d8b936..fb0a455 100644 +index 88db08b..18dae9e 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -46,7 +46,6 @@ @@ -12675,8 +7689,8 @@ index 5d8b936..fb0a455 100644 -#include "solib.h" #include "parser-defs.h" #include "charset.h" - -@@ -900,6 +899,11 @@ print_command_1 (char *exp, int inspect, int voidprint) + #include "arch-utils.h" +@@ -941,6 +940,11 @@ print_command_1 (char *exp, int inspect, int voidprint) else val = access_value_history (0); @@ -12688,7 +7702,7 @@ index 5d8b936..fb0a455 100644 if (voidprint || (val && value_type (val) && TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) { -@@ -1396,6 +1400,22 @@ x_command (char *exp, int from_tty) +@@ -1437,6 +1441,22 @@ x_command (char *exp, int from_tty) set_internalvar (lookup_internalvar ("__"), last_examine_value); } } @@ -12711,7 +7725,7 @@ index 5d8b936..fb0a455 100644 /* Add an expression to the auto-display chain. -@@ -1798,50 +1818,6 @@ disable_display_command (char *args, int from_tty) +@@ -1859,52 +1879,6 @@ disable_display_command (char *args, int from_tty) } } @@ -12727,6 +7741,7 @@ index 5d8b936..fb0a455 100644 - 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; - @@ -12747,7 +7762,8 @@ index 5d8b936..fb0a455 100644 - SYMBOL_OBJ_SECTION (symbol); - - if (block != NULL -- && solib_contains_address_p (solib, block->startaddr)) +- && solib_contains_address_p (solib, +- block->startaddr)) - return 1; - - if (section && section->objfile == solib->objfile) @@ -12762,7 +7778,7 @@ index 5d8b936..fb0a455 100644 /* 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 -@@ -1853,18 +1829,20 @@ display_uses_solib_p (const struct display *d, +@@ -1916,18 +1890,20 @@ display_uses_solib_p (const struct display *d, static void clear_dangling_display_expressions (struct so_list *solib) { @@ -12793,7 +7809,7 @@ index 5d8b936..fb0a455 100644 } -@@ -2749,4 +2727,6 @@ Show printing of source filename and line number with ."), NULL, +@@ -2812,4 +2788,6 @@ Show printing of source filename and line number with ."), NULL, NULL, show_print_symbol_filename, &setprintlist, &showprintlist); @@ -14004,10 +9020,10 @@ index 0000000..8019e9d +}; diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c new file mode 100644 -index 0000000..afa9526 +index 0000000..783385e --- /dev/null +++ b/gdb/python/py-breakpoint.c -@@ -0,0 +1,665 @@ +@@ -0,0 +1,666 @@ +/* Python interface to breakpoints + + Copyright (C) 2008, 2009 Free Software Foundation, Inc. @@ -14036,7 +9052,8 @@ index 0000000..afa9526 +#include "gdbcmd.h" +#include "gdbthread.h" +#include "observer.h" -+ ++#include "arch-utils.h" ++#include "language.h" + +/* From breakpoint.c. */ +extern struct breakpoint *breakpoint_chain; @@ -14504,7 +9521,7 @@ index 0000000..afa9526 +{ + breakpoint_object *newbp; + struct breakpoint *bp; -+ PyGILState_STATE state; ++ struct cleanup *cleanup; + + if (num < 0) + return; @@ -14529,7 +9546,7 @@ index 0000000..afa9526 + + ++bppy_live; + -+ state = PyGILState_Ensure (); ++ cleanup = ensure_python_env (get_current_arch (), current_language); + + if (bppy_pending_object) + { @@ -14562,7 +9579,7 @@ index 0000000..afa9526 + /* Just ignore errors here. */ + PyErr_Clear (); + -+ PyGILState_Release (state); ++ do_cleanups (cleanup); +} + +/* Callback that is used when a breakpoint is deleted. This will @@ -14570,9 +9587,9 @@ index 0000000..afa9526 +static void +gdbpy_breakpoint_deleted (int num) +{ -+ PyGILState_STATE state; ++ struct cleanup *cleanup; + -+ state = PyGILState_Ensure (); ++ cleanup = ensure_python_env (get_current_arch (), current_language); + if (BPPY_VALID_P (num)) + { + bppy_breakpoints[num]->bp = NULL; @@ -14580,7 +9597,7 @@ index 0000000..afa9526 + bppy_breakpoints[num] = NULL; + --bppy_live; + } -+ PyGILState_Release (state); ++ do_cleanups (cleanup); +} + + @@ -14674,7 +9691,7 @@ index 0000000..afa9526 + breakpoint_object_getset /* tp_getset */ +}; diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c -index 528aca6..04b3fd1 100644 +index ae462d9..22d1405 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -49,8 +49,7 @@ static struct cmdpy_completer completers[] = @@ -14739,7 +9756,7 @@ index 528aca6..04b3fd1 100644 return -1; diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c -index 279415c..5d8ce0a 100644 +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) @@ -14984,13 +10001,13 @@ index 0000000..a3140bc +} diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c new file mode 100644 -index 0000000..5e90cc2 +index 0000000..b259ab5 --- /dev/null +++ b/gdb/python/py-inferior.c -@@ -0,0 +1,926 @@ +@@ -0,0 +1,934 @@ +/* Python interface to inferiors. + -+ Copyright (C) 2009 Free Software Foundation, Inc. ++ Copyright (C) 2009, 2010 Free Software Foundation, Inc. + + This file is part of GDB. + @@ -15072,7 +10089,7 @@ index 0000000..5e90cc2 + +/* List containing inferior_objects. This list owns a reference to each + object it contains. */ -+static struct inflist_entry *inferior_list; ++static struct inflist_entry *gdbpy_inferior_list; + +static int ninferiors; + @@ -15094,7 +10111,10 @@ index 0000000..5e90cc2 + return; + } + -+ cleanup = ensure_python_env (get_current_arch (), current_language); ++ /* 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) @@ -15111,9 +10131,9 @@ index 0000000..5e90cc2 + + entry = xmalloc (sizeof (struct inflist_entry)); + entry->inf_obj = inf_obj; -+ entry->next = inferior_list; ++ entry->next = gdbpy_inferior_list; + -+ inferior_list = entry; ++ gdbpy_inferior_list = entry; + + ninferiors++; + @@ -15126,12 +10146,12 @@ index 0000000..5e90cc2 +static void +delete_inferior_object (int pid) +{ -+ PyGILState_STATE state; ++ 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 = &inferior_list; *inf_entry != NULL; ++ for (inf_entry = &gdbpy_inferior_list; *inf_entry != NULL; + inf_entry = &(*inf_entry)->next) + if ((*inf_entry)->inf_obj->inferior->pid == pid) + break; @@ -15139,7 +10159,7 @@ index 0000000..5e90cc2 + if (!*inf_entry) + return; + -+ state = PyGILState_Ensure (); ++ cleanup = ensure_python_env (get_current_arch (), current_language); + + inf_tmp = *inf_entry; + inf_tmp->inf_obj->inferior = NULL; @@ -15162,7 +10182,7 @@ index 0000000..5e90cc2 + + ninferiors--; + -+ PyGILState_Release (state); ++ do_cleanups (cleanup); +} + +/* Finds the Python Inferior object for the given pid. Returns a borrowed @@ -15172,7 +10192,7 @@ index 0000000..5e90cc2 +{ + struct inflist_entry *p; + -+ for (p = inferior_list; p != NULL; p = p->next) ++ for (p = gdbpy_inferior_list; p != NULL; p = p->next) + if (p->inf_obj->inferior->pid == pid) + return (PyObject *) p->inf_obj; + @@ -15189,7 +10209,7 @@ index 0000000..5e90cc2 + struct threadlist_entry *q; + + pid = PIDGET (ptid); -+ for (p = inferior_list; p != NULL; p = p->next) ++ 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)) @@ -15205,19 +10225,22 @@ index 0000000..5e90cc2 +static void +add_thread_object (struct thread_info *tp) +{ -+ PyGILState_STATE state; ++ struct cleanup *cleanup; + thread_object *thread_obj; + inferior_object *inf_obj; + struct threadlist_entry *entry; + -+ state = PyGILState_Ensure (); ++ /* 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 (); -+ PyGILState_Release (state); ++ do_cleanups (cleanup); + return; + } + @@ -15230,13 +10253,13 @@ index 0000000..5e90cc2 + inf_obj->threads = entry; + inf_obj->nthreads++; + -+ PyGILState_Release (state); ++ do_cleanups (cleanup); +} + +static void +delete_thread_object (struct thread_info *tp, int ignore) +{ -+ PyGILState_STATE state; ++ struct cleanup *cleanup; + inferior_object *inf_obj; + thread_object *thread_obj; + struct threadlist_entry **entry, *tmp; @@ -15253,7 +10276,7 @@ index 0000000..5e90cc2 + if (!*entry) + return; + -+ state = PyGILState_Ensure (); ++ cleanup = ensure_python_env (get_current_arch (), current_language); + + tmp = *entry; + tmp->thread_obj->thread = NULL; @@ -15265,7 +10288,7 @@ index 0000000..5e90cc2 + xfree (tmp); + + -+ PyGILState_Release (state); ++ do_cleanups (cleanup); +} + +static PyObject * @@ -15343,7 +10366,9 @@ index 0000000..5e90cc2 + + /* The list is in reverse order of inferior age (i.e., newest comes first), + is this a problem? */ -+ for (i = 0, entry = inferior_list; i < ninferiors; i++, entry = entry->next) ++ 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); @@ -15767,10 +10792,10 @@ index 0000000..5e90cc2 + PyModule_AddObject (gdb_module, "Inferior", + (PyObject *) &inferior_object_type); + -+ inferior_list = NULL; ++ gdbpy_inferior_list = NULL; + ninferiors = 0; + -+ observer_attach_new_inferior (add_inferior_object); ++ 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); @@ -17092,19 +12117,11 @@ index 0000000..1f591a8 + PyType_GenericNew /* tp_new */ +}; diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c -index 5d696c8..a6348ba 100644 +index 193f97c..2f2b365 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c -@@ -121,6 +121,7 @@ find_pretty_printer (PyObject *value) - - return function; - } -+ - /* 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, -@@ -141,10 +142,15 @@ pretty_print_one_value (PyObject *printer, struct value **out_value) - if (! gdbpy_is_string (result)) +@@ -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 ()) @@ -17123,7 +12140,7 @@ index 5d696c8..a6348ba 100644 } } } -@@ -556,14 +562,7 @@ gdbpy_get_varobj_pretty_printer (struct value *value) +@@ -604,14 +609,7 @@ gdbpy_get_varobj_pretty_printer (struct value *value) { PyObject *val_obj; PyObject *pretty_printer = NULL; @@ -17809,7 +12826,7 @@ index 0000000..830e586 + sal_object_getset /* tp_getset */ +}; diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c -index 590d90a..f512248 100644 +index a97c125..ac366bb 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -27,6 +27,8 @@ @@ -17840,19 +12857,7 @@ index 590d90a..f512248 100644 static PyTypeObject type_object_type; /* A Field object. */ -@@ -169,6 +177,11 @@ convert_field (struct type *type, int field) - if (PyObject_SetAttrString (result, "artificial", arg) < 0) - goto failarg; - -+ arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False; -+ Py_INCREF (arg); -+ if (PyObject_SetAttrString (result, "is_base_class", arg) < 0) -+ goto failarg; -+ - arg = PyLong_FromLong (TYPE_FIELD_BITSIZE (type, field)); - if (!arg) - goto fail; -@@ -361,7 +374,7 @@ typy_get_sizeof (PyObject *self, void *closure) +@@ -434,7 +442,7 @@ typy_get_sizeof (PyObject *self, void *closure) } static struct type * @@ -17861,7 +12866,7 @@ index 590d90a..f512248 100644 { struct type *type = NULL; volatile struct gdb_exception except; -@@ -375,7 +388,7 @@ typy_lookup_typename (char *type_name) +@@ -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, @@ -17870,7 +12875,7 @@ index 590d90a..f512248 100644 } if (except.reason < 0) { -@@ -389,7 +402,8 @@ typy_lookup_typename (char *type_name) +@@ -462,7 +470,8 @@ typy_lookup_typename (char *type_name) } static struct type * @@ -17880,7 +12885,7 @@ index 590d90a..f512248 100644 { struct type *type; char *type_name; -@@ -404,7 +418,7 @@ typy_lookup_type (struct demangle_component *demangled) +@@ -477,7 +486,7 @@ typy_lookup_type (struct demangle_component *demangled) || demangled_type == DEMANGLE_COMPONENT_CONST || demangled_type == DEMANGLE_COMPONENT_VOLATILE) { @@ -17889,7 +12894,7 @@ index 590d90a..f512248 100644 if (! type) return NULL; -@@ -422,7 +436,7 @@ typy_lookup_type (struct demangle_component *demangled) +@@ -495,7 +504,7 @@ typy_lookup_type (struct demangle_component *demangled) } type_name = cp_comp_to_string (demangled, 10); @@ -17898,7 +12903,7 @@ index 590d90a..f512248 100644 xfree (type_name); return type; -@@ -436,10 +450,23 @@ typy_template_argument (PyObject *self, PyObject *args) +@@ -509,10 +518,23 @@ typy_template_argument (PyObject *self, PyObject *args) struct demangle_component *demangled; const char *err; struct type *argtype; @@ -17923,7 +12928,7 @@ index 590d90a..f512248 100644 type = check_typedef (type); if (TYPE_CODE (type) == TYPE_CODE_REF) type = check_typedef (TYPE_TARGET_TYPE (type)); -@@ -482,7 +509,7 @@ typy_template_argument (PyObject *self, PyObject *args) +@@ -555,7 +577,7 @@ typy_template_argument (PyObject *self, PyObject *args) return NULL; } @@ -17932,7 +12937,7 @@ index 590d90a..f512248 100644 if (! argtype) return NULL; -@@ -524,8 +551,59 @@ typy_str (PyObject *self) +@@ -597,8 +619,59 @@ typy_str (PyObject *self) @@ -17992,7 +12997,7 @@ index 590d90a..f512248 100644 static void save_objfile_types (struct objfile *objfile, void *datum) { -@@ -543,12 +621,13 @@ save_objfile_types (struct objfile *objfile, void *datum) +@@ -616,12 +689,13 @@ save_objfile_types (struct objfile *objfile, void *datum) { type_object *next = obj->next; @@ -18010,7 +13015,7 @@ index 590d90a..f512248 100644 obj = next; } -@@ -559,41 +638,25 @@ save_objfile_types (struct objfile *objfile, void *datum) +@@ -632,41 +706,25 @@ save_objfile_types (struct objfile *objfile, void *datum) } static void @@ -18064,7 +13069,7 @@ index 590d90a..f512248 100644 } /* Create a new Type referring to TYPE. */ -@@ -604,7 +667,10 @@ type_to_type_object (struct type *type) +@@ -677,7 +735,10 @@ type_to_type_object (struct type *type) type_obj = PyObject_New (type_object, &type_object_type); if (type_obj) @@ -18076,7 +13081,7 @@ index 590d90a..f512248 100644 return (PyObject *) type_obj; } -@@ -623,14 +689,28 @@ type_object_to_type (PyObject *obj) +@@ -696,14 +757,28 @@ type_object_to_type (PyObject *obj) PyObject * gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw) { @@ -18108,7 +13113,7 @@ index 590d90a..f512248 100644 if (! type) return NULL; -@@ -664,6 +744,8 @@ gdbpy_initialize_types (void) +@@ -737,6 +812,8 @@ gdbpy_initialize_types (void) Py_INCREF (&field_object_type); PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type); @@ -18118,7 +13123,7 @@ index 590d90a..f512248 100644 diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c -index 49c0437..84a476e 100644 +index 4ccf97f..87cde73 100644 --- a/gdb/python/py-utils.c +++ b/gdb/python/py-utils.c @@ -19,6 +19,7 @@ @@ -18179,7 +13184,7 @@ index 49c0437..84a476e 100644 + return 1; +} diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c -index 0146593..b82fcb6 100644 +index a792819..bdac80e 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -25,6 +25,7 @@ @@ -18201,7 +13206,7 @@ index 0146593..b82fcb6 100644 #define builtin_type_pybool \ language_bool_type (python_language, python_gdbarch) -@@ -913,7 +918,34 @@ convert_value_from_python (PyObject *obj) +@@ -945,7 +950,34 @@ convert_value_from_python (PyObject *obj) { LONGEST l = PyLong_AsLongLong (obj); @@ -18237,7 +13242,7 @@ index 0146593..b82fcb6 100644 value = value_from_longest (builtin_type_pylong, l); } else if (PyFloat_Check (obj)) -@@ -972,6 +1004,25 @@ gdbpy_history (PyObject *self, PyObject *args) +@@ -1011,6 +1043,25 @@ gdbpy_history (PyObject *self, PyObject *args) return value_to_value_object (res_val); } @@ -18263,7 +13268,7 @@ index 0146593..b82fcb6 100644 void gdbpy_initialize_values (void) { -@@ -982,6 +1033,8 @@ gdbpy_initialize_values (void) +@@ -1021,6 +1072,8 @@ gdbpy_initialize_values (void) PyModule_AddObject (gdb_module, "Value", (PyObject *) &value_object_type); values_in_python = NULL; @@ -18273,10 +13278,10 @@ index 0146593..b82fcb6 100644 diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h -index 67a78af..47662d9 100644 +index 9196f08..5230a8c 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h -@@ -61,33 +61,76 @@ typedef int Py_ssize_t; +@@ -61,36 +61,79 @@ typedef int Py_ssize_t; #define PyEval_ReleaseLock() 0 #endif @@ -18312,6 +13317,8 @@ index 67a78af..47662d9 100644 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); @@ -18347,13 +13354,14 @@ index 67a78af..47662d9 100644 +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); -@@ -97,6 +140,12 @@ struct cleanup *ensure_python_env (struct gdbarch *gdbarch, +@@ -100,6 +143,12 @@ struct cleanup *ensure_python_env (struct gdbarch *gdbarch, extern struct gdbarch *python_gdbarch; extern const struct language_defn *python_language; @@ -18366,7 +13374,7 @@ index 67a78af..47662d9 100644 /* Use this after a TRY_EXCEPT to throw the appropriate Python exception. */ #define GDB_PY_HANDLE_EXCEPTION(Exception) \ -@@ -107,6 +156,19 @@ extern const struct language_defn *python_language; +@@ -110,6 +159,19 @@ extern const struct language_defn *python_language; "%s", Exception.message); \ } while (0) @@ -18386,9 +13394,9 @@ index 67a78af..47662d9 100644 void gdbpy_print_stack (void); -@@ -118,17 +180,22 @@ char *python_string_to_host_string (PyObject *obj); - PyObject *target_string_to_unicode (const gdb_byte *str, int length); - int gdbpy_is_string (PyObject *obj); +@@ -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); + @@ -18411,7 +13419,7 @@ index 67a78af..47662d9 100644 #endif /* GDB_PYTHON_INTERNAL_H */ diff --git a/gdb/python/python.c b/gdb/python/python.c -index 254bd28..5a2a9ae 100644 +index 827372c..171cd5b 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -27,6 +27,7 @@ @@ -18510,7 +13518,7 @@ index 254bd28..5a2a9ae 100644 } /* A Python function which evaluates a string using the gdb CLI. */ -@@ -319,6 +327,233 @@ execute_gdb_command (PyObject *self, PyObject *args) +@@ -323,6 +331,105 @@ execute_gdb_command (PyObject *self, PyObject *args) Py_RETURN_NONE; } @@ -18527,7 +13535,7 @@ index 254bd28..5a2a9ae 100644 + if (!PyArg_ParseTuple (args, "K", &pc)) + return NULL; + -+ soname = solib_name_from_address (pc); ++ soname = solib_name_from_address (current_program_space, pc); + if (soname) + str_obj = PyString_Decode (soname, strlen (soname), host_charset (), NULL); + else @@ -18613,28 +13621,13 @@ index 254bd28..5a2a9ae 100644 + Py_RETURN_NONE; +} + -+/* Parse a string and evaluate it as an expression. */ -+static PyObject * -+gdbpy_parse_and_eval (PyObject *self, PyObject *args) -+{ -+ char *expr_str; -+ struct value *result = NULL; -+ volatile struct gdb_exception except; -+ -+ if (!PyArg_ParseTuple (args, "s", &expr_str)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ result = parse_and_eval (expr_str); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ return value_to_value_object (result); -+} -+ -+ -+ + /* Parse a string and evaluate it as an expression. */ + static PyObject * + gdbpy_parse_and_eval (PyObject *self, PyObject *args) +@@ -345,6 +452,114 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args) + + + +/* Posting and handling events. */ + +/* A single event. */ @@ -18661,11 +13654,11 @@ index 254bd28..5a2a9ae 100644 +static void +gdbpy_run_events (int err, gdb_client_data ignore) +{ -+ PyGILState_STATE state; ++ struct cleanup *cleanup; + char buffer[100]; + int r; + -+ state = PyGILState_Ensure (); ++ 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. */ @@ -18687,7 +13680,7 @@ index 254bd28..5a2a9ae 100644 + xfree (item); + } + -+ PyGILState_Release (state); ++ do_cleanups (cleanup); +} + +/* Submit an event to the gdb thread. */ @@ -18741,10 +13734,12 @@ index 254bd28..5a2a9ae 100644 + } +} + - - ++ ++ /* Printing. */ -@@ -357,6 +592,69 @@ gdbpy_print_stack (void) + + /* A python function to write a single string using gdb's filtered +@@ -381,6 +596,67 @@ gdbpy_print_stack (void) @@ -18778,10 +13773,9 @@ index 254bd28..5a2a9ae 100644 +run_python_script (int argc, char **argv) +{ + FILE *input; -+ PyGILState_STATE state; + + /* We never free this, since we plan to exit at the end. */ -+ state = PyGILState_Ensure (); ++ ensure_python_env (get_current_arch (), current_language); + + running_python_script = 1; + PySys_SetArgv (argc - 1, argv + 1); @@ -18799,14 +13793,13 @@ index 254bd28..5a2a9ae 100644 +void +source_python_script (FILE *stream, char *file) +{ -+ PyGILState_STATE state; -+ -+ state = PyGILState_Ensure (); ++ struct cleanup *cleanup; + ++ cleanup = ensure_python_env (get_current_arch (), current_language); + PyRun_SimpleFile (stream, file); + + fclose (stream); -+ PyGILState_Release (state); ++ do_cleanups (cleanup); +} + + @@ -18814,7 +13807,7 @@ index 254bd28..5a2a9ae 100644 /* 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. */ -@@ -501,6 +799,13 @@ eval_python_from_control_command (struct command_line *cmd) +@@ -525,6 +801,13 @@ eval_python_from_control_command (struct command_line *cmd) error (_("Python scripting is not supported in this copy of GDB.")); } @@ -18828,7 +13821,7 @@ index 254bd28..5a2a9ae 100644 #endif /* HAVE_PYTHON */ -@@ -592,13 +897,27 @@ Enables or disables auto-loading of Python code when an object is opened."), +@@ -616,14 +899,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); @@ -18850,13 +13843,14 @@ index 254bd28..5a2a9ae 100644 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 = []"); -@@ -634,6 +953,15 @@ class GdbOutputFile:\n\ +@@ -659,6 +956,15 @@ class GdbOutputFile:\n\ \n\ sys.stderr = GdbOutputFile()\n\ sys.stdout = GdbOutputFile()\n\ @@ -18872,7 +13866,7 @@ index 254bd28..5a2a9ae 100644 "); /* Release the GIL while gdb runs. */ -@@ -653,9 +981,14 @@ static PyMethodDef GdbMethods[] = +@@ -678,9 +984,14 @@ static PyMethodDef GdbMethods[] = "Get a value from history" }, { "execute", execute_gdb_command, METH_VARARGS, "Execute a gdb command" }, @@ -18887,7 +13881,7 @@ index 254bd28..5a2a9ae 100644 { "default_visualizer", gdbpy_default_visualizer, METH_VARARGS, "Find the default visualizer for a Value." }, -@@ -676,6 +1009,37 @@ Return a string explaining unwind stop reason." }, +@@ -701,11 +1012,39 @@ Return a string explaining unwind stop reason." }, "lookup_type (name [, block]) -> type\n\ Return a Type corresponding to the given name." }, @@ -18916,9 +13910,11 @@ index 254bd28..5a2a9ae 100644 + "inferiors () -> (gdb.Inferior, ...).\n\ +Return a tuple containing all inferiors." }, + -+ { "parse_and_eval", gdbpy_parse_and_eval, METH_VARARGS, -+ "Parse a string as an expression, evaluate it, and return the result." }, -+ + { "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." }, + @@ -18926,7 +13922,7 @@ index 254bd28..5a2a9ae 100644 "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 e970180..bbb6184 100644 +index f35827b..1a5b9a8 100644 --- a/gdb/python/python.h +++ b/gdb/python/python.h @@ -24,6 +24,10 @@ @@ -18941,7 +13937,7 @@ index e970180..bbb6184 100644 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 de34894..07518b0 100644 +index 1d05f8a..e2015c4 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -233,6 +233,7 @@ const struct exp_descriptor exp_descriptor_scm = @@ -18952,122 +13948,11 @@ index de34894..07518b0 100644 op_name_standard, dump_subexp_body_standard, evaluate_exp -diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c -index cc3319a..d0d4702 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/solib-darwin.c b/gdb/solib-darwin.c -index 8b96a6f..9428d92 100644 ---- a/gdb/solib-darwin.c -+++ b/gdb/solib-darwin.c -@@ -389,7 +389,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 19e3212..9f06fa9 100644 ---- a/gdb/solib-spu.c -+++ b/gdb/solib-spu.c -@@ -334,16 +334,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 6cfaa85..68aadc0 100644 ---- a/gdb/solib-svr4.c -+++ b/gdb/solib-svr4.c -@@ -1908,15 +1908,13 @@ 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) - { - if (objfile->obfd == NULL - || scan_dyntag (DT_SYMBOLIC, objfile->obfd, 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 a2ad0c4..3574e62 100644 ---- a/gdb/solib.c -+++ b/gdb/solib.c -@@ -1127,13 +1127,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 63a6ba0..005e8f7 100644 ---- a/gdb/solist.h -+++ b/gdb/solist.h -@@ -114,7 +114,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 -@@ -146,7 +145,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 36a2b28..4d5bda9 100644 +index c7beaba..e31164c 100644 --- a/gdb/somread.c +++ b/gdb/somread.c -@@ -435,6 +435,7 @@ static struct sym_fns som_sym_fns = +@@ -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 */ @@ -19075,46 +13960,11 @@ index 36a2b28..4d5bda9 100644 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/spu-tdep.c b/gdb/spu-tdep.c -index 7e7ab9c..a014b7a 100644 ---- a/gdb/spu-tdep.c -+++ b/gdb/spu-tdep.c -@@ -1839,7 +1839,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/stabsread.c b/gdb/stabsread.c -index e62bb15..ad6568e 100644 ---- a/gdb/stabsread.c -+++ b/gdb/stabsread.c -@@ -322,7 +322,7 @@ dbx_alloc_type (int typenums[2], struct objfile *objfile) - - if (typenums[0] == -1) - { -- return (alloc_type (objfile)); -+ return (alloc_type (objfile, NULL)); - } - - type_addr = dbx_lookup_type (typenums, objfile); -@@ -332,7 +332,7 @@ dbx_alloc_type (int typenums[2], struct objfile *objfile) - We will fill it in later if we find out how. */ - if (*type_addr == 0) - { -- *type_addr = alloc_type (objfile); -+ *type_addr = alloc_type (objfile, NULL); - } - - return (*type_addr); diff --git a/gdb/stack.c b/gdb/stack.c -index 1c37801..594eb16 100644 +index 6e198e0..94a3ef9 100644 --- a/gdb/stack.c +++ b/gdb/stack.c -@@ -1308,24 +1308,24 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty) +@@ -1309,24 +1309,24 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty) else count = -1; @@ -19157,38 +14007,11 @@ index 1c37801..594eb16 100644 for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi)) { -@@ -1473,6 +1473,8 @@ print_block_frame_locals (struct block *b, struct frame_info *frame, - case LOC_COMPUTED: - if (SYMBOL_IS_ARGUMENT (sym)) - break; -+ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN) -+ break; - values_printed = 1; - print_variable_and_value (NULL, sym, frame, stream, 4 * num_tabs); - break; diff --git a/gdb/symfile.c b/gdb/symfile.c -index 2458201..c31b72a 100644 +index 89cc07c..b759f10 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c -@@ -921,6 +921,17 @@ new_symfile_objfile (struct objfile *objfile, int add_flags) - clear_complaints (&symfile_complaints, 0, add_flags & SYMFILE_VERBOSE); - } - -+/* A helper function which returns true if OBJFILE has any debug -+ symbols, and false otherwise. */ -+static int -+has_any_debug_symbols (struct objfile *objfile) -+{ -+ return (objfile->psymtabs || objfile->quick_addrmap -+ || (objfile->separate_debug_objfile -+ && (objfile->separate_debug_objfile->psymtabs -+ || objfile->separate_debug_objfile->quick_addrmap))); -+} -+ - /* Process a symbol file, as either the main file or as a dynamically - loaded file. - -@@ -958,13 +969,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, +@@ -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. */ @@ -19206,8 +14029,8 @@ index 2458201..c31b72a 100644 + objfile->flags |= OBJF_MAIN; discard_cleanups (my_cleanups); - if (addrs) -@@ -997,6 +1011,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, + /* 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) { @@ -19216,70 +14039,28 @@ index 2458201..c31b72a 100644 if (from_tty || info_verbose) { printf_unfiltered (_("expanding to full symbols...")); -@@ -1015,7 +1031,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - /* 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->psymtabs == NULL) -+ if (!has_any_debug_symbols (objfile)) - debugfile = find_separate_debug_file (objfile); - if (debugfile) - { -@@ -1039,9 +1055,10 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - xfree (debugfile); - } +@@ -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)); -+ /* has_any_debug_symbols is not fully compatible with the former calls which -+ would just be needlessly expensive here. */ - if ((from_tty || info_verbose) -- && !objfile_has_partial_symbols (objfile) -- && !objfile_has_full_symbols (objfile)) -+ && !has_any_debug_symbols (objfile)) - { - wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)...")); -@@ -2422,14 +2439,15 @@ reread_symbols (void) - zero is OK since dbxread.c also does what it needs to do if - objfile->global_psymbols.size is 0. */ - (*objfile->sf->sym_read) (objfile, 0); -- if (!objfile_has_partial_symbols (objfile) -- && !objfile_has_full_symbols (objfile)) -+ if (!has_any_debug_symbols (objfile)) - { - wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)\n")); - wrap_here (""); - } - -+ objfile->flags &= ~OBJF_SYMTABS_READ; ++ objfile->flags &= ~OBJF_SYMTABS_READ; + - /* We're done reading the symbol file; finish off complaints. */ - clear_complaints (&symfile_complaints, 0, 1); - -@@ -2727,7 +2745,7 @@ allocate_symtab (char *filename, struct objfile *objfile) - } - - struct partial_symtab * --allocate_psymtab (char *filename, struct objfile *objfile) -+allocate_psymtab (const char *filename, struct objfile *objfile) - { - struct partial_symtab *psymtab; - -@@ -3041,7 +3059,8 @@ again2: - - struct partial_symtab * - start_psymtab_common (struct objfile *objfile, -- struct section_offsets *section_offsets, char *filename, -+ struct section_offsets *section_offsets, -+ const char *filename, - CORE_ADDR textlow, struct partial_symbol **global_syms, - struct partial_symbol **static_syms) - { + 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 8c9249c..bf9d9e7 100644 +index 7ae819c..f3f6eb3 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h -@@ -140,6 +140,12 @@ struct sym_fns +@@ -139,6 +139,12 @@ struct sym_fns void (*sym_read) (struct objfile *, int); @@ -19292,100 +14073,20 @@ index 8c9249c..bf9d9e7 100644 /* Called when we are finished with an objfile. Should do all cleanup that is specific to the object file format for the particular objfile. */ -@@ -266,7 +272,7 @@ extern void free_section_addr_info (struct section_addr_info *); - - extern struct partial_symtab *start_psymtab_common (struct objfile *, - struct section_offsets *, -- char *, CORE_ADDR, -+ const char *, CORE_ADDR, - struct partial_symbol **, - struct partial_symbol **); - -@@ -309,7 +315,7 @@ extern int auto_solib_limit; - - extern void set_initial_language (void); - --extern struct partial_symtab *allocate_psymtab (char *, struct objfile *); -+extern struct partial_symtab *allocate_psymtab (const char *, struct objfile *); - - extern void discard_psymtab (struct partial_symtab *); - -@@ -378,7 +384,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data); +@@ -389,7 +395,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 *, int); + 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 eb35369..dfd8c8c 100644 ---- a/gdb/symmisc.c -+++ b/gdb/symmisc.c -@@ -1128,7 +1128,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 `"); -@@ -1145,7 +1145,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 8d9d72c..82e0163 100644 +index 426326d..bac4ca3 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) +@@ -271,7 +271,7 @@ lookup_partial_symtab (const char *name) make_cleanup (xfree, real_path); } @@ -19394,7 +14095,7 @@ index 8d9d72c..82e0163 100644 { if (FILENAME_CMP (name, pst->filename) == 0) { -@@ -414,7 +413,8 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol, +@@ -414,7 +414,8 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol, gsymbol->language = language; if (gsymbol->language == language_cplus || gsymbol->language == language_java @@ -19404,16 +14105,7 @@ index 8d9d72c..82e0163 100644 { gsymbol->language_specific.cplus_specific.demangled_name = NULL; } -@@ -474,7 +474,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; -@@ -633,6 +633,7 @@ symbol_natural_name (const struct general_symbol_info *gsymbol) +@@ -695,6 +696,7 @@ symbol_natural_name (const struct general_symbol_info *gsymbol) case language_cplus: case language_java: case language_objc: @@ -19421,7 +14113,7 @@ index 8d9d72c..82e0163 100644 if (gsymbol->language_specific.cplus_specific.demangled_name != NULL) return gsymbol->language_specific.cplus_specific.demangled_name; break; -@@ -658,6 +659,7 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol) +@@ -720,6 +722,7 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol) case language_cplus: case language_java: case language_objc: @@ -19429,7 +14121,7 @@ index 8d9d72c..82e0163 100644 if (gsymbol->language_specific.cplus_specific.demangled_name != NULL) return gsymbol->language_specific.cplus_specific.demangled_name; break; -@@ -868,7 +870,13 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) +@@ -931,7 +934,13 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) than the later used TEXTLOW/TEXTHIGH one. */ ALL_OBJFILES (objfile) @@ -19444,7 +14136,7 @@ index 8d9d72c..82e0163 100644 { struct partial_symtab *pst; -@@ -901,6 +909,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) +@@ -964,6 +973,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) return pst; } } @@ -19452,7 +14144,7 @@ index 8d9d72c..82e0163 100644 /* Existing PSYMTABS_ADDRMAP mapping is present even for PARTIAL_SYMTABs which still have no corresponding full SYMTABs read. But it is not -@@ -1168,6 +1177,22 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) +@@ -1231,6 +1241,22 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) return psym; } @@ -19475,322 +14167,15 @@ index 8d9d72c..82e0163 100644 /* 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. -@@ -1194,10 +1219,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); +@@ -1534,6 +1560,7 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile, + } -+ 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 -@@ -1207,7 +1236,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); - } -@@ -1229,7 +1257,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); - } -@@ -1248,8 +1275,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; -@@ -1273,9 +1300,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; -@@ -1291,55 +1318,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; -- /* 'this' is only defined in the function's block, so find the -- enclosing function block. */ -- for (; block && !BLOCK_FUNCTION (block); -- block = BLOCK_SUPERBLOCK (block)); -- -- if (block && !dict_empty (BLOCK_DICT (block))) -- sym = lookup_block_symbol (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; - -@@ -1349,11 +1340,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; - -@@ -1364,30 +1355,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 (BLOCK_FUNCTION (block) != NULL && block_inlined_p (block)) -- break; -- block = BLOCK_SUPERBLOCK (block); -+ -+ if (language == language_cplus ) -+ { -+ sym = cp_lookup_symbol_imports (block_scope (block_iterator), name, -+ block_iterator, domain, 1, 1); -+ -+ 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; - } -@@ -1416,13 +1458,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; -@@ -1438,7 +1479,6 @@ lookup_symbol_aux_block (const char *name, const char *linkage_name, - struct symbol * - lookup_global_symbol_from_objfile (const struct objfile *objfile, - const char *name, -- const char *linkage_name, - const domain_enum domain) - { - struct symbol *sym; -@@ -1452,7 +1492,7 @@ lookup_global_symbol_from_objfile (const struct objfile *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; -@@ -1461,23 +1501,23 @@ lookup_global_symbol_from_objfile (const struct objfile *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); - } - } - - if (objfile->separate_debug_objfile) - return lookup_global_symbol_from_objfile (objfile->separate_debug_objfile, -- name, linkage_name, domain); -+ name, domain); - - return NULL; - } -@@ -1488,8 +1528,7 @@ lookup_global_symbol_from_objfile (const struct objfile *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; -@@ -1502,7 +1541,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; -@@ -1520,7 +1559,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; -@@ -1531,16 +1569,15 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, + /* Now go through psymtabs. */ ++ require_partial_symbols ((struct objfile *) objfile); + ALL_OBJFILE_PSYMTABS (objfile, ps) + { + if (!ps->readin +@@ -1601,7 +1628,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, struct symtab *s; const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); @@ -19798,148 +14183,8 @@ index 8d9d72c..82e0163 100644 + 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 -@@ -1557,7 +1594,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", -@@ -1576,7 +1613,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) - { -@@ -1610,11 +1646,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 -@@ -1622,14 +1658,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; - } -@@ -1639,7 +1674,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) - { -@@ -1649,15 +1683,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 -@@ -1681,14 +1715,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; -@@ -1740,9 +1771,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)) -@@ -1759,15 +1788,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); - } - } - -@@ -1809,22 +1832,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); + && lookup_partial_symbol (ps, name, linkage_name, +@@ -1886,7 +1913,11 @@ basic_lookup_transparent_type (const char *name) } } @@ -19950,36 +14195,9 @@ index 8d9d72c..82e0163 100644 + 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 -@@ -1833,7 +1859,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\ -@@ -1857,21 +1883,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); + if (!ps->readin && lookup_partial_symbol (ps, name, NULL, + 1, STRUCT_DOMAIN)) +@@ -1934,7 +1965,12 @@ basic_lookup_transparent_type (const char *name) } } @@ -19991,27 +14209,9 @@ index 8d9d72c..82e0163 100644 + 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)) + if (!ps->readin && lookup_partial_symbol (ps, name, NULL, 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 -@@ -1880,7 +1911,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\ -@@ -1905,9 +1936,23 @@ find_main_psymtab (void) +@@ -1975,7 +2011,21 @@ find_main_psymtab (void) struct partial_symtab *pst; struct objfile *objfile; @@ -20023,7 +14223,7 @@ index 8d9d72c..82e0163 100644 + require_partial_symbols (objfile); + ALL_OBJFILE_PSYMTABS (objfile, pst) + { -+ if (lookup_partial_symbol (pst, main_name (), 1, VAR_DOMAIN)) ++ if (lookup_partial_symbol (pst, main_name (), NULL, 1, VAR_DOMAIN)) + { + return pst; + } @@ -20032,49 +14232,9 @@ index 8d9d72c..82e0163 100644 + + 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)) + if (lookup_partial_symbol (pst, main_name (), NULL, 1, VAR_DOMAIN)) { - return (pst); - } -@@ -1925,14 +1970,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; -@@ -1945,9 +1986,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; -@@ -1967,9 +2006,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)) -@@ -3172,7 +3209,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], +@@ -3261,7 +3311,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. */ @@ -20084,81 +14244,22 @@ index 8d9d72c..82e0163 100644 struct partial_symbol **bound, **gbound, **sbound; int keep_going = 1; diff --git a/gdb/symtab.h b/gdb/symtab.h -index 740d4e0..461ff95 100644 +index 800ffd8..3ed6947 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h -@@ -171,9 +171,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); - #define SYMBOL_SECTION(symbol) (symbol)->ginfo.section - #define SYMBOL_OBJ_SECTION(symbol) (symbol)->ginfo.obj_section - --#define SYMBOL_CPLUS_DEMANGLED_NAME(symbol) \ -- (symbol)->ginfo.language_specific.cplus_specific.demangled_name -- - /* Initializes the language dependent portion of a symbol - depending upon the language for the symbol. */ - #define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \ -@@ -394,7 +391,13 @@ typedef enum domain_enum_tag +@@ -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, -+ + /* Fortran module. Their naming must be separate. */ + MODULE_DOMAIN } domain_enum; -@@ -990,7 +993,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); - -@@ -1001,7 +1003,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); - -@@ -1009,7 +1010,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); - -@@ -1018,21 +1018,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 */ -@@ -1062,6 +1059,8 @@ extern void clear_pc_function_cache (void); +@@ -1065,6 +1068,8 @@ extern void clear_pc_function_cache (void); /* from symtab.c: */ @@ -20167,16 +14268,8 @@ index 740d4e0..461ff95 100644 /* lookup partial symbol table by filename */ extern struct partial_symtab *lookup_partial_symtab (const char *); -@@ -1356,7 +1355,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 e5d14fd..37fab72 100644 +index edf8697..a7ed206 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -124,6 +124,8 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int); @@ -20188,7 +14281,7 @@ index e5d14fd..37fab72 100644 static int debug_to_stopped_by_watchpoint (void); static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); -@@ -622,6 +624,7 @@ update_current_target (void) +@@ -624,6 +626,7 @@ update_current_target (void) INHERIT (to_remove_hw_breakpoint, t); INHERIT (to_insert_watchpoint, t); INHERIT (to_remove_watchpoint, t); @@ -20196,7 +14289,7 @@ index e5d14fd..37fab72 100644 INHERIT (to_stopped_data_address, t); INHERIT (to_have_steppable_watchpoint, t); INHERIT (to_have_continuable_watchpoint, t); -@@ -733,6 +736,9 @@ update_current_target (void) +@@ -747,6 +750,9 @@ update_current_target (void) de_fault (to_remove_watchpoint, (int (*) (CORE_ADDR, int, int)) return_minus_one); @@ -20206,7 +14299,7 @@ index e5d14fd..37fab72 100644 de_fault (to_stopped_by_watchpoint, (int (*) (void)) return_zero); -@@ -3173,6 +3179,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type) +@@ -3302,6 +3308,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type) return retval; } @@ -20226,7 +14319,7 @@ index e5d14fd..37fab72 100644 static void debug_to_terminal_init (void) { -@@ -3420,6 +3439,7 @@ setup_target_debug (void) +@@ -3549,6 +3568,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; @@ -20235,10 +14328,10 @@ index e5d14fd..37fab72 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 b1cb852..3c06eba 100644 +index a020bf7..2c5e58e 100644 --- a/gdb/target.h +++ b/gdb/target.h -@@ -395,6 +395,7 @@ struct target_ops +@@ -419,6 +419,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); @@ -20246,16 +14339,7 @@ index b1cb852..3c06eba 100644 int (*to_stopped_by_watchpoint) (void); int to_have_steppable_watchpoint; int to_have_continuable_watchpoint; -@@ -1124,7 +1125,7 @@ extern char *normal_pid_to_str (ptid_t ptid); - /* Hardware watchpoint interfaces. */ - - /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or -- write). */ -+ write). Only the INFERIOR_PTID task is being queried. */ - - #define target_stopped_by_watchpoint \ - (*current_target.to_stopped_by_watchpoint) -@@ -1166,14 +1167,26 @@ extern char *normal_pid_to_str (ptid_t ptid); +@@ -1262,6 +1263,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) @@ -20271,20 +14355,7 @@ index b1cb852..3c06eba 100644 #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) - #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \ - (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt) - --#define target_stopped_data_address(target, x) \ -- (*target.to_stopped_data_address) (target, x) -+/* Return non-zero if target knows the data address which triggered this -+ target_stopped_by_watchpoint, in such case place it to *ADDR_P. Only the -+ INFERIOR_PTID task is being queried. */ -+#define target_stopped_data_address(target, addr_p) \ -+ (*target.to_stopped_data_address) (target, addr_p) - - #define target_watchpoint_addr_within_range(target, addr, start, length) \ - (*target.to_watchpoint_addr_within_range) (target, addr, start, length) -@@ -1203,6 +1216,20 @@ extern int target_search_memory (CORE_ADDR start_addr, +@@ -1302,6 +1312,20 @@ extern int target_search_memory (CORE_ADDR start_addr, ULONGEST pattern_len, CORE_ADDR *found_addrp); @@ -20302,318 +14373,9 @@ index b1cb852..3c06eba 100644 + +void put_bits (bfd_uint64_t data, char *buf, int bits, bfd_boolean big_p); + - /* Command logging facility. */ + /* Tracepoint-related operations. */ - #define target_log_command(p) \ -@@ -1322,6 +1349,14 @@ extern struct target_ops *find_target_beneath (struct target_ops *); - - extern char *target_get_osdata (const char *type); - -+/* Read OS data object of type TYPE from the target, and return it in -+ XML format. The result is NUL-terminated and returned as a string, -+ allocated using xmalloc. If an error occurs or the transfer is -+ unsupported, NULL is returned. Empty objects are returned as -+ allocated but empty strings. */ -+ -+extern char *target_get_osdata (const char *type); -+ - - /* Stuff that should be shared among the various remote targets. */ - -diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.exp b/gdb/testsuite/gdb.arch/powerpc-power7.exp -new file mode 100644 -index 0000000..ae301db ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp -@@ -0,0 +1,175 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Test PowerPC Power7 instructions disassembly. -+ -+if {![istarget "powerpc*-*-*"]} then { -+ verbose "Skipping PowerPC Power7 instructions disassembly." -+ return -+} -+ -+set testfile "powerpc-power7" -+set srcfile ${testfile}.s -+set objfile ${objdir}/${subdir}/${testfile}.o -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } { -+ untested "PowerPC Power7 instructions disassembly" -+ return -1 -+} -+ -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${objfile} -+ -+ -+# Disassemble the function. -+ -+set test "disass func" -+gdb_test_multiple $test $test { -+ -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" { -+ set func $expect_out(1,string) -+ pass $test -+ } -+} -+ -+proc instr_to_patt {offset instr} { -+ # 0x0000000000000018 : stxvd2x vs43,r4,r5 -+ return ".*\r\n[string map {0x 0x0*} $offset] :\[ \t\]*[string map [list { } "\[ \t\]+" . {\.}] $instr]\[ \t\]*\r\n.*" -+} -+ -+# KFAIL strings would not exist if -Many would print the same as -Mpower7. -+# That means the power7 form should be the preferred one. -+# http://sourceware.org/ml/gdb-patches/2009-03/threads.html#00020 -+ -+proc func_check {offset instr {kfail ""}} { -+ global func -+ -+ set test "Found $offset: $instr" -+ if [regexp -nocase -line [instr_to_patt $offset $instr] $func] { -+ pass $test -+ } elseif {$kfail != "" && [regexp -nocase -line [instr_to_patt $offset $kfail] $func]} { -+ kfail gdb/NNNN $test -+ } else { -+ fail $test -+ } -+} -+ -+func_check 0x0 "lxvd2x vs3,r4,r5" -+func_check 0x4 "lxvd2ux vs3,r4,r5" -+func_check 0x8 "lxvd2x vs43,r4,r5" -+func_check 0xc "lxvd2ux vs43,r4,r5" -+func_check 0x10 "stxvd2x vs3,r4,r5" -+func_check 0x14 "stxvd2ux vs3,r4,r5" -+func_check 0x18 "stxvd2x vs43,r4,r5" -+func_check 0x1c "stxvd2ux vs43,r4,r5" -+func_check 0x20 "xxmrghd vs3,vs4,vs5" -+func_check 0x24 "xxmrghd vs43,vs44,vs45" -+func_check 0x28 "xxmrgld vs3,vs4,vs5" -+func_check 0x2c "xxmrgld vs43,vs44,vs45" -+func_check 0x30 "xxmrghd vs3,vs4,vs5" -+func_check 0x34 "xxmrghd vs43,vs44,vs45" -+func_check 0x38 "xxmrgld vs3,vs4,vs5" -+func_check 0x3c "xxmrgld vs43,vs44,vs45" -+func_check 0x40 "xxpermdi vs3,vs4,vs5,1" -+func_check 0x44 "xxpermdi vs43,vs44,vs45,1" -+func_check 0x48 "xxpermdi vs3,vs4,vs5,2" -+func_check 0x4c "xxpermdi vs43,vs44,vs45,2" -+func_check 0x50 "xvmovdp vs3,vs4" -+func_check 0x54 "xvmovdp vs43,vs44" -+func_check 0x58 "xvmovdp vs3,vs4" -+func_check 0x5c "xvmovdp vs43,vs44" -+func_check 0x60 "xvcpsgndp vs3,vs4,vs5" -+func_check 0x64 "xvcpsgndp vs43,vs44,vs45" -+func_check 0x68 "wait" -+func_check 0x6c "wait" -+func_check 0x70 "waitrsv" -+func_check 0x74 "waitrsv" -+func_check 0x78 "waitimpl" -+func_check 0x7c "waitimpl" -+func_check 0x80 "doze" -+func_check 0x84 "nap" -+func_check 0x88 "sleep" -+func_check 0x8c "rvwinkle" -+func_check 0x90 "prtyw r3,r4" -+func_check 0x94 "prtyd r13,r14" -+func_check 0x98 "mfcfar r10" "mfspr r10,28" -+func_check 0x9c "mtcfar r11" "mtspr 28,r11" -+func_check 0xa0 "cmpb r3,r4,r5" -+func_check 0xa4 "lwzcix r10,r11,r12" -+func_check 0xa8 "dadd f16,f17,f18" -+func_check 0xac "daddq f20,f22,f24" -+func_check 0xb0 "dss 3" -+func_check 0xb4 "dssall" -+func_check 0xb8 "dst r5,r4,1" -+func_check 0xbc "dstt r8,r7,0" -+func_check 0xc0 "dstst r5,r6,3" -+func_check 0xc4 "dststt r4,r5,2" -+func_check 0xc8 "divwe r10,r11,r12" -+func_check 0xcc "divwe. r11,r12,r13" -+func_check 0xd0 "divweo r12,r13,r14" -+func_check 0xd4 "divweo. r13,r14,r15" -+func_check 0xd8 "divweu r10,r11,r12" -+func_check 0xdc "divweu. r11,r12,r13" -+func_check 0xe0 "divweuo r12,r13,r14" -+func_check 0xe4 "divweuo. r13,r14,r15" -+func_check 0xe8 "bpermd r7,r17,r27" -+func_check 0xec "popcntw r10,r20" -+func_check 0xf0 "popcntd r10,r20" -+func_check 0xf4 "ldbrx r20,r21,r22" -+func_check 0xf8 "stdbrx r20,r21,r22" -+func_check 0xfc "lfiwzx f10,0,r10" -+func_check 0x100 "lfiwzx f10,r9,r10" -+func_check 0x104 "fcfids f4,f5" -+func_check 0x108 "fcfids. f4,f5" -+func_check 0x10c "fcfidus f4,f5" -+func_check 0x110 "fcfidus. f4,f5" -+func_check 0x114 "fctiwu f4,f5" -+func_check 0x118 "fctiwu. f4,f5" -+func_check 0x11c "fctiwuz f4,f5" -+func_check 0x120 "fctiwuz. f4,f5" -+func_check 0x124 "fctidu f4,f5" -+func_check 0x128 "fctidu. f4,f5" -+func_check 0x12c "fctiduz f4,f5" -+func_check 0x130 "fctiduz. f4,f5" -+func_check 0x134 "fcfidu f4,f5" -+func_check 0x138 "fcfidu. f4,f5" -+func_check 0x13c "ftdiv cr0,f10,f11" -+func_check 0x140 "ftdiv cr7,f10,f11" -+func_check 0x144 "ftsqrt cr0,f10" -+func_check 0x148 "ftsqrt cr7,f10" -+func_check 0x14c "dcbtt r8,r9" "dcbt 16,r8,r9" -+func_check 0x150 "dcbtstt r8,r9" "dcbtst 16,r8,r9" -+func_check 0x154 "dcffix f10,f12" -+func_check 0x158 "dcffix. f20,f22" -+func_check 0x15c "lbarx r10,r11,r12" -+func_check 0x160 "lbarx r10,r11,r12" -+func_check 0x164 "lbarx r10,r11,r12,1" -+func_check 0x168 "lharx r20,r21,r22" -+func_check 0x16c "lharx r20,r21,r22" -+func_check 0x170 "lharx r20,r21,r22,1" -+func_check 0x174 "stbcx. r10,r11,r12" -+func_check 0x178 "sthcx. r10,r11,r12" -+func_check 0x17c "fre f14,f15" -+func_check 0x180 "fre. f14,f15" -+func_check 0x184 "fres f14,f15" -+func_check 0x188 "fres. f14,f15" -+func_check 0x18c "frsqrte f14,f15" -+func_check 0x190 "frsqrte. f14,f15" -+func_check 0x194 "frsqrtes f14,f15" -+func_check 0x198 "frsqrtes. f14,f15" -+func_check 0x19c "isel r2,r3,r4,28" -diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.s b/gdb/testsuite/gdb.arch/powerpc-power7.s -new file mode 100644 -index 0000000..98b2e79 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/powerpc-power7.s -@@ -0,0 +1,107 @@ -+ .text -+ .globl func -+func: -+ .long 0x7c642e98 /* 0: lxvd2x vs3,r4,r5 */ -+ .long 0x7c642ed8 /* 4: lxvd2ux vs3,r4,r5 */ -+ .long 0x7d642e99 /* 8: lxvd2x vs43,r4,r5 */ -+ .long 0x7d642ed9 /* c: lxvd2ux vs43,r4,r5 */ -+ .long 0x7c642f98 /* 10: stxvd2x vs3,r4,r5 */ -+ .long 0x7c642fd8 /* 14: stxvd2ux vs3,r4,r5 */ -+ .long 0x7d642f99 /* 18: stxvd2x vs43,r4,r5 */ -+ .long 0x7d642fd9 /* 1c: stxvd2ux vs43,r4,r5 */ -+ .long 0xf0642850 /* 20: xxmrghd vs3,vs4,vs5 */ -+ .long 0xf16c6857 /* 24: xxmrghd vs43,vs44,vs45 */ -+ .long 0xf0642b50 /* 28: xxmrgld vs3,vs4,vs5 */ -+ .long 0xf16c6b57 /* 2c: xxmrgld vs43,vs44,vs45 */ -+ .long 0xf0642850 /* 30: xxmrghd vs3,vs4,vs5 */ -+ .long 0xf16c6857 /* 34: xxmrghd vs43,vs44,vs45 */ -+ .long 0xf0642b50 /* 38: xxmrgld vs3,vs4,vs5 */ -+ .long 0xf16c6b57 /* 3c: xxmrgld vs43,vs44,vs45 */ -+ .long 0xf0642950 /* 40: xxpermdi vs3,vs4,vs5,1 */ -+ .long 0xf16c6957 /* 44: xxpermdi vs43,vs44,vs45,1 */ -+ .long 0xf0642a50 /* 48: xxpermdi vs3,vs4,vs5,2 */ -+ .long 0xf16c6a57 /* 4c: xxpermdi vs43,vs44,vs45,2 */ -+ .long 0xf0642780 /* 50: xvmovdp vs3,vs4 */ -+ .long 0xf16c6787 /* 54: xvmovdp vs43,vs44 */ -+ .long 0xf0642780 /* 58: xvmovdp vs3,vs4 */ -+ .long 0xf16c6787 /* 5c: xvmovdp vs43,vs44 */ -+ .long 0xf0642f80 /* 60: xvcpsgndp vs3,vs4,vs5 */ -+ .long 0xf16c6f87 /* 64: xvcpsgndp vs43,vs44,vs45 */ -+ .long 0x7c00007c /* 68: wait */ -+ .long 0x7c00007c /* 6c: wait */ -+ .long 0x7c20007c /* 70: waitrsv */ -+ .long 0x7c20007c /* 74: waitrsv */ -+ .long 0x7c40007c /* 78: waitimpl */ -+ .long 0x7c40007c /* 7c: waitimpl */ -+ .long 0x4c000324 /* 80: doze */ -+ .long 0x4c000364 /* 84: nap */ -+ .long 0x4c0003a4 /* 88: sleep */ -+ .long 0x4c0003e4 /* 8c: rvwinkle */ -+ .long 0x7c830134 /* 90: prtyw r3,r4 */ -+ .long 0x7dcd0174 /* 94: prtyd r13,r14 */ -+ .long 0x7d5c02a6 /* 98: mfcfar r10 */ -+ .long 0x7d7c03a6 /* 9c: mtcfar r11 */ -+ .long 0x7c832bf8 /* a0: cmpb r3,r4,r5 */ -+ .long 0x7d4b662a /* a4: lwzcix r10,r11,r12 */ -+ .long 0xee119004 /* a8: dadd f16,f17,f18 */ -+ .long 0xfe96c004 /* ac: daddq f20,f22,f24 */ -+ .long 0x7c60066c /* b0: dss 3 */ -+ .long 0x7e00066c /* b4: dssall */ -+ .long 0x7c2522ac /* b8: dst r5,r4,1 */ -+ .long 0x7e083aac /* bc: dstt r8,r7,0 */ -+ .long 0x7c6532ec /* c0: dstst r5,r6,3 */ -+ .long 0x7e442aec /* c4: dststt r4,r5,2 */ -+ .long 0x7d4b6356 /* c8: divwe r10,r11,r12 */ -+ .long 0x7d6c6b57 /* cc: divwe. r11,r12,r13 */ -+ .long 0x7d8d7756 /* d0: divweo r12,r13,r14 */ -+ .long 0x7dae7f57 /* d4: divweo. r13,r14,r15 */ -+ .long 0x7d4b6316 /* d8: divweu r10,r11,r12 */ -+ .long 0x7d6c6b17 /* dc: divweu. r11,r12,r13 */ -+ .long 0x7d8d7716 /* e0: divweuo r12,r13,r14 */ -+ .long 0x7dae7f17 /* e4: divweuo. r13,r14,r15 */ -+ .long 0x7e27d9f8 /* e8: bpermd r7,r17,r27 */ -+ .long 0x7e8a02f4 /* ec: popcntw r10,r20 */ -+ .long 0x7e8a03f4 /* f0: popcntd r10,r20 */ -+ .long 0x7e95b428 /* f4: ldbrx r20,r21,r22 */ -+ .long 0x7e95b528 /* f8: stdbrx r20,r21,r22 */ -+ .long 0x7d4056ee /* fc: lfiwzx f10,0,r10 */ -+ .long 0x7d4956ee /* 100: lfiwzx f10,r9,r10 */ -+ .long 0xec802e9c /* 104: fcfids f4,f5 */ -+ .long 0xec802e9d /* 108: fcfids. f4,f5 */ -+ .long 0xec802f9c /* 10c: fcfidus f4,f5 */ -+ .long 0xec802f9d /* 110: fcfidus. f4,f5 */ -+ .long 0xfc80291c /* 114: fctiwu f4,f5 */ -+ .long 0xfc80291d /* 118: fctiwu. f4,f5 */ -+ .long 0xfc80291e /* 11c: fctiwuz f4,f5 */ -+ .long 0xfc80291f /* 120: fctiwuz. f4,f5 */ -+ .long 0xfc802f5c /* 124: fctidu f4,f5 */ -+ .long 0xfc802f5d /* 128: fctidu. f4,f5 */ -+ .long 0xfc802f5e /* 12c: fctiduz f4,f5 */ -+ .long 0xfc802f5f /* 130: fctiduz. f4,f5 */ -+ .long 0xfc802f9c /* 134: fcfidu f4,f5 */ -+ .long 0xfc802f9d /* 138: fcfidu. f4,f5 */ -+ .long 0xfc0a5900 /* 13c: ftdiv cr0,f10,f11 */ -+ .long 0xff8a5900 /* 140: ftdiv cr7,f10,f11 */ -+ .long 0xfc005140 /* 144: ftsqrt cr0,f10 */ -+ .long 0xff805140 /* 148: ftsqrt cr7,f10 */ -+ .long 0x7e084a2c /* 14c: dcbtt r8,r9 */ -+ .long 0x7e0849ec /* 150: dcbtstt r8,r9 */ -+ .long 0xed406644 /* 154: dcffix f10,f12 */ -+ .long 0xee80b645 /* 158: dcffix. f20,f22 */ -+ .long 0x7d4b6068 /* 15c: lbarx r10,r11,r12 */ -+ .long 0x7d4b6068 /* 160: lbarx r10,r11,r12 */ -+ .long 0x7d4b6069 /* 164: lbarx r10,r11,r12,1 */ -+ .long 0x7e95b0e8 /* 168: lharx r20,r21,r22 */ -+ .long 0x7e95b0e8 /* 16c: lharx r20,r21,r22 */ -+ .long 0x7e95b0e9 /* 170: lharx r20,r21,r22,1 */ -+ .long 0x7d4b656d /* 174: stbcx. r10,r11,r12 */ -+ .long 0x7d4b65ad /* 178: sthcx. r10,r11,r12 */ -+ .long 0xfdc07830 /* 17c: fre f14,f15 */ -+ .long 0xfdc07831 /* 180: fre. f14,f15 */ -+ .long 0xedc07830 /* 184: fres f14,f15 */ -+ .long 0xedc07831 /* 188: fres. f14,f15 */ -+ .long 0xfdc07834 /* 18c: frsqrte f14,f15 */ -+ .long 0xfdc07835 /* 190: frsqrte. f14,f15 */ -+ .long 0xedc07834 /* 194: frsqrtes f14,f15 */ -+ .long 0xedc07835 /* 198: frsqrtes. f14,f15 */ -+ .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */ + #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 @@ -21779,7 +15541,7 @@ index 0000000..b05411e + +gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array" diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c -index 98d4d35..f98a656 100644 +index ecc3289..f79ad40 100644 --- a/gdb/testsuite/gdb.base/arrayidx.c +++ b/gdb/testsuite/gdb.base/arrayidx.c @@ -17,6 +17,13 @@ @@ -21797,7 +15559,7 @@ index 98d4d35..f98a656 100644 main (void) { diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp -index 71ce4aa..af0e5f8 100644 +index 0ef6c4b..330ed87 100644 --- a/gdb/testsuite/gdb.base/arrayidx.exp +++ b/gdb/testsuite/gdb.base/arrayidx.exp @@ -59,4 +59,12 @@ gdb_test "print array" \ @@ -21815,7 +15577,7 @@ index 71ce4aa..af0e5f8 100644 + } +} diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp -index d76cc36..496ff18 100644 +index d71641b..dbe86eb 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp @@ -606,7 +606,7 @@ gdb_test "help stepi" "Step one instruction exactly\.\[\r\n\]+Argument N means d @@ -21885,182 +15647,11 @@ index 0000000..6d82e73 + +gdb_test {set $varstruct = staticstruct} +gdb_test {p $varstruct.field} " = 1" -diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c -new file mode 100644 -index 0000000..1a0220e ---- /dev/null -+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c -@@ -0,0 +1,21 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+void -+func (void) -+{ -+} -diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup.c -new file mode 100644 -index 0000000..bb20e98 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/lineno-makeup.c -@@ -0,0 +1,35 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number -+ information (.debug_line) so we cannot use an external object file. -+ -+ It must not be just a label as it would alias on the next function even for -+ correct GDB. Therefore some stub data must be placed there. -+ -+ We need to provide a real stub function body as at least s390 -+ (s390_analyze_prologue) would skip the whole body till reaching `main'. */ -+ -+extern void func (void); -+asm ("func: .incbin \"gdb.base/lineno-makeup-func.bin\""); -+ -+int -+main (void) -+{ -+ func (); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp -new file mode 100644 -index 0000000..0c75b84 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp -@@ -0,0 +1,78 @@ -+# Copyright 2009 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile "lineno-makeup" -+set srcfuncfile ${testfile}-func.c -+set srcfile ${testfile}.c -+set objfuncfile ${objdir}/${subdir}/${testfile}-func.o -+set binfuncfile ${objdir}/${subdir}/${testfile}-func.bin -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output] -+verbose -log "objcopy=$objcopy: $output" -+if { $objcopy != 0 } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+set binfuncfilesize [file size $binfuncfile] -+verbose -log "file size $binfuncfile = $binfuncfilesize" -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set b_addr "" -+set test "break func" -+gdb_test_multiple $test $test { -+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { -+ set b_addr $expect_out(1,string) -+ pass $test -+ } -+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" { -+ set b_addr $expect_out(1,string) -+ fail $test -+ } -+} -+verbose -log "b_addr=<$b_addr>" -+ -+set p_addr "" -+set test "print func" -+gdb_test_multiple $test $test { -+ -re "\\$\[0-9\]+ = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" { -+ set p_addr $expect_out(1,string) -+ pass $test -+ } -+} -+verbose -log "p_addr=<$p_addr>" -+ -+set test "break address belongs to func" -+if {$b_addr == $p_addr} { -+ pass "$test (exact match)" -+} else { -+ set skip [expr $b_addr - $p_addr] -+ if {$skip > 0 && $skip < $binfuncfilesize} { -+ pass "$test (prologue skip by $skip bytes)" -+ } else { -+ fail $test -+ } -+} -diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp -index 55c4d31..df25d3c 100644 ---- a/gdb/testsuite/gdb.base/macscp.exp -+++ b/gdb/testsuite/gdb.base/macscp.exp -@@ -33,6 +33,14 @@ if [test_compiler_info gcc*] { - lappend options additional_flags=-g3 - } - -+# Workaround ccache making lineno non-zero for command-line definitions. -+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} { -+ set result [catch "exec which gcc" output] -+ if {$result == 0 && [string first "/ccache/" $output] >= -1} { -+ lappend options "compiler=/usr/bin/gcc" -+ } -+} -+ - # Generate the intermediate object file. This is required by Darwin to - # have access to the .debug_macinfo section. - if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \ diff --git a/gdb/testsuite/gdb.base/radix.exp b/gdb/testsuite/gdb.base/radix.exp -index 750fd23..dfdb929 100644 +index 9fd6cb5..93aa142 100644 --- a/gdb/testsuite/gdb.base/radix.exp +++ b/gdb/testsuite/gdb.base/radix.exp -@@ -162,13 +162,6 @@ gdb_test "set radix" \ +@@ -163,13 +163,6 @@ gdb_test "set radix" \ "Input and output radices now set to decimal 10, hex a, octal 12\." \ "Reset radices" @@ -22074,166 +15665,6 @@ index 750fd23..dfdb929 100644 gdb_test "set input-radix 1" \ "Nonsense input radix ``decimal 1''; input radix unchanged\\." \ "Reject input-radix 1" -diff --git a/gdb/testsuite/gdb.base/valgrind-attach.c b/gdb/testsuite/gdb.base/valgrind-attach.c -new file mode 100644 -index 0000000..84b57db ---- /dev/null -+++ b/gdb/testsuite/gdb.base/valgrind-attach.c -@@ -0,0 +1,28 @@ -+/* 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 -+ -+int -+main (void) -+{ -+ int *a = malloc (1); -+ -+ a[10] = 0; /* crash-here */ -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/valgrind-attach.exp b/gdb/testsuite/gdb.base/valgrind-attach.exp -new file mode 100644 -index 0000000..1f9b26e ---- /dev/null -+++ b/gdb/testsuite/gdb.base/valgrind-attach.exp -@@ -0,0 +1,94 @@ -+# 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 valgrind-attach -+set shfile ${testfile}.sh -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_stop_suppressing_tests; -+ -+set VALGRIND "valgrind" -+ -+# Syntax for ${shfile} is: -+set VALGRIND_SPAWN "sh ${srcdir}/${subdir}/${shfile} $binfile $VALGRIND $GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]" -+ -+set test "spawn valgrind" -+verbose "Spawning $VALGRIND_SPAWN" -+ -+if [info exists gdb_spawn_id] { -+ fail $test -+ return -1 -+} -+ -+if ![is_remote host] { -+ if { [which $VALGRIND] == 0 } then { -+ untested "Couldn't find $VALGRIND" -+ return -1 -+ } -+} -+set res [remote_spawn host "$VALGRIND_SPAWN"] -+if { $res < 0 || $res == "" } { -+ perror "Spawning $VALGRIND_SPAWN failed." -+ return -1 -+} -+set gdb_spawn_id -1; -+ -+gdb_expect { -+ -re "---- Attach to debugger \\? --- \\\[Return/N/n/Y/y/C/c\\\] ---- $" { -+ pass $test -+ } -+ eof { -+ perror "(eof) $VALGRIND never initialized" -+ remote_close host -+ return -1 -+ } -+ timeout { -+ perror "(timeout) $VALGRIND never initialized" -+ remote_close host -+ return -1 -+ } -+} -+send_gdb "y\n" -+ -+set test "spawn gdb" -+set test2 "crash line caught" -+gdb_expect { -+ -re "starting debugger with cmd:.* in main .* crash-here .*\[\r\n\]$gdb_prompt $" { -+ pass $test -+ pass $test2 -+ } -+ -re "starting debugger with cmd:.*\[\r\n\]$gdb_prompt $" { -+ pass $test -+ fail $test2 -+ } -+ eof { -+ perror "(eof) $GDB never initialized" -+ remote_close host -+ return -1 -+ } -+ timeout { -+ perror "(timeout) $GDB never initialized" -+ remote_close host -+ return -1 -+ } -+} -+ -+remote_close host -diff --git a/gdb/testsuite/gdb.base/valgrind-attach.sh b/gdb/testsuite/gdb.base/valgrind-attach.sh -new file mode 100755 -index 0000000..f02c6f7 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/valgrind-attach.sh -@@ -0,0 +1,20 @@ -+#! /bin/sh -+ -+# 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 . -+ -+BINFILE="$1"; shift -+VALGRIND="$1"; shift -+"$VALGRIND" --db-attach=yes --db-command="$* %f %p" "$BINFILE" diff --git a/gdb/testsuite/gdb.base/vla-overflow.c b/gdb/testsuite/gdb.base/vla-overflow.c new file mode 100644 index 0000000..c5d5ee0 @@ -22513,549 +15944,19 @@ 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.base/watchpoint-hw.c b/gdb/testsuite/gdb.base/watchpoint-hw.c -index 8da9af5..e2de53a 100644 ---- a/gdb/testsuite/gdb.base/watchpoint-hw.c -+++ b/gdb/testsuite/gdb.base/watchpoint-hw.c -@@ -20,5 +20,11 @@ int watchee; - int - main (void) - { -+ volatile int dummy; -+ -+ dummy = watchee; -+ dummy = 1; -+ dummy = 2; /* break-at-exit */ -+ - return 0; - } -diff --git a/gdb/testsuite/gdb.base/watchpoint-hw.exp b/gdb/testsuite/gdb.base/watchpoint-hw.exp -index a2bb731..d74d6c7 100644 ---- a/gdb/testsuite/gdb.base/watchpoint-hw.exp -+++ b/gdb/testsuite/gdb.base/watchpoint-hw.exp -@@ -21,19 +21,12 @@ if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] - return - } - --set testfile watchpoint-hw --set srcfile ${testfile}.c --set binfile ${objdir}/${subdir}/${testfile} --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -- untested "Couldn't compile test program" -+set test watchpoint-hw -+set srcfile ${test}.c -+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } { - return -1 - } - --gdb_exit --gdb_start --gdb_reinitialize_dir $srcdir/$subdir --gdb_load ${binfile} -- - # Create the watchpoint before the inferior gets started. Now the native CPU - # target is still not active and its `to_can_use_hw_breakpoint' is not - # installed, therefore only a software watchpoint gets created. -@@ -43,10 +36,40 @@ gdb_test "watch watchee" "atchpoint 1: watchee" - # `runto_main' or `runto main' would delete the watchpoint created above. - - if { [gdb_start_cmd] < 0 } { -- untested start -+ untested ${test}.exp - return -1 - } - gdb_test "" "main .* at .*" "start" - - # Check it is really a `hw'-watchpoint. - gdb_test "info watchpoints" "1 *hw watchpoint .* watchee" -+ -+# Before the inferior gets started we would get: -+# Target does not support this type of hardware watchpoint. -+gdb_test "delete 1" -+gdb_test "rwatch watchee" -+ -+set breakline [gdb_get_line_number "break-at-exit"] -+gdb_breakpoint $breakline -+ -+gdb_test "continue" "Continuing.\r\nHardware read watchpoint 3: watchee\r\n\r\nValue = 0\r\n.*" -+ -+# Here should be no repeated notification of the read watchpoint. -+gdb_test "continue" \ -+ "Continuing\\.\[ \r\n\]+Breakpoint \[0-9\]+, .*break-at-exit.*" \ -+ "continue to break-at-exit after rwatch" -+ -+clean_restart ${test} -+ -+if ![runto_main] { -+ untested ${test}.exp -+ return -1 -+} -+ -+gdb_test "hbreak ${srcfile}:${breakline}" \ -+ "Hardware assisted breakpoint 2 at 0x\[0-9a-f\]+: file .*${srcfile}, line ${breakline}\\." \ -+ "hbreak" -+ -+gdb_test "continue" \ -+ "Continuing\\.\[ \r\n\]+Breakpoint \[0-9\]+, .*break-at-exit.*" \ -+ "continue to break-at-exit after hbreak" diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in -index 0a087c7..b4880f2 100644 +index c990a64..c964db9 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 -+ ref-types ref-params method2 pr9594 gdb2495 gdb9593 +- ref-types ref-params method2 pr9594 gdb2495 virtfunc2 ++ ref-types ref-params method2 pr9594 gdb2495 gdb9593 virtfunc2 all info install-info dvi install uninstall installcheck check: @echo "Nothing to be done for $@..." -diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp -index 4095ccf..03c07d5 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/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc -index 7f033d6..11dba06 100644 ---- a/gdb/testsuite/gdb.cp/cplusfuncs.cc -+++ b/gdb/testsuite/gdb.cp/cplusfuncs.cc -@@ -46,7 +46,9 @@ public: - void operator [] (foo&); - void operator () (foo&); - void* operator new (size_t) throw (); -+ void* operator new[] (size_t) throw (); - void operator delete (void *); -+ void operator delete[] (void *); - /**/ operator int (); - /**/ operator char* (); - -@@ -115,7 +117,9 @@ void foo::operator ->* (foo& afoo) { afoo.ifoo = 0; } - void foo::operator [] (foo& afoo) { afoo.ifoo = 0; } - void foo::operator () (foo& afoo) { afoo.ifoo = 0; } - void* foo::operator new (size_t ival) throw () { ival = 0; return 0; } -+void* foo::operator new[] (size_t ival) throw () { ival = 0; return 0; } - void foo::operator delete (void *ptr) { ptr = 0; } -+void foo::operator delete[] (void *ptr) { ptr = 0; } - /**/ foo::operator int () { return 0; } - /**/ foo::operator char* () { return 0; } - -@@ -191,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 5e08768..2ec50ca 100644 ---- a/gdb/testsuite/gdb.cp/cplusfuncs.exp -+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp -@@ -63,12 +63,28 @@ set dm_type_foo_ref "foo&" - set dm_type_int_star "int*" - set dm_type_long_star "long*" - set dm_type_unsigned_int "unsigned" --set dm_type_void "" -+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,8 +93,13 @@ 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" -+ send_gdb "print &foo::operator,(foo&)\n" - gdb_expect { - -re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" { - # v2 demangler -@@ -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)" -+ } -+ } - } - - # -@@ -241,6 +382,7 @@ proc info_func_regexp { name demangled } { - global gdb_prompt - - send_gdb "info function $name\n" -+ set demangled [regsub {\\\(void\\\)} $demangled {\(\)}] - gdb_expect { - -re ".*File .*:\r\n(class |)$demangled\r\n.*$gdb_prompt $" { - pass "info function for \"$name\"" -@@ -277,16 +419,16 @@ proc print_addr_2 { name good } { - - set good_pattern [string_to_regexp $good] - -- send_gdb "print &'$name'\n" -+ send_gdb "print &$name\n" - gdb_expect { - -re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" { -- pass "print &'$name'" -+ pass "print &$name" - } - -re ".*$gdb_prompt $" { -- fail "print &'$name'" -+ fail "print &$name" - } - timeout { -- fail "print &'$name' (timeout)" -+ fail "print &$name (timeout)" - } - } - } -@@ -327,7 +469,12 @@ proc print_addr_2_kfail { name good bad bugid } { - # - - proc print_addr { name } { -- print_addr_2 "$name" "$name" -+ set expected [regsub {\(void\)} $name {()}] -+ if {[string first "::" $name] == -1} { -+ # C function -- must be qutoed -+ set name "'$name'" -+ } -+ print_addr_2 "$name" $expected - } - - # -@@ -345,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 -@@ -404,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);" - - } - -@@ -420,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)" -@@ -460,17 +609,20 @@ proc test_paddr_operator_functions {} { - print_addr "foo::operator\[\]($dm_type_foo_ref)" - print_addr "foo::operator()($dm_type_foo_ref)" - -- gdb_test "print &'foo::operator new'" \ -+ gdb_test "print &foo::operator new" \ - " = .* $hex " -+ gdb_test "print &foo::operator new\[\]" \ -+ " = .* $hex " - if { !$hp_aCC_compiler } { - print_addr "foo::operator delete($dm_type_void_star)" -+ print_addr "foo::operator delete[]($dm_type_void_star)" - } else { - gdb_test "print &'foo::operator delete($dm_type_void_star) static'" \ - " = .*(0x\[0-9a-f\]+|) " - } - - 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)" - } - - # -@@ -480,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)" - -@@ -513,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 {} { -@@ -534,6 +704,7 @@ proc do_tests {} { - global srcdir - global binfile - global gdb_prompt -+ global dm_type_int_star - - set prms_id 0 - set bug_id 0 -@@ -557,6 +728,10 @@ proc do_tests {} { - test_paddr_operator_functions - test_paddr_hairy_functions - test_lookup_operator_functions -+ -+ # A regression test on errors involving operators -+ gdb_test "list foo::operator $dm_type_int_star" \ -+ ".*the class foo does not have any method named operator $dm_type_int_star.*" - } - - do_tests -diff --git a/gdb/testsuite/gdb.cp/expand-sals.exp b/gdb/testsuite/gdb.cp/expand-sals.exp -index 3c302c3..cd0496d 100644 ---- a/gdb/testsuite/gdb.cp/expand-sals.exp -+++ b/gdb/testsuite/gdb.cp/expand-sals.exp -@@ -48,7 +48,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 @@ -23433,1513 +16334,6 @@ index 0000000..ee9aeff +gdb_test "advance $line" \ + ".*catch (...).*" \ + "advance-over-throw" -diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc -index 1dff70a..648b2af 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 b69d4ad..83dd0d5 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-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-using.cc b/gdb/testsuite/gdb.cp/namespace-using.cc -index 4786fd5..8ff5622 100644 ---- a/gdb/testsuite/gdb.cp/namespace-using.cc -+++ b/gdb/testsuite/gdb.cp/namespace-using.cc -@@ -1,26 +1,129 @@ -+namespace M -+{ -+ int x = 911; -+} -+ -+namespace N -+{ -+ int x = 912; -+} -+ -+int marker10 () -+{ -+ using namespace M; -+ int y = x + 1; // marker10 stop -+ using namespace N; -+ return y; -+} -+ -+namespace J -+{ -+ int jx = 44; -+} -+ -+namespace K -+{ -+ int -+ marker9 () -+ { -+ //x; -+ return marker10 (); -+ } -+} -+ -+namespace L -+{ -+ using namespace J; -+ int -+ marker8 () -+ { -+ jx; -+ return K::marker9 (); -+ } -+} -+ -+namespace G -+{ -+ namespace H -+ { -+ int ghx = 6; -+ } -+} -+ -+namespace I -+{ -+ int -+ marker7 () -+ { -+ using namespace G::H; -+ ghx; -+ return L::marker8 (); -+ } -+} -+ -+namespace E -+{ -+ namespace F -+ { -+ int efx = 5; -+ } -+} -+ -+using namespace E::F; -+int -+marker6 () -+{ -+ efx; -+ return I::marker7 (); -+} -+ - namespace A - { - int _a = 1; - int x = 2; - } - --int marker4(){ -- using A::x; -- return 0; -+namespace C -+{ -+ int cc = 3; -+} -+ -+namespace D -+{ -+ int dx = 4; -+} -+ -+using namespace C; -+int -+marker5 () -+{ -+ cc; -+ return marker6 (); -+} -+ -+int -+marker4 () -+{ -+ using D::dx; -+ return marker5 (); - } - --int marker3(){ -- return marker4(); -+int -+marker3 () -+{ -+ return marker4 (); - } - --int marker2() -+int -+marker2 () - { - namespace B = A; - B::_a; -- return marker3(); -+ return marker3 (); - } - --int marker1() -+int -+marker1 () - { - int total = 0; - { -@@ -29,17 +132,18 @@ int marker1() - using namespace A; - int c = 2; - { -- int d = 3; -- total = _a + b + c + d + marker2(); // marker1 stop -+ int d = 3; -+ total = _a + b + c + d + marker2 (); // marker1 stop - } - } - } - return total; - } - --int main() -+int -+main () - { - using namespace A; - _a; -- return marker1(); -+ return marker1 (); - } -diff --git a/gdb/testsuite/gdb.cp/namespace-using.exp b/gdb/testsuite/gdb.cp/namespace-using.exp -index f24973f..fc23115 100644 ---- a/gdb/testsuite/gdb.cp/namespace-using.exp -+++ b/gdb/testsuite/gdb.cp/namespace-using.exp -@@ -28,6 +28,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb - return -1 - } - -+if [get_compiler_info ${binfile}] { -+ return -1; -+} -+ -+ - # Get things started. - - gdb_exit -@@ -46,42 +51,155 @@ if ![runto_main] then { - - gdb_test "print _a" "= 1" - -+# Test that names are not printed when they -+# are not imported -+ -+gdb_breakpoint marker3 -+gdb_continue_to_breakpoint "marker3" -+ -+#send_gdb "break marker3\n" -+#send_gdb "continue\n" -+ -+gdb_test "print _a" "No symbol \"_a\" in current context." "Print _a without import" -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+ - ############################################ - # test printing of namespace imported into - # a scope containing the pc. - -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ - gdb_breakpoint [gdb_get_line_number "marker1 stop"] - gdb_continue_to_breakpoint "marker1 stop" - - gdb_test "print _a" "= 1" "print _a in a nested scope" - -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+############################################ -+# test printing of namespace imported into -+# file scope. -+ -+ -+if ![runto marker5] then { -+ perror "couldn't run to breakpoint marker5" -+ continue -+} -+ -+gdb_test "print cc" "= 3" -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+ - ############################################ - # Test printing of namespace aliases - --setup_kfail "gdb/7935" "*-*-*" - if ![runto marker2] then { - perror "couldn't run to breakpoint marker2" - continue - } - --gdb_test "print B::a" "= 1" -+gdb_test "print B::_a" "= 1" -+ -+gdb_test "print _a" "No symbol \"_a\" in current context." "print _a in namespace alias scope" -+gdb_test "print x" "No symbol \"x\" in current context." "print x in namespace alias scope" -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ - - ############################################ - # Test that names are not printed when they - # are not imported - --gdb_breakpoint "marker3" --gdb_continue_to_breakpoint "marker3" -+if {![runto marker3]} { -+ perror "couldn't run to breakpoint marker3" -+} - --gdb_test "print _a" "No symbol \"_a\" in current context." "Print a without import" -+# gcc-4-3 puts import statements for aliases in -+# the global scope instead of the corresponding -+# function scope. These wrong import statements throw -+# this test off. This is fixed in gcc-4-4. -+if [test_compiler_info gcc-4-3-*] then { setup_xfail *-*-* } -+ -+gdb_test "print _a" "No symbol \"_a\" in current context." "Print _a without import" - - ############################################ - # Test printing of individually imported elements - --setup_kfail "gdb/7936" "*-*-*" - if ![runto marker4] then { - perror "couldn't run to breakpoint marker4" - continue - } - --gdb_test "print x" "= 2" -+gdb_test "print dx" "= 4" -+ -+############################################ -+# Test printing of namespace aliases -+ -+if ![runto marker5] then { -+ perror "couldn't run to marker5" -+ continue -+} -+ -+gdb_test "print efx" "= 5" -+ -+############################################ -+# Test printing of variables imported from -+# nested namespaces -+ -+if ![runto I::marker7] then { -+ perror "couldn't run to breakpoint I::marker7" -+ continue -+} -+ -+gdb_test "print ghx" "= 6" -+ -+############################################ -+# Test that variables are not printed in a namespace -+# that is sibling to the namespace containing an import -+ -+if ![runto L::marker8] then { -+ perror "couldn't run to breakpoint L::marker8" -+ continue -+} -+ -+gdb_test "print jx" "= 44" -+ -+gdb_breakpoint "K::marker9" -+gdb_continue_to_breakpoint "K::marker9" -+ -+gdb_test "print jx" "No symbol \"jx\" in current context." -+ -+############################################ -+# Test that variables are only printed after the line -+# containing the import -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_breakpoint [gdb_get_line_number "marker10 stop"] -+gdb_continue_to_breakpoint "marker10 stop" -+ -+# Assert that M::x is printed and not N::x -+gdb_test "print x" "= 911" "print x (from M::x)" -+ -diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp -index 76b1b82..2042db2 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 -@@ -259,11 +260,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\"." -@@ -273,8 +279,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/overload.exp b/gdb/testsuite/gdb.cp/overload.exp -index 24025a2..a72932e 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 8a6b795..9997a45 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/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.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S new file mode 100644 index 0000000..d5b9ca5 @@ -25397,186 +16791,6 @@ index 0000000..c41151c +clean_restart $binfile + +gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}" -diff --git a/gdb/testsuite/gdb.fortran/common-block.exp b/gdb/testsuite/gdb.fortran/common-block.exp -new file mode 100644 -index 0000000..888f6c3 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/common-block.exp -@@ -0,0 +1,101 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# This file was written by Jan Kratochvil . -+ -+set testfile "common-block" -+set srcfile ${testfile}.f90 -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_breakpoint [gdb_get_line_number "stop-here-out"] -+gdb_continue_to_breakpoint "stop-here-out" -+ -+# Common block naming with source name /foo/: -+# .symtab DW_TAG_common_block's DW_AT_name -+# Intel Fortran foo_ foo_ -+# GNU Fortran foo_ foo -+#set suffix "_" -+set suffix "" -+ -+set int4 {(integer\(kind=4\)|INTEGER\(4\))} -+set real4 {(real\(kind=4\)|REAL\(4\))} -+set real8 {(real\(kind=8\)|REAL\(8\))} -+ -+gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context." -+gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context." -+gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context." -+gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." -+gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." -+gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." -+ -+gdb_test "info locals" "ix_x = 11\r\niy_y = 22\r\niz_z = 33\r\nix = 1\r\niy = 2\r\niz = 3" "info locals out" -+gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix_x = 11\r\niy_y = 22\r\niz_z = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix = 1\r\niy = 2\r\niz = 3" "info common out" -+ -+gdb_test "ptype ix" "type = $int4" "ptype ix out" -+gdb_test "ptype iy" "type = $real4" "ptype iy out" -+gdb_test "ptype iz" "type = $real8" "ptype iz out" -+gdb_test "ptype ix_x" "type = $int4" "ptype ix_x out" -+gdb_test "ptype iy_y" "type = $real4" "ptype iy_y out" -+gdb_test "ptype iz_z" "type = $real8" "ptype iz_z out" -+ -+gdb_test "p ix" " = 1 *" "p ix out" -+gdb_test "p iy" " = 2 *" "p iy out" -+gdb_test "p iz" " = 3 *" "p iz out" -+gdb_test "p ix_x" " = 11 *" "p ix_x out" -+gdb_test "p iy_y" " = 22 *" "p iy_y out" -+gdb_test "p iz_z" " = 33 *" "p iz_z out" -+ -+gdb_breakpoint [gdb_get_line_number "stop-here-in"] -+gdb_continue_to_breakpoint "stop-here-in" -+ -+gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context." "whatis foo$suffix in" -+gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context." "ptype foo$suffix in" -+gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context." "p foo$suffix in" -+gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "whatis fo_o$suffix in" -+gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "ptype fo_o$suffix in" -+gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "p fo_o$suffix in" -+ -+gdb_test "info locals" "ix = 11\r\niy2 = 22\r\niz = 33\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3\r\niy = 5\r\niz_z = 55" "info locals in" -+gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix = 11\r\niy2 = 22\r\niz = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3" "info common in" -+ -+gdb_test "ptype ix" "type = $int4" "ptype ix in" -+gdb_test "ptype iy2" "type = $real4" "ptype iy2 in" -+gdb_test "ptype iz" "type = $real8" "ptype iz in" -+gdb_test "ptype ix_x" "type = $int4" "ptype ix_x in" -+gdb_test "ptype iy_y" "type = $real4" "ptype iy_y in" -+gdb_test "ptype iz_z2" "type = $real8" "ptype iz_z2 in" -+ -+gdb_test "p ix" " = 11 *" "p ix in" -+gdb_test "p iy2" " = 22 *" "p iy2 in" -+gdb_test "p iz" " = 33 *" "p iz in" -+gdb_test "p ix_x" " = 1 *" "p ix_x in" -+gdb_test "p iy_y" " = 2 *" "p iy_y in" -+gdb_test "p iz_z2" " = 3 *" "p iz_z2 in" -diff --git a/gdb/testsuite/gdb.fortran/common-block.f90 b/gdb/testsuite/gdb.fortran/common-block.f90 -new file mode 100644 -index 0000000..b614e8a ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/common-block.f90 -@@ -0,0 +1,67 @@ -+! Copyright 2008 Free Software Foundation, Inc. -+! -+! This program is free software; you can redistribute it and/or modify -+! it under the terms of the GNU General Public License as published by -+! the Free Software Foundation; either version 2 of the License, or -+! (at your option) any later version. -+! -+! This program is distributed in the hope that it will be useful, -+! but WITHOUT ANY WARRANTY; without even the implied warranty of -+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+! GNU General Public License for more details. -+! -+! You should have received a copy of the GNU General Public License -+! along with this program; if not, write to the Free Software -+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+! -+! Ihis file is the Fortran source file for dynamic.exp. -+! Original file written by Jakub Jelinek . -+! Modified for the GDB testcase by Jan Kratochvil . -+ -+subroutine in -+ -+ INTEGER*4 ix -+ REAL*4 iy2 -+ REAL*8 iz -+ -+ INTEGER*4 ix_x -+ REAL*4 iy_y -+ REAL*8 iz_z2 -+ -+ common /fo_o/ix,iy2,iz -+ common /foo/ix_x,iy_y,iz_z2 -+ -+ iy = 5 -+ iz_z = 55 -+ -+ if (ix .ne. 11 .or. iy2 .ne. 22.0 .or. iz .ne. 33.0) call abort -+ if (ix_x .ne. 1 .or. iy_y .ne. 2.0 .or. iz_z2 .ne. 3.0) call abort -+ -+ ix = 0 ! stop-here-in -+ -+end subroutine in -+ -+program common_test -+ -+ INTEGER*4 ix -+ REAL*4 iy -+ REAL*8 iz -+ -+ INTEGER*4 ix_x -+ REAL*4 iy_y -+ REAL*8 iz_z -+ -+ common /foo/ix,iy,iz -+ common /fo_o/ix_x,iy_y,iz_z -+ -+ ix = 1 -+ iy = 2.0 -+ iz = 3.0 -+ -+ ix_x = 11 -+ iy_y = 22.0 -+ iz_z = 33.0 -+ -+ call in ! stop-here-out -+ -+end program common_test diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp new file mode 100644 index 0000000..cd3486b @@ -26048,97 +17262,8 @@ index 0000000..4b4ea4c +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/logical.exp b/gdb/testsuite/gdb.fortran/logical.exp -new file mode 100644 -index 0000000..ef76f43 ---- /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/testsuite/gdb.fortran/module.exp b/gdb/testsuite/gdb.fortran/module.exp -index 342ccee..c836c3c 100644 +index 0acce4f..b952162 100644 --- a/gdb/testsuite/gdb.fortran/module.exp +++ b/gdb/testsuite/gdb.fortran/module.exp @@ -15,21 +15,31 @@ @@ -26183,7 +17308,7 @@ index 342ccee..c836c3c 100644 +gdb_test "print var_d" " = 12" +gdb_test "print var_i" " = 14" "print var_i value 14" diff --git a/gdb/testsuite/gdb.fortran/module.f90 b/gdb/testsuite/gdb.fortran/module.f90 -index 501ccc8..118931d 100644 +index 81ef376..fb6eccd 100644 --- a/gdb/testsuite/gdb.fortran/module.f90 +++ b/gdb/testsuite/gdb.fortran/module.f90 @@ -13,10 +13,37 @@ @@ -26338,7 +17463,7 @@ index 0000000..226dc5d + call foo (g, h) +end diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index 495ae45..d08d7a4 100644 +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 {} { @@ -26662,7 +17787,7 @@ index 0000000..e48d520 + call f ('foo') + end diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp -index f6ef938..1032a2d 100644 +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 { @@ -26706,7 +17831,7 @@ index f6ef938..1032a2d 100644 # Test a simple command. diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp -index a67eaa3..5380c0f 100644 +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 { @@ -26796,7 +17921,7 @@ index a67eaa3..5380c0f 100644 + +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 30fde7d..14cd90c 100644 +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 { @@ -27186,7 +18311,7 @@ index 0000000..e9d18b7 +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 b4b3776..359c4ed 100644 +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} @@ -27216,17 +18341,17 @@ index b4b3776..359c4ed 100644 } # Run a command in GDB, and report a failure if a Python exception is thrown. -@@ -102,6 +110,8 @@ proc run_lang_tests {lang} { - - gdb_test "print c" " = container $hex \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" +@@ -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 cea6ae0..c9a63d4 100644 +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 { @@ -27269,10 +18394,10 @@ index cea6ae0..c9a63d4 100644 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 2958233..0de1cae 100644 +index aa4e519..f87277d 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -292,6 +292,15 @@ proc test_value_after_death {} { +@@ -305,6 +305,15 @@ proc test_value_after_death {} { "print value's type" } @@ -27288,7 +18413,7 @@ index 2958233..0de1cae 100644 # 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. -@@ -366,16 +375,23 @@ proc test_subscript_regression {lang} { +@@ -390,16 +399,23 @@ proc test_parse_and_eval {} { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -27319,16 +18444,16 @@ index 2958233..0de1cae 100644 test_value_creation test_value_numeric_ops test_value_boolean -@@ -391,6 +407,7 @@ if ![runto_main] then { - +@@ -417,6 +433,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. diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp -index 5223fc8..03e1eab 100644 +index 951c295..9dd0c12 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -26,30 +26,9 @@ gdb_exit @@ -27908,512 +19033,8 @@ index 0000000..1dc93ab +if {[istarget "*-*-linux*"]} { + test child FOLLOW_CHILD +} -diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.c b/gdb/testsuite/gdb.threads/watchthreads-reorder.c -new file mode 100644 -index 0000000..14f42d6 ---- /dev/null -+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c -@@ -0,0 +1,366 @@ -+/* 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 . */ -+ -+#define _GNU_SOURCE -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define gettid() syscall (__NR_gettid) -+ -+/* Terminate always in the main task, it can lock up with SIGSTOPped GDB -+ otherwise. */ -+#define TIMEOUT (gettid () == getpid() ? 10 : 15) -+ -+static pthread_mutex_t gdbstop_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -+ -+static pid_t thread1_tid; -+static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER; -+static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -+ -+static pid_t thread2_tid; -+static pthread_cond_t thread2_tid_cond = PTHREAD_COND_INITIALIZER; -+static pthread_mutex_t thread2_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -+ -+static pthread_mutex_t terminate_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -+ -+static volatile int thread1_rwatch; -+static volatile int thread2_rwatch; -+ -+static int unused1_rwatch; -+static int unused2_rwatch; -+ -+/* Do not use alarm as it would create a ptrace event which would hang up us if -+ * we are being traced by GDB which we stopped ourselves. */ -+ -+static void timed_mutex_lock (pthread_mutex_t *mutex) -+{ -+ int i; -+ struct timespec start, now; -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &start); -+ assert (i == 0); -+ -+ do -+ { -+ i = pthread_mutex_trylock (mutex); -+ if (i == 0) -+ return; -+ assert (i == EBUSY); -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &now); -+ assert (i == 0); -+ assert (now.tv_sec >= start.tv_sec); -+ } -+ while (now.tv_sec - start.tv_sec < TIMEOUT); -+ -+ fprintf (stderr, "Timed out waiting for internal lock!\n"); -+ exit (EXIT_FAILURE); -+} -+ -+static void * -+thread1_func (void *unused) -+{ -+ int i; -+ volatile int rwatch_store; -+ -+ thread1_tid = gettid (); -+ i = pthread_cond_signal (&thread1_tid_cond); -+ assert (i == 0); -+ -+ /* Be sure GDB is already stopped before continuing. */ -+ timed_mutex_lock (&gdbstop_mutex); -+ i = pthread_mutex_unlock (&gdbstop_mutex); -+ assert (i == 0); -+ -+ rwatch_store = thread1_rwatch; -+ -+ /* 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); -+ -+ return NULL; -+} -+ -+static void * -+thread2_func (void *unused) -+{ -+ int i; -+ volatile int rwatch_store; -+ -+ thread2_tid = gettid (); -+ i = pthread_cond_signal (&thread2_tid_cond); -+ assert (i == 0); -+ -+ /* Be sure GDB is already stopped before continuing. */ -+ timed_mutex_lock (&gdbstop_mutex); -+ i = pthread_mutex_unlock (&gdbstop_mutex); -+ assert (i == 0); -+ -+ rwatch_store = thread2_rwatch; -+ -+ /* 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); -+ -+ return NULL; -+} -+ -+static const char * -+proc_string (const char *filename, const char *line) -+{ -+ FILE *f; -+ static char buf[LINE_MAX]; -+ size_t line_len = strlen (line); -+ -+ f = fopen (filename, "r"); -+ if (f == NULL) -+ { -+ fprintf (stderr, "fopen (\"%s\") for \"%s\": %s\n", filename, line, -+ strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ while (errno = 0, fgets (buf, sizeof (buf), f)) -+ { -+ char *s; -+ -+ s = strchr (buf, '\n'); -+ assert (s != NULL); -+ *s = 0; -+ -+ if (strncmp (buf, line, line_len) != 0) -+ continue; -+ -+ if (fclose (f)) -+ { -+ fprintf (stderr, "fclose (\"%s\") for \"%s\": %s\n", filename, line, -+ strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ -+ return &buf[line_len]; -+ } -+ if (errno != 0) -+ { -+ fprintf (stderr, "fgets (\"%s\": %s\n", filename, strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ fprintf (stderr, "\"%s\": No line \"%s\" found.\n", filename, line); -+ exit (EXIT_FAILURE); -+} -+ -+static unsigned long -+proc_ulong (const char *filename, const char *line) -+{ -+ const char *s = proc_string (filename, line); -+ long retval; -+ char *end; -+ -+ errno = 0; -+ retval = strtol (s, &end, 10); -+ if (retval < 0 || retval >= LONG_MAX || (end && *end)) -+ { -+ fprintf (stderr, "\"%s\":\"%s\": %ld, %s\n", filename, line, retval, -+ strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ return retval; -+} -+ -+static void -+state_wait (pid_t process, const char *wanted) -+{ -+ char *filename; -+ int i; -+ struct timespec start, now; -+ const char *state; -+ -+ i = asprintf (&filename, "/proc/%lu/status", (unsigned long) process); -+ assert (i > 0); -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &start); -+ assert (i == 0); -+ -+ do -+ { -+ state = proc_string (filename, "State:\t"); -+ if (strcmp (state, wanted) == 0) -+ { -+ free (filename); -+ return; -+ } -+ -+ if (sched_yield ()) -+ { -+ perror ("sched_yield()"); -+ exit (EXIT_FAILURE); -+ } -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &now); -+ assert (i == 0); -+ assert (now.tv_sec >= start.tv_sec); -+ } -+ while (now.tv_sec - start.tv_sec < TIMEOUT); -+ -+ fprintf (stderr, "Timed out waiting for PID %lu \"%s\" (now it is \"%s\")!\n", -+ (unsigned long) process, wanted, state); -+ exit (EXIT_FAILURE); -+} -+ -+static volatile pid_t tracer = 0; -+static pthread_t thread1, thread2; -+ -+static void -+cleanup (void) -+{ -+ printf ("Resuming GDB PID %lu.\n", (unsigned long) tracer); -+ -+ if (tracer) -+ { -+ int i; -+ int tracer_save = tracer; -+ -+ tracer = 0; -+ -+ i = kill (tracer_save, SIGCONT); -+ assert (i == 0); -+ } -+} -+ -+int -+main (int argc, char **argv) -+{ -+ int i; -+ int standalone = 0; -+ -+ if (argc == 2 && strcmp (argv[1], "-s") == 0) -+ standalone = 1; -+ else -+ assert (argc == 1); -+ -+ setbuf (stdout, NULL); -+ -+ timed_mutex_lock (&gdbstop_mutex); -+ -+ timed_mutex_lock (&terminate_mutex); -+ -+ i = pthread_create (&thread1, NULL, thread1_func, NULL); -+ assert (i == 0); -+ -+ i = pthread_create (&thread2, NULL, thread2_func, NULL); -+ assert (i == 0); -+ -+ if (!standalone) -+ { -+ tracer = proc_ulong ("/proc/self/status", "TracerPid:\t"); -+ if (tracer == 0) -+ { -+ fprintf (stderr, "The testcase must be run by GDB!\n"); -+ exit (EXIT_FAILURE); -+ } -+ if (tracer != getppid ()) -+ { -+ fprintf (stderr, "The testcase parent must be our GDB tracer!\n"); -+ exit (EXIT_FAILURE); -+ } -+ } -+ -+ /* SIGCONT our debugger in the case of our crash as we would deadlock -+ otherwise. */ -+ -+ atexit (cleanup); -+ -+ printf ("Stopping GDB PID %lu.\n", (unsigned long) tracer); -+ -+ if (tracer) -+ { -+ i = kill (tracer, SIGSTOP); -+ assert (i == 0); -+ state_wait (tracer, "T (stopped)"); -+ } -+ -+ timed_mutex_lock (&thread1_tid_mutex); -+ timed_mutex_lock (&thread2_tid_mutex); -+ -+ /* Let the threads start. */ -+ i = pthread_mutex_unlock (&gdbstop_mutex); -+ assert (i == 0); -+ -+ printf ("Waiting till the threads initialize their TIDs.\n"); -+ -+ if (thread1_tid == 0) -+ { -+ i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex); -+ assert (i == 0); -+ -+ assert (thread1_tid > 0); -+ } -+ -+ if (thread2_tid == 0) -+ { -+ i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex); -+ assert (i == 0); -+ -+ assert (thread2_tid > 0); -+ } -+ -+ printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n", -+ (unsigned long) thread1_tid, (unsigned long) thread2_tid, -+ (unsigned long) getpid ()); -+ -+ printf ("Waiting till the threads get trapped by the watchpoints.\n"); -+ -+ if (tracer) -+ { -+ /* s390x-unknown-linux-gnu will fail with "R (running)". */ -+ -+ state_wait (thread1_tid, "T (tracing stop)"); -+ -+ state_wait (thread2_tid, "T (tracing stop)"); -+ } -+ -+ cleanup (); -+ -+ printf ("Joining the threads.\n"); -+ -+ i = pthread_mutex_unlock (&terminate_mutex); -+ assert (i == 0); -+ -+ i = pthread_join (thread1, NULL); -+ assert (i == 0); -+ -+ i = pthread_join (thread2, NULL); -+ assert (i == 0); -+ -+ printf ("Exiting.\n"); /* break-at-exit */ -+ -+ /* Just prevent compiler `warning: $B!F(BunusedX_rwatch$B!G(B defined but not used'. */ -+ unused1_rwatch = 1; -+ unused2_rwatch = 2; -+ -+ return EXIT_SUCCESS; -+} -diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp -new file mode 100644 -index 0000000..5ad1a4e ---- /dev/null -+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp -@@ -0,0 +1,105 @@ -+# 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 GDB can cope with two watchpoints being hit by different threads at the -+# same time, GDB reports one of them and after "continue" to report the other -+# one GDB should not be confused by differently set watchpoints that time. -+# This is the goal of "reorder1". "reorder0" tests the basic functionality of -+# two watchpoint being hit at the same time, without reordering them during the -+# stop. The formerly broken functionality is due to the all-stop mode default -+# "show breakpoint always-inserted" being "off". Formerly the remembered hit -+# could be assigned during continuation of a thread with pending SIGTRAP to the -+# different/new watchpoint, just based on the watchpoint/debug register number. -+ -+if {[target_info exists gdb,no_hardware_watchpoints] -+ || ![istarget *-*-linux*]} { -+ return 0; -+} -+ -+set testfile "watchthreads-reorder" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } { -+ return -1 -+} -+ -+foreach reorder {0 1} { -+ -+ global pf_prefix -+ set prefix_test $pf_prefix -+ lappend pf_prefix "reorder$reorder:" -+ -+ clean_restart $testfile -+ -+ gdb_test "set can-use-hw-watchpoints 1" -+ -+ if ![runto_main] { -+ gdb_suppress_tests -+ } -+ -+ # Use "rwatch" as "watch" would report the watchpoint changed just based on its -+ # read memory value during a stop by unrelated event. We are interested to not -+ # to lose the hardware watchpoint trigger. -+ -+ gdb_test "rwatch thread1_rwatch" "Hardware read watchpoint \[0-9\]+: thread1_rwatch" -+ gdb_test {set $rwatch1=$bpnum} -+ set test "rwatch thread2_rwatch" -+ gdb_test_multiple $test $test { -+ -re "Target does not support this type of hardware watchpoint\\.\r\n$gdb_prompt $" { -+ # ppc64 supports at most 1 hw watchpoints. -+ unsupported $test -+ return -+ } -+ -re "Hardware read watchpoint \[0-9\]+: thread2_rwatch\r\n$gdb_prompt $" { -+ pass $test -+ } -+ } -+ gdb_test {set $rwatch2=$bpnum} -+ gdb_breakpoint [gdb_get_line_number "break-at-exit"] -+ -+ # The watchpoints can happen in arbitrary order depending on random: -+ # SEL: Found 2 SIGTRAP events, selecting #[01] -+ # As GDB contains no srand() on the specific host/OS it will behave always the -+ # same. Such order cannot be guaranteed for GDB in general. -+ -+ gdb_test "continue" \ -+ "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \ -+ "continue a" -+ -+ if $reorder { -+ gdb_test {delete $rwatch1} -+ gdb_test {delete $rwatch2} -+ -+ gdb_test "rwatch unused1_rwatch" "Hardware read watchpoint \[0-9\]+: unused1_rwatch" -+ gdb_test "rwatch unused2_rwatch" "Hardware read watchpoint \[0-9\]+: unused2_rwatch" -+ -+ gdb_test "rwatch thread1_rwatch" "Hardware read watchpoint \[0-9\]+: thread1_rwatch" -+ gdb_test "rwatch thread2_rwatch" "Hardware read watchpoint \[0-9\]+: thread2_rwatch" -+ } -+ -+ gdb_test "continue" \ -+ "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \ -+ "continue b" -+ -+ # While the debug output itself is not checked in this testcase one bug was -+ # found in the DEBUG_INFRUN code path. -+ gdb_test "set debug infrun 1" -+ -+ gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*" -+ -+ set pf_prefix $prefix_test -+} -diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp -index dbd2f59..44e1b51 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) - } - } -+ - 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 0c93a73..d0c3493 100644 +index 9b06a2f..419d5a9 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -27,6 +27,7 @@ if {$tool == ""} { @@ -28484,7 +19105,7 @@ index 0000000..b8e9836 + return 0 +} diff --git a/gdb/thread.c b/gdb/thread.c -index 55b4b96..e0ad2d3 100644 +index 16a207c..c3cff06 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -61,7 +61,6 @@ static int thread_alive (struct thread_info *); @@ -28495,7 +19116,7 @@ index 55b4b96..e0ad2d3 100644 /* Frontend view of the thread state. Possible extensions: stepping, finishing, until(ling),... */ -@@ -497,16 +496,23 @@ thread_alive (struct thread_info *tp) +@@ -517,7 +516,7 @@ thread_alive (struct thread_info *tp) return 1; } @@ -28503,32 +19124,12 @@ index 55b4b96..e0ad2d3 100644 +void prune_threads (void) { -- struct thread_info *tp, *next; -+ struct thread_info *tp; -+ struct thread_info **prevp = &thread_list; - -- for (tp = thread_list; tp; tp = next) -+ for (tp = *prevp; tp; tp = *prevp) - { -- next = tp->next; -+ /* If the thread has died, free it and unlink it from the list. -+ Otherwise, advance to the next thread. */ - if (!thread_alive (tp)) -- delete_thread (tp->ptid); -+ { -+ *prevp = tp->next; -+ free_thread (tp); -+ } -+ else -+ prevp = &tp->next; - } - } - + struct thread_info *tp, *next; diff --git a/gdb/top.c b/gdb/top.c -index 1b4aa9d..3cfe57e 100644 +index 85e7b62..b4f0bf7 100644 --- a/gdb/top.c +++ b/gdb/top.c -@@ -349,6 +349,7 @@ void +@@ -346,6 +346,7 @@ void prepare_execute_command (void) { free_all_values (); @@ -28537,19 +19138,18 @@ index 1b4aa9d..3cfe57e 100644 /* With multiple threads running while the one we're examining is stopped, the dcache can get stale without us being able to detect it. diff --git a/gdb/typeprint.c b/gdb/typeprint.c -index f090231..fc15ec1 100644 +index ce9f551..5f9d739 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c -@@ -35,6 +35,8 @@ +@@ -36,6 +36,7 @@ #include "gdb_string.h" #include "exceptions.h" #include "valprint.h" +#include "dwarf2loc.h" -+ #include extern void _initialize_typeprint (void); -@@ -76,6 +78,9 @@ void +@@ -77,6 +78,9 @@ void type_print (struct type *type, char *varstring, struct ui_file *stream, int show) { @@ -28559,7 +19159,7 @@ index f090231..fc15ec1 100644 LA_PRINT_TYPE (type, varstring, stream, show, 0); } -@@ -114,7 +119,8 @@ whatis_exp (char *exp, int show) +@@ -115,7 +119,8 @@ whatis_exp (char *exp, int show) { struct expression *expr; struct value *val; @@ -28569,7 +19169,7 @@ index f090231..fc15ec1 100644 struct type *real_type = NULL; struct type *type; int full = 0; -@@ -125,12 +131,13 @@ whatis_exp (char *exp, int show) +@@ -126,12 +131,13 @@ whatis_exp (char *exp, int show) if (exp) { expr = parse_expression (exp); @@ -28584,7 +19184,7 @@ index f090231..fc15ec1 100644 type = value_type (val); get_user_print_options (&opts); -@@ -167,8 +174,7 @@ whatis_exp (char *exp, int show) +@@ -168,8 +174,7 @@ whatis_exp (char *exp, int show) type_print (type, "", gdb_stdout, show); printf_filtered ("\n"); @@ -28594,120 +19194,8 @@ index f090231..fc15ec1 100644 } static void -diff --git a/gdb/typeprint.h b/gdb/typeprint.h -index f561310..d261c79 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 527917c..07d959a 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 -@@ -263,7 +264,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 - { -@@ -297,6 +298,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 bf9915c..233206c 100644 ---- a/gdb/ui-file.h -+++ b/gdb/ui-file.h -@@ -19,6 +19,7 @@ - #ifndef UI_FILE_H - #define UI_FILE_H - -+struct obstack; - struct ui_file; - - /* Create a generic ui_file object with null methods. */ -@@ -77,7 +78,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/utils.c b/gdb/utils.c -index 16ad084..3021a43 100644 ---- a/gdb/utils.c -+++ b/gdb/utils.c -@@ -2610,7 +2610,10 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name, - As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO". - This "feature" is useful when searching for matching C++ function names - (such as if the user types 'break FOO', where FOO is a mangled C++ -- function). */ -+ function). -+ -+ As an extra-special hack, we do the same with ' ', so that -+ "FOO(ARGS) const" can match "FOO", too. */ - - int - strcmp_iw (const char *string1, const char *string2) -@@ -2635,7 +2638,7 @@ strcmp_iw (const char *string1, const char *string2) - string2++; - } - } -- return (*string1 != '\0' && *string1 != '(') || (*string2 != '\0'); -+ return (*string1 != ' ' && *string1 != '\0' && *string1 != '(') || (*string2 != '\0' && *string2 != '('); - } - - /* This is like strcmp except that it ignores whitespace and treats diff --git a/gdb/valarith.c b/gdb/valarith.c -index a9c875d..12f6f07 100644 +index 2b66f85..9c36e56 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -139,7 +139,6 @@ an integer nor a pointer of the same type.")); @@ -28797,7 +19285,7 @@ index a9c875d..12f6f07 100644 } diff --git a/gdb/valops.c b/gdb/valops.c -index 012ea6a..9b4d2a8 100644 +index 1667368..e1a6bef 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -38,6 +38,7 @@ @@ -28808,7 +19296,7 @@ index 012ea6a..9b4d2a8 100644 #include #include "gdb_string.h" -@@ -369,8 +370,6 @@ value_cast (struct type *type, struct value *arg2) +@@ -374,8 +375,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")); @@ -28817,7 +19305,7 @@ index 012ea6a..9b4d2a8 100644 range_type = create_range_type ((struct type *) NULL, TYPE_TARGET_TYPE (range_type), low_bound, -@@ -565,6 +564,64 @@ value_one (struct type *type, enum lval_type lv) +@@ -570,6 +569,64 @@ value_one (struct type *type, enum lval_type lv) return val; } @@ -28882,7 +19370,7 @@ index 012ea6a..9b4d2a8 100644 /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */ static struct value * -@@ -656,15 +713,21 @@ value_fetch_lazy (struct value *val) +@@ -661,15 +718,21 @@ value_fetch_lazy (struct value *val) } else if (VALUE_LVAL (val) == lval_memory) { @@ -28911,7 +19399,7 @@ index 012ea6a..9b4d2a8 100644 } } else if (VALUE_LVAL (val) == lval_register) -@@ -1072,7 +1135,18 @@ address_of_variable (struct symbol *var, struct block *b) +@@ -1077,7 +1140,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) { @@ -28931,7 +19419,7 @@ index 012ea6a..9b4d2a8 100644 return value_from_pointer (lookup_pointer_type (type), addr); } -@@ -1178,6 +1252,7 @@ struct value * +@@ -1183,6 +1257,7 @@ struct value * value_coerce_array (struct value *arg1) { struct type *type = check_typedef (value_type (arg1)); @@ -28939,7 +19427,7 @@ index 012ea6a..9b4d2a8 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 -@@ -1187,8 +1262,12 @@ value_coerce_array (struct value *arg1) +@@ -1192,8 +1267,12 @@ value_coerce_array (struct value *arg1) if (VALUE_LVAL (arg1) != lval_memory) error (_("Attempt to take address of value not located in memory.")); @@ -28953,228 +19441,7 @@ index 012ea6a..9b4d2a8 100644 } /* Given a value which is a function, return a value which is a pointer -@@ -2071,12 +2150,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, -@@ -2096,16 +2188,29 @@ find_overload_match (struct type **arg_types, int nargs, - } - else - { -- const char *qualified_name = SYMBOL_CPLUS_DEMANGLED_NAME (fsym); -+ const char *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 we have a C++ name, try to extract just the function -- part. */ -- if (qualified_name) -- 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; -+ } -+ } - -- /* 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 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; -@@ -2536,8 +2641,8 @@ check_field (struct type *type, const char *name) - the comment before value_struct_elt_for_reference. */ - - struct value * --value_aggregate_elt (struct type *curtype, -- char *name, int want_address, -+value_aggregate_elt (struct type *curtype, char *name, -+ struct type *expect_type, int want_address, - enum noside noside) - { - switch (TYPE_CODE (curtype)) -@@ -2545,7 +2650,7 @@ value_aggregate_elt (struct type *curtype, - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - return value_struct_elt_for_reference (curtype, 0, curtype, -- name, NULL, -+ name, expect_type, - want_address, noside); - case TYPE_CODE_NAMESPACE: - return value_namespace_elt (curtype, name, -@@ -2556,6 +2661,56 @@ value_aggregate_elt (struct type *curtype, - } - } - -+/* Compares the two method/function types T1 and T2 for "equality" -+ with respect to the the methods' parameters. If the types of the -+ two parameter lists are the same, returns 1; 0 otherwise. This -+ comparison may ignore any artificial parameters in T1 if -+ SKIP_ARTIFICIAL is non-zero. This function will ALWAYS skip -+ the first artificial parameter in T1, assumed to be a 'this' pointer. -+ -+ The type T2 is expected to have come from make_params (in eval.c). */ -+static int -+compare_parameters (struct type *t1, struct type *t2, int skip_artificial) -+{ -+ int start = 0; -+ -+ if (TYPE_FIELD_ARTIFICIAL (t1, 0)) -+ ++start; -+ -+ /* If skipping artificial fields, find the first real field -+ in T1. */ -+ if (skip_artificial) -+ { -+ while (start < TYPE_NFIELDS (t1) -+ && TYPE_FIELD_ARTIFICIAL (t1, start)) -+ ++start; -+ } -+ -+ /* Now compare parameters */ -+ -+ /* Special case: a method taking void. T1 will contain no -+ non-artificial fields, and T2 will contain TYPE_CODE_VOID. */ -+ if ((TYPE_NFIELDS (t1) - start) == 0 && TYPE_NFIELDS (t2) == 1 -+ && TYPE_CODE (TYPE_FIELD_TYPE (t2, 0)) == TYPE_CODE_VOID) -+ return 1; -+ -+ if ((TYPE_NFIELDS (t1) - start) == TYPE_NFIELDS (t2)) -+ { -+ int i; -+ for (i = 0; i < TYPE_NFIELDS (t2); ++i) -+ { -+ if (rank_one_type (TYPE_FIELD_TYPE (t1, start + i), -+ TYPE_FIELD_TYPE (t2, i)) -+ != 0) -+ return 0; -+ } -+ -+ return 1; -+ } -+ -+ return 0; -+} -+ - /* C++: Given an aggregate type CURTYPE, and a member name NAME, - return the address of this member as a "pointer to member" type. - If INTYPE is non-null, then it will be the type of the member we -@@ -2633,23 +2788,46 @@ value_struct_elt_for_reference (struct type *domain, int offset, - } - if (t_field_name && strcmp (t_field_name, name) == 0) - { -- int j = TYPE_FN_FIELDLIST_LENGTH (t, i); -+ int j; -+ int len = TYPE_FN_FIELDLIST_LENGTH (t, i); - struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i); - - check_stub_method_group (t, i); - -- if (intype == 0 && j > 1) -- error (_("non-unique member `%s' requires type instantiation"), name); - if (intype) - { -- while (j--) -- if (TYPE_FN_FIELD_TYPE (f, j) == intype) -- break; -- if (j < 0) -- error (_("no member function matches that type instantiation")); -- } -+ for (j = 0; j < len; ++j) -+ { -+ if (compare_parameters (TYPE_FN_FIELD_TYPE (f, j), intype, 0) -+ || compare_parameters (TYPE_FN_FIELD_TYPE (f, j), intype, 1)) -+ break; -+ } -+ -+ if (j == len) -+ error (_("no member function matches that type instantiation")); } - else -- j = 0; -+ { -+ int ii; -+ /* Skip artificial methods. This is necessary if, for example, -+ the user wants to "print subclass::subclass" with only -+ one defined user constructor. There is no ambiguity in this -+ case. */ -+ for (ii = 0; ii < TYPE_FN_FIELDLIST_LENGTH (t, i); -+ ++ii) -+ { -+ if (TYPE_FN_FIELD_ARTIFICIAL (f, ii)) -+ --len; -+ } -+ -+ /* Desired method is ambiguous if more than one method is -+ defined. */ -+ if (len > 1) -+ error (_("non-unique member `%s' requires type instantiation"), name); -+ -+ /* This assumes, of course, that all artificial methods appear -+ BEFORE any concrete methods. */ -+ j = TYPE_FN_FIELDLIST_LENGTH (t, i) - 1; -+ } - - if (TYPE_FN_FIELD_STATIC_P (f, j)) - { -@@ -2763,7 +2941,7 @@ value_maybe_namespace_elt (const struct type *curtype, - struct symbol *sym; - struct value *result; - -- sym = cp_lookup_symbol_namespace (namespace_name, name, NULL, -+ sym = cp_lookup_symbol_namespace(namespace_name, name, - get_selected_block (0), - VAR_DOMAIN); - -@@ -2907,7 +3085,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) -@@ -2961,8 +3139,6 @@ value_slice (struct value *array, int lowbound, int length) +@@ -3042,8 +3121,6 @@ value_slice (struct value *array, int lowbound, int length) || lowbound + length - 1 > upperbound) error (_("slice out of range")); @@ -29184,7 +19451,7 @@ index 012ea6a..9b4d2a8 100644 TYPE_TARGET_TYPE (range_type), lowbound, diff --git a/gdb/valprint.c b/gdb/valprint.c -index cbb5d94..f9634ea 100644 +index 3f21ae4..9b15b1a 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -236,7 +236,6 @@ scalar_type_p (struct type *type) @@ -29195,7 +19462,7 @@ index cbb5d94..f9634ea 100644 case TYPE_CODE_BITSTRING: return 0; default: -@@ -1153,6 +1152,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, +@@ -1154,6 +1153,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, for (; i < len && things_printed < options->print_max; i++) { @@ -29203,7 +19470,7 @@ index cbb5d94..f9634ea 100644 if (i != 0) { if (options->prettyprint_arrays) -@@ -1172,7 +1172,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, +@@ -1173,7 +1173,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, rep1 = i + 1; reps = 1; while ((rep1 < len) && @@ -29213,7 +19480,7 @@ index cbb5d94..f9634ea 100644 ++reps; ++rep1; diff --git a/gdb/value.c b/gdb/value.c -index 589e03b..62003fa 100644 +index a462ee4..968cdf4 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -37,8 +37,10 @@ @@ -29242,46 +19509,29 @@ index 589e03b..62003fa 100644 /* Register number if the value is from a register. */ short regnum; -@@ -261,7 +271,9 @@ allocate_value_lazy (struct type *type) - val->next = all_values; - all_values = val; - val->type = type; -+ type_incref (type); - val->enclosing_type = type; -+ type_incref (type); - VALUE_LVAL (val) = not_lval; - val->location.address = 0; - VALUE_FRAME_ID (val) = null_frame_id; -@@ -346,6 +358,8 @@ value_type (struct value *value) - void - deprecated_set_value_type (struct value *value, struct type *type) - { -+ type_incref (type); -+ type_decref (value->type); - value->type = type; - } - -@@ -624,6 +638,9 @@ value_free (struct value *val) +@@ -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; -@@ -728,6 +745,9 @@ value_copy (struct value *arg) +@@ -735,6 +752,7 @@ value_copy (struct value *arg) val = allocate_value_lazy (encl_type); else val = allocate_value (encl_type); + -+ type_incref (arg->type); -+ type_decref (val->type); val->type = arg->type; VALUE_LVAL (val) = VALUE_LVAL (arg); val->location = arg->location; -@@ -763,12 +783,15 @@ value_copy (struct value *arg) +@@ -770,12 +788,15 @@ value_copy (struct value *arg) void set_value_component_location (struct value *component, struct value *whole) { @@ -29297,7 +19547,7 @@ index 589e03b..62003fa 100644 if (VALUE_LVAL (whole) == lval_computed) { struct lval_funcs *funcs = whole->location.computed.funcs; -@@ -776,6 +799,12 @@ set_value_component_location (struct value *component, struct value *whole) +@@ -783,6 +804,12 @@ set_value_component_location (struct value *component, struct value *whole) if (funcs->copy_closure) component->location.computed.closure = funcs->copy_closure (whole); } @@ -29310,7 +19560,7 @@ index 589e03b..62003fa 100644 } -@@ -906,6 +935,29 @@ show_values (char *num_exp, int from_tty) +@@ -913,6 +940,29 @@ show_values (char *num_exp, int from_tty) num_exp[1] = '\0'; } } @@ -29340,7 +19590,7 @@ index 589e03b..62003fa 100644 /* Internal variables. These are variables within the debugger that hold values assigned by debugger commands. -@@ -1381,6 +1433,40 @@ call_internal_function (struct gdbarch *gdbarch, +@@ -1388,6 +1438,40 @@ call_internal_function (struct gdbarch *gdbarch, return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); } @@ -29381,7 +19631,7 @@ index 589e03b..62003fa 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 -@@ -1428,11 +1514,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, +@@ -1435,11 +1519,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, htab_t copied_types) { if (TYPE_OBJFILE (value->type) == objfile) @@ -29395,7 +19645,7 @@ index 589e03b..62003fa 100644 copied_types); } -@@ -1447,13 +1532,13 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, +@@ -1454,13 +1537,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 @@ -29411,25 +19661,7 @@ index 589e03b..62003fa 100644 break; case INTERNALVAR_VALUE: -@@ -1855,6 +1940,8 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type) - val->contents = - (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type)); - -+ type_incref (new_encl_type); -+ type_decref (val->enclosing_type); - val->enclosing_type = new_encl_type; - return val; - } -@@ -1919,6 +2006,8 @@ value_primitive_field (struct value *arg1, int offset, - memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1), - TYPE_LENGTH (value_enclosing_type (arg1))); - } -+ type_incref (type); -+ type_decref (v->type); - v->type = type; - v->offset = value_offset (arg1); - v->embedded_offset = (offset + value_embedded_offset (arg1) -@@ -2177,6 +2266,42 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num) +@@ -2192,6 +2275,42 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num) } @@ -29472,7 +19704,7 @@ index 589e03b..62003fa 100644 /* Convert C numbers into newly allocated values. */ struct value * -@@ -2190,6 +2315,19 @@ value_from_longest (struct type *type, LONGEST num) +@@ -2205,6 +2324,19 @@ value_from_longest (struct type *type, LONGEST num) } @@ -29492,7 +19724,7 @@ index 589e03b..62003fa 100644 /* Create a value representing a pointer of type TYPE to the address ADDR. */ struct value * -@@ -2348,4 +2486,8 @@ VARIABLE is already initialized.")); +@@ -2363,4 +2495,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); @@ -29502,7 +19734,7 @@ index 589e03b..62003fa 100644 + observer_attach_mark_used (value_types_mark_used); } diff --git a/gdb/value.h b/gdb/value.h -index 51e6960..48b30e4 100644 +index 8ac62b8..051c8c5 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -342,11 +342,16 @@ extern LONGEST unpack_field_as_long (struct type *type, @@ -29522,15 +19754,7 @@ index 51e6960..48b30e4 100644 extern struct value *value_at (struct type *type, CORE_ADDR addr); extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); -@@ -436,6 +441,7 @@ extern struct value *value_struct_elt (struct value **argp, - - extern struct value *value_aggregate_elt (struct type *curtype, - char *name, -+ struct type *expect_type, - int want_address, - enum noside noside); - -@@ -681,7 +687,7 @@ extern struct value *value_allocate_space_in_inferior (int); +@@ -684,7 +689,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, @@ -29540,7 +19764,7 @@ index 51e6960..48b30e4 100644 /* User function handler. */ diff --git a/gdb/varobj.c b/gdb/varobj.c -index 8f22156..8fe72ca 100644 +index 46d6b34..0536753 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -26,6 +26,8 @@ @@ -29552,66 +19776,7 @@ index 8f22156..8fe72ca 100644 #include "gdb_assert.h" #include "gdb_string.h" -@@ -253,6 +255,8 @@ static void free_variable (struct varobj *var); - - static struct cleanup *make_cleanup_free_variable (struct varobj *var); - -+static struct cleanup *make_cleanup_uninstall_variable (struct varobj *var); -+ - static struct type *get_type (struct varobj *var); - - static struct type *get_value_type (struct varobj *var); -@@ -480,6 +484,8 @@ is_root_p (struct varobj *var) - struct cleanup * - varobj_ensure_python_env (struct varobj *var) - { -+ gdb_assert (var->root->is_valid); -+ - return ensure_python_env (var->root->exp->gdbarch, - var->root->exp->language_defn); - } -@@ -651,6 +657,7 @@ varobj_create (char *objname, - do_cleanups (old_chain); - return NULL; - } -+ make_cleanup_uninstall_variable (var); - } - - discard_cleanups (old_chain); -@@ -821,7 +828,12 @@ varobj_get_display_hint (struct varobj *var) - char *result = NULL; - - #if HAVE_PYTHON -- struct cleanup *back_to = varobj_ensure_python_env (var); -+ struct cleanup *back_to; -+ -+ if (!var->root->is_valid) -+ return NULL; -+ -+ back_to = varobj_ensure_python_env (var); - - if (var->pretty_printer) - result = gdbpy_get_display_hint (var->pretty_printer); -@@ -2186,6 +2198,18 @@ make_cleanup_free_variable (struct varobj *var) - return make_cleanup (do_free_variable_cleanup, var); - } - -+static void -+do_uninstall_variable_cleanup (void *var) -+{ -+ uninstall_variable (var); -+} -+ -+static struct cleanup * -+make_cleanup_uninstall_variable (struct varobj *var) -+{ -+ return make_cleanup (do_uninstall_variable_cleanup, var); -+} -+ - /* This returns the type of the variable. It also skips past typedefs - to return the real type of the variable. - -@@ -3442,6 +3466,19 @@ java_value_of_variable (struct varobj *var, enum varobj_display_formats format) +@@ -3468,6 +3470,19 @@ java_value_of_variable (struct varobj *var, enum varobj_display_formats format) return cplus_value_of_variable (var, format); } @@ -29631,7 +19796,7 @@ index 8f22156..8fe72ca 100644 /* Iterate all the existing _root_ VAROBJs and call the FUNC callback for them with an arbitrary caller supplied DATA pointer. */ -@@ -3459,6 +3496,43 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) +@@ -3485,6 +3500,43 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) (*func) (var_root->rootvar, data); } } @@ -29676,10 +19841,10 @@ index 8f22156..8fe72ca 100644 extern void _initialize_varobj (void); void diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c -index c56ab86..dacf913 100644 +index 6301b61..47c2acb 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c -@@ -3038,6 +3038,7 @@ static struct sym_fns xcoff_sym_fns = +@@ -3035,6 +3035,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 */ diff --git a/gdb-bitfield-check_typedef.patch b/gdb-bitfield-check_typedef.patch deleted file mode 100644 index aa87bfb..0000000 --- a/gdb-bitfield-check_typedef.patch +++ /dev/null @@ -1,101 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-01/msg00030.html -Subject: [patch] Re: Regression: field type preservation: 7.0 -> 7.0.1+HEAD - -On Friday 01 January 2010 21:45:05 Jan Kratochvil wrote: -> -PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1 -> +FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1 -> -PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1 -> +FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1 -> -PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing -> +FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing -> -> due to: -> Re: RFA: unbreak typedefed bitfield -> http://sourceware.org/ml/gdb-patches/2009-12/msg00295.html -> commit fc85da4ee2a7c32afc53b1b334a4f84e2e9bd84e -> http://sourceware.org/ml/gdb-cvs/2009-12/msg00100.html - -attached a fix on top of existing HEAD. - -Original PR gdb/10884 was a regression 6.8 -> 7.0 due to: -RFC: Lazy bitfields -http://sourceware.org/ml/gdb-patches/2009-07/msg00437.html -http://sourceware.org/ml/gdb-cvs/2009-07/msg00143.html -07491b3409f6ace0b7a9a707775a56ce10fece1c - -No regressions for HEAD on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. Plus: --FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1 -+PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1 --FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1 -+PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1 --FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing -+PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing - -Going to check it in also for gdb_7_0-branch after an approval. - - -Thanks, -Jan - - -gdb/ -2010-01-02 Jan Kratochvil - - * value.c (value_primitive_field): Remove one check_typedef call. - Move bitpos and container_bitsize initialization after - allocate_value_lazy. New comment before accessing TYPE_LENGTH. - -gdb/testsuite/ -2010-01-02 Jan Kratochvil - - * gdb.mi/var-cmd.c (do_bitfield_tests): Change "V.sharable" type to - "uint_for_mi_testing". - ---- a/gdb/testsuite/gdb.mi/var-cmd.c -+++ b/gdb/testsuite/gdb.mi/var-cmd.c -@@ -494,7 +494,7 @@ void do_bitfield_tests () - mi_create_varobj V d "create varobj for Data" - mi_list_varobj_children "V" { - {"V.alloc" "alloc" "0" "int"} -- {"V.sharable" "sharable" "0" "unsigned int"} -+ {"V.sharable" "sharable" "0" "uint_for_mi_testing"} - } "list children of Data" - mi_check_varobj_value V.sharable 3 "access bitfield" - :*/ ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -1873,7 +1873,6 @@ value_primitive_field (struct value *arg1, int offset, - - CHECK_TYPEDEF (arg_type); - type = TYPE_FIELD_TYPE (arg_type, fieldno); -- type = check_typedef (type); - - /* Handle packed fields */ - -@@ -1885,10 +1884,14 @@ value_primitive_field (struct value *arg1, int offset, - Otherwise, adjust offset to the byte containing the first - bit. Assume that the address, offset, and embedded offset - are sufficiently aligned. */ -- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno); -- int container_bitsize = TYPE_LENGTH (type) * 8; -+ int bitpos, container_bitsize; - - v = allocate_value_lazy (type); -+ -+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value_lazy. */ -+ bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno); -+ container_bitsize = TYPE_LENGTH (type) * 8; -+ - v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno); - if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize - && TYPE_LENGTH (type) <= (int) sizeof (LONGEST)) -@@ -1939,6 +1942,8 @@ value_primitive_field (struct value *arg1, int offset, - else - { - v = allocate_value (type); -+ -+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value. */ - memcpy (value_contents_raw (v), - value_contents_raw (arg1) + offset, - TYPE_LENGTH (type)); - diff --git a/gdb-bz528668-symfile-cleanup.patch b/gdb-bz528668-symfile-cleanup.patch deleted file mode 100644 index 2a843fa..0000000 --- a/gdb-bz528668-symfile-cleanup.patch +++ /dev/null @@ -1,137 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2009-10/msg00509.html -Subject: [patch 2/3] find_separate_debug_file cleanup - -Hi, - -current code was: -* difficult to maintain as a new variable required xfree on many places -* was causing memory corruptions due to silently misapplied 3rd party patches - as the close code fragments unfortunately match patch context - - -Thanks, -Jan - - -gdb/ -2009-10-21 Jan Kratochvil - - * symfile.c (find_separate_debug_file): Initialize dir, debugfile and - canon_name to NULL. Change alloca to xmalloc, newly call xfree for it. - New label cleanup_return_debugfile, jump to it from the failure paths. - ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -1333,11 +1333,10 @@ static char * - find_separate_debug_file (struct objfile *objfile) - { - asection *sect; -- char *basename; -- char *dir; -- char *debugfile; -- char *name_copy; -- char *canon_name; -+ char *basename, *name_copy; -+ char *dir = NULL; -+ char *debugfile = NULL; -+ char *canon_name = NULL; - bfd_size_type debuglink_size; - unsigned long crc32; - int i; -@@ -1366,7 +1365,7 @@ find_separate_debug_file (struct objfile *objfile) - if (basename == NULL) - /* There's no separate debug info, hence there's no way we could - load it => no warning. */ -- return NULL; -+ goto cleanup_return_debugfile; - - dir = xstrdup (objfile->name); - -@@ -1388,24 +1387,19 @@ find_separate_debug_file (struct objfile *objfile) - if (canon_name && strlen (canon_name) > i) - i = strlen (canon_name); - -- debugfile = alloca (strlen (debug_file_directory) + 1 -- + i -- + strlen (DEBUG_SUBDIRECTORY) -- + strlen ("/") -- + strlen (basename) -- + 1); -+ debugfile = xmalloc (strlen (debug_file_directory) + 1 -+ + i -+ + strlen (DEBUG_SUBDIRECTORY) -+ + strlen ("/") -+ + strlen (basename) -+ + 1); - - /* First try in the same directory as the original file. */ - strcpy (debugfile, dir); - strcat (debugfile, basename); - - if (separate_debug_file_exists (debugfile, crc32, objfile->name)) -- { -- xfree (basename); -- xfree (dir); -- xfree (canon_name); -- return xstrdup (debugfile); -- } -+ goto cleanup_return_debugfile; - - /* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */ - strcpy (debugfile, dir); -@@ -1414,12 +1408,7 @@ find_separate_debug_file (struct objfile *objfile) - strcat (debugfile, basename); - - if (separate_debug_file_exists (debugfile, crc32, objfile->name)) -- { -- xfree (basename); -- xfree (dir); -- xfree (canon_name); -- return xstrdup (debugfile); -- } -+ goto cleanup_return_debugfile; - - /* Then try in the global debugfile directory. */ - strcpy (debugfile, debug_file_directory); -@@ -1428,12 +1417,7 @@ find_separate_debug_file (struct objfile *objfile) - strcat (debugfile, basename); - - if (separate_debug_file_exists (debugfile, crc32, objfile->name)) -- { -- xfree (basename); -- xfree (dir); -- xfree (canon_name); -- return xstrdup (debugfile); -- } -+ goto cleanup_return_debugfile; - - /* If the file is in the sysroot, try using its base path in the - global debugfile directory. */ -@@ -1447,20 +1431,17 @@ find_separate_debug_file (struct objfile *objfile) - strcat (debugfile, basename); - - if (separate_debug_file_exists (debugfile, crc32, objfile->name)) -- { -- xfree (canon_name); -- xfree (basename); -- xfree (dir); -- return xstrdup (debugfile); -- } -+ goto cleanup_return_debugfile; - } - -- if (canon_name) -- xfree (canon_name); -+ xfree (debugfile); -+ debugfile = NULL; - -+cleanup_return_debugfile: -+ xfree (canon_name); - xfree (basename); - xfree (dir); -- return NULL; -+ return debugfile; - } - - - diff --git a/gdb-bz528668-symfile-multi.patch b/gdb-bz528668-symfile-multi.patch deleted file mode 100644 index e773f2f..0000000 --- a/gdb-bz528668-symfile-multi.patch +++ /dev/null @@ -1,271 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2009-10/msg00508.html -Subject: [patch 3/3] debug-file-directory with multiple components - -Hi, - -for various reasons `debug-file-directory' would be sometimes useful to have -multiple components such as `solib-search-path' has. - -I found it useful myself during various separate debuginfo tests/scripts. - -It was requested for the ABRT bugreporting project at the preceding mail of: - https://fedorahosted.org/pipermail/crash-catcher/2009-October/000054.html - -It should be a backward compatible extension as DIRNAME_SEPARATOR should never -be a valid part of a single DEBUG_FILE_DIRECTORY component. - - -Thanks, -Jan - - -gdb/doc/ -2009-10-22 Jan Kratochvil - - * gdb.texinfo (set debug-file-directory, show debug-file-directory) - (Auto-loading): Use plural and note one can use multiple components now. - -gdb/ -2009-10-22 Jan Kratochvil - - * symfile.c (build_id_to_debug_filename): New variable debugdir. Move - variables size, s and data into a new inner block. Change xmalloc for - alloca, use direct BUILDID->SIZE there now. Loop for the - DEBUG_FILE_DIRECTORY components. - (find_separate_debug_file): New variable debugdir and debugdir_end. - Loop for the DEBUG_FILE_DIRECTORY components. - (_initialize_symfile): For "debug-file-directory" use plural and note - one can use multiple components now. - -gdb/testsuite/ -2009-10-22 Jan Kratochvil - - * gdb.base/sepdebug.exp: New test_different_dir call for multiple-dirs. - ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -14066,13 +14066,14 @@ name @value{GDBN} is currently using. - @table @code - - @kindex set debug-file-directory --@item set debug-file-directory @var{directory} --Set the directory which @value{GDBN} searches for separate debugging --information files to @var{directory}. -+@item set debug-file-directory @var{directories} -+Set the directories which @value{GDBN} searches for separate debugging -+information files to @var{directory}. Multiple directory components can be set -+concatenating them by a directory separator. - - @kindex show debug-file-directory - @item show debug-file-directory --Show the directory @value{GDBN} searches for separate debugging -+Show the directories @value{GDBN} searches for separate debugging - information files. - - @end table -@@ -19336,8 +19337,8 @@ readable, @value{GDBN} will evaluate it as a Python script. - - If this file does not exist, and if the parameter - @code{debug-file-directory} is set (@pxref{Separate Debug Files}), --then @value{GDBN} will use the file named --@file{@var{debug-file-directory}/@var{real-name}}, where -+then @value{GDBN} will use for its each separated directory component -+@code{component} the file named @file{@code{component}/@var{real-name}}, where - @var{real-name} is the object file's real name, as described above. - - Finally, if this file does not exist, then @value{GDBN} will look for ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -1218,35 +1218,59 @@ build_id_verify (const char *filename, struct build_id *check) - static char * - build_id_to_debug_filename (struct build_id *build_id) - { -- char *link, *s, *retval = NULL; -- gdb_byte *data = build_id->data; -- size_t size = build_id->size; -+ char *link, *debugdir, *retval = NULL; - - /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */ -- link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1 -- + 2 * size + (sizeof ".debug" - 1) + 1); -- s = link + sprintf (link, "%s/.build-id/", debug_file_directory); -- if (size > 0) -- { -- size--; -- s += sprintf (s, "%02x", (unsigned) *data++); -- } -- if (size > 0) -- *s++ = '/'; -- while (size-- > 0) -- s += sprintf (s, "%02x", (unsigned) *data++); -- strcpy (s, ".debug"); -- -- /* lrealpath() is expensive even for the usually non-existent files. */ -- if (access (link, F_OK) == 0) -- retval = lrealpath (link); -- xfree (link); -- -- if (retval != NULL && !build_id_verify (retval, build_id)) -+ link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1 -+ + 2 * build_id->size + (sizeof ".debug" - 1) + 1); -+ -+ /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will -+ cause "/.build-id/..." lookups. */ -+ -+ debugdir = debug_file_directory; -+ do - { -- xfree (retval); -- retval = NULL; -+ char *s, *debugdir_end; -+ gdb_byte *data = build_id->data; -+ size_t size = build_id->size; -+ -+ while (*debugdir == DIRNAME_SEPARATOR) -+ debugdir++; -+ -+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR); -+ if (debugdir_end == NULL) -+ debugdir_end = &debugdir[strlen (debugdir)]; -+ -+ memcpy (link, debugdir, debugdir_end - debugdir); -+ s = &link[debugdir_end - debugdir]; -+ s += sprintf (s, "/.build-id/"); -+ if (size > 0) -+ { -+ size--; -+ s += sprintf (s, "%02x", (unsigned) *data++); -+ } -+ if (size > 0) -+ *s++ = '/'; -+ while (size-- > 0) -+ s += sprintf (s, "%02x", (unsigned) *data++); -+ strcpy (s, ".debug"); -+ -+ /* lrealpath() is expensive even for the usually non-existent files. */ -+ if (access (link, F_OK) == 0) -+ retval = lrealpath (link); -+ -+ if (retval != NULL && !build_id_verify (retval, build_id)) -+ { -+ xfree (retval); -+ retval = NULL; -+ } -+ -+ if (retval != NULL) -+ break; -+ -+ debugdir = debugdir_end; - } -+ while (*debugdir != 0); - - return retval; - } -@@ -1333,7 +1357,7 @@ static char * - find_separate_debug_file (struct objfile *objfile) - { - asection *sect; -- char *basename, *name_copy; -+ char *basename, *name_copy, *debugdir; - char *dir = NULL; - char *debugfile = NULL; - char *canon_name = NULL; -@@ -1410,29 +1434,51 @@ find_separate_debug_file (struct objfile *objfile) - if (separate_debug_file_exists (debugfile, crc32, objfile->name)) - goto cleanup_return_debugfile; - -- /* Then try in the global debugfile directory. */ -- strcpy (debugfile, debug_file_directory); -- strcat (debugfile, "/"); -- strcat (debugfile, dir); -- strcat (debugfile, basename); -- -- if (separate_debug_file_exists (debugfile, crc32, objfile->name)) -- goto cleanup_return_debugfile; -+ /* Then try in the global debugfile directories. -+ -+ Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will -+ cause "/..." lookups. */ - -- /* If the file is in the sysroot, try using its base path in the -- global debugfile directory. */ -- if (canon_name -- && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0 -- && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)])) -+ debugdir = debug_file_directory; -+ do - { -- strcpy (debugfile, debug_file_directory); -- strcat (debugfile, canon_name + strlen (gdb_sysroot)); -+ char *debugdir_end; -+ -+ while (*debugdir == DIRNAME_SEPARATOR) -+ debugdir++; -+ -+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR); -+ if (debugdir_end == NULL) -+ debugdir_end = &debugdir[strlen (debugdir)]; -+ -+ memcpy (debugfile, debugdir, debugdir_end - debugdir); -+ debugfile[debugdir_end - debugdir] = 0; - strcat (debugfile, "/"); -+ strcat (debugfile, dir); - strcat (debugfile, basename); - - if (separate_debug_file_exists (debugfile, crc32, objfile->name)) - goto cleanup_return_debugfile; -+ -+ /* If the file is in the sysroot, try using its base path in the -+ global debugfile directory. */ -+ if (canon_name -+ && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0 -+ && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)])) -+ { -+ memcpy (debugfile, debugdir, debugdir_end - debugdir); -+ debugfile[debugdir_end - debugdir] = 0; -+ strcat (debugfile, canon_name + strlen (gdb_sysroot)); -+ strcat (debugfile, "/"); -+ strcat (debugfile, basename); -+ -+ if (separate_debug_file_exists (debugfile, crc32, objfile->name)) -+ goto cleanup_return_debugfile; -+ } -+ -+ debugdir = debugdir_end; - } -+ while (*debugdir != 0); - - xfree (debugfile); - debugfile = NULL; -@@ -4173,12 +4219,12 @@ Usage: set extension-language .foo bar"), - - add_setshow_optional_filename_cmd ("debug-file-directory", class_support, - &debug_file_directory, _("\ --Set the directory where separate debug symbols are searched for."), _("\ --Show the directory where separate debug symbols are searched for."), _("\ -+Set the directories where separate debug symbols are searched for."), _("\ -+Show the directories where separate debug symbols are searched for."), _("\ - Separate debug symbols are first searched for in the same\n\ - directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\ - and lastly at the path of the directory of the binary with\n\ --the global debug-file directory prepended."), -+each global debug-file-directory component prepended."), - NULL, - show_debug_file_directory, - &setlist, &showlist); ---- a/gdb/testsuite/gdb.base/sepdebug.exp -+++ b/gdb/testsuite/gdb.base/sepdebug.exp -@@ -995,6 +995,12 @@ if ![string compare $build_id_debug_filename ""] then { - - test_different_dir build-id "${objdir}/${subdir}" $xfail - -+ # Test also multiple directories can be specified. Without the build-id -+ # reference GDB would find the separate debug info just at the same -+ # location as the executable file. -+ -+ test_different_dir multiple-dirs "/doesnotexist:${objdir}/${subdir}" $xfail -+ - # Spare debug files may confuse testsuite runs in the future. - remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}" - } - diff --git a/gdb-bz528668-symfile-sepcrc.patch b/gdb-bz528668-symfile-sepcrc.patch deleted file mode 100644 index 387e45f..0000000 --- a/gdb-bz528668-symfile-sepcrc.patch +++ /dev/null @@ -1,151 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2009-10/msg00507.html -Subject: [patch 1/3] print the .debug file name having CRC mismatch - -Hi, - -this patch is left as is from Andrew Cagney. - - -Thanks, -Jan - - -gdb/ -2005-04-02 Andrew Cagney - - * symfile.c (separate_debug_file_exists): When the CRCs mismatch - print a warning. - (find_separate_debug_file): Pass in the objfile's name. - -gdb/testsuite/ -2009-10-21 Jan Kratochvil - - * gdb.base/sepdebug.exp (CRC mismatch is reported): New test. - * gdb.base/sepdebug2.c: New file. - ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -1283,7 +1283,8 @@ get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out) - } - - static int --separate_debug_file_exists (const char *name, unsigned long crc) -+separate_debug_file_exists (const char *name, unsigned long crc, -+ const char *parent_name) - { - unsigned long file_crc = 0; - bfd *abfd; -@@ -1303,7 +1304,15 @@ separate_debug_file_exists (const char *name, unsigned long crc) - - bfd_close (abfd); - -- return crc == file_crc; -+ if (crc != file_crc) -+ { -+ warning (_("the debug information found in \"%s\"" -+ " does not match \"%s\" (CRC mismatch).\n"), -+ name, parent_name); -+ return 0; -+ } -+ -+ return 1; - } - - char *debug_file_directory = NULL; -@@ -1355,6 +1364,8 @@ find_separate_debug_file (struct objfile *objfile) - basename = get_debug_link_info (objfile, &crc32); - - if (basename == NULL) -+ /* There's no separate debug info, hence there's no way we could -+ load it => no warning. */ - return NULL; - - dir = xstrdup (objfile->name); -@@ -1388,7 +1399,7 @@ find_separate_debug_file (struct objfile *objfile) - strcpy (debugfile, dir); - strcat (debugfile, basename); - -- if (separate_debug_file_exists (debugfile, crc32)) -+ if (separate_debug_file_exists (debugfile, crc32, objfile->name)) - { - xfree (basename); - xfree (dir); -@@ -1402,7 +1413,7 @@ find_separate_debug_file (struct objfile *objfile) - strcat (debugfile, "/"); - strcat (debugfile, basename); - -- if (separate_debug_file_exists (debugfile, crc32)) -+ if (separate_debug_file_exists (debugfile, crc32, objfile->name)) - { - xfree (basename); - xfree (dir); -@@ -1416,7 +1427,7 @@ find_separate_debug_file (struct objfile *objfile) - strcat (debugfile, dir); - strcat (debugfile, basename); - -- if (separate_debug_file_exists (debugfile, crc32)) -+ if (separate_debug_file_exists (debugfile, crc32, objfile->name)) - { - xfree (basename); - xfree (dir); -@@ -1435,7 +1446,7 @@ find_separate_debug_file (struct objfile *objfile) - strcat (debugfile, "/"); - strcat (debugfile, basename); - -- if (separate_debug_file_exists (debugfile, crc32)) -+ if (separate_debug_file_exists (debugfile, crc32, objfile->name)) - { - xfree (canon_name); - xfree (basename); ---- a/gdb/testsuite/gdb.base/sepdebug.exp -+++ b/gdb/testsuite/gdb.base/sepdebug.exp -@@ -952,6 +952,23 @@ set debugfile "${objdir}/${subdir}/${testfile}.debug" - test_different_dir debuglink "${objdir}/${subdir}" 0 - - -+# Test CRC mismatch is reported. -+ -+if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1 -+ && ![gdb_gnu_strip_debug ${objdir}/${subdir}/sepdebug2]} { -+ -+ remote_exec build "cp ${debugfile} ${objdir}/${subdir}/.debug/sepdebug2.debug" -+ -+ gdb_exit -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ -+ set escapedobjdirsubdir [string_to_regexp ${objdir}/${subdir}] -+ -+ gdb_test "file ${objdir}/${subdir}/sepdebug2" "warning: the debug information found in \"${escapedobjdirsubdir}/\\.debug/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported" -+} -+ -+ - # NT_GNU_BUILD_ID / .note.gnu.build-id test: - - set build_id_debug_filename [build_id_debug_filename_get $binfile] ---- /dev/null -+++ b/gdb/testsuite/gdb.base/sepdebug2.c -@@ -0,0 +1,22 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2009 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+int -+main (void) -+{ -+ return 0; -+} - diff --git a/gdb-bz538626-bp_location-accel-bp-cond.patch b/gdb-bz538626-bp_location-accel-bp-cond.patch deleted file mode 100644 index e53bf3c..0000000 --- a/gdb-bz538626-bp_location-accel-bp-cond.patch +++ /dev/null @@ -1,317 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2009-12/msg00180.html -Subject: [patch] Fix a regression by me on breakpoint-cond-infcall - -Hi, - -GDB has now a regression since: - Re: [patch] Performance optimize large bp_location count - http://sourceware.org/ml/gdb-patches/2009-10/msg00632.html - = - 2009-10-25 Jan Kratochvil - Performance optimize large bp_location count. - -on breakpoints with conditions calling inferior. - -Bringing the code back to the state before my acceleration patch. - -The code before already assumed no breakpoints or their bp_locations can -change across the inferior call which should be true - trying to do some: - break a if b() - break b - command 1 - delete 2 - end -or similar cannot work as inside "if b()" evaluation no breakpoints can be -added or removed. - -update_global_location_list also does not removed/add `struct bp_location's -themselves but only pointers to them in the bp_location array. As the new -iteration no longer uses the bp_location array it is no longer a problem. - -Original problem was found by and fixed differently by Phil Muldoon. - -No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. - - -Thanks, -Jan - - -gdb/ -2009-12-13 Jan Kratochvil - - * breakpoint.c (bpstat_stop_status): Iterate using ALL_BREAKPOINTS and - the B->LOC list. Remove gdb_assert on B. Change bp_hardware_watchpoint - continue to break. Remove variable update_locations. Remove HIT_COUNT - increment protection by an ENABLE_STATE check. Inline the delayed - update_global_location_list call. - -gdb/testsuite/ -2009-12-13 Jan Kratochvil - Phil Muldoon - - * gdb.base/condbreak.exp: Put breakpoint on marker3 and marker4. - (bp_location13, bp_location14, bp_location17, bp_location18) - (marker3_proto, marker4_proto): New variables. - (breakpoint info): Update output. - (run until breakpoint at marker3, run until breakpoint at marker4): New - tests. - -[ Backported for F-12. ] - ---- ./gdb/breakpoint.c 2009-12-14 00:25:55.000000000 +0100 -+++ ./gdb/breakpoint.c 2009-12-14 00:32:32.000000000 +0100 -@@ -3298,93 +3298,93 @@ bpstat_stop_status (CORE_ADDR bp_addr, p - /* Pointer to the last thing in the chain currently. */ - bpstat bs = root_bs; - int ix; -- int need_remove_insert, update_locations = 0; -+ int need_remove_insert; - -- ALL_BP_LOCATIONS (bl, blp_tmp) -- { -- bpstat bs_prev = bs; -+ /* ALL_BP_LOCATIONS iteration would break across -+ update_global_location_list possibly executed by -+ bpstat_check_breakpoint_conditions's inferior call. */ - -- b = bl->owner; -- gdb_assert (b); -- if (!breakpoint_enabled (b) && b->enable_state != bp_permanent) -- continue; -- -- /* For hardware watchpoints, we look only at the first location. -- The watchpoint_check function will work on entire expression, -- not the individual locations. For read watchopints, the -- watchpoints_triggered function have checked all locations -- alrea -- */ -- if (b->type == bp_hardware_watchpoint && bl != b->loc) -- continue; -- -- if (!bpstat_check_location (bl, bp_addr)) -- continue; -- -- /* Come here if it's a watchpoint, or if the break address matches */ -- -- bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */ -- gdb_assert (bs_prev->next == bs); -- -- /* Assume we stop. Should we find watchpoint that is not actually -- triggered, or if condition of breakpoint is false, we'll reset -- 'stop' to 0. */ -- bs->stop = 1; -- bs->print = 1; -+ ALL_BREAKPOINTS (b) -+ { -+ if (!breakpoint_enabled (b) && b->enable_state != bp_permanent) -+ continue; - -- if (!bpstat_check_watchpoint (bs)) -- { -- /* Ensure bpstat_explains_signal stays false if this BL could not be -- the cause of this trap. */ -+ for (bl = b->loc; bl != NULL; bl = bl->next) -+ { -+ bpstat bs_prev = bs; -+ -+ /* For hardware watchpoints, we look only at the first location. -+ The watchpoint_check function will work on entire expression, -+ not the individual locations. For read watchopints, the -+ watchpoints_triggered function have checked all locations -+ alrea -+ */ -+ if (b->type == bp_hardware_watchpoint && bl != b->loc) -+ break; - -- gdb_assert (bs->print_it == print_it_noop); -- gdb_assert (!bs->stop); -- xfree (bs); -- bs = bs_prev; -- bs->next = NULL; -- continue; -- } -+ if (!bpstat_check_location (bl, bp_addr)) -+ continue; - -- if (b->type == bp_thread_event || b->type == bp_overlay_event -- || b->type == bp_longjmp_master || b->type == bp_exception_master) -- /* We do not stop for these. */ -- bs->stop = 0; -- else -- bpstat_check_breakpoint_conditions (bs, ptid); -- -- if (bs->stop) -- { -- if (b->enable_state != bp_disabled) -- ++(b->hit_count); -+ /* Come here if it's a watchpoint, or if the break address matches */ - -- /* We will stop here */ -- if (b->disposition == disp_disable) -- { -- if (b->enable_state != bp_permanent) -- b->enable_state = bp_disabled; -- update_locations = 1; -- } -- if (b->silent) -- bs->print = 0; -- bs->commands = b->commands; -- if (bs->commands -- && (strcmp ("silent", bs->commands->line) == 0 -- || (xdb_commands && strcmp ("Q", bs->commands->line) == 0))) -- { -- bs->commands = bs->commands->next; -- bs->print = 0; -- } -- bs->commands = copy_command_lines (bs->commands); -- } -+ bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */ -+ gdb_assert (bs_prev->next == bs); - -- /* Print nothing for this entry if we dont stop or if we dont print. */ -- if (bs->stop == 0 || bs->print == 0) -- bs->print_it = print_it_noop; -- } -+ /* Assume we stop. Should we find watchpoint that is not actually -+ triggered, or if condition of breakpoint is false, we'll reset -+ 'stop' to 0. */ -+ bs->stop = 1; -+ bs->print = 1; - -- /* Delay this call which would break the ALL_BP_LOCATIONS iteration above. */ -- if (update_locations) -- update_global_location_list (0); -+ if (!bpstat_check_watchpoint (bs)) -+ { -+ /* Ensure bpstat_explains_signal stays false if this BL could not be -+ the cause of this trap. */ -+ -+ gdb_assert (bs->print_it == print_it_noop); -+ gdb_assert (!bs->stop); -+ xfree (bs); -+ bs = bs_prev; -+ bs->next = NULL; -+ continue; -+ } -+ -+ if (b->type == bp_thread_event || b->type == bp_overlay_event -+ || b->type == bp_longjmp_master || b->type == bp_exception_master) -+ /* We do not stop for these. */ -+ bs->stop = 0; -+ else -+ bpstat_check_breakpoint_conditions (bs, ptid); -+ -+ if (bs->stop) -+ { -+ ++(b->hit_count); -+ -+ /* We will stop here */ -+ if (b->disposition == disp_disable) -+ { -+ if (b->enable_state != bp_permanent) -+ b->enable_state = bp_disabled; -+ update_global_location_list (0); -+ } -+ if (b->silent) -+ bs->print = 0; -+ bs->commands = b->commands; -+ if (bs->commands -+ && (strcmp ("silent", bs->commands->line) == 0 -+ || (xdb_commands && strcmp ("Q", bs->commands->line) == 0))) -+ { -+ bs->commands = bs->commands->next; -+ bs->print = 0; -+ } -+ bs->commands = copy_command_lines (bs->commands); -+ } -+ -+ /* Print nothing for this entry if we dont stop or if we dont print. */ -+ if (bs->stop == 0 || bs->print == 0) -+ bs->print_it = print_it_noop; -+ } -+ } - - for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix) - { ---- ./gdb/testsuite/gdb.base/condbreak.exp 2009-01-03 06:58:03.000000000 +0100 -+++ ./gdb/testsuite/gdb.base/condbreak.exp 2009-12-14 00:27:21.000000000 +0100 -@@ -68,8 +68,12 @@ set bp_location1 [gdb_get_line_number " - set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] - set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] - set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] -+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] -+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] - set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1] - set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1] -+set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1] -+set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1] - - # - # test break at function -@@ -110,15 +114,29 @@ gdb_test "break marker2 if (a==43)" \ - "Breakpoint.*at.* file .*$srcfile1, line.*" - - # -+# Check break involving inferior function call. -+# Ensure there is at least one additional breakpoint with higher VMA. -+# -+gdb_test "break marker3 if (multi_line_if_conditional(1,1,1)==0)" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" -+gdb_test "break marker4" \ -+ "Breakpoint.*at.* file .*$srcfile1, line.*" -+ -+# - # check to see what breakpoints are set - # - - if {$hp_aCC_compiler} { - set marker1_proto "\\(void\\)" - set marker2_proto "\\(int\\)" -+ # Not checked. -+ set marker3_proto "\\(char \\*, char \\*\\)" -+ set marker4_proto "\\(long\\)" - } else { - set marker1_proto "" - set marker2_proto "" -+ set marker3_proto "" -+ set marker4_proto "" - } - - gdb_test "info break" \ -@@ -129,7 +147,10 @@ gdb_test "info break" \ - \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* - \[\t \]+stop only if \\(1==1\\).* - \[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).* --\[\t \]+stop only if \\(a==43\\).*" \ -+\[\t \]+stop only if \\(a==43\\).* -+\[0-9\]+\[\t \]+breakpoint keep y.* in marker3$marker3_proto at .*$srcfile1:($bp_location17|$bp_location18).* -+\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).* -+\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*" \ - "breakpoint info" - - -@@ -220,3 +241,23 @@ gdb_expect { - fail "(timeout) run until breakpoint at marker2" - } - } -+ -+set test "run until breakpoint at marker3" -+gdb_test_multiple "continue" $test { -+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" { -+ pass $test -+ } -+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" { -+ xfail $test -+ } -+} -+ -+set test "run until breakpoint at marker4" -+gdb_test_multiple "continue" $test { -+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" { -+ pass $test -+ } -+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" { -+ xfail $test -+ } -+} diff --git a/gdb-bz539590-gnu-ifunc.patch b/gdb-bz539590-gnu-ifunc.patch index 2f1b80b..fb4f56d 100644 --- a/gdb-bz539590-gnu-ifunc.patch +++ b/gdb-bz539590-gnu-ifunc.patch @@ -32,11 +32,11 @@ gdb/testsuite/ * gdb.base/gnu-ifunc-lib.c, gdb.base/gnu-ifunc.c, gdb.base/gnu-ifunc.exp: New. -Index: gdb-7.0/gdb/elfread.c +Index: gdb-7.0.50.20100115/gdb/elfread.c =================================================================== ---- gdb-7.0.orig/gdb/elfread.c 2009-11-25 10:24:45.000000000 +0100 -+++ gdb-7.0/gdb/elfread.c 2009-11-25 10:25:50.000000000 +0100 -@@ -168,7 +168,8 @@ record_minimal_symbol (char *name, CORE_ +--- gdb-7.0.50.20100115.orig/gdb/elfread.c 2010-01-15 11:45:34.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/elfread.c 2010-01-15 12:17:16.000000000 +0100 +@@ -184,7 +184,8 @@ record_minimal_symbol (const char *name, { struct gdbarch *gdbarch = get_objfile_arch (objfile); @@ -45,8 +45,8 @@ Index: gdb-7.0/gdb/elfread.c + || ms_type == mst_text_gnu_ifunc) address = gdbarch_smash_text_address (gdbarch, address); - return prim_record_minimal_symbol_and_info -@@ -373,7 +374,10 @@ elf_symtab_read (struct objfile *objfile + return prim_record_minimal_symbol_full (name, name_len, copy_name, address, +@@ -393,7 +394,10 @@ elf_symtab_read (struct objfile *objfile { if (sym->flags & (BSF_GLOBAL | BSF_WEAK)) { @@ -58,11 +58,11 @@ Index: gdb-7.0/gdb/elfread.c } else if ((sym->name[0] == '.' && sym->name[1] == 'L') || ((sym->flags & BSF_LOCAL) -Index: gdb-7.0/gdb/gdbtypes.c +Index: gdb-7.0.50.20100115/gdb/gdbtypes.c =================================================================== ---- gdb-7.0.orig/gdb/gdbtypes.c 2009-11-25 10:24:47.000000000 +0100 -+++ gdb-7.0/gdb/gdbtypes.c 2009-11-25 10:24:56.000000000 +0100 -@@ -1904,6 +1904,8 @@ init_type (enum type_code code, int leng +--- gdb-7.0.50.20100115.orig/gdb/gdbtypes.c 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/gdbtypes.c 2010-01-15 12:16:49.000000000 +0100 +@@ -1946,6 +1946,8 @@ init_type (enum type_code code, int leng TYPE_NOTTEXT (type) = 1; if (flags & TYPE_FLAG_FIXED_INSTANCE) TYPE_FIXED_INSTANCE (type) = 1; @@ -71,7 +71,7 @@ Index: gdb-7.0/gdb/gdbtypes.c if (name) TYPE_NAME (type) = obsavestring (name, strlen (name), -@@ -3762,6 +3764,8 @@ gdbtypes_post_init (struct gdbarch *gdba +@@ -3846,6 +3848,8 @@ gdbtypes_post_init (struct gdbarch *gdba = lookup_pointer_type (builtin_type->builtin_void); builtin_type->builtin_func_ptr = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void)); @@ -80,7 +80,7 @@ Index: gdb-7.0/gdb/gdbtypes.c /* This type represents a GDB internal function. */ builtin_type->internal_fn -@@ -3878,6 +3882,11 @@ objfile_type (struct objfile *objfile) +@@ -3962,6 +3966,11 @@ objfile_type (struct objfile *objfile) "", objfile); TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol) = objfile_type->builtin_int; @@ -92,11 +92,11 @@ Index: gdb-7.0/gdb/gdbtypes.c objfile_type->nodebug_data_symbol = init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0, -Index: gdb-7.0/gdb/gdbtypes.h +Index: gdb-7.0.50.20100115/gdb/gdbtypes.h =================================================================== ---- gdb-7.0.orig/gdb/gdbtypes.h 2009-11-25 10:24:48.000000000 +0100 -+++ gdb-7.0/gdb/gdbtypes.h 2009-11-25 10:25:17.000000000 +0100 -@@ -187,6 +187,7 @@ enum type_flag_value +--- gdb-7.0.50.20100115.orig/gdb/gdbtypes.h 2010-01-15 11:49:26.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/gdbtypes.h 2010-01-15 12:16:49.000000000 +0100 +@@ -188,6 +188,7 @@ enum type_flag_value TYPE_FLAG_FIXED_INSTANCE = (1 << 15), TYPE_FLAG_STUB_SUPPORTED = (1 << 16), TYPE_FLAG_NOTTEXT = (1 << 17), @@ -104,7 +104,7 @@ Index: gdb-7.0/gdb/gdbtypes.h /* Used for error-checking. */ TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED -@@ -292,6 +293,12 @@ enum type_instance_flag_value +@@ -293,6 +294,12 @@ enum type_instance_flag_value #define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext) @@ -117,7 +117,7 @@ Index: gdb-7.0/gdb/gdbtypes.h /* Type owner. If TYPE_OBJFILE_OWNED is true, the type is owned by the objfile retrieved as TYPE_OBJFILE. Otherweise, the type is owned by an architecture; TYPE_OBJFILE is NULL in this case. */ -@@ -427,6 +434,7 @@ struct main_type +@@ -447,6 +454,7 @@ struct main_type unsigned int flag_vector : 1; unsigned int flag_stub_supported : 1; unsigned int flag_nottext : 1; @@ -125,7 +125,7 @@ Index: gdb-7.0/gdb/gdbtypes.h unsigned int flag_fixed_instance : 1; unsigned int flag_objfile_owned : 1; unsigned int flag_discardable : 1; -@@ -1144,6 +1152,10 @@ struct builtin_type +@@ -1250,6 +1258,10 @@ struct builtin_type (*) () can server as a generic function pointer. */ struct type *builtin_func_ptr; @@ -136,7 +136,7 @@ Index: gdb-7.0/gdb/gdbtypes.h /* Special-purpose types. */ -@@ -1186,6 +1198,7 @@ struct objfile_type +@@ -1292,6 +1304,7 @@ struct objfile_type /* Types used for symbols with no debug information. */ struct type *nodebug_text_symbol; @@ -144,10 +144,10 @@ Index: gdb-7.0/gdb/gdbtypes.h struct type *nodebug_data_symbol; struct type *nodebug_unknown_symbol; struct type *nodebug_tls_symbol; -Index: gdb-7.0/gdb/infcall.c +Index: gdb-7.0.50.20100115/gdb/infcall.c =================================================================== ---- gdb-7.0.orig/gdb/infcall.c 2009-11-25 10:24:45.000000000 +0100 -+++ gdb-7.0/gdb/infcall.c 2009-11-25 10:24:56.000000000 +0100 +--- gdb-7.0.50.20100115.orig/gdb/infcall.c 2010-01-01 08:31:36.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/infcall.c 2010-01-15 12:16:49.000000000 +0100 @@ -286,6 +286,27 @@ find_function_addr (struct value *functi else error (_("Invalid data type for function to be called.")); @@ -176,10 +176,10 @@ Index: gdb-7.0/gdb/infcall.c if (retval_type != NULL) *retval_type = value_type; return funaddr + gdbarch_deprecated_function_start_offset (gdbarch); -Index: gdb-7.0/gdb/linespec.c +Index: gdb-7.0.50.20100115/gdb/linespec.c =================================================================== ---- gdb-7.0.orig/gdb/linespec.c 2009-11-25 10:24:45.000000000 +0100 -+++ gdb-7.0/gdb/linespec.c 2009-11-25 10:24:56.000000000 +0100 +--- gdb-7.0.50.20100115.orig/gdb/linespec.c 2010-01-12 06:48:56.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linespec.c 2010-01-15 12:16:49.000000000 +0100 @@ -40,6 +40,7 @@ #include "interps.h" #include "mi/mi-cmds.h" @@ -188,7 +188,7 @@ Index: gdb-7.0/gdb/linespec.c /* We share this one with symtab.c, but it is not exported widely. */ -@@ -1875,6 +1876,22 @@ minsym_found (int funfirstline, struct m +@@ -1867,6 +1868,22 @@ minsym_found (int funfirstline, struct m pc = gdbarch_convert_from_func_ptr_addr (gdbarch, values.sals[0].pc, ¤t_target); @@ -211,10 +211,10 @@ Index: gdb-7.0/gdb/linespec.c if (pc != values.sals[0].pc) values.sals[0] = find_pc_sect_line (pc, NULL, 0); -Index: gdb-7.0/gdb/minsyms.c +Index: gdb-7.0.50.20100115/gdb/minsyms.c =================================================================== ---- gdb-7.0.orig/gdb/minsyms.c 2009-11-25 10:24:47.000000000 +0100 -+++ gdb-7.0/gdb/minsyms.c 2009-11-25 10:24:56.000000000 +0100 +--- gdb-7.0.50.20100115.orig/gdb/minsyms.c 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/minsyms.c 2010-01-15 12:16:49.000000000 +0100 @@ -331,8 +331,9 @@ lookup_minimal_symbol_text (const char * msymbol = msymbol->hash_next) { @@ -227,7 +227,7 @@ Index: gdb-7.0/gdb/minsyms.c { switch (MSYMBOL_TYPE (msymbol)) { -@@ -699,6 +700,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR p +@@ -698,6 +699,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR p { return lookup_minimal_symbol_by_pc_section (pc, NULL); } @@ -244,7 +244,7 @@ Index: gdb-7.0/gdb/minsyms.c /* Return leading symbol character for a BFD. If BFD is NULL, -@@ -738,6 +749,7 @@ prim_record_minimal_symbol (const char * +@@ -737,6 +748,7 @@ prim_record_minimal_symbol (const char * switch (ms_type) { case mst_text: @@ -252,7 +252,7 @@ Index: gdb-7.0/gdb/minsyms.c case mst_file_text: case mst_solib_trampoline: section = SECT_OFF_TEXT (objfile); -@@ -1184,7 +1196,8 @@ find_solib_trampoline_target (struct fra +@@ -1202,7 +1214,8 @@ find_solib_trampoline_target (struct fra { ALL_MSYMBOLS (objfile, msymbol) { @@ -262,11 +262,11 @@ Index: gdb-7.0/gdb/minsyms.c && strcmp (SYMBOL_LINKAGE_NAME (msymbol), SYMBOL_LINKAGE_NAME (tsymbol)) == 0) return SYMBOL_VALUE_ADDRESS (msymbol); -Index: gdb-7.0/gdb/parse.c +Index: gdb-7.0.50.20100115/gdb/parse.c =================================================================== ---- gdb-7.0.orig/gdb/parse.c 2009-11-25 10:24:47.000000000 +0100 -+++ gdb-7.0/gdb/parse.c 2009-11-25 10:26:16.000000000 +0100 -@@ -517,6 +517,11 @@ write_exp_msymbol (struct minimal_symbol +--- gdb-7.0.50.20100115.orig/gdb/parse.c 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/parse.c 2010-01-15 12:16:49.000000000 +0100 +@@ -516,6 +516,11 @@ write_exp_msymbol (struct minimal_symbol write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol); break; @@ -278,25 +278,25 @@ Index: gdb-7.0/gdb/parse.c case mst_data: case mst_file_data: case mst_bss: -Index: gdb-7.0/gdb/solib-svr4.c +Index: gdb-7.0.50.20100115/gdb/solib-svr4.c =================================================================== ---- gdb-7.0.orig/gdb/solib-svr4.c 2009-11-25 10:24:49.000000000 +0100 -+++ gdb-7.0/gdb/solib-svr4.c 2009-11-25 10:26:41.000000000 +0100 -@@ -1242,7 +1242,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR p - { - return ((pc >= interp_text_sect_low && pc < interp_text_sect_high) - || (pc >= interp_plt_sect_low && pc < interp_plt_sect_high) +--- gdb-7.0.50.20100115.orig/gdb/solib-svr4.c 2010-01-15 12:16:41.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/solib-svr4.c 2010-01-15 12:17:40.000000000 +0100 +@@ -1257,7 +1257,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR p + && pc < info->interp_text_sect_high) + || (pc >= info->interp_plt_sect_low + && pc < info->interp_plt_sect_high) - || in_plt_section (pc, NULL)); + || in_plt_section (pc, NULL) + || in_gnu_ifunc_stub (pc)); } /* Given an executable's ABFD and target, compute the entry-point -Index: gdb-7.0/gdb/symmisc.c +Index: gdb-7.0.50.20100115/gdb/symmisc.c =================================================================== ---- gdb-7.0.orig/gdb/symmisc.c 2009-11-25 10:24:47.000000000 +0100 -+++ gdb-7.0/gdb/symmisc.c 2009-11-25 10:24:56.000000000 +0100 -@@ -287,6 +287,9 @@ dump_msymbols (struct objfile *objfile, +--- gdb-7.0.50.20100115.orig/gdb/symmisc.c 2010-01-15 03:22:32.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symmisc.c 2010-01-15 12:16:49.000000000 +0100 +@@ -294,6 +294,9 @@ dump_msymbols (struct objfile *objfile, case mst_text: ms_type = 'T'; break; @@ -306,11 +306,11 @@ Index: gdb-7.0/gdb/symmisc.c case mst_solib_trampoline: ms_type = 'S'; break; -Index: gdb-7.0/gdb/symtab.c +Index: gdb-7.0.50.20100115/gdb/symtab.c =================================================================== ---- gdb-7.0.orig/gdb/symtab.c 2009-11-25 10:24:47.000000000 +0100 -+++ gdb-7.0/gdb/symtab.c 2009-11-25 10:24:56.000000000 +0100 -@@ -3155,7 +3155,7 @@ search_symbols (char *regexp, domain_enu +--- gdb-7.0.50.20100115.orig/gdb/symtab.c 2010-01-15 03:22:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symtab.c 2010-01-15 12:16:49.000000000 +0100 +@@ -3257,7 +3257,7 @@ search_symbols (char *regexp, domain_enu {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown}; static enum minimal_symbol_type types4[] = @@ -319,11 +319,11 @@ Index: gdb-7.0/gdb/symtab.c enum minimal_symbol_type ourtype; enum minimal_symbol_type ourtype2; enum minimal_symbol_type ourtype3; -Index: gdb-7.0/gdb/symtab.h +Index: gdb-7.0.50.20100115/gdb/symtab.h =================================================================== ---- gdb-7.0.orig/gdb/symtab.h 2009-11-25 10:24:45.000000000 +0100 -+++ gdb-7.0/gdb/symtab.h 2009-11-25 10:24:56.000000000 +0100 -@@ -275,6 +275,8 @@ enum minimal_symbol_type +--- gdb-7.0.50.20100115.orig/gdb/symtab.h 2010-01-15 03:22:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symtab.h 2010-01-15 12:16:49.000000000 +0100 +@@ -280,6 +280,8 @@ enum minimal_symbol_type { mst_unknown = 0, /* Unknown type, the default */ mst_text, /* Generally executable instructions */ @@ -332,7 +332,7 @@ Index: gdb-7.0/gdb/symtab.h mst_data, /* Generally initialized data */ mst_bss, /* Generally uninitialized data */ mst_abs, /* Generally absolute (nonrelocatable) */ -@@ -1149,6 +1151,8 @@ extern struct minimal_symbol *lookup_min +@@ -1163,6 +1165,8 @@ extern struct minimal_symbol *lookup_min extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR); @@ -341,10 +341,10 @@ Index: gdb-7.0/gdb/symtab.h extern struct minimal_symbol *lookup_minimal_symbol_by_pc_section (CORE_ADDR, struct obj_section *); -Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc-lib.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gnu-ifunc-lib.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc-lib.c 2009-11-25 10:24:56.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gnu-ifunc-lib.c 2010-01-15 12:16:49.000000000 +0100 @@ -0,0 +1,45 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -391,10 +391,10 @@ Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc-lib.c + + return final; +} -Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.c +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gnu-ifunc.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.c 2009-11-25 10:24:56.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gnu-ifunc.c 2010-01-15 12:16:49.000000000 +0100 @@ -0,0 +1,36 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -432,10 +432,10 @@ Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.c + + return 0; /* break-at-exit */ +} -Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.exp +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gnu-ifunc.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.exp 2009-11-25 10:24:56.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/gnu-ifunc.exp 2010-01-15 12:16:49.000000000 +0100 @@ -0,0 +1,72 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + diff --git a/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch new file mode 100644 index 0000000..86147bf --- /dev/null +++ b/gdb-ccache-workaround.patch @@ -0,0 +1,17 @@ +--- a/gdb/testsuite/gdb.base/macscp.exp ++++ b/gdb/testsuite/gdb.base/macscp.exp +@@ -33,6 +33,14 @@ if [test_compiler_info gcc*] { + lappend options additional_flags=-g3 + } + ++# Workaround ccache making lineno non-zero for command-line definitions. ++if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} { ++ set result [catch "exec which gcc" output] ++ if {$result == 0 && [string first "/ccache/" $output] >= -1} { ++ lappend options "compiler=/usr/bin/gcc" ++ } ++} ++ + # Generate the intermediate object file. This is required by Darwin to + # have access to the .debug_macinfo section. + if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \ diff --git a/gdb-empty-namespace.patch b/gdb-empty-namespace.patch index a8baf05..1aa7654 100644 --- a/gdb-empty-namespace.patch +++ b/gdb-empty-namespace.patch @@ -1,10 +1,10 @@ -gdb/ -2009-12-20 Jan Kratochvil - - Fix compatibility with G++-4.1. - * dwarf2read.c (partial_die_parent_scope): New variable PARENT_NAME. - Ignore parent namespaces with name "::". - (physname_prefix_1): Ignore namespaces with name "::". +###gdb/ +###2009-12-20 Jan Kratochvil +### +### Fix compatibility with G++-4.1. +### * dwarf2read.c (partial_die_parent_scope): New variable PARENT_NAME. +### Ignore parent namespaces with name "::". +### (physname_prefix_1): Ignore namespaces with name "::". gdb/testsuite/ 2009-12-20 Jan Kratochvil @@ -12,39 +12,39 @@ gdb/testsuite/ * gdb.dwarf2/dw2-empty-namespace.exp, gdb.dwarf2/dw2-empty-namespace.S: New. ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -2355,11 +2355,18 @@ partial_die_parent_scope (struct partial_die_info *pdi, - || parent->tag == DW_TAG_interface_type - || parent->tag == DW_TAG_union_type) - { -+ char *parent_name = parent->name; -+ -+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */ -+ if (parent->tag == DW_TAG_namespace && parent_name != NULL -+ && strcmp (parent_name, "::") == 0) -+ parent_name = NULL; -+ - if (grandparent_scope == NULL) -- parent->scope = parent->name; -+ parent->scope = parent_name; - else - parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope, -- parent->name, cu); -+ parent_name, cu); - } - else if (parent->tag == DW_TAG_enumeration_type) - /* Enumerators should not get the name of the enumeration as a prefix. */ -@@ -9008,6 +9015,9 @@ physname_prefix_1 (struct ui_file *buf, struct die_info *die, - name = dwarf2_name (die, cu); - if (name == NULL) - name = "(anonymous namespace)"; -+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */ -+ else if (strcmp (name, "::") == 0) -+ name = NULL; - break; - - case DW_TAG_class_type: +###--- a/gdb/dwarf2read.c +###+++ b/gdb/dwarf2read.c +###@@ -2355,11 +2355,18 @@ partial_die_parent_scope (struct partial_die_info *pdi, +### || parent->tag == DW_TAG_interface_type +### || parent->tag == DW_TAG_union_type) +### { +###+ char *parent_name = parent->name; +###+ +###+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */ +###+ if (parent->tag == DW_TAG_namespace && parent_name != NULL +###+ && strcmp (parent_name, "::") == 0) +###+ parent_name = NULL; +###+ +### if (grandparent_scope == NULL) +###- parent->scope = parent->name; +###+ parent->scope = parent_name; +### else +### parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope, +###- parent->name, cu); +###+ parent_name, cu); +### } +### else if (parent->tag == DW_TAG_enumeration_type) +### /* Enumerators should not get the name of the enumeration as a prefix. */ +###@@ -9008,6 +9015,9 @@ physname_prefix_1 (struct ui_file *buf, struct die_info *die, +### name = dwarf2_name (die, cu); +### if (name == NULL) +### name = "(anonymous namespace)"; +###+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */ +###+ else if (strcmp (name, "::") == 0) +###+ name = NULL; +### break; +### +### case DW_TAG_class_type: --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S @@ -0,0 +1,108 @@ diff --git a/gdb-fortran-common-reduce.patch b/gdb-fortran-common-reduce.patch new file mode 100644 index 0000000..1e13183 --- /dev/null +++ b/gdb-fortran-common-reduce.patch @@ -0,0 +1,501 @@ +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -55,20 +55,6 @@ typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR; + /* Local functions */ + + extern void _initialize_f_language (void); +-#if 0 +-static void clear_function_list (void); +-static long get_bf_for_fcn (long); +-static void clear_bf_list (void); +-static void patch_all_commons_by_name (char *, CORE_ADDR, int); +-static SAVED_F77_COMMON_PTR find_first_common_named (char *); +-static void add_common_entry (struct symbol *); +-static void add_common_block (char *, CORE_ADDR, int, char *); +-static SAVED_FUNCTION *allocate_saved_function_node (void); +-static SAVED_BF_PTR allocate_saved_bf_node (void); +-static COMMON_ENTRY_PTR allocate_common_entry_node (void); +-static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node (void); +-static void patch_common_entries (SAVED_F77_COMMON_PTR, CORE_ADDR, int); +-#endif + + static void f_printchar (int c, struct type *type, struct ui_file * stream); + static void f_emit_char (int c, struct type *type, +@@ -419,185 +405,7 @@ _initialize_f_language (void) + add_language (&f_language_defn); + } + +-#if 0 +-static SAVED_BF_PTR +-allocate_saved_bf_node (void) +-{ +- SAVED_BF_PTR new; +- +- new = (SAVED_BF_PTR) xmalloc (sizeof (SAVED_BF)); +- return (new); +-} +- +-static SAVED_FUNCTION * +-allocate_saved_function_node (void) +-{ +- SAVED_FUNCTION *new; +- +- new = (SAVED_FUNCTION *) xmalloc (sizeof (SAVED_FUNCTION)); +- return (new); +-} +- +-static SAVED_F77_COMMON_PTR +-allocate_saved_f77_common_node (void) +-{ +- SAVED_F77_COMMON_PTR new; +- +- new = (SAVED_F77_COMMON_PTR) xmalloc (sizeof (SAVED_F77_COMMON)); +- return (new); +-} +- +-static COMMON_ENTRY_PTR +-allocate_common_entry_node (void) +-{ +- COMMON_ENTRY_PTR new; +- +- new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY)); +- return (new); +-} +-#endif +- + SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */ +-SAVED_F77_COMMON_PTR tail_common_list = NULL; /* Ptr to last saved COMMON */ +-SAVED_F77_COMMON_PTR current_common = NULL; /* Ptr to current COMMON */ +- +-#if 0 +-static SAVED_BF_PTR saved_bf_list = NULL; /* Ptr to (.bf,function) +- list */ +-static SAVED_BF_PTR saved_bf_list_end = NULL; /* Ptr to above list's end */ +-static SAVED_BF_PTR current_head_bf_list = NULL; /* Current head of above list +- */ +- +-static SAVED_BF_PTR tmp_bf_ptr; /* Generic temporary for use +- in macros */ +- +-/* The following function simply enters a given common block onto +- the global common block chain */ +- +-static void +-add_common_block (char *name, CORE_ADDR offset, int secnum, char *func_stab) +-{ +- SAVED_F77_COMMON_PTR tmp; +- char *c, *local_copy_func_stab; +- +- /* If the COMMON block we are trying to add has a blank +- name (i.e. "#BLNK_COM") then we set it to __BLANK +- because the darn "#" character makes GDB's input +- parser have fits. */ +- +- +- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0 +- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0) +- { +- +- xfree (name); +- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1); +- strcpy (name, BLANK_COMMON_NAME_LOCAL); +- } +- +- tmp = allocate_saved_f77_common_node (); +- +- local_copy_func_stab = xmalloc (strlen (func_stab) + 1); +- strcpy (local_copy_func_stab, func_stab); +- +- tmp->name = xmalloc (strlen (name) + 1); +- +- /* local_copy_func_stab is a stabstring, let us first extract the +- function name from the stab by NULLing out the ':' character. */ +- +- +- c = NULL; +- c = strchr (local_copy_func_stab, ':'); +- +- if (c) +- *c = '\0'; +- else +- error (_("Malformed function STAB found in add_common_block()")); +- +- +- tmp->owning_function = xmalloc (strlen (local_copy_func_stab) + 1); +- +- strcpy (tmp->owning_function, local_copy_func_stab); +- +- strcpy (tmp->name, name); +- tmp->offset = offset; +- tmp->next = NULL; +- tmp->entries = NULL; +- tmp->secnum = secnum; +- +- current_common = tmp; +- +- if (head_common_list == NULL) +- { +- head_common_list = tail_common_list = tmp; +- } +- else +- { +- tail_common_list->next = tmp; +- tail_common_list = tmp; +- } +-} +-#endif +- +-/* The following function simply enters a given common entry onto +- the "current_common" block that has been saved away. */ +- +-#if 0 +-static void +-add_common_entry (struct symbol *entry_sym_ptr) +-{ +- COMMON_ENTRY_PTR tmp; +- +- +- +- /* The order of this list is important, since +- we expect the entries to appear in decl. +- order when we later issue "info common" calls */ +- +- tmp = allocate_common_entry_node (); +- +- tmp->next = NULL; +- tmp->symbol = entry_sym_ptr; +- +- if (current_common == NULL) +- error (_("Attempt to add COMMON entry with no block open!")); +- else +- { +- if (current_common->entries == NULL) +- { +- current_common->entries = tmp; +- current_common->end_of_entries = tmp; +- } +- else +- { +- current_common->end_of_entries->next = tmp; +- current_common->end_of_entries = tmp; +- } +- } +-} +-#endif +- +-/* This routine finds the first encountred COMMON block named "name" */ +- +-#if 0 +-static SAVED_F77_COMMON_PTR +-find_first_common_named (char *name) +-{ +- +- SAVED_F77_COMMON_PTR tmp; +- +- tmp = head_common_list; +- +- while (tmp != NULL) +- { +- if (strcmp (tmp->name, name) == 0) +- return (tmp); +- else +- tmp = tmp->next; +- } +- return (NULL); +-} +-#endif + + /* This routine finds the first encountred COMMON block named "name" + that belongs to function funcname */ +@@ -620,193 +428,3 @@ find_common_for_function (char *name, char *funcname) + } + return (NULL); + } +- +- +-#if 0 +- +-/* The following function is called to patch up the offsets +- for the statics contained in the COMMON block named +- "name." */ +- +-static void +-patch_common_entries (SAVED_F77_COMMON_PTR blk, CORE_ADDR offset, int secnum) +-{ +- COMMON_ENTRY_PTR entry; +- +- blk->offset = offset; /* Keep this around for future use. */ +- +- entry = blk->entries; +- +- while (entry != NULL) +- { +- SYMBOL_VALUE (entry->symbol) += offset; +- SYMBOL_SECTION (entry->symbol) = secnum; +- +- entry = entry->next; +- } +- blk->secnum = secnum; +-} +- +-/* Patch all commons named "name" that need patching.Since COMMON +- blocks occur with relative infrequency, we simply do a linear scan on +- the name. Eventually, the best way to do this will be a +- hashed-lookup. Secnum is the section number for the .bss section +- (which is where common data lives). */ +- +-static void +-patch_all_commons_by_name (char *name, CORE_ADDR offset, int secnum) +-{ +- +- SAVED_F77_COMMON_PTR tmp; +- +- /* For blank common blocks, change the canonical reprsentation +- of a blank name */ +- +- if (strcmp (name, BLANK_COMMON_NAME_ORIGINAL) == 0 +- || strcmp (name, BLANK_COMMON_NAME_MF77) == 0) +- { +- xfree (name); +- name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1); +- strcpy (name, BLANK_COMMON_NAME_LOCAL); +- } +- +- tmp = head_common_list; +- +- while (tmp != NULL) +- { +- if (COMMON_NEEDS_PATCHING (tmp)) +- if (strcmp (tmp->name, name) == 0) +- patch_common_entries (tmp, offset, secnum); +- +- tmp = tmp->next; +- } +-} +-#endif +- +-/* This macro adds the symbol-number for the start of the function +- (the symbol number of the .bf) referenced by symnum_fcn to a +- list. This list, in reality should be a FIFO queue but since +- #line pragmas sometimes cause line ranges to get messed up +- we simply create a linear list. This list can then be searched +- first by a queueing algorithm and upon failure fall back to +- a linear scan. */ +- +-#if 0 +-#define ADD_BF_SYMNUM(bf_sym,fcn_sym) \ +- \ +- if (saved_bf_list == NULL) \ +-{ \ +- tmp_bf_ptr = allocate_saved_bf_node(); \ +- \ +- tmp_bf_ptr->symnum_bf = (bf_sym); \ +- tmp_bf_ptr->symnum_fcn = (fcn_sym); \ +- tmp_bf_ptr->next = NULL; \ +- \ +- current_head_bf_list = saved_bf_list = tmp_bf_ptr; \ +- saved_bf_list_end = tmp_bf_ptr; \ +- } \ +-else \ +-{ \ +- tmp_bf_ptr = allocate_saved_bf_node(); \ +- \ +- tmp_bf_ptr->symnum_bf = (bf_sym); \ +- tmp_bf_ptr->symnum_fcn = (fcn_sym); \ +- tmp_bf_ptr->next = NULL; \ +- \ +- saved_bf_list_end->next = tmp_bf_ptr; \ +- saved_bf_list_end = tmp_bf_ptr; \ +- } +-#endif +- +-/* This function frees the entire (.bf,function) list */ +- +-#if 0 +-static void +-clear_bf_list (void) +-{ +- +- SAVED_BF_PTR tmp = saved_bf_list; +- SAVED_BF_PTR next = NULL; +- +- while (tmp != NULL) +- { +- next = tmp->next; +- xfree (tmp); +- tmp = next; +- } +- saved_bf_list = NULL; +-} +-#endif +- +-int global_remote_debug; +- +-#if 0 +- +-static long +-get_bf_for_fcn (long the_function) +-{ +- SAVED_BF_PTR tmp; +- int nprobes = 0; +- +- /* First use a simple queuing algorithm (i.e. look and see if the +- item at the head of the queue is the one you want) */ +- +- if (saved_bf_list == NULL) +- internal_error (__FILE__, __LINE__, +- _("cannot get .bf node off empty list")); +- +- if (current_head_bf_list != NULL) +- if (current_head_bf_list->symnum_fcn == the_function) +- { +- if (global_remote_debug) +- fprintf_unfiltered (gdb_stderr, "*"); +- +- tmp = current_head_bf_list; +- current_head_bf_list = current_head_bf_list->next; +- return (tmp->symnum_bf); +- } +- +- /* If the above did not work (probably because #line directives were +- used in the sourcefile and they messed up our internal tables) we now do +- the ugly linear scan */ +- +- if (global_remote_debug) +- fprintf_unfiltered (gdb_stderr, "\ndefaulting to linear scan\n"); +- +- nprobes = 0; +- tmp = saved_bf_list; +- while (tmp != NULL) +- { +- nprobes++; +- if (tmp->symnum_fcn == the_function) +- { +- if (global_remote_debug) +- fprintf_unfiltered (gdb_stderr, "Found in %d probes\n", nprobes); +- current_head_bf_list = tmp->next; +- return (tmp->symnum_bf); +- } +- tmp = tmp->next; +- } +- +- return (-1); +-} +- +-static SAVED_FUNCTION_PTR saved_function_list = NULL; +-static SAVED_FUNCTION_PTR saved_function_list_end = NULL; +- +-static void +-clear_function_list (void) +-{ +- SAVED_FUNCTION_PTR tmp = saved_function_list; +- SAVED_FUNCTION_PTR next = NULL; +- +- while (tmp != NULL) +- { +- next = tmp->next; +- xfree (tmp); +- tmp = next; +- } +- +- saved_function_list = NULL; +-} +-#endif +--- a/gdb/f-lang.h ++++ b/gdb/f-lang.h +@@ -71,14 +71,9 @@ typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR; + typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR; + + extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */ +-extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON */ +-extern SAVED_F77_COMMON_PTR current_common; /* Ptr to current COMMON */ + + extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *); + +-#define UNINITIALIZED_SECNUM -1 +-#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM) +- + #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */ + #define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */ + #define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */ +--- a/gdb/f-valprint.c ++++ b/gdb/f-valprint.c +@@ -35,10 +35,6 @@ + #include "command.h" + #include "block.h" + +-#if 0 +-static int there_is_a_visible_common_named (char *); +-#endif +- + extern void _initialize_f_valprint (void); + static void info_common_command (char *, int); + static void list_all_visible_commons (char *); +@@ -578,67 +574,6 @@ info_common_command (char *comname, int from_tty) + comname, funname); + } + +-/* This function is used to determine whether there is a +- F77 common block visible at the current scope called 'comname'. */ +- +-#if 0 +-static int +-there_is_a_visible_common_named (char *comname) +-{ +- SAVED_F77_COMMON_PTR the_common; +- struct frame_info *fi; +- char *funname = 0; +- struct symbol *func; +- +- if (comname == NULL) +- error (_("Cannot deal with NULL common name!")); +- +- fi = get_selected_frame (_("No frame selected")); +- +- /* The following is generally ripped off from stack.c's routine +- print_frame_info() */ +- +- func = find_pc_function (fi->pc); +- if (func) +- { +- /* In certain pathological cases, the symtabs give the wrong +- function (when we are in the first function in a file which +- is compiled without debugging symbols, the previous function +- is compiled with debugging symbols, and the "foo.o" symbol +- that is supposed to tell us where the file with debugging symbols +- ends has been truncated by ar because it is longer than 15 +- characters). +- +- So look in the minimal symbol tables as well, and if it comes +- up with a larger address for the function use that instead. +- I don't think this can ever cause any problems; there shouldn't +- be any minimal symbols in the middle of a function. +- FIXME: (Not necessarily true. What about text labels) */ +- +- struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc); +- +- if (msymbol != NULL +- && (SYMBOL_VALUE_ADDRESS (msymbol) +- > BLOCK_START (SYMBOL_BLOCK_VALUE (func)))) +- funname = SYMBOL_LINKAGE_NAME (msymbol); +- else +- funname = SYMBOL_LINKAGE_NAME (func); +- } +- else +- { +- struct minimal_symbol *msymbol = +- lookup_minimal_symbol_by_pc (fi->pc); +- +- if (msymbol != NULL) +- funname = SYMBOL_LINKAGE_NAME (msymbol); +- } +- +- the_common = find_common_for_function (comname, funname); +- +- return (the_common ? 1 : 0); +-} +-#endif +- + void + _initialize_f_valprint (void) + { diff --git a/gdb-fortran-common.patch b/gdb-fortran-common.patch new file mode 100644 index 0000000..ef86f06 --- /dev/null +++ b/gdb-fortran-common.patch @@ -0,0 +1,576 @@ +Index: gdb-7.0.50.20100115/gdb/dwarf2read.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 21:35:15.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 21:41:32.000000000 +0100 +@@ -5811,12 +5811,14 @@ read_set_type (struct die_info *die, str + return set_die_type (die, set_type, cu); + } + +-/* First cut: install each common block member as a global variable. */ ++/* Create appropriate locally-scoped variables for all the DW_TAG_common_block ++ entries. Create also TYPE_CODE_STRUCT listing all such variables to be ++ available for `info common'. COMMON_BLOCK_DOMAIN is used to sepate the ++ common blocks name namespace from regular variable names. */ + + static void + read_common_block (struct die_info *die, struct dwarf2_cu *cu) + { +- struct die_info *child_die; + struct attribute *attr; + struct symbol *sym; + CORE_ADDR base = (CORE_ADDR) 0; +@@ -5841,10 +5843,40 @@ read_common_block (struct die_info *die, + } + if (die->child != NULL) + { ++ struct objfile *objfile = cu->objfile; ++ struct die_info *child_die; ++ struct type *type; ++ struct field *field; ++ char *name; ++ struct symbol *sym; ++ ++ type = alloc_type (objfile); ++ TYPE_CODE (type) = TYPE_CODE_STRUCT; ++ /* Artificial type to be used only by `info common'. */ ++ TYPE_NAME (type) = ""; ++ ++ child_die = die->child; ++ while (child_die && child_die->tag) ++ { ++ TYPE_NFIELDS (type)++; ++ child_die = sibling_die (child_die); ++ } ++ ++ TYPE_FIELDS (type) = obstack_alloc (&objfile->objfile_obstack, ++ sizeof (*TYPE_FIELDS (type)) ++ * TYPE_NFIELDS (type)); ++ memset (TYPE_FIELDS (type), 0, sizeof (*TYPE_FIELDS (type)) ++ * TYPE_NFIELDS (type)); ++ ++ field = TYPE_FIELDS (type); + child_die = die->child; + while (child_die && child_die->tag) + { ++ /* Create the symbol in the DW_TAG_common_block block in the current ++ symbol scope. */ + sym = new_symbol (child_die, NULL, cu); ++ ++ /* Undocumented in DWARF3, when it can be present? */ + attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu); + if (attr) + { +@@ -5862,8 +5894,25 @@ read_common_block (struct die_info *die, + SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset; + add_symbol_to_list (sym, &global_symbols); + } ++ ++ if (SYMBOL_CLASS (sym) == LOC_STATIC) ++ SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym)); ++ else ++ SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym)); ++ FIELD_TYPE (*field) = SYMBOL_TYPE (sym); ++ FIELD_NAME (*field) = SYMBOL_NATURAL_NAME (sym); ++ field++; + child_die = sibling_die (child_die); + } ++ ++ /* TYPE_LENGTH (type) is left 0 - it is only a virtual structure even ++ with no consecutive address space. */ ++ ++ sym = new_symbol (die, type, cu); ++ /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */ ++ SYMBOL_VALUE_ADDRESS (sym) = base; ++ ++ set_die_type (die, type, cu); + } + } + +@@ -9052,6 +9101,13 @@ new_symbol (struct die_info *die, struct + { + var_decode_location (attr, sym, cu); + attr2 = dwarf2_attr (die, DW_AT_external, cu); ++ ++ /* Fortran explicitly imports any global symbols to the local ++ scope by DW_TAG_common_block. */ ++ if (cu->language == language_fortran && die->parent ++ && die->parent->tag == DW_TAG_common_block) ++ attr2 = NULL; ++ + if (attr2 && (DW_UNSND (attr2) != 0)) + { + /* Workaround gfortran PR debug/40040 - it uses +@@ -9230,6 +9286,11 @@ new_symbol (struct die_info *die, struct + SYMBOL_DOMAIN (sym) = MODULE_DOMAIN; + add_symbol_to_list (sym, &global_symbols); + break; ++ case DW_TAG_common_block: ++ SYMBOL_CLASS (sym) = LOC_STATIC; ++ SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN; ++ add_symbol_to_list (sym, cu->list_in_scope); ++ break; + default: + /* Not a tag we recognize. Hopefully we aren't processing + trash data, but since we must specifically ignore things +Index: gdb-7.0.50.20100115/gdb/f-lang.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/f-lang.c 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/f-lang.c 2010-01-15 21:35:27.000000000 +0100 +@@ -448,27 +448,3 @@ _initialize_f_language (void) + + add_language (&f_language_defn); + } +- +-SAVED_F77_COMMON_PTR head_common_list = NULL; /* Ptr to 1st saved COMMON */ +- +-/* This routine finds the first encountred COMMON block named "name" +- that belongs to function funcname */ +- +-SAVED_F77_COMMON_PTR +-find_common_for_function (char *name, char *funcname) +-{ +- +- SAVED_F77_COMMON_PTR tmp; +- +- tmp = head_common_list; +- +- while (tmp != NULL) +- { +- if (strcmp (tmp->name, name) == 0 +- && strcmp (tmp->owning_function, funcname) == 0) +- return (tmp); +- else +- tmp = tmp->next; +- } +- return (NULL); +-} +Index: gdb-7.0.50.20100115/gdb/f-lang.h +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/f-lang.h 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/f-lang.h 2010-01-15 21:35:27.000000000 +0100 +@@ -51,36 +51,8 @@ enum f90_range_type + NONE_BOUND_DEFAULT /* "(low:high)" */ + }; + +-struct common_entry +- { +- struct symbol *symbol; /* The symbol node corresponding +- to this component */ +- struct common_entry *next; /* The next component */ +- }; +- +-struct saved_f77_common +- { +- char *name; /* Name of COMMON */ +- char *owning_function; /* Name of parent function */ +- int secnum; /* Section # of .bss */ +- CORE_ADDR offset; /* Offset from .bss for +- this block */ +- struct common_entry *entries; /* List of block's components */ +- struct common_entry *end_of_entries; /* ptr. to end of components */ +- struct saved_f77_common *next; /* Next saved COMMON block */ +- }; +- +-typedef struct saved_f77_common SAVED_F77_COMMON, *SAVED_F77_COMMON_PTR; +- +-typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR; +- +-extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON */ +- +-extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *); +- + #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM" /* XLF assigned */ + #define BLANK_COMMON_NAME_MF77 "__BLNK__" /* MF77 assigned */ +-#define BLANK_COMMON_NAME_LOCAL "__BLANK" /* Local GDB */ + + /* When reasonable array bounds cannot be fetched, such as when + you ask to 'mt print symbols' and there is no stack frame and +Index: gdb-7.0.50.20100115/gdb/f-valprint.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/f-valprint.c 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/f-valprint.c 2010-01-15 21:35:27.000000000 +0100 +@@ -34,6 +34,8 @@ + #include "gdbcore.h" + #include "command.h" + #include "block.h" ++#include "dictionary.h" ++#include "gdb_assert.h" + + extern void _initialize_f_valprint (void); + static void info_common_command (char *, int); +@@ -476,22 +478,54 @@ f_val_print (struct type *type, const gd + return 0; + } + +-static void +-list_all_visible_commons (char *funname) ++static int ++info_common_command_for_block (struct block *block, struct frame_info *frame, ++ const char *comname) + { +- SAVED_F77_COMMON_PTR tmp; +- +- tmp = head_common_list; ++ struct dict_iterator iter; ++ struct symbol *sym; ++ int values_printed = 0; ++ const char *name; ++ struct value_print_options opts; ++ ++ get_user_print_options (&opts); ++ ++ ALL_BLOCK_SYMBOLS (block, iter, sym) ++ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN) ++ { ++ struct type *type = SYMBOL_TYPE (sym); ++ int index; ++ ++ gdb_assert (SYMBOL_CLASS (sym) == LOC_STATIC); ++ gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT); ++ ++ if (comname && (!SYMBOL_LINKAGE_NAME (sym) ++ || strcmp (comname, SYMBOL_LINKAGE_NAME (sym)) != 0)) ++ continue; ++ ++ values_printed = 1; ++ if (SYMBOL_PRINT_NAME (sym)) ++ printf_filtered (_("Contents of F77 COMMON block '%s':\n"), ++ SYMBOL_PRINT_NAME (sym)); ++ else ++ printf_filtered (_("Contents of blank COMMON block:\n")); ++ ++ for (index = 0; index < TYPE_NFIELDS (type); index++) ++ { ++ struct value *val; ++ ++ gdb_assert (field_is_static (&TYPE_FIELD (type, index))); ++ val = value_static_field (type, index); ++ ++ printf_filtered ("%s = ", TYPE_FIELD_NAME (type, index)); ++ value_print (val, gdb_stdout, &opts); ++ putchar_filtered ('\n'); ++ } + +- printf_filtered (_("All COMMON blocks visible at this level:\n\n")); ++ putchar_filtered ('\n'); ++ } + +- while (tmp != NULL) +- { +- if (strcmp (tmp->owning_function, funname) == 0) +- printf_filtered ("%s\n", tmp->name); +- +- tmp = tmp->next; +- } ++ return values_printed; + } + + /* This function is used to print out the values in a given COMMON +@@ -501,11 +535,9 @@ list_all_visible_commons (char *funname) + static void + info_common_command (char *comname, int from_tty) + { +- SAVED_F77_COMMON_PTR the_common; +- COMMON_ENTRY_PTR entry; + struct frame_info *fi; +- char *funname = 0; +- struct symbol *func; ++ struct block *block; ++ int values_printed = 0; + + /* We have been told to display the contents of F77 COMMON + block supposedly visible in this function. Let us +@@ -517,74 +549,31 @@ info_common_command (char *comname, int + /* The following is generally ripped off from stack.c's routine + print_frame_info() */ + +- func = find_pc_function (get_frame_pc (fi)); +- if (func) ++ block = get_frame_block (fi, 0); ++ if (block == NULL) + { +- /* In certain pathological cases, the symtabs give the wrong +- function (when we are in the first function in a file which +- is compiled without debugging symbols, the previous function +- is compiled with debugging symbols, and the "foo.o" symbol +- that is supposed to tell us where the file with debugging symbols +- ends has been truncated by ar because it is longer than 15 +- characters). +- +- So look in the minimal symbol tables as well, and if it comes +- up with a larger address for the function use that instead. +- I don't think this can ever cause any problems; there shouldn't +- be any minimal symbols in the middle of a function. +- FIXME: (Not necessarily true. What about text labels) */ +- +- struct minimal_symbol *msymbol = +- lookup_minimal_symbol_by_pc (get_frame_pc (fi)); +- +- if (msymbol != NULL +- && (SYMBOL_VALUE_ADDRESS (msymbol) +- > BLOCK_START (SYMBOL_BLOCK_VALUE (func)))) +- funname = SYMBOL_LINKAGE_NAME (msymbol); +- else +- funname = SYMBOL_LINKAGE_NAME (func); +- } +- else +- { +- struct minimal_symbol *msymbol = +- lookup_minimal_symbol_by_pc (get_frame_pc (fi)); +- +- if (msymbol != NULL) +- funname = SYMBOL_LINKAGE_NAME (msymbol); +- else /* Got no 'funname', code below will fail. */ +- error (_("No function found for frame.")); ++ printf_filtered (_("No symbol table info available.\n")); ++ return; + } + +- /* If comname is NULL, we assume the user wishes to see the +- which COMMON blocks are visible here and then return */ +- +- if (comname == 0) ++ while (block) + { +- list_all_visible_commons (funname); +- return; ++ if (info_common_command_for_block (block, fi, comname)) ++ values_printed = 1; ++ /* After handling the function's top-level block, stop. Don't ++ continue to its superblock, the block of per-file symbols. */ ++ if (BLOCK_FUNCTION (block)) ++ break; ++ block = BLOCK_SUPERBLOCK (block); + } + +- the_common = find_common_for_function (comname, funname); +- +- if (the_common) ++ if (!values_printed) + { +- if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0) +- printf_filtered (_("Contents of blank COMMON block:\n")); ++ if (comname) ++ printf_filtered (_("No common block '%s'.\n"), comname); + else +- printf_filtered (_("Contents of F77 COMMON block '%s':\n"), comname); +- +- printf_filtered ("\n"); +- entry = the_common->entries; +- +- while (entry != NULL) +- { +- print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0); +- entry = entry->next; +- } ++ printf_filtered (_("No common blocks.\n")); + } +- else +- printf_filtered (_("Cannot locate the common block %s in function '%s'\n"), +- comname, funname); + } + + void +Index: gdb-7.0.50.20100115/gdb/stack.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/stack.c 2010-01-15 21:35:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/stack.c 2010-01-15 21:35:27.000000000 +0100 +@@ -1474,6 +1474,8 @@ print_block_frame_locals (struct block * + case LOC_COMPUTED: + if (SYMBOL_IS_ARGUMENT (sym)) + break; ++ if (SYMBOL_DOMAIN (sym) == COMMON_BLOCK_DOMAIN) ++ break; + values_printed = 1; + print_variable_and_value (NULL, sym, frame, stream, 4 * num_tabs); + break; +Index: gdb-7.0.50.20100115/gdb/symtab.h +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/symtab.h 2010-01-15 21:35:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/symtab.h 2010-01-15 21:35:57.000000000 +0100 +@@ -401,7 +401,10 @@ typedef enum domain_enum_tag + TYPES_DOMAIN, + + /* Fortran module. Their naming must be separate. */ +- MODULE_DOMAIN ++ MODULE_DOMAIN, ++ ++ /* Fortran common blocks. Their naming must be separate from VAR_DOMAIN. */ ++ COMMON_BLOCK_DOMAIN + } + domain_enum; + +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/common-block.exp +@@ -0,0 +1,101 @@ ++# Copyright 2008 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# This file was written by Jan Kratochvil . ++ ++set testfile "common-block" ++set srcfile ${testfile}.f90 ++set binfile ${objdir}/${subdir}/${testfile} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { ++ untested "Couldn't compile ${srcfile}" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto MAIN__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "stop-here-out"] ++gdb_continue_to_breakpoint "stop-here-out" ++ ++# Common block naming with source name /foo/: ++# .symtab DW_TAG_common_block's DW_AT_name ++# Intel Fortran foo_ foo_ ++# GNU Fortran foo_ foo ++#set suffix "_" ++set suffix "" ++ ++set int4 {(integer\(kind=4\)|INTEGER\(4\))} ++set real4 {(real\(kind=4\)|REAL\(4\))} ++set real8 {(real\(kind=8\)|REAL\(8\))} ++ ++gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context." ++gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context." ++gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context." ++gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." ++gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." ++gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." ++ ++gdb_test "info locals" "ix_x = 11\r\niy_y = 22\r\niz_z = 33\r\nix = 1\r\niy = 2\r\niz = 3" "info locals out" ++gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix_x = 11\r\niy_y = 22\r\niz_z = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix = 1\r\niy = 2\r\niz = 3" "info common out" ++ ++gdb_test "ptype ix" "type = $int4" "ptype ix out" ++gdb_test "ptype iy" "type = $real4" "ptype iy out" ++gdb_test "ptype iz" "type = $real8" "ptype iz out" ++gdb_test "ptype ix_x" "type = $int4" "ptype ix_x out" ++gdb_test "ptype iy_y" "type = $real4" "ptype iy_y out" ++gdb_test "ptype iz_z" "type = $real8" "ptype iz_z out" ++ ++gdb_test "p ix" " = 1 *" "p ix out" ++gdb_test "p iy" " = 2 *" "p iy out" ++gdb_test "p iz" " = 3 *" "p iz out" ++gdb_test "p ix_x" " = 11 *" "p ix_x out" ++gdb_test "p iy_y" " = 22 *" "p iy_y out" ++gdb_test "p iz_z" " = 33 *" "p iz_z out" ++ ++gdb_breakpoint [gdb_get_line_number "stop-here-in"] ++gdb_continue_to_breakpoint "stop-here-in" ++ ++gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context." "whatis foo$suffix in" ++gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context." "ptype foo$suffix in" ++gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context." "p foo$suffix in" ++gdb_test "whatis fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "whatis fo_o$suffix in" ++gdb_test "ptype fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "ptype fo_o$suffix in" ++gdb_test "p fo_o$suffix" "No symbol \"fo_o$suffix\" in current context." "p fo_o$suffix in" ++ ++gdb_test "info locals" "ix = 11\r\niy2 = 22\r\niz = 33\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3\r\niy = 5\r\niz_z = 55" "info locals in" ++gdb_test "info common" "Contents of F77 COMMON block 'fo_o':\r\nix = 11\r\niy2 = 22\r\niz = 33\r\n\r\nContents of F77 COMMON block 'foo':\r\nix_x = 1\r\niy_y = 2\r\niz_z2 = 3" "info common in" ++ ++gdb_test "ptype ix" "type = $int4" "ptype ix in" ++gdb_test "ptype iy2" "type = $real4" "ptype iy2 in" ++gdb_test "ptype iz" "type = $real8" "ptype iz in" ++gdb_test "ptype ix_x" "type = $int4" "ptype ix_x in" ++gdb_test "ptype iy_y" "type = $real4" "ptype iy_y in" ++gdb_test "ptype iz_z2" "type = $real8" "ptype iz_z2 in" ++ ++gdb_test "p ix" " = 11 *" "p ix in" ++gdb_test "p iy2" " = 22 *" "p iy2 in" ++gdb_test "p iz" " = 33 *" "p iz in" ++gdb_test "p ix_x" " = 1 *" "p ix_x in" ++gdb_test "p iy_y" " = 2 *" "p iy_y in" ++gdb_test "p iz_z2" " = 3 *" "p iz_z2 in" +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/common-block.f90 +@@ -0,0 +1,67 @@ ++! Copyright 2008 Free Software Foundation, Inc. ++! ++! This program is free software; you can redistribute it and/or modify ++! it under the terms of the GNU General Public License as published by ++! the Free Software Foundation; either version 2 of the License, or ++! (at your option) any later version. ++! ++! This program is distributed in the hope that it will be useful, ++! but WITHOUT ANY WARRANTY; without even the implied warranty of ++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++! GNU General Public License for more details. ++! ++! You should have received a copy of the GNU General Public License ++! along with this program; if not, write to the Free Software ++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++! ++! Ihis file is the Fortran source file for dynamic.exp. ++! Original file written by Jakub Jelinek . ++! Modified for the GDB testcase by Jan Kratochvil . ++ ++subroutine in ++ ++ INTEGER*4 ix ++ REAL*4 iy2 ++ REAL*8 iz ++ ++ INTEGER*4 ix_x ++ REAL*4 iy_y ++ REAL*8 iz_z2 ++ ++ common /fo_o/ix,iy2,iz ++ common /foo/ix_x,iy_y,iz_z2 ++ ++ iy = 5 ++ iz_z = 55 ++ ++ if (ix .ne. 11 .or. iy2 .ne. 22.0 .or. iz .ne. 33.0) call abort ++ if (ix_x .ne. 1 .or. iy_y .ne. 2.0 .or. iz_z2 .ne. 3.0) call abort ++ ++ ix = 0 ! stop-here-in ++ ++end subroutine in ++ ++program common_test ++ ++ INTEGER*4 ix ++ REAL*4 iy ++ REAL*8 iz ++ ++ INTEGER*4 ix_x ++ REAL*4 iy_y ++ REAL*8 iz_z ++ ++ common /foo/ix,iy,iz ++ common /fo_o/ix_x,iy_y,iz_z ++ ++ ix = 1 ++ iy = 2.0 ++ iz = 3.0 ++ ++ ix_x = 11 ++ iy_y = 22.0 ++ iz_z = 33.0 ++ ++ call in ! stop-here-out ++ ++end program common_test diff --git a/gdb-fortran-logical8.patch b/gdb-fortran-logical8.patch new file mode 100644 index 0000000..aadb65a --- /dev/null +++ b/gdb-fortran-logical8.patch @@ -0,0 +1,153 @@ +--- a/gdb/f-exp.y ++++ b/gdb/f-exp.y +@@ -196,6 +196,7 @@ static int parse_number (char *, int, int, YYSTYPE *); + /* Special type cases, put in to allow the parser to distinguish different + legal basetypes. */ + %token INT_KEYWORD INT_S2_KEYWORD LOGICAL_S1_KEYWORD LOGICAL_S2_KEYWORD ++%token LOGICAL_S8_KEYWORD + %token LOGICAL_KEYWORD REAL_KEYWORD REAL_S8_KEYWORD REAL_S16_KEYWORD + %token COMPLEX_S8_KEYWORD COMPLEX_S16_KEYWORD COMPLEX_S32_KEYWORD + %token BOOL_AND BOOL_OR BOOL_NOT +@@ -606,6 +607,8 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */ + { $$ = parse_f_type->builtin_integer_s2; } + | CHARACTER + { $$ = parse_f_type->builtin_character; } ++ | LOGICAL_S8_KEYWORD ++ { $$ = parse_f_type->builtin_logical_s8;} + | LOGICAL_KEYWORD + { $$ = parse_f_type->builtin_logical; } + | LOGICAL_S2_KEYWORD +@@ -858,6 +861,7 @@ static const struct token f77_keywords[] = + { "integer_2", INT_S2_KEYWORD, BINOP_END }, + { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END }, + { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END }, ++ { "logical_8", LOGICAL_S8_KEYWORD, BINOP_END }, + { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END }, + { "integer", INT_KEYWORD, BINOP_END }, + { "logical", LOGICAL_KEYWORD, BINOP_END }, +--- a/gdb/f-lang.c ++++ b/gdb/f-lang.c +@@ -259,6 +245,7 @@ enum f_primitive_types { + f_primitive_type_logical, + f_primitive_type_logical_s1, + f_primitive_type_logical_s2, ++ f_primitive_type_logical_s8, + f_primitive_type_integer, + f_primitive_type_integer_s2, + f_primitive_type_real, +@@ -289,6 +276,8 @@ f_language_arch_info (struct gdbarch *gdbarch, + = builtin->builtin_logical_s1; + lai->primitive_type_vector [f_primitive_type_logical_s2] + = builtin->builtin_logical_s2; ++ lai->primitive_type_vector [f_primitive_type_logical_s8] ++ = builtin->builtin_logical_s8; + lai->primitive_type_vector [f_primitive_type_real] + = builtin->builtin_real; + lai->primitive_type_vector [f_primitive_type_real_s8] +@@ -372,6 +361,10 @@ build_fortran_types (struct gdbarch *gdbarch) + = arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1, + "logical*2"); + ++ builtin_f_type->builtin_logical_s8 ++ = arch_boolean_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1, ++ "logical*8"); ++ + builtin_f_type->builtin_integer + = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, + "integer"); +--- a/gdb/f-lang.h ++++ b/gdb/f-lang.h +@@ -113,6 +80,7 @@ struct builtin_f_type + struct type *builtin_logical; + struct type *builtin_logical_s1; + struct type *builtin_logical_s2; ++ struct type *builtin_logical_s8; + struct type *builtin_real; + struct type *builtin_real_s8; + struct type *builtin_real_s16; +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/logical.exp +@@ -0,0 +1,44 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# This file was written by Jan Kratochvil . ++ ++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-lineno-makeup-test.patch b/gdb-lineno-makeup-test.patch new file mode 100644 index 0000000..073662a --- /dev/null +++ b/gdb-lineno-makeup-test.patch @@ -0,0 +1,151 @@ +New testcase for: +https://bugzilla.redhat.com/show_bug.cgi?id=466222 + (for the first / customer recommended fix) +and the upstream fix: +http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html + [rfc] Do not make up line information +http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html + +--- /dev/null ++++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c +@@ -0,0 +1,21 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++void ++func (void) ++{ ++} +--- /dev/null ++++ b/gdb/testsuite/gdb.base/lineno-makeup.c +@@ -0,0 +1,35 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number ++ information (.debug_line) so we cannot use an external object file. ++ ++ It must not be just a label as it would alias on the next function even for ++ correct GDB. Therefore some stub data must be placed there. ++ ++ We need to provide a real stub function body as at least s390 ++ (s390_analyze_prologue) would skip the whole body till reaching `main'. */ ++ ++extern void func (void); ++asm ("func: .incbin \"gdb.base/lineno-makeup-func.bin\""); ++ ++int ++main (void) ++{ ++ func (); ++ return 0; ++} +--- /dev/null ++++ b/gdb/testsuite/gdb.base/lineno-makeup.exp +@@ -0,0 +1,78 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile "lineno-makeup" ++set srcfuncfile ${testfile}-func.c ++set srcfile ${testfile}.c ++set objfuncfile ${objdir}/${subdir}/${testfile}-func.o ++set binfuncfile ${objdir}/${subdir}/${testfile}-func.bin ++set binfile ${objdir}/${subdir}/${testfile} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++ ++set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output] ++verbose -log "objcopy=$objcopy: $output" ++if { $objcopy != 0 } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++set binfuncfilesize [file size $binfuncfile] ++verbose -log "file size $binfuncfile = $binfuncfilesize" ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set b_addr "" ++set test "break func" ++gdb_test_multiple $test $test { ++ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { ++ set b_addr $expect_out(1,string) ++ pass $test ++ } ++ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" { ++ set b_addr $expect_out(1,string) ++ fail $test ++ } ++} ++verbose -log "b_addr=<$b_addr>" ++ ++set p_addr "" ++set test "print func" ++gdb_test_multiple $test $test { ++ -re "\\$\[0-9\]+ = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" { ++ set p_addr $expect_out(1,string) ++ pass $test ++ } ++} ++verbose -log "p_addr=<$p_addr>" ++ ++set test "break address belongs to func" ++if {$b_addr == $p_addr} { ++ pass "$test (exact match)" ++} else { ++ set skip [expr $b_addr - $p_addr] ++ if {$skip > 0 && $skip < $binfuncfilesize} { ++ pass "$test (prologue skip by $skip bytes)" ++ } else { ++ fail $test ++ } ++} diff --git a/gdb-orphanripper.c b/gdb-orphanripper.c index 4893e8f..b289477 100644 --- a/gdb-orphanripper.c +++ b/gdb-orphanripper.c @@ -41,6 +41,7 @@ #include #include #include +#include #define LENGTH(x) (sizeof (x) / sizeof (*(x))) @@ -87,6 +88,8 @@ static int read_out (int amaster) /* Weird but at least after POLLHUP we get EIO instead of just EOF. */ if (buf_got == -1 && errno == EIO) return 0; + if (buf_got == -1 && errno == EAGAIN) + return 0; if (buf_got < 0) { perror ("read (amaster)"); diff --git a/gdb-ppc-hw-watchpoint-twice.patch b/gdb-ppc-hw-watchpoint-twice.patch deleted file mode 100644 index e363158..0000000 --- a/gdb-ppc-hw-watchpoint-twice.patch +++ /dev/null @@ -1,21 +0,0 @@ -pcc regression from: -http://sourceware.org/ml/gdb-patches/2008-12/msg00143.html - -gdb/ -2009-12-21 Jan Kratochvil - - * breakpoint.c (update_watchpoint): Set B->TYPE to bp_watchpoint before - calling hw_watchpoint_used_count. - ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -1152,6 +1152,9 @@ update_watchpoint (struct breakpoint *b, int reparse) - { - int i, mem_cnt, other_type_used; - -+ /* Do not count with B twice below. */ -+ b->type = bp_watchpoint; -+ - i = hw_watchpoint_used_count (bp_hardware_watchpoint, - &other_type_used); - mem_cnt = can_use_hardware_watchpoint (val_chain); diff --git a/gdb-ppc-power7-test.patch b/gdb-ppc-power7-test.patch new file mode 100644 index 0000000..876c134 --- /dev/null +++ b/gdb-ppc-power7-test.patch @@ -0,0 +1,288 @@ +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp +@@ -0,0 +1,175 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Test PowerPC Power7 instructions disassembly. ++ ++if {![istarget "powerpc*-*-*"]} then { ++ verbose "Skipping PowerPC Power7 instructions disassembly." ++ return ++} ++ ++set testfile "powerpc-power7" ++set srcfile ${testfile}.s ++set objfile ${objdir}/${subdir}/${testfile}.o ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } { ++ untested "PowerPC Power7 instructions disassembly" ++ return -1 ++} ++ ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${objfile} ++ ++ ++# Disassemble the function. ++ ++set test "disass func" ++gdb_test_multiple $test $test { ++ -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" { ++ set func $expect_out(1,string) ++ pass $test ++ } ++} ++ ++proc instr_to_patt {offset instr} { ++ # 0x0000000000000018 : stxvd2x vs43,r4,r5 ++ return ".*\r\n[string map {0x 0x0*} $offset] :\[ \t\]*[string map [list { } "\[ \t\]+" . {\.}] $instr]\[ \t\]*\r\n.*" ++} ++ ++# KFAIL strings would not exist if -Many would print the same as -Mpower7. ++# That means the power7 form should be the preferred one. ++# http://sourceware.org/ml/gdb-patches/2009-03/threads.html#00020 ++ ++proc func_check {offset instr {kfail ""}} { ++ global func ++ ++ set test "Found $offset: $instr" ++ if [regexp -nocase -line [instr_to_patt $offset $instr] $func] { ++ pass $test ++ } elseif {$kfail != "" && [regexp -nocase -line [instr_to_patt $offset $kfail] $func]} { ++ kfail gdb/NNNN $test ++ } else { ++ fail $test ++ } ++} ++ ++func_check 0x0 "lxvd2x vs3,r4,r5" ++func_check 0x4 "lxvd2ux vs3,r4,r5" ++func_check 0x8 "lxvd2x vs43,r4,r5" ++func_check 0xc "lxvd2ux vs43,r4,r5" ++func_check 0x10 "stxvd2x vs3,r4,r5" ++func_check 0x14 "stxvd2ux vs3,r4,r5" ++func_check 0x18 "stxvd2x vs43,r4,r5" ++func_check 0x1c "stxvd2ux vs43,r4,r5" ++func_check 0x20 "xxmrghd vs3,vs4,vs5" ++func_check 0x24 "xxmrghd vs43,vs44,vs45" ++func_check 0x28 "xxmrgld vs3,vs4,vs5" ++func_check 0x2c "xxmrgld vs43,vs44,vs45" ++func_check 0x30 "xxmrghd vs3,vs4,vs5" ++func_check 0x34 "xxmrghd vs43,vs44,vs45" ++func_check 0x38 "xxmrgld vs3,vs4,vs5" ++func_check 0x3c "xxmrgld vs43,vs44,vs45" ++func_check 0x40 "xxpermdi vs3,vs4,vs5,1" ++func_check 0x44 "xxpermdi vs43,vs44,vs45,1" ++func_check 0x48 "xxpermdi vs3,vs4,vs5,2" ++func_check 0x4c "xxpermdi vs43,vs44,vs45,2" ++func_check 0x50 "xvmovdp vs3,vs4" ++func_check 0x54 "xvmovdp vs43,vs44" ++func_check 0x58 "xvmovdp vs3,vs4" ++func_check 0x5c "xvmovdp vs43,vs44" ++func_check 0x60 "xvcpsgndp vs3,vs4,vs5" ++func_check 0x64 "xvcpsgndp vs43,vs44,vs45" ++func_check 0x68 "wait" ++func_check 0x6c "wait" ++func_check 0x70 "waitrsv" ++func_check 0x74 "waitrsv" ++func_check 0x78 "waitimpl" ++func_check 0x7c "waitimpl" ++func_check 0x80 "doze" ++func_check 0x84 "nap" ++func_check 0x88 "sleep" ++func_check 0x8c "rvwinkle" ++func_check 0x90 "prtyw r3,r4" ++func_check 0x94 "prtyd r13,r14" ++func_check 0x98 "mfcfar r10" "mfspr r10,28" ++func_check 0x9c "mtcfar r11" "mtspr 28,r11" ++func_check 0xa0 "cmpb r3,r4,r5" ++func_check 0xa4 "lwzcix r10,r11,r12" ++func_check 0xa8 "dadd f16,f17,f18" ++func_check 0xac "daddq f20,f22,f24" ++func_check 0xb0 "dss 3" ++func_check 0xb4 "dssall" ++func_check 0xb8 "dst r5,r4,1" ++func_check 0xbc "dstt r8,r7,0" ++func_check 0xc0 "dstst r5,r6,3" ++func_check 0xc4 "dststt r4,r5,2" ++func_check 0xc8 "divwe r10,r11,r12" ++func_check 0xcc "divwe. r11,r12,r13" ++func_check 0xd0 "divweo r12,r13,r14" ++func_check 0xd4 "divweo. r13,r14,r15" ++func_check 0xd8 "divweu r10,r11,r12" ++func_check 0xdc "divweu. r11,r12,r13" ++func_check 0xe0 "divweuo r12,r13,r14" ++func_check 0xe4 "divweuo. r13,r14,r15" ++func_check 0xe8 "bpermd r7,r17,r27" ++func_check 0xec "popcntw r10,r20" ++func_check 0xf0 "popcntd r10,r20" ++func_check 0xf4 "ldbrx r20,r21,r22" ++func_check 0xf8 "stdbrx r20,r21,r22" ++func_check 0xfc "lfiwzx f10,0,r10" ++func_check 0x100 "lfiwzx f10,r9,r10" ++func_check 0x104 "fcfids f4,f5" ++func_check 0x108 "fcfids. f4,f5" ++func_check 0x10c "fcfidus f4,f5" ++func_check 0x110 "fcfidus. f4,f5" ++func_check 0x114 "fctiwu f4,f5" ++func_check 0x118 "fctiwu. f4,f5" ++func_check 0x11c "fctiwuz f4,f5" ++func_check 0x120 "fctiwuz. f4,f5" ++func_check 0x124 "fctidu f4,f5" ++func_check 0x128 "fctidu. f4,f5" ++func_check 0x12c "fctiduz f4,f5" ++func_check 0x130 "fctiduz. f4,f5" ++func_check 0x134 "fcfidu f4,f5" ++func_check 0x138 "fcfidu. f4,f5" ++func_check 0x13c "ftdiv cr0,f10,f11" ++func_check 0x140 "ftdiv cr7,f10,f11" ++func_check 0x144 "ftsqrt cr0,f10" ++func_check 0x148 "ftsqrt cr7,f10" ++func_check 0x14c "dcbtt r8,r9" "dcbt 16,r8,r9" ++func_check 0x150 "dcbtstt r8,r9" "dcbtst 16,r8,r9" ++func_check 0x154 "dcffix f10,f12" ++func_check 0x158 "dcffix. f20,f22" ++func_check 0x15c "lbarx r10,r11,r12" ++func_check 0x160 "lbarx r10,r11,r12" ++func_check 0x164 "lbarx r10,r11,r12,1" ++func_check 0x168 "lharx r20,r21,r22" ++func_check 0x16c "lharx r20,r21,r22" ++func_check 0x170 "lharx r20,r21,r22,1" ++func_check 0x174 "stbcx. r10,r11,r12" ++func_check 0x178 "sthcx. r10,r11,r12" ++func_check 0x17c "fre f14,f15" ++func_check 0x180 "fre. f14,f15" ++func_check 0x184 "fres f14,f15" ++func_check 0x188 "fres. f14,f15" ++func_check 0x18c "frsqrte f14,f15" ++func_check 0x190 "frsqrte. f14,f15" ++func_check 0x194 "frsqrtes f14,f15" ++func_check 0x198 "frsqrtes. f14,f15" ++func_check 0x19c "isel r2,r3,r4,28" +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-power7.s +@@ -0,0 +1,107 @@ ++ .text ++ .globl func ++func: ++ .long 0x7c642e98 /* 0: lxvd2x vs3,r4,r5 */ ++ .long 0x7c642ed8 /* 4: lxvd2ux vs3,r4,r5 */ ++ .long 0x7d642e99 /* 8: lxvd2x vs43,r4,r5 */ ++ .long 0x7d642ed9 /* c: lxvd2ux vs43,r4,r5 */ ++ .long 0x7c642f98 /* 10: stxvd2x vs3,r4,r5 */ ++ .long 0x7c642fd8 /* 14: stxvd2ux vs3,r4,r5 */ ++ .long 0x7d642f99 /* 18: stxvd2x vs43,r4,r5 */ ++ .long 0x7d642fd9 /* 1c: stxvd2ux vs43,r4,r5 */ ++ .long 0xf0642850 /* 20: xxmrghd vs3,vs4,vs5 */ ++ .long 0xf16c6857 /* 24: xxmrghd vs43,vs44,vs45 */ ++ .long 0xf0642b50 /* 28: xxmrgld vs3,vs4,vs5 */ ++ .long 0xf16c6b57 /* 2c: xxmrgld vs43,vs44,vs45 */ ++ .long 0xf0642850 /* 30: xxmrghd vs3,vs4,vs5 */ ++ .long 0xf16c6857 /* 34: xxmrghd vs43,vs44,vs45 */ ++ .long 0xf0642b50 /* 38: xxmrgld vs3,vs4,vs5 */ ++ .long 0xf16c6b57 /* 3c: xxmrgld vs43,vs44,vs45 */ ++ .long 0xf0642950 /* 40: xxpermdi vs3,vs4,vs5,1 */ ++ .long 0xf16c6957 /* 44: xxpermdi vs43,vs44,vs45,1 */ ++ .long 0xf0642a50 /* 48: xxpermdi vs3,vs4,vs5,2 */ ++ .long 0xf16c6a57 /* 4c: xxpermdi vs43,vs44,vs45,2 */ ++ .long 0xf0642780 /* 50: xvmovdp vs3,vs4 */ ++ .long 0xf16c6787 /* 54: xvmovdp vs43,vs44 */ ++ .long 0xf0642780 /* 58: xvmovdp vs3,vs4 */ ++ .long 0xf16c6787 /* 5c: xvmovdp vs43,vs44 */ ++ .long 0xf0642f80 /* 60: xvcpsgndp vs3,vs4,vs5 */ ++ .long 0xf16c6f87 /* 64: xvcpsgndp vs43,vs44,vs45 */ ++ .long 0x7c00007c /* 68: wait */ ++ .long 0x7c00007c /* 6c: wait */ ++ .long 0x7c20007c /* 70: waitrsv */ ++ .long 0x7c20007c /* 74: waitrsv */ ++ .long 0x7c40007c /* 78: waitimpl */ ++ .long 0x7c40007c /* 7c: waitimpl */ ++ .long 0x4c000324 /* 80: doze */ ++ .long 0x4c000364 /* 84: nap */ ++ .long 0x4c0003a4 /* 88: sleep */ ++ .long 0x4c0003e4 /* 8c: rvwinkle */ ++ .long 0x7c830134 /* 90: prtyw r3,r4 */ ++ .long 0x7dcd0174 /* 94: prtyd r13,r14 */ ++ .long 0x7d5c02a6 /* 98: mfcfar r10 */ ++ .long 0x7d7c03a6 /* 9c: mtcfar r11 */ ++ .long 0x7c832bf8 /* a0: cmpb r3,r4,r5 */ ++ .long 0x7d4b662a /* a4: lwzcix r10,r11,r12 */ ++ .long 0xee119004 /* a8: dadd f16,f17,f18 */ ++ .long 0xfe96c004 /* ac: daddq f20,f22,f24 */ ++ .long 0x7c60066c /* b0: dss 3 */ ++ .long 0x7e00066c /* b4: dssall */ ++ .long 0x7c2522ac /* b8: dst r5,r4,1 */ ++ .long 0x7e083aac /* bc: dstt r8,r7,0 */ ++ .long 0x7c6532ec /* c0: dstst r5,r6,3 */ ++ .long 0x7e442aec /* c4: dststt r4,r5,2 */ ++ .long 0x7d4b6356 /* c8: divwe r10,r11,r12 */ ++ .long 0x7d6c6b57 /* cc: divwe. r11,r12,r13 */ ++ .long 0x7d8d7756 /* d0: divweo r12,r13,r14 */ ++ .long 0x7dae7f57 /* d4: divweo. r13,r14,r15 */ ++ .long 0x7d4b6316 /* d8: divweu r10,r11,r12 */ ++ .long 0x7d6c6b17 /* dc: divweu. r11,r12,r13 */ ++ .long 0x7d8d7716 /* e0: divweuo r12,r13,r14 */ ++ .long 0x7dae7f17 /* e4: divweuo. r13,r14,r15 */ ++ .long 0x7e27d9f8 /* e8: bpermd r7,r17,r27 */ ++ .long 0x7e8a02f4 /* ec: popcntw r10,r20 */ ++ .long 0x7e8a03f4 /* f0: popcntd r10,r20 */ ++ .long 0x7e95b428 /* f4: ldbrx r20,r21,r22 */ ++ .long 0x7e95b528 /* f8: stdbrx r20,r21,r22 */ ++ .long 0x7d4056ee /* fc: lfiwzx f10,0,r10 */ ++ .long 0x7d4956ee /* 100: lfiwzx f10,r9,r10 */ ++ .long 0xec802e9c /* 104: fcfids f4,f5 */ ++ .long 0xec802e9d /* 108: fcfids. f4,f5 */ ++ .long 0xec802f9c /* 10c: fcfidus f4,f5 */ ++ .long 0xec802f9d /* 110: fcfidus. f4,f5 */ ++ .long 0xfc80291c /* 114: fctiwu f4,f5 */ ++ .long 0xfc80291d /* 118: fctiwu. f4,f5 */ ++ .long 0xfc80291e /* 11c: fctiwuz f4,f5 */ ++ .long 0xfc80291f /* 120: fctiwuz. f4,f5 */ ++ .long 0xfc802f5c /* 124: fctidu f4,f5 */ ++ .long 0xfc802f5d /* 128: fctidu. f4,f5 */ ++ .long 0xfc802f5e /* 12c: fctiduz f4,f5 */ ++ .long 0xfc802f5f /* 130: fctiduz. f4,f5 */ ++ .long 0xfc802f9c /* 134: fcfidu f4,f5 */ ++ .long 0xfc802f9d /* 138: fcfidu. f4,f5 */ ++ .long 0xfc0a5900 /* 13c: ftdiv cr0,f10,f11 */ ++ .long 0xff8a5900 /* 140: ftdiv cr7,f10,f11 */ ++ .long 0xfc005140 /* 144: ftsqrt cr0,f10 */ ++ .long 0xff805140 /* 148: ftsqrt cr7,f10 */ ++ .long 0x7e084a2c /* 14c: dcbtt r8,r9 */ ++ .long 0x7e0849ec /* 150: dcbtstt r8,r9 */ ++ .long 0xed406644 /* 154: dcffix f10,f12 */ ++ .long 0xee80b645 /* 158: dcffix. f20,f22 */ ++ .long 0x7d4b6068 /* 15c: lbarx r10,r11,r12 */ ++ .long 0x7d4b6068 /* 160: lbarx r10,r11,r12 */ ++ .long 0x7d4b6069 /* 164: lbarx r10,r11,r12,1 */ ++ .long 0x7e95b0e8 /* 168: lharx r20,r21,r22 */ ++ .long 0x7e95b0e8 /* 16c: lharx r20,r21,r22 */ ++ .long 0x7e95b0e9 /* 170: lharx r20,r21,r22,1 */ ++ .long 0x7d4b656d /* 174: stbcx. r10,r11,r12 */ ++ .long 0x7d4b65ad /* 178: sthcx. r10,r11,r12 */ ++ .long 0xfdc07830 /* 17c: fre f14,f15 */ ++ .long 0xfdc07831 /* 180: fre. f14,f15 */ ++ .long 0xedc07830 /* 184: fres f14,f15 */ ++ .long 0xedc07831 /* 188: fres. f14,f15 */ ++ .long 0xfdc07834 /* 18c: frsqrte f14,f15 */ ++ .long 0xfdc07835 /* 190: frsqrte. f14,f15 */ ++ .long 0xedc07834 /* 194: frsqrtes f14,f15 */ ++ .long 0xedc07835 /* 198: frsqrtes. f14,f15 */ ++ .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */ diff --git a/gdb-readline-6.0-signal.patch b/gdb-readline-6.0-signal.patch index 0873bea..1b8c8c6 100644 --- a/gdb-readline-6.0-signal.patch +++ b/gdb-readline-6.0-signal.patch @@ -65,9 +65,11 @@ gdb/testsuite/ (send SIGINT signal to child process): Use gdb_test. (backtrace through readline handler): New. ---- a/gdb/config.in -+++ b/gdb/config.in -@@ -351,6 +351,9 @@ +Index: gdb-7.0.50.20100115/gdb/config.in +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/config.in 2010-01-15 12:48:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/config.in 2010-01-15 12:48:40.000000000 +0100 +@@ -359,6 +359,9 @@ /* Define if Python interpreter is being linked in. */ #undef HAVE_PYTHON @@ -77,9 +79,11 @@ gdb/testsuite/ /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -539,17 +539,25 @@ if test "$with_system_readline" = yes; then +Index: gdb-7.0.50.20100115/gdb/configure.ac +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/configure.ac 2010-01-15 12:48:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/configure.ac 2010-01-15 12:48:40.000000000 +0100 +@@ -777,17 +777,25 @@ if test "$with_system_readline" = yes; t # readline-6.0 started to use the name `_rl_echoing_p'. # `$(READLINE_DIR)/' of bundled readline would not resolve in configure. @@ -107,8 +111,10 @@ gdb/testsuite/ else READLINE='$(READLINE_DIR)/libreadline.a' READLINE_DEPS='$(READLINE)' ---- a/gdb/event-loop.c -+++ b/gdb/event-loop.c +Index: gdb-7.0.50.20100115/gdb/event-loop.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/event-loop.c 2010-01-01 08:31:31.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/event-loop.c 2010-01-15 12:48:40.000000000 +0100 @@ -37,6 +37,7 @@ #include "exceptions.h" #include "gdb_assert.h" @@ -144,9 +150,11 @@ gdb/testsuite/ /* Handle any new events occurred while waiting. */ if (process_event ()) return 1; ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -464,31 +464,42 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.gdb/selftest.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.gdb/selftest.exp 2010-01-15 12:48:01.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.gdb/selftest.exp 2010-01-15 12:48:40.000000000 +0100 +@@ -471,31 +471,42 @@ GDB.*Copyright \[0-9\]+ Free Software Fo fail "$description (timeout)" } } @@ -202,7 +210,7 @@ gdb/testsuite/ pass "$description" } -re ".*$gdb_prompt $" { -@@ -500,9 +510,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ +@@ -507,9 +518,6 @@ GDB.*Copyright \[0-9\]+ Free Software Fo setup_xfail "alpha*-*-osf*" fail "$description" } @@ -212,75 +220,407 @@ gdb/testsuite/ } ---- gdb-7.0/gdb/configure 2009-12-07 18:53:30.000000000 +0100 -+++ gdb-7.0-x/gdb/configure 2009-12-07 18:53:14.000000000 +0100 -@@ -9201,15 +9201,11 @@ if test "$with_system_readline" = yes; t +Index: gdb-7.0.50.20100115/gdb/configure +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/configure 2010-01-15 12:48:04.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/configure 2010-01-15 12:48:46.000000000 +0100 +@@ -6772,6 +6772,185 @@ else + fi + + ++ ++ ++ ++ ++# Check whether --with-separate-debug-dir was given. ++if test "${with_separate_debug_dir+set}" = set; then : ++ withval=$with_separate_debug_dir; ++ DEBUGDIR=$withval ++else ++ DEBUGDIR=${libdir}/debug ++fi ++ ++ ++ test "x$prefix" = xNONE && prefix="$ac_default_prefix" ++ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ++ ac_define_dir=`eval echo $DEBUGDIR` ++ ac_define_dir=`eval echo $ac_define_dir` ++ ++cat >>confdefs.h <<_ACEOF ++#define DEBUGDIR "$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 ++ value=0 ++ case ${ac_define_dir} in ++ "${test_prefix}"|"${test_prefix}/"*|\ ++ '${exec_prefix}'|'${exec_prefix}/'*) ++ value=1 ++ ;; ++ esac ++ ++cat >>confdefs.h <<_ACEOF ++#define DEBUGDIR_RELOCATABLE $value ++_ACEOF ++ ++ ++ ++# GDB's datadir relocation ++ ++ ++ ++# Check whether --with-gdb-datadir was given. ++if test "${with_gdb_datadir+set}" = set; then : ++ withval=$with_gdb_datadir; ++ GDB_DATADIR=$withval ++else ++ GDB_DATADIR=${datadir}/gdb ++fi ++ ++ ++ test "x$prefix" = xNONE && prefix="$ac_default_prefix" ++ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ++ ac_define_dir=`eval echo $GDB_DATADIR` ++ 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 ++ value=0 ++ case ${ac_define_dir} in ++ "${test_prefix}"|"${test_prefix}/"*|\ ++ '${exec_prefix}'|'${exec_prefix}/'*) ++ value=1 ++ ;; ++ esac ++ ++cat >>confdefs.h <<_ACEOF ++#define GDB_DATADIR_RELOCATABLE $value ++_ACEOF ++ ++ ++ ++ ++# Check whether --with-relocated-sources was given. ++if test "${with_relocated_sources+set}" = set; then : ++ withval=$with_relocated_sources; reloc_srcdir="${withval}" ++ ++ test "x$prefix" = xNONE && prefix="$ac_default_prefix" ++ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ++ ac_define_dir=`eval echo $reloc_srcdir` ++ ac_define_dir=`eval echo $ac_define_dir` ++ ++cat >>confdefs.h <<_ACEOF ++#define RELOC_SRCDIR "$ac_define_dir" ++_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 ++ ++ + # Integration with rpm library to support missing debuginfo suggestions. + # --without-rpm: Disable any rpm support. + # --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. +@@ -7255,185 +7434,6 @@ fi + + + +- +-# Check whether --with-separate-debug-dir was given. +-if test "${with_separate_debug_dir+set}" = set; then : +- withval=$with_separate_debug_dir; +- DEBUGDIR=$withval +-else +- DEBUGDIR=${libdir}/debug +-fi +- +- +- test "x$prefix" = xNONE && prefix="$ac_default_prefix" +- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $DEBUGDIR` +- ac_define_dir=`eval echo $ac_define_dir` +- +-cat >>confdefs.h <<_ACEOF +-#define DEBUGDIR "$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 +- value=0 +- case ${ac_define_dir} in +- "${test_prefix}"|"${test_prefix}/"*|\ +- '${exec_prefix}'|'${exec_prefix}/'*) +- value=1 +- ;; +- esac +- +-cat >>confdefs.h <<_ACEOF +-#define DEBUGDIR_RELOCATABLE $value +-_ACEOF +- +- +- +-# GDB's datadir relocation +- +- +- +-# Check whether --with-gdb-datadir was given. +-if test "${with_gdb_datadir+set}" = set; then : +- withval=$with_gdb_datadir; +- GDB_DATADIR=$withval +-else +- GDB_DATADIR=${datadir}/gdb +-fi +- +- +- test "x$prefix" = xNONE && prefix="$ac_default_prefix" +- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $GDB_DATADIR` +- 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 +- value=0 +- case ${ac_define_dir} in +- "${test_prefix}"|"${test_prefix}/"*|\ +- '${exec_prefix}'|'${exec_prefix}/'*) +- value=1 +- ;; +- esac +- +-cat >>confdefs.h <<_ACEOF +-#define GDB_DATADIR_RELOCATABLE $value +-_ACEOF +- +- +- +- +-# Check whether --with-relocated-sources was given. +-if test "${with_relocated_sources+set}" = set; then : +- withval=$with_relocated_sources; reloc_srcdir="${withval}" +- +- test "x$prefix" = xNONE && prefix="$ac_default_prefix" +- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- ac_define_dir=`eval echo $reloc_srcdir` +- ac_define_dir=`eval echo $ac_define_dir` +- +-cat >>confdefs.h <<_ACEOF +-#define RELOC_SRCDIR "$ac_define_dir" +-_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" + + +@@ -9290,10 +9290,10 @@ if test "$with_system_readline" = yes; t # readline-6.0 started to use the name `_rl_echoing_p'. # `$(READLINE_DIR)/' of bundled readline would not resolve in configure. -- echo "$as_me:$LINENO: checking for readline_echoing_p" >&5 --echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6 +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5 +-$as_echo_n "checking for readline_echoing_p... " >&6; } save_LIBS=$LIBS LIBS="$LIBS $READLINE" -- cat >conftest.$ac_ext <<_ACEOF --/* confdefs.h. */ --_ACEOF --cat confdefs.h >>conftest.$ac_ext --cat >>conftest.$ac_ext <<_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5 +$as_echo_n "checking for readline_echoing_p... " >&6; } -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - int -@@ -9221,45 +9217,45 @@ extern int readline_echoing_p; - return 0; - } - _ACEOF --rm -f conftest.$ac_objext conftest$ac_exeext --if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -- (eval $ac_link) 2>conftest.er1 -- ac_status=$? -- grep -v '^ *+' conftest.er1 >conftest.err -- rm -f conftest.er1 -- cat conftest.err >&5 -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); } && -- { ac_try='test -z "$ac_c_werror_flag" -- || test ! -s conftest.err' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; } && -- { ac_try='test -s conftest$ac_exeext' -- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -- (eval $ac_try) 2>&5 -- ac_status=$? -- echo "$as_me:$LINENO: \$? = $ac_status" >&5 -- (exit $ac_status); }; }; then -+if ac_fn_c_try_link "$LINENO"; then : - READLINE_ECHOING_P=yes - else -- echo "$as_me: failed program was:" >&5 --sed 's/^/| /' conftest.$ac_ext >&5 -+ READLINE_ECHOING_P=no - --READLINE_ECHOING_P=no -+$as_echo "#define readline_echoing_p _rl_echoing_p" >>confdefs.h -+ -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5 -+$as_echo "$READLINE_ECHOING_P" >&6; } +@@ -9316,9 +9316,35 @@ $as_echo "#define readline_echoing_p _rl + fi + rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +- LIBS="$save_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5 + $as_echo "$READLINE_ECHOING_P" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5 +$as_echo_n "checking for _rl_caught_signal... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - --cat >>confdefs.h <<\_ACEOF --#define readline_echoing_p _rl_echoing_p ++ +int +main () +{ @@ -289,24 +629,20 @@ gdb/testsuite/ + ; + return 0; +} - _ACEOF ++_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + READLINE_CAUGHT_SIGNAL=yes + +$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h - ++ +else + READLINE_CAUGHT_SIGNAL=no - fi --rm -f conftest.err conftest.$ac_objext \ -- conftest$ac_exeext conftest.$ac_ext ++fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5 +$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; } - LIBS="$save_LIBS" -- echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5 --echo "${ECHO_T}$READLINE_ECHOING_P" >&6 ++ LIBS="$save_LIBS" else READLINE='$(READLINE_DIR)/libreadline.a' READLINE_DEPS='$(READLINE)' diff --git a/gdb-readline-6.0.patch b/gdb-readline-6.0.patch deleted file mode 100644 index 2d0060b..0000000 --- a/gdb-readline-6.0.patch +++ /dev/null @@ -1,123 +0,0 @@ -gdb/ -2009-07-31 Jan Kratochvil - - Fix compatibility of --with-system-readline and readline-6.0+. - * configure.ac <--with-system-readline> (for readline_echoing_p): New - test. - * config.in: Regenerate. - * configure: Regenerate. - -Index: gdb-6.8.50.20090909/gdb/configure.ac -=================================================================== ---- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:11:04.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:11:54.000000000 +0200 -@@ -773,6 +773,21 @@ if test "$with_system_readline" = yes; t - READLINE=-lreadline - READLINE_DEPS= - READLINE_CFLAGS= -+ -+ # readline-6.0 started to use the name `_rl_echoing_p'. -+ # `$(READLINE_DIR)/' of bundled readline would not resolve in configure. -+ -+ AC_MSG_CHECKING([for readline_echoing_p]) -+ save_LIBS=$LIBS -+ LIBS="$LIBS $READLINE" -+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p; -+ return readline_echoing_p;]]), -+ [READLINE_ECHOING_P=yes], -+ [READLINE_ECHOING_P=no -+ AC_DEFINE([readline_echoing_p], [_rl_echoing_p], -+ [readline-6.0 started to use different name.])]) -+ LIBS="$save_LIBS" -+ AC_MSG_RESULT([$READLINE_ECHOING_P]) - else - READLINE='$(READLINE_DIR)/libreadline.a' - READLINE_DEPS='$(READLINE)' -Index: gdb-6.8.50.20090909/gdb/config.in -=================================================================== ---- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:11:33.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:12:00.000000000 +0200 -@@ -815,6 +815,9 @@ - /* Define to `int' if does not define. */ - #undef pid_t - -+/* readline-6.0 started to use different name. */ -+#undef readline_echoing_p -+ - /* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -Index: gdb-6.8.50.20090909/gdb/configure -=================================================================== ---- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:11:07.000000000 +0200 -+++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:11:54.000000000 +0200 -@@ -9197,6 +9197,69 @@ if test "$with_system_readline" = yes; t - READLINE=-lreadline - READLINE_DEPS= - READLINE_CFLAGS= -+ -+ # readline-6.0 started to use the name `_rl_echoing_p'. -+ # `$(READLINE_DIR)/' of bundled readline would not resolve in configure. -+ -+ echo "$as_me:$LINENO: checking for readline_echoing_p" >&5 -+echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6 -+ save_LIBS=$LIBS -+ LIBS="$LIBS $READLINE" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+extern int readline_echoing_p; -+ return readline_echoing_p; -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && -+ { ac_try='test -z "$ac_c_werror_flag" -+ || test ! -s conftest.err' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } && -+ { ac_try='test -s conftest$ac_exeext' -+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; }; then -+ READLINE_ECHOING_P=yes -+else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+READLINE_ECHOING_P=no -+ -+cat >>confdefs.h <<\_ACEOF -+#define readline_echoing_p _rl_echoing_p -+_ACEOF -+ -+fi -+rm -f conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LIBS="$save_LIBS" -+ echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5 -+echo "${ECHO_T}$READLINE_ECHOING_P" >&6 - else - READLINE='$(READLINE_DIR)/libreadline.a' - READLINE_DEPS='$(READLINE)' diff --git a/gdb-rhel5-compat.patch b/gdb-rhel5-compat.patch index 97b2719..33e63a9 100644 --- a/gdb-rhel5-compat.patch +++ b/gdb-rhel5-compat.patch @@ -1,9 +1,20 @@ gdb/linux-nat.c: - Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595). ---- gdb-6.8/gdb-orig/symfile.c 2008-08-21 00:06:50.000000000 +0200 -+++ gdb-6.8/gdb/symfile.c 2008-08-21 22:31:00.000000000 +0200 -@@ -1456,8 +1456,10 @@ find_separate_debug_file (struct objfile +Index: gdb-7.0.50.20100115/gdb/elfread.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/elfread.c 2010-01-15 22:19:28.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/elfread.c 2010-01-15 22:19:34.000000000 +0100 +@@ -582,7 +582,7 @@ elf_symtab_read (struct objfile *objfile + #define BUILD_ID_VERBOSE_NONE 0 + #define BUILD_ID_VERBOSE_FILENAMES 1 + #define BUILD_ID_VERBOSE_BINARY_PARSE 2 +-static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES; ++static int build_id_verbose = BUILD_ID_VERBOSE_NONE; + static void + show_build_id_verbose (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +@@ -1659,8 +1659,10 @@ find_separate_debug_file_by_buildid (str /* Prevent looping on a stripped .debug file. */ if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0) { @@ -14,9 +25,11 @@ gdb/linux-nat.c: xfree (build_id_name); } else if (build_id_name != NULL) ---- ./gdb/corelow.c 2010-01-01 16:04:34.000000000 +0100 -+++ ./gdb/corelow.c 2010-01-01 16:06:26.000000000 +0100 -@@ -277,7 +277,7 @@ add_to_thread_list (bfd *abfd, asection +Index: gdb-7.0.50.20100115/gdb/corelow.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/corelow.c 2010-01-15 22:19:27.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/corelow.c 2010-01-15 22:19:34.000000000 +0100 +@@ -294,7 +294,7 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current */ } @@ -25,21 +38,12 @@ gdb/linux-nat.c: static void build_id_locate_exec (int from_tty) ---- ./gdb/symfile.c 2010-01-01 16:04:35.000000000 +0100 -+++ ./gdb/symfile.c 2010-01-01 16:06:12.000000000 +0100 -@@ -1249,7 +1249,7 @@ symbol_file_clear (int from_tty) - #define BUILD_ID_VERBOSE_NONE 0 - #define BUILD_ID_VERBOSE_FILENAMES 1 - #define BUILD_ID_VERBOSE_BINARY_PARSE 2 --static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES; -+static int build_id_verbose = BUILD_ID_VERBOSE_NONE; - static void - show_build_id_verbose (struct ui_file *file, int from_tty, - struct cmd_list_element *c, const char *value) ---- gdb-7.0-orig/gdb/linux-nat.c 2009-12-19 20:53:46.000000000 +0100 -+++ gdb-7.0/gdb/linux-nat.c 2009-12-19 20:55:02.000000000 +0100 -@@ -1604,8 +1604,22 @@ GPT: lwp %s had signal %s, but it is in - *status = lp->status; +Index: gdb-7.0.50.20100115/gdb/linux-nat.c +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/linux-nat.c 2010-01-15 22:19:27.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/linux-nat.c 2010-01-15 22:19:55.000000000 +0100 +@@ -1768,8 +1768,22 @@ GPT: lwp %s had signal %s, but it is in + target_signal_to_string (signo)); } - if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped) diff --git a/gdb-rhel5-gcc44.patch b/gdb-rhel5-gcc44.patch index c1fa8c4..15d34df 100644 --- a/gdb-rhel5-gcc44.patch +++ b/gdb-rhel5-gcc44.patch @@ -1,8 +1,10 @@ Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as the default gcc and gfortran binaries are from gcc-4.1. ---- gdb-7.0/gdb/testsuite/gdb.base/vla.exp-orig 2009-12-20 00:38:13.000000000 +0100 -+++ gdb-7.0/gdb/testsuite/gdb.base/vla.exp 2009-12-20 00:54:19.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/vla.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/vla.exp 2010-01-15 22:14:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/vla.exp 2010-01-15 22:14:51.000000000 +0100 @@ -16,7 +16,25 @@ set testfile vla set srcfile ${testfile}.c @@ -30,8 +32,10 @@ the default gcc and gfortran binaries are from gcc-4.1. untested "Couldn't compile test program" return -1 } ---- gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp-orig 2009-12-20 00:38:13.000000000 +0100 -+++ gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp 2009-12-20 01:11:47.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.base/break-interp.exp 2010-01-14 22:12:00.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.base/break-interp.exp 2010-01-15 22:14:51.000000000 +0100 @@ -31,10 +31,30 @@ if [get_compiler_info ${binfile_lib}] { return -1 } @@ -64,7 +68,7 @@ the default gcc and gfortran binaries are from gcc-4.1. return -1 } -@@ -483,9 +503,33 @@ foreach ldprelink {NO YES} { +@@ -480,9 +500,33 @@ foreach ldprelink {NO YES} { if {$binpie == "YES"} { lappend opts {additional_flags=-fPIE -pie} } @@ -100,8 +104,10 @@ the default gcc and gfortran binaries are from gcc-4.1. if {$binsepdebug == "SEP"} { gdb_gnu_strip_debug $exec # Just a sanity check. As gdb_gnu_strip_debug uses the ---- ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:13:56.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:21:00.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/common-block.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/common-block.exp 2010-01-15 22:14:17.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/common-block.exp 2010-01-15 22:14:51.000000000 +0100 @@ -20,7 +20,25 @@ set testfile "common-block" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -129,8 +135,10 @@ the default gcc and gfortran binaries are from gcc-4.1. untested "Couldn't compile ${srcfile}" return -1 } ---- ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:13:56.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:20:07.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dwarf-stride.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-01-15 22:14:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-01-15 22:14:51.000000000 +0100 @@ -27,7 +27,25 @@ set testfile dwarf-stride set srcfile ${testfile}.f90 @@ -158,8 +166,10 @@ the default gcc and gfortran binaries are from gcc-4.1. return -1 } ---- ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:13:56.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:17:21.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dynamic.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2010-01-15 22:14:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/dynamic.exp 2010-01-15 22:14:51.000000000 +0100 @@ -25,7 +25,25 @@ set testfile "dynamic" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -187,8 +197,10 @@ the default gcc and gfortran binaries are from gcc-4.1. untested "Couldn't compile ${srcfile}" return -1 } ---- ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:13:56.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:22:37.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/library-module.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/library-module.exp 2010-01-15 22:14:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/library-module.exp 2010-01-15 22:14:51.000000000 +0100 @@ -25,16 +25,34 @@ if [get_compiler_info not-used] { return -1 } @@ -228,8 +240,10 @@ the default gcc and gfortran binaries are from gcc-4.1. untested "Couldn't compile ${srcfile}" return -1 } ---- ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:13:56.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:28:49.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/module.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/module.exp 2010-01-15 22:14:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/module.exp 2010-01-15 22:14:51.000000000 +0100 @@ -16,7 +16,25 @@ set testfile "module" set srcfile ${testfile}.f90 @@ -257,8 +271,10 @@ the default gcc and gfortran binaries are from gcc-4.1. return -1 } ---- ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:13:56.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:18:13.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/string.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/string.exp 2010-01-15 22:14:13.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/string.exp 2010-01-15 22:14:51.000000000 +0100 @@ -23,7 +23,25 @@ set testfile "string" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -286,8 +302,10 @@ the default gcc and gfortran binaries are from gcc-4.1. untested "Couldn't compile ${srcfile}" return -1 } ---- gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp-orig 2009-12-20 09:47:04.000000000 +0100 -+++ gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp 2009-12-20 09:50:06.000000000 +0100 +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/omp-step.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2010-01-15 22:14:16.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/omp-step.exp 2010-01-15 22:14:51.000000000 +0100 @@ -15,7 +15,26 @@ set testfile "omp-step" @@ -316,13 +334,16 @@ the default gcc and gfortran binaries are from gcc-4.1. return -1 } ---- ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-01-07 13:39:13.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-12-20 12:37:12.000000000 +0100 -@@ -26,7 +26,25 @@ set testfile "derived-type" +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/derived-type.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-01 08:32:02.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-15 22:16:20.000000000 +0100 +@@ -28,8 +28,26 @@ set testfile "derived-type" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { +-if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ +- executable {debug f77}] != ""} { +# Temporarily provide f77compiler=gfortran44 saving the original value around. + +set board [target_info name] @@ -334,7 +355,8 @@ the default gcc and gfortran binaries are from gcc-4.1. +} +set_board_info f77compiler gfortran44 + -+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] ++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ ++ executable {debug f77}] + +unset_board_info f77compiler +if [info exists old_f77compiler] { @@ -342,16 +364,19 @@ the default gcc and gfortran binaries are from gcc-4.1. +} + +if { $err != "" } { - untested "Couldn't compile ${srcfile}" return -1 } ---- ./gdb/testsuite/gdb.fortran/subarray.exp 2009-01-07 13:39:13.000000000 +0100 -+++ ./gdb/testsuite/gdb.fortran/subarray.exp 2009-12-20 12:38:00.000000000 +0100 -@@ -26,7 +26,25 @@ set testfile "subarray" + +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/subarray.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-01 08:32:02.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-15 22:17:18.000000000 +0100 +@@ -28,8 +28,26 @@ set testfile "subarray" set srcfile ${testfile}.f set binfile ${objdir}/${subdir}/${testfile} --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { +-if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ +- executable {debug f77}] != ""} { +# Temporarily provide f77compiler=gfortran44 saving the original value around. + +set board [target_info name] @@ -363,7 +388,8 @@ the default gcc and gfortran binaries are from gcc-4.1. +} +set_board_info f77compiler gfortran44 + -+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] ++set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ ++ executable {debug f77}] + +unset_board_info f77compiler +if [info exists old_f77compiler] { @@ -371,11 +397,13 @@ the default gcc and gfortran binaries are from gcc-4.1. +} + +if { $err != "" } { - untested "Couldn't compile ${srcfile}" return -1 } ---- ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:22:18.000000000 +0100 -+++ ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:39:53.000000000 +0100 + +Index: gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/tls-sepdebug.exp +=================================================================== +--- gdb-7.0.50.20100115.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-01-15 22:14:15.000000000 +0100 ++++ gdb-7.0.50.20100115/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-01-15 22:14:51.000000000 +0100 @@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi # FIXME: gcc dependency (-Wl,-soname). diff --git a/gdb-stabs-read_args.patch b/gdb-stabs-read_args.patch deleted file mode 100644 index 6e16924..0000000 --- a/gdb-stabs-read_args.patch +++ /dev/null @@ -1,70 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-01/msg00142.html -Subject: [patch] Fix crash reading broken stabs - -Hi, - -seen this stabs from unknown variant of gcc-4.1.2: - -1176586 LSYM 0 154 00000000 16682076 basic_string,std::allocator >::_Rep:Tt(0,34)=s12!1,020,(0,35)=xs_Rep_base:;_S_max_size:/2(0,36)=k(0,30):_ZNSs4_Rep11_S_max_sizeE;_S_terminal:/2(0,22):_ZNSs4_Rep11_S_terminalE;_S_empty_rep_storage:/2(0,37)=ar(0,38)=r(0,38);0;037777777777;;0;3;(0,30):_ZNSs4_Rep20_S_empty_rep_storageE;_S_empty_rep::(0,39)=f(0,40)=&(0,34):_ZNSs4_Rep12_S_empty_repEv;2A?;_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);:_ZNKSs4_Rep12_M_is_leakedEv;2B.;_M_is_shared::(0,41):_ZNKSs4_Rep12_M_is_sharedEv;2B.;_M_set_leaked::(0,45)=#(0,34),(0,1),(0,33),(0,1);:_ZNSs4_Rep13_M_set_leakedEv;2A.;_M_set_sharable::(0,45):_ZNSs4_Rep15_M_set_sharableEv;2A.;_M_set_length_and_sharable::(0,46)=#(0,34),(0,1),(0,33),(0,25),(0,1);:_ZNSs4_Rep26_M_set_length_and_sharableEj;2A.;_M_refdata::(0,47)=#(0,34),(0,3),(0,33),(0,1);:_ZNSs4_Rep10_M_refdataEv;2A.;_M_grab::(0,48)=#(0,34),(0,3),(0,33),(0,5),(0,5),(0,1);:_ZNSs4_Rep7_M_grabERKSaIcES2_;2A.;_S_create::(0,49)=f(0,33):_ZNSs4_Rep9_S_createEjjRKSaIcE;2A?;_M_dispose::(0,50)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_disposeERKSaIcE;2A.;_M_destroy::(0,51)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_destroyERKSaIcE;2A.;_M_refcopy::(0,47):_ZNSs4_Rep10_M_refcopyEv;2A.;_M_clone::(0,52)=#(0,34),(0,3),(0,33),(0,5),(0,25),(0,1);:_ZNSs4_Rep8_M_cloneERKSaIcEj;2A.;; - -There is a GDB crash at: -_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1); - ^^ -+ [...] Some broken stabs -+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should -+ have been present ";-16,(0,43)" reference instead. This way the -+ excessive ";" marker prematurely stops the parameters parsing. */ - -Still I was unable to reproduce producing such STABS output. - -So this patch does not try to compensate the - presumably - buggy STABS output -and parses such record incorrectly. But it no longer crashes. - -No regressions on {x86_64-m32,i686}-fedora12-linux-gnu -using --target_board unix/-gstabs+/-m32. - - -Thanks, -Jan - - -gdb/ -2010-01-07 Jan Kratochvil - - * stabsread.c (read_args): Handle zero arguments. - -gdb/testsuite/ -2010-01-07 Jan Kratochvil - - * gdb.stabs/weird.def (args93): New. - ---- a/gdb/stabsread.c -+++ b/gdb/stabsread.c -@@ -4111,7 +4111,17 @@ read_args (char **pp, int end, struct objfile *objfile, int *nargsp, - } - (*pp)++; /* get past `end' (the ':' character) */ - -- if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID) -+ if (n == 0) -+ { -+ /* We should read at least the THIS parameter here. Some broken stabs -+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should -+ have been present ";-16,(0,43)" reference instead. This way the -+ excessive ";" marker prematurely stops the parameters parsing. */ -+ -+ complaint (&symfile_complaints, _("Invalid (empty) method arguments")); -+ *varargsp = 0; -+ } -+ else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID) - *varargsp = 1; - else - { ---- a/gdb/testsuite/gdb.stabs/weird.def -+++ b/gdb/testsuite/gdb.stabs/weird.def -@@ -880,3 +880,6 @@ var3: - .stabs "sym92:\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0 - .stabs "type92:t92=\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0 - .stabs "attr92:G392=@\ !#$%&'()*+,-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~;1",N_GSYM,0,0, 0 -+ -+# See read_args "Invalid (empty) method arguments" error. -+.stabs "args93:G93=#(0,93),(0,93)=@s8;-16;,(0,93),(0,93);",N_GSYM,0,0,0 diff --git a/gdb-testsuite-unknown-output.patch b/gdb-testsuite-unknown-output.patch deleted file mode 100644 index 89decac..0000000 --- a/gdb-testsuite-unknown-output.patch +++ /dev/null @@ -1,69 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2009-12/msg00473.html -Subject: [patch] testsuite: false MI "unknown output after running" regression - -Hi, - -the attached patch will turn the results this way: --KFAIL: gdb.mi/mi-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104) -+KFAIL: gdb.mi/mi-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104) --XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (unknown output after running) -+XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (stopped at wrong place) --KFAIL: gdb.mi/mi2-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104) -+KFAIL: gdb.mi/mi2-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104) --XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (unknown output after running) -+XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (stopped at wrong place) - -This is a fix of KFAIL-kind regression due to: -commit 26d086d741fb1bb0eee9d50e0bafa7c5e388023f -Re: [RFA] fix *stopped for CLI commands -http://sourceware.org/ml/gdb-patches/2009-02/msg00278.html -http://sourceware.org/ml/gdb-cvs/2009-02/msg00084.html -part: -gdb/testsuite/ -2009-02-14 Vladimir Prus - * lib/mi-support.exp (mi_expect_stop): Adjust the order of fields. - (mi_expect_interrupt): Likewise. - * gdb.mi/mi-cli.exp: Check that "step" results in proper *stopped - response. - -re-wdiff-ed for your convenience as: - verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" - -re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" { - -re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}[-$any-]{+thread-id=\"$decimal\",stopped-threads=$any+}\r\n$prompt_re" { - -FYI there is: set any "\[^\n\]*" - -"stopped at wrong place" is the right kind of KFAIL/XFAIL (tested -gcc-4.1.2-46.el5_4.1.x86_64 and gcc-4.4.2-20.fc12.x86_64) as discussed -in PR gdb/2104. - -In the last case there is missing comma (,) after the former patch above. - -$after_stopped was IMO missing there even before. It is in use only by -gdb.mi/mi-simplerun.exp and gdb.mi/mi2-simplerun.exp. Also fixed below. - -No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. - - -Thanks, -Jan - - -gdb/testsuite/ -2009-12-31 Jan Kratochvil - - * lib/mi-support.exp (mi_expect_stop ): Insert - missing $after_stopped and comma (,) expectation. - ---- a/gdb/testsuite/lib/mi-support.exp -+++ b/gdb/testsuite/lib/mi-support.exp -@@ -1038,7 +1038,7 @@ proc mi_expect_stop { reason func args file line extra test } { - pass "$test" - return $expect_out(2,string) - } -- -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" { -+ -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" { - verbose -log "got $expect_out(buffer)" - fail "$test (stopped at wrong place)" - return -1 - diff --git a/gdb-tracepoint-warning.patch b/gdb-tracepoint-warning.patch new file mode 100644 index 0000000..4c51071 --- /dev/null +++ b/gdb-tracepoint-warning.patch @@ -0,0 +1,221 @@ +Re: cvs tracepoint.c build error +http://sourceware.org/ml/gdb/2010-01/msg00150.html + +--- a/gdb/tracepoint.c ++++ b/gdb/tracepoint.c +@@ -1647,8 +1647,8 @@ trace_status_command (char *args, int from_tty) + + if (ts->buffer_free) + { +- printf_filtered (_("Trace buffer has %d bytes free.\n"), +- ts->buffer_free); ++ printf_filtered (_("Trace buffer has %lld bytes free.\n"), ++ (long long) ts->buffer_free); + } + + /* Now report on what we're doing with tfind. */ +@@ -2389,7 +2389,7 @@ trace_save_command (char *args, int from_tty) + /* Write a file header, with a high-bit-set char to indicate a + binary file, plus a hint as what this file is, and a version + number in case of future needs. */ +- fwrite ("\x7fTRACE0\n", 8, 1, fp); ++ 1 || fwrite ("\x7fTRACE0\n", 8, 1, fp); + + /* Write descriptive info. */ + +@@ -2473,12 +2473,12 @@ trace_save_command (char *args, int from_tty) + /* No more data is forthcoming, we're done. */ + if (gotten == 0) + break; +- fwrite (buf, gotten, 1, fp); ++ 1 || fwrite (buf, gotten, 1, fp); + offset += gotten; + } + + /* Mark the end of trace data. */ +- fwrite (&gotten, 4, 1, fp); ++ 1 || fwrite (&gotten, 4, 1, fp); + + do_cleanups (cleanup); + if (from_tty) +@@ -2785,7 +2785,7 @@ tfile_open (char *filename, int from_tty) + int scratch_chan; + char header[TRACE_HEADER_SIZE]; + char linebuf[1000]; /* should be max remote packet size or so */ +- char byte; ++ char byte = 0; + int bytes, i; + struct trace_status *ts; + struct uploaded_tp *uploaded_tps = NULL; +@@ -2823,7 +2823,7 @@ tfile_open (char *filename, int from_tty) + + bytes = 0; + /* Read the file header and test for validity. */ +- read (trace_fd, &header, TRACE_HEADER_SIZE); ++ 1 || read (trace_fd, &header, TRACE_HEADER_SIZE); + bytes += TRACE_HEADER_SIZE; + if (!(header[0] == 0x7f + && (strncmp (header + 1, "TRACE0\n", 7) == 0))) +@@ -2844,7 +2844,7 @@ tfile_open (char *filename, int from_tty) + i = 0; + while (1) + { +- read (trace_fd, &byte, 1); ++ 1 || read (trace_fd, &byte, 1); + ++bytes; + if (byte == '\n') + { +@@ -3141,7 +3141,7 @@ static ULONGEST + tfile_get_traceframe_address (off_t tframe_offset) + { + ULONGEST addr = 0; +- short tpnum; ++ short tpnum = 0; + struct breakpoint *tp; + off_t saved_offset = cur_offset; + +@@ -3149,7 +3149,7 @@ tfile_get_traceframe_address (off_t tframe_offset) + + /* Fall back to using tracepoint address. */ + lseek (trace_fd, tframe_offset, SEEK_SET); +- read (trace_fd, &tpnum, 2); ++ 1 || read (trace_fd, &tpnum, 2); + tp = get_tracepoint_by_number_on_target (tpnum); + if (tp && tp->loc) + addr = tp->loc->address; +@@ -3169,7 +3169,7 @@ static int + tfile_trace_find (enum trace_find_type type, int num, + ULONGEST addr1, ULONGEST addr2, int *tpp) + { +- short tpnum; ++ short tpnum = 0; + int tfnum = 0, found = 0; + int data_size; + struct breakpoint *tp; +@@ -3181,11 +3181,11 @@ tfile_trace_find (enum trace_find_type type, int num, + while (1) + { + tframe_offset = offset; +- read (trace_fd, &tpnum, 2); ++ 1 || read (trace_fd, &tpnum, 2); + offset += 2; + if (tpnum == 0) + break; +- read (trace_fd, &data_size, 4); ++ 1 || read (trace_fd, &data_size, 4); + offset += 4; + switch (type) + { +@@ -3245,9 +3245,9 @@ tfile_fetch_registers (struct target_ops *ops, + struct regcache *regcache, int regno) + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); +- char block_type; ++ char block_type = 0; + int i, pos, offset, regn, regsize; +- unsigned short mlen; ++ unsigned short mlen = 0; + char *regs; + + /* An uninitialized reg size says we're not going to be +@@ -3261,12 +3261,12 @@ tfile_fetch_registers (struct target_ops *ops, + pos = 0; + while (pos < cur_data_size) + { +- read (trace_fd, &block_type, 1); ++ 1 || read (trace_fd, &block_type, 1); + ++pos; + switch (block_type) + { + case 'R': +- read (trace_fd, regs, trace_regblock_size); ++ 1 || read (trace_fd, regs, trace_regblock_size); + /* Assume the block is laid out in GDB register number order, + each register with the size that it has in GDB. */ + offset = 0; +@@ -3293,7 +3293,7 @@ tfile_fetch_registers (struct target_ops *ops, + return; + case 'M': + lseek (trace_fd, 8, SEEK_CUR); +- read (trace_fd, &mlen, 2); ++ 1 || read (trace_fd, &mlen, 2); + lseek (trace_fd, mlen, SEEK_CUR); + pos += (8 + 2 + mlen); + break; +@@ -3314,10 +3314,10 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object, + const char *annex, gdb_byte *readbuf, + const gdb_byte *writebuf, ULONGEST offset, LONGEST len) + { +- char block_type; ++ char block_type = 0; + int pos; +- ULONGEST maddr; +- unsigned short mlen; ++ ULONGEST maddr = 0; ++ unsigned short mlen = 0; + + /* We're only doing regular memory for now. */ + if (object != TARGET_OBJECT_MEMORY) +@@ -3330,7 +3330,7 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object, + pos = 0; + while (pos < cur_data_size) + { +- read (trace_fd, &block_type, 1); ++ 1 || read (trace_fd, &block_type, 1); + ++pos; + switch (block_type) + { +@@ -3339,11 +3339,11 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object, + pos += trace_regblock_size; + break; + case 'M': +- read (trace_fd, &maddr, 8); +- read (trace_fd, &mlen, 2); ++ 1 || read (trace_fd, &maddr, 8); ++ 1 || read (trace_fd, &mlen, 2); + if (maddr <= offset && (offset + len) <= (maddr + mlen)) + { +- read (trace_fd, readbuf, mlen); ++ 1 || read (trace_fd, readbuf, mlen); + return mlen; + } + lseek (trace_fd, mlen, SEEK_CUR); +@@ -3369,15 +3369,15 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object, + static int + tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val) + { +- char block_type; +- int pos, vnum; +- unsigned short mlen; ++ char block_type = 0; ++ int pos, vnum = 0; ++ unsigned short mlen = 0; + + lseek (trace_fd, cur_offset, SEEK_SET); + pos = 0; + while (pos < cur_data_size) + { +- read (trace_fd, &block_type, 1); ++ 1 || read (trace_fd, &block_type, 1); + ++pos; + switch (block_type) + { +@@ -3387,15 +3387,15 @@ tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val) + break; + case 'M': + lseek (trace_fd, 8, SEEK_CUR); +- read (trace_fd, &mlen, 2); ++ 1 || read (trace_fd, &mlen, 2); + lseek (trace_fd, mlen, SEEK_CUR); + pos += (8 + 2 + mlen); + break; + case 'V': +- read (trace_fd, &vnum, 4); ++ 1 || read (trace_fd, &vnum, 4); + if (tsvnum == vnum) + { +- read (trace_fd, val, 8); ++ 1 || read (trace_fd, val, 8); + return 1; + } + lseek (trace_fd, 8, SEEK_CUR); diff --git a/gdb.spec b/gdb.spec index 4e513e9..2d71db8 100644 --- a/gdb.spec +++ b/gdb.spec @@ -32,17 +32,17 @@ 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.0.1 +Version: 7.0.50.20100116 # 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: 25%{?_with_upstream:.upstream}%{dist} +Release: 1%{?_with_upstream:.upstream}%{dist} License: GPLv3+ Group: Development/Debuggers # 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/ @@ -118,7 +118,7 @@ Patch118: gdb-6.3-gstack-20050411.patch # VSYSCALL and PIE Patch122: gdb-6.3-test-pie-20050107.patch -Patch124: gdb-archer-pie.patch +Patch124: gdb-archer-pie-0315-breakpoint_address_match.patch Patch389: gdb-archer-pie-addons.patch Patch394: gdb-archer-pie-addons-keep-disabled.patch @@ -240,8 +240,8 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch # Testcase for exec() from threaded program (BZ 202689). Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch -# Backported post gdb-7.0 fixups. -Patch232: gdb-7.0-upstream.patch +# Backported fixups post the source tarball. +#Patch232: gdb-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch @@ -376,12 +376,8 @@ Patch349: gdb-archer.patch # Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). # - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE. -Patch352: gdb-6.8-bz457187-largefile.patch Patch360: gdb-6.8-bz457187-largefile-test.patch -# Fix compatibility of --with-system-readline and readline-6.0+. -Patch375: gdb-readline-6.0.patch - # Fix python pretty printers lookup on x86_64. Patch376: libstdc++-v3-python-common-prefix.patch @@ -391,17 +387,9 @@ Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch # Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. Patch382: gdb-core-open-vdso-warning.patch -# Support multiple directories for `set debug-file-directory' (BZ 528668). -Patch383: gdb-bz528668-symfile-sepcrc.patch -Patch384: gdb-bz528668-symfile-cleanup.patch -Patch385: gdb-bz528668-symfile-multi.patch - # Support GNU IFUNCs - indirect functions (BZ 539590). Patch387: gdb-bz539590-gnu-ifunc.patch -# Fix bp conditionals [bp_location-accel] regression (BZ 538626). -Patch388: gdb-bz538626-bp_location-accel-bp-cond.patch - # Fix callback-mode readline-6.0 regression for CTRL-C. Patch390: gdb-readline-6.0-signal.patch @@ -421,23 +409,30 @@ Patch335: gdb-rhel5-compat.patch # Fix backward compatibility with G++ 4.1 namespaces "::". Patch395: gdb-empty-namespace.patch -# Fix regression on re-setting the single ppc watchpoint slot. -Patch396: gdb-ppc-hw-watchpoint-twice.patch - # Fix regression by python on ia64 due to stale current frame. Patch397: gdb-follow-child-stale-parent.patch -# testsuite: Fix false MI "unknown output after running" regression. -Patch398: gdb-testsuite-unknown-output.patch - -# Fix regression of gdb-7.0.1 not preserving typedef of a field. -Patch399: gdb-bitfield-check_typedef.patch - # Fix related_breakpoint stale ref crash. Patch400: gdb-stale-related_breakpoint.patch -# Fix crash reading broken stabs (it377671). -Patch401: gdb-stabs-read_args.patch +# Workaround ccache making lineno non-zero for command-line definitions. +Patch403: gdb-ccache-workaround.patch + +# Implement `info common' for Fortran. +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 + +# Test power7 ppc disassembly. +Patch408: gdb-ppc-power7-test.patch + +# Fix tracepoint.c compilation warnings. +Patch409: gdb-tracepoint-warning.patch BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa} Requires: readline%{?_isa} @@ -568,12 +563,8 @@ 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 -%patch383 -p1 -%patch384 -p1 -%patch385 -p1 -%patch388 -p1 %patch124 -p1 %patch1 -p1 %patch3 -p1 @@ -670,17 +661,26 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch337 -p1 %patch343 -p1 %patch348 -p1 -%patch352 -p1 %patch360 -p1 -%patch375 -p1 %patch376 -p1 %patch381 -p1 %patch382 -p1 %patch387 -p1 -%patch389 -p1 %patch390 -p1 %patch391 -p1 %patch392 -p1 +%patch395 -p1 +%patch397 -p1 +%patch400 -p1 +%patch403 -p1 +%patch404 -p1 +%patch405 -p1 +%patch389 -p1 +%patch394 -p1 +%patch406 -p1 +%patch407 -p1 +%patch408 -p1 +%patch409 -p1 # Always verify its applicability. %patch393 -p1 %patch335 -p1 @@ -688,14 +688,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch393 -p1 -R %patch335 -p1 -R %endif -%patch394 -p1 -%patch395 -p1 -%patch396 -p1 -%patch397 -p1 -%patch398 -p1 -%patch399 -p1 -%patch400 -p1 -%patch401 -p1 find -name "*.orig" | xargs rm -f ! find -name "*.rej" # Should not happen. @@ -777,7 +769,7 @@ $(: RHEL-5 librpm has incompatible API. ) \ %if 0%{?el5:1} --without-rpm \ %else - --with-rpm=librpm.so.0 \ + --with-rpm=librpm.so.1 \ %endif %ifarch ia64 --with-libunwind \ @@ -1014,6 +1006,14 @@ fi %endif %changelog +* Sat Jan 16 2010 Jan Kratochvil - 7.0.50.20100116-1.fc13 +- Upgrade to the FSF GDB snapshot: 7.0.50.20100116 +- archer-jankratochvil-fedora13 commit: 81810a20b2d2c3bf18e151de3cddfc96445b3c46 +- [expr-cumulative] Archer branch is missing in this release. +- Update rpm.org#76 workaround for rpm-4.8 using librpm.so.1. +- Dissect archer-jankratochvil-misc into Patch403...Patch408. +- Some regressions exist in this release. + * Tue Jan 12 2010 Jan Kratochvil - 7.0.1-25.fc12 - non-librpm missing debuginfo yumcommand now prints also --disablerepo='*' to save some bandwidth by yum (Robin Green, BZ 554152). diff --git a/sources b/sources index 3678d3c..baf2be4 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -53ebade39bfdc1d06744e5188b6438b1 gdb-7.0.1.tar.bz2 +446db9ed2489ab9984f67923a51b74a9 gdb-7.0.50.20100116.tar.bz2 7507540c50a1edeb2fc22a37bc4a08b8 libstdc++-v3-python-r151798.tar.bz2