Rebase to FSF GDB 7.2.90.20110525 (which is a 7.3 pre-release).

[stap] Fix double free (Sergio Durigan Junior).
This commit is contained in:
Jan Kratochvil 2011-05-25 21:25:26 +02:00
parent 4adfc8b85c
commit c8a4544144
13 changed files with 618 additions and 1813 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/libstdc++-v3-python-r155978.tar.bz2
/gdb-7.2.90.20110429.tar.bz2
/gdb-7.2.90.20110525.tar.bz2

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/dwarf2read.c 2011-01-17 15:56:23.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/dwarf2read.c 2011-01-17 16:00:14.000000000 +0100
@@ -7475,7 +7475,12 @@ read_common_block (struct die_info *die,
--- gdb-7.2.90.20110525.orig/gdb/dwarf2read.c 2011-05-25 17:10:46.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/dwarf2read.c 2011-05-25 17:12:35.000000000 +0200
@@ -7675,7 +7675,12 @@ read_common_block (struct die_info *die,
{
struct attribute *attr;
struct symbol *sym;
@ -16,7 +16,7 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr)
@@ -7484,6 +7489,7 @@ read_common_block (struct die_info *die,
@@ -7684,6 +7689,7 @@ read_common_block (struct die_info *die,
if (attr_form_is_block (attr))
{
base = decode_locdesc (DW_BLOCK (attr), cu);
@ -24,15 +24,15 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
}
else if (attr_form_is_section_offset (attr))
{
@@ -7545,12 +7551,15 @@ read_common_block (struct die_info *die,
else
dwarf2_complex_location_expr_complaint ();
- SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
@@ -7736,12 +7742,15 @@ read_common_block (struct die_info *die,
if (sym != NULL
&& handle_data_member_location (child_die, cu, &offset))
{
- SYMBOL_VALUE_ADDRESS (sym) = base + offset;
+ if (!base_p)
+ dwarf2_invalid_attrib_class_complaint
+ ("DW_AT_data_member_location", "common block member");
+ SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset + baseaddr;
+ SYMBOL_VALUE_ADDRESS (sym) = base + offset + baseaddr;
add_symbol_to_list (sym, &global_symbols);
}
@ -42,7 +42,7 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
else
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
@@ -7564,7 +7573,7 @@ read_common_block (struct die_info *die,
@@ -7755,7 +7764,7 @@ read_common_block (struct die_info *die,
sym = new_symbol (die, type, cu);
/* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
@ -51,11 +51,11 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
set_die_type (die, type, cu);
}
Index: gdb-7.2.50.20110117/gdb/gdbtypes.h
Index: gdb-7.2.90.20110525/gdb/gdbtypes.h
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/gdbtypes.h 2011-01-17 15:51:03.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/gdbtypes.h 2011-01-17 16:00:32.000000000 +0100
@@ -394,6 +394,7 @@ enum type_instance_flag_value
--- gdb-7.2.90.20110525.orig/gdb/gdbtypes.h 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/gdbtypes.h 2011-05-25 17:11:10.000000000 +0200
@@ -396,6 +396,7 @@ enum type_instance_flag_value
enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /* bitpos */
@ -63,7 +63,7 @@ Index: gdb-7.2.50.20110117/gdb/gdbtypes.h
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
FIELD_LOC_KIND_PHYSNAME /* physname */
};
@@ -576,6 +577,7 @@ struct main_type
@@ -580,6 +581,7 @@ struct main_type
is the location (in the target) of the static field.
Otherwise, physname is the mangled label of the static field. */
@ -71,7 +71,7 @@ Index: gdb-7.2.50.20110117/gdb/gdbtypes.h
CORE_ADDR physaddr;
char *physname;
}
@@ -1102,6 +1104,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1106,6 +1108,7 @@ extern void allocate_gnat_aux_type (stru
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
@ -79,7 +79,7 @@ Index: gdb-7.2.50.20110117/gdb/gdbtypes.h
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
@@ -1109,6 +1112,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1113,6 +1116,7 @@ extern void allocate_gnat_aux_type (stru
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
@ -87,7 +87,7 @@ Index: gdb-7.2.50.20110117/gdb/gdbtypes.h
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -1121,6 +1125,7 @@ extern void allocate_gnat_aux_type (stru
@@ -1125,6 +1129,7 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
@ -95,10 +95,10 @@ Index: gdb-7.2.50.20110117/gdb/gdbtypes.h
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
Index: gdb-7.2.50.20110117/gdb/jv-lang.c
Index: gdb-7.2.90.20110525/gdb/jv-lang.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/jv-lang.c 2011-01-09 04:08:57.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/jv-lang.c 2011-01-17 16:00:59.000000000 +0100
--- gdb-7.2.90.20110525.orig/gdb/jv-lang.c 2011-03-02 01:42:53.000000000 +0100
+++ gdb-7.2.90.20110525/gdb/jv-lang.c 2011-05-25 17:11:10.000000000 +0200
@@ -414,7 +414,8 @@ java_link_class_type (struct gdbarch *gd
fields = NULL;
@ -119,11 +119,11 @@ Index: gdb-7.2.50.20110117/gdb/jv-lang.c
else
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
Index: gdb-7.2.50.20110117/gdb/value.c
Index: gdb-7.2.90.20110525/gdb/value.c
===================================================================
--- gdb-7.2.50.20110117.orig/gdb/value.c 2011-01-17 15:47:37.000000000 +0100
+++ gdb-7.2.50.20110117/gdb/value.c 2011-01-17 16:00:14.000000000 +0100
@@ -1997,7 +1997,8 @@ value_static_field (struct type *type, i
--- gdb-7.2.90.20110525.orig/gdb/value.c 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/value.c 2011-05-25 17:11:10.000000000 +0200
@@ -2492,7 +2492,8 @@ value_static_field (struct type *type, i
{
case FIELD_LOC_KIND_PHYSADDR:
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),

File diff suppressed because it is too large Load Diff

View File

@ -58,10 +58,10 @@ gdb/testsuite/
* gdb.dwarf2/dw2-case-insensitive.c: New file.
* gdb.dwarf2/dw2-case-insensitive.exp: New file.
Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/dwarf2read.c 2011-04-29 09:43:34.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/dwarf2read.c 2011-04-29 09:45:58.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/dwarf2read.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/dwarf2read.c 2011-05-25 19:12:33.000000000 +0200
@@ -152,6 +152,9 @@ DEF_VEC_I (offset_type);
a comment by the code that writes the index. */
struct mapped_index
@ -72,7 +72,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
/* The total length of the buffer. */
off_t total_size;
@@ -1990,17 +1993,23 @@ create_addrmap_from_index (struct objfil
@@ -1997,17 +2000,23 @@ create_addrmap_from_index (struct objfil
SYMBOL_HASH_NEXT, but we keep a separate copy to maintain control over the
implementation. This is necessary because the hash function is tied to the
format of the mapped index file. The hash values do not have to match with
@ -99,29 +99,34 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
return r;
}
@@ -2013,11 +2022,19 @@ static int
find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
offset_type **vec_out)
{
- offset_type hash = mapped_index_string_hash (name);
+ /* Index version 4 did not support case insensitive searches. But the
+ indexes for case insensitive languages are built in lowercase, therefore
+ simulate our NAME being searched is also lowercased. */
+ offset_type hash = mapped_index_string_hash ((index->version == 4
+ && case_sensitivity == case_sensitive_off
+ ? 5 : index->version),
+ name);
@@ -2023,6 +2032,7 @@ find_slot_in_mapped_hash (struct mapped_
struct cleanup *back_to = make_cleanup (null_cleanup, 0);
offset_type hash;
offset_type slot, step;
+ int (*cmp) (const char *, const char *);
if (current_language->la_language == language_cplus
|| current_language->la_language == language_java
@@ -2045,9 +2055,16 @@ find_slot_in_mapped_hash (struct mapped_
}
}
- hash = mapped_index_string_hash (name);
+ /* Index version 4 did not support case insensitive searches. But the
+ indexes for case insensitive languages are built in lowercase, therefore
+ simulate our NAME being searched is also lowercased. */
+ hash = mapped_index_string_hash ((index->version == 4
+ && case_sensitivity == case_sensitive_off
+ ? 5 : index->version),
+ name);
slot = hash & (index->symbol_table_slots - 1);
step = ((hash * 17) & (index->symbol_table_slots - 1)) | 1;
+ cmp = (case_sensitivity == case_sensitive_on ? strcmp : strcasecmp);
for (;;)
{
@@ -2028,7 +2045,7 @@ find_slot_in_mapped_hash (struct mapped_
return 0;
@@ -2061,7 +2078,7 @@ find_slot_in_mapped_hash (struct mapped_
}
str = index->constant_pool + MAYBE_SWAP (index->symbol_table[i]);
- if (!strcmp (name, str))
@ -129,7 +134,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
{
*vec_out = (offset_type *) (index->constant_pool
+ MAYBE_SWAP (index->symbol_table[i + 1]));
@@ -2071,15 +2088,17 @@ dwarf2_read_index (struct objfile *objfi
@@ -2105,15 +2122,17 @@ dwarf2_read_index (struct objfile *objfi
/* Versions earlier than 3 emitted every copy of a psymbol. This
causes the index to behave very poorly for certain requests. Version 3
contained incomplete addrmap. So, it seems better to just ignore such
@ -149,7 +154,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
map->total_size = dwarf2_per_objfile->gdb_index.size;
metadata = (offset_type *) (addr + sizeof (offset_type));
@@ -15602,13 +15621,16 @@ struct strtab_entry
@@ -15692,13 +15711,16 @@ struct strtab_entry
const char *str;
};
@ -168,7 +173,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
}
/* Equality function for a strtab_entry. */
@@ -15746,12 +15768,15 @@ cleanup_mapped_symtab (void *p)
@@ -15836,12 +15858,15 @@ cleanup_mapped_symtab (void *p)
}
/* Find a slot in SYMTAB for the symbol NAME. Returns a pointer to
@ -186,7 +191,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
index = hash & (symtab->size - 1);
step = ((hash * 17) & (symtab->size - 1)) | 1;
@@ -16279,7 +16304,7 @@ write_psymtabs_to_index (struct objfile
@@ -16369,7 +16394,7 @@ write_psymtabs_to_index (struct objfile
total_len = size_of_contents;
/* The version number. */
@ -195,10 +200,10 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
obstack_grow (&contents, &val, sizeof (val));
/* The offset of the CU list from the start of the file. */
Index: gdb-7.2.90.20110429/gdb/minsyms.c
Index: gdb-7.2.90.20110525/gdb/minsyms.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/minsyms.c 2011-04-29 09:43:34.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/minsyms.c 2011-04-29 09:44:15.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/minsyms.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/minsyms.c 2011-05-25 17:13:13.000000000 +0200
@@ -239,11 +239,16 @@ lookup_minimal_symbol (const char *name,
if (pass == 1)
@ -218,10 +223,10 @@ Index: gdb-7.2.90.20110429/gdb/minsyms.c
match = SYMBOL_MATCHES_SEARCH_NAME (msymbol,
modified_name);
}
Index: gdb-7.2.90.20110429/gdb/psymtab.c
Index: gdb-7.2.90.20110525/gdb/psymtab.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/psymtab.c 2011-04-20 22:10:29.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/psymtab.c 2011-04-29 09:44:15.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/psymtab.c 2011-04-20 22:10:29.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/psymtab.c 2011-05-25 17:13:13.000000000 +0200
@@ -690,8 +690,15 @@ lookup_partial_symbol (struct partial_sy
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
@ -240,10 +245,10 @@ Index: gdb-7.2.90.20110429/gdb/psymtab.c
{
if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
SYMBOL_DOMAIN (*top), domain))
Index: gdb-7.2.90.20110429/gdb/symtab.c
Index: gdb-7.2.90.20110525/gdb/symtab.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/symtab.c 2011-04-29 09:43:55.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/symtab.c 2011-04-29 09:44:15.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/symtab.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/symtab.c 2011-05-25 17:13:49.000000000 +0200
@@ -1062,19 +1062,6 @@ lookup_symbol_in_language (const char *n
}
}
@ -264,7 +269,7 @@ Index: gdb-7.2.90.20110429/gdb/symtab.c
returnval = lookup_symbol_aux (modified_name, block, domain, lang,
is_a_field_of_this);
do_cleanups (cleanup);
@@ -3082,7 +3069,9 @@ search_symbols (char *regexp, domain_enu
@@ -3106,7 +3093,9 @@ search_symbols (char *regexp, domain_enu
}
}
@ -275,26 +280,24 @@ Index: gdb-7.2.90.20110429/gdb/symtab.c
if (errcode != 0)
{
char *err = get_regcomp_error (errcode, &datum.preg);
@@ -3529,10 +3518,13 @@ completion_list_add_name (char *symname,
char *text, char *word)
@@ -3546,7 +3535,11 @@ rbreak_command (char *regexp, int from_t
static int
compare_symbol_name (const char *name, const char *sym_text, int sym_text_len)
{
int newsize;
- if (strncmp (name, sym_text, sym_text_len) != 0)
+ int (*ncmp) (const char *, const char *, size_t);
+
+ ncmp = (case_sensitivity == case_sensitive_on ? strncmp : strncasecmp);
+
+ if (ncmp (name, sym_text, sym_text_len) != 0)
return 0;
/* Clip symbols that cannot match. */
- if (strncmp (symname, sym_text, sym_text_len) != 0)
+ if (ncmp (symname, sym_text, sym_text_len) != 0)
{
return;
}
Index: gdb-7.2.90.20110429/gdb/symtab.h
if (sym_text[sym_text_len] == '(')
Index: gdb-7.2.90.20110525/gdb/symtab.h
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/symtab.h 2011-04-29 09:43:34.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/symtab.h 2011-04-29 09:44:15.000000000 +0200
@@ -1030,7 +1030,8 @@ extern unsigned int msymbol_hash (const
--- gdb-7.2.90.20110525.orig/gdb/symtab.h 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/symtab.h 2011-05-25 17:13:13.000000000 +0200
@@ -1036,7 +1036,8 @@ extern unsigned int msymbol_hash (const
is only a GDB in-memory computed value with no external files compatibility
requirements. */
@ -304,10 +307,10 @@ Index: gdb-7.2.90.20110429/gdb/symtab.h
extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.base/fortran-sym-case.c
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.base/fortran-sym-case.c 2011-04-29 09:44:15.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.c 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -331,10 +334,10 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.base/fortran-sym-case.c
+{
+ return 0;
+}
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.base/fortran-sym-case.exp
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.base/fortran-sym-case.exp 2011-04-29 09:44:15.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.base/fortran-sym-case.exp 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,27 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
@ -363,10 +366,10 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.base/fortran-sym-case.exp
+gdb_test "set language fortran" {Warning: the current language does not match this frame\.}
+
+gdb_test "frame" ", aRGv=.*"
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S 2011-04-29 09:44:15.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,102 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -470,10 +473,10 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c 2011-04-29 09:44:15.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,38 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@ -513,10 +516,10 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c
+ FUNC_symtab ();
+ return 0;
+}
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp 2011-04-29 09:44:15.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp 2011-05-25 17:13:13.000000000 +0200
@@ -0,0 +1,49 @@
+# Copyright 2011 Free Software Foundation, Inc.
+
@ -567,10 +570,10 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
+if {[gdb_breakpoint "fuNC_symtab"] == 1} {
+ pass "setting breakpoint at fuNC_symtab"
+}
Index: gdb-7.2.90.20110429/gdb/utils.c
Index: gdb-7.2.90.20110525/gdb/utils.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/utils.c 2011-04-29 09:43:34.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/utils.c 2011-04-29 09:44:15.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/utils.c 2011-05-25 17:12:51.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/utils.c 2011-05-25 17:13:13.000000000 +0200
@@ -3003,10 +3003,12 @@ strcmp_iw (const char *string1, const ch
{
string2++;

View File

@ -1,62 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-04/msg00546.html
Subject: [obv] Fix completer pre-expansion for case insensitive lookups
Hi,
due to the pending patches there happened a semantic collision. Both pathsets
were right on their own but together it did not work well. There could be
a testcase for it but I do not provide it, it seems obvious enought to me.
The two patches were:
Re: [patch 3/3] case insensitive: the fix [rediff]
http://sourceware.org/ml/gdb-patches/2011-04/msg00418.html
- see the change in completion_list_add_name
and
[patch][+7.3] Fix physname completion regression
http://sourceware.org/ml/gdb-patches/2011-04/msg00140.html
- see expand_partial_symbol_name which just called
completion_list_add_name before but now it has explicit strncmp.
Another problem is this code is still wrong. That is the subject of:
CU expansion problem for parameters
http://sourceware.org/bugzilla/show_bug.cgi?id=12708
But I did not want to mix two unrelated fixes into a single patch
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu. Checked it in
already to not get lost in the inter-patch dependencies again.
Sorry,
Jan
http://sourceware.org/ml/gdb-cvs/2011-04/msg00186.html
### src/gdb/ChangeLog 2011/04/28 15:52:53 1.12964
### src/gdb/ChangeLog 2011/04/28 17:37:02 1.12965
## -1,3 +1,8 @@
+2011-04-28 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * symtab.c (expand_partial_symbol_name): New variable NCMP. Support
+ case insensitive comparison.
+
2011-04-28 Ulrich Weigand <ulrich.weigand@linaro.org>
* infrun.c (proceed): Revert previous change.
--- src/gdb/symtab.c 2011/04/27 20:03:03 1.269
+++ src/gdb/symtab.c 2011/04/28 17:37:06 1.270
@@ -3707,8 +3707,11 @@
expand_partial_symbol_name (const char *name, void *user_data)
{
struct add_name_data *datum = (struct add_name_data *) user_data;
+ int (*ncmp) (const char *, const char *, size_t);
- return strncmp (name, datum->sym_text, datum->sym_text_len) == 0;
+ ncmp = (case_sensitivity == case_sensitive_on ? strncmp : strncasecmp);
+
+ return ncmp (name, datum->sym_text, datum->sym_text_len) == 0;
}
char **

View File

@ -58,8 +58,10 @@ readline/doc/
@defcodeindex. Make the `Programming with GNU History' reference
external.
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
Index: gdb-7.2.90.20110525/gdb/doc/Makefile.in
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/doc/Makefile.in 2011-01-03 14:01:05.000000000 +0100
+++ gdb-7.2.90.20110525/gdb/doc/Makefile.in 2011-05-25 19:16:35.000000000 +0200
@@ -117,7 +117,7 @@ GDB_DOC_SOURCE_INCLUDES = \
$(srcdir)/gpl.texi \
$(srcdir)/agentexpr.texi \
@ -69,9 +71,11 @@ readline/doc/
GDB_DOC_BUILD_INCLUDES = \
gdb-cfg.texi \
GDBvn.texi
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -31008,13 +31008,13 @@ things without first using the debugger to find the facts.
Index: gdb-7.2.90.20110525/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.2.90.20110525.orig/gdb/doc/gdb.texinfo 2011-05-25 19:14:36.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/doc/gdb.texinfo 2011-05-25 19:17:01.000000000 +0200
@@ -31095,13 +31095,13 @@ things without first using the debugger
@c The readline documentation is distributed with the readline code
@c and consists of the two following files:
@ -87,10 +91,12 @@ readline/doc/
+@include hsuser.texi
@end ifclear
--- a/readline/doc/hsuser.texi
+++ b/readline/doc/hsuser.texi
@@ -26,9 +26,10 @@ into another language, under the above conditions for modified versions.
@node In Memoriam
Index: gdb-7.2.90.20110525/readline/doc/hsuser.texi
===================================================================
--- gdb-7.2.90.20110525.orig/readline/doc/hsuser.texi 2011-05-25 19:16:17.000000000 +0200
+++ gdb-7.2.90.20110525/readline/doc/hsuser.texi 2011-05-25 19:16:35.000000000 +0200
@@ -26,9 +26,10 @@ into another language, under the above c
@node Using History Interactively
@chapter Using History Interactively
@ -104,7 +110,7 @@ readline/doc/
@ifset BashFeatures
This chapter describes how to use the @sc{gnu} History Library
@@ -41,7 +42,8 @@ see the @sc{gnu} Readline Library Manual.
@@ -41,7 +42,8 @@ see the @sc{gnu} Readline Library Manual
This chapter describes how to use the @sc{gnu} History Library interactively,
from a user's standpoint. It should be considered a user's guide. For
information on using the @sc{gnu} History Library in your own programs,
@ -114,4 +120,3 @@ readline/doc/
@end ifclear
@ifset BashFeatures

View File

@ -1,8 +1,8 @@
Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
Index: gdb-7.2.90.20110525/gdb/dwarf2read.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/dwarf2read.c 2011-04-29 09:41:14.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/dwarf2read.c 2011-04-29 09:41:20.000000000 +0200
@@ -7569,12 +7569,14 @@ read_set_type (struct die_info *die, str
--- gdb-7.2.90.20110525.orig/gdb/dwarf2read.c 2011-05-25 17:06:19.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/dwarf2read.c 2011-05-25 17:10:46.000000000 +0200
@@ -7665,12 +7665,14 @@ read_set_type (struct die_info *die, str
return set_die_type (die, set_type, cu);
}
@ -19,7 +19,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
struct attribute *attr;
struct symbol *sym;
CORE_ADDR base = (CORE_ADDR) 0;
@@ -7599,10 +7601,40 @@ read_common_block (struct die_info *die,
@@ -7695,20 +7697,67 @@ read_common_block (struct die_info *die,
}
if (die->child != NULL)
{
@ -52,16 +52,17 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
child_die = die->child;
while (child_die && child_die->tag)
{
LONGEST offset;
+ /* 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 (sym != NULL && attr != NULL)
if (sym != NULL
&& handle_data_member_location (child_die, cu, &offset))
{
@@ -7620,8 +7652,25 @@ read_common_block (struct die_info *die,
SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
SYMBOL_VALUE_ADDRESS (sym) = base + offset;
add_symbol_to_list (sym, &global_symbols);
}
+
@ -86,7 +87,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
}
}
@@ -11286,6 +11335,13 @@ new_symbol_full (struct die_info *die, s
@@ -11376,6 +11425,13 @@ new_symbol_full (struct die_info *die, s
{
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
@ -100,7 +101,7 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
if (SYMBOL_CLASS (sym) == LOC_STATIC
&& SYMBOL_VALUE_ADDRESS (sym) == 0
&& !dwarf2_per_objfile->has_section_at_zero)
@@ -11458,6 +11514,11 @@ new_symbol_full (struct die_info *die, s
@@ -11548,6 +11604,11 @@ new_symbol_full (struct die_info *die, s
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
list_to_add = &global_symbols;
break;
@ -112,10 +113,10 @@ Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
default:
/* Not a tag we recognize. Hopefully we aren't processing
trash data, but since we must specifically ignore things
Index: gdb-7.2.90.20110429/gdb/f-lang.c
Index: gdb-7.2.90.20110525/gdb/f-lang.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/f-lang.c 2011-04-29 09:41:15.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/f-lang.c 2011-04-29 09:41:20.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/f-lang.c 2011-05-25 17:06:22.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/f-lang.c 2011-05-25 17:07:02.000000000 +0200
@@ -446,27 +446,3 @@ _initialize_f_language (void)
add_language (&f_language_defn);
@ -144,10 +145,10 @@ Index: gdb-7.2.90.20110429/gdb/f-lang.c
- }
- return (NULL);
-}
Index: gdb-7.2.90.20110429/gdb/f-lang.h
Index: gdb-7.2.90.20110525/gdb/f-lang.h
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/f-lang.h 2011-04-29 09:41:15.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/f-lang.h 2011-04-29 09:41:20.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/f-lang.h 2011-05-25 17:06:22.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/f-lang.h 2011-05-25 17:07:02.000000000 +0200
@@ -52,36 +52,8 @@ enum f90_range_type
NONE_BOUND_DEFAULT /* "(low:high)" */
};
@ -185,10 +186,10 @@ Index: gdb-7.2.90.20110429/gdb/f-lang.h
/* When reasonable array bounds cannot be fetched, such as when
you ask to 'mt print symbols' and there is no stack frame and
Index: gdb-7.2.90.20110429/gdb/f-valprint.c
Index: gdb-7.2.90.20110525/gdb/f-valprint.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/f-valprint.c 2011-04-29 09:41:15.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/f-valprint.c 2011-04-29 09:41:20.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/f-valprint.c 2011-05-25 17:06:22.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/f-valprint.c 2011-05-25 17:07:02.000000000 +0200
@@ -34,6 +34,8 @@
#include "gdbcore.h"
#include "command.h"
@ -371,10 +372,10 @@ Index: gdb-7.2.90.20110429/gdb/f-valprint.c
}
void
Index: gdb-7.2.90.20110429/gdb/stack.c
Index: gdb-7.2.90.20110525/gdb/stack.c
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/stack.c 2011-04-29 09:40:46.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/stack.c 2011-04-29 09:41:20.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/stack.c 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/stack.c 2011-05-25 17:07:02.000000000 +0200
@@ -1525,6 +1525,8 @@ iterate_over_block_locals (struct block
case LOC_COMPUTED:
if (SYMBOL_IS_ARGUMENT (sym))
@ -384,10 +385,10 @@ Index: gdb-7.2.90.20110429/gdb/stack.c
(*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
break;
Index: gdb-7.2.90.20110429/gdb/symtab.h
Index: gdb-7.2.90.20110525/gdb/symtab.h
===================================================================
--- gdb-7.2.90.20110429.orig/gdb/symtab.h 2011-04-29 09:40:46.000000000 +0200
+++ gdb-7.2.90.20110429/gdb/symtab.h 2011-04-29 09:42:17.000000000 +0200
--- gdb-7.2.90.20110525.orig/gdb/symtab.h 2011-05-25 17:05:21.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/symtab.h 2011-05-25 17:07:02.000000000 +0200
@@ -411,7 +411,10 @@ typedef enum domain_enum_tag
TYPES_DOMAIN,
@ -400,10 +401,10 @@ Index: gdb-7.2.90.20110429/gdb/symtab.h
}
domain_enum;
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.exp
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.exp 2011-04-29 09:41:20.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.exp 2011-05-25 17:07:02.000000000 +0200
@@ -0,0 +1,101 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
@ -506,10 +507,10 @@ Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.exp
+gdb_test "p ix_x" " = 1 *" "p ix_x in"
+gdb_test "p iy_y" " = 2 *" "p iy_y in"
+gdb_test "p iz_z2" " = 3 *" "p iz_z2 in"
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.f90
Index: gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.f90
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.f90 2011-04-29 09:41:20.000000000 +0200
+++ gdb-7.2.90.20110525/gdb/testsuite/gdb.fortran/common-block.f90 2011-05-25 17:07:02.000000000 +0200
@@ -0,0 +1,67 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!

View File

@ -1,830 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-04/msg00229.html
Subject: [rfc, 7.3?] -O2 -g breakpoints internal error + prologue skipping
[ Backported. ]
Hi,
obsoletes my:
[patch] Fix internal error on some -O2 -g breakpoints
http://sourceware.org/ml/gdb-patches/2010-07/msg00533.html
and IMO also Paul's:
[patch] Fix for PR gdb/12573
http://sourceware.org/ml/gdb-patches/2011-03/msg00883.html
it is an improvement of:
[patch] Do not skip prologue for -O2 -g with GCC VTA Re: [patch] Fix for PR gdb/12573
http://sourceware.org/ml/gdb-patches/2011-03/msg01129.html
Just the removal of gdb_assert may place the breakpoints on -O2 -g code too
late. IMO on `(gdb) break Bar::Bar' no real inferior modification should
happen while with the Paul's reproducer in the PR the `free(malloc(1));' line
is already executed when GDB stops. This over-execution is tested in the
attached artificial reproducer by the testcase "no statement got executed".
There are several issues of this patch:
#1 The two-pass complicated execution in skip_prologue_sal currently has no
effect as the functionality depending on it does not work now. But that is
a separate new Bug and the two passes will be needed after its fix:
regression by physname: PE32 prologue skip vs. static initializers
http://sourceware.org/bugzilla/show_bug.cgi?id=12680
#2 A conservative approach has been taken. The problematic prologue skipping
is disabled only if .debug_loc reference is found which proves -O2 (with -g).
This test is imperfect as there may exist optimized debug code not using
any location list and still facing inlining issues if handled as
unoptimized code. For a future better test see GCC PR other/32998.
GCC PR other/32998 = -frecord-gcc-switches issues, Status: NEW
The opposite option would be to keep the prologue skipping enabled only if
there is any DW_AT_location(DW_OP_fbreg(x)). I haven't tested this way, it
seems very intrusive to me. In practice I doubt there will be a real world
case of -O2 -g CU not referencing .debug_loc - such as if all its code accesses
only global variables and has no local variables. Just the testcase originally
was such a countercase CU. :-/ The GDB internal error is kept in place as it
still can happen in such case, this problem is not yet fully fixed.
#3 Whether a .debug_loc reference may be present with still invalid
DW_AT_location before prologue I do not know, it does not seem to happen for
GCC. There is currently no DW_AT_producer check. Even before VTA (Variable
Tracking Assignments, since FSF GCC 4.5, -O2 -g variables DW_AT_location
improvement) it seems to me the validity at function entry point worked well
enough.
#4 This whole problems appears only with involvement of inlined code, either
explicitly or implicitly. But GDB does not support inlined code breakpoints
well (PR breakpoints/10738, RH BZ#149125). When one plays with testing this
patch various suitable breakpoints are not placed but AFAIK all of them are in
the scope of the PR 10738.
#5 If function does not start is not on a line boundary the multi-location
breakpoints are already not found properly and everything fails. I do not
think it can ever happen in real world. Even for a singe-line code
void f (void) {} void g (void) {}
GCC places there multiple line markers - -O2 -g, duplicity is for prologues:
File name Line number Starting address
1.c 1 0
1.c 1 0
1.c 1 0x10
1.c 1 0x10
Whether this should go for 7.3 I am not sure. The simple removal of
gdb_assert looks nice, GDB does not crash. But GDB behaves wrong and `break
func' may not stop before a crash there at all etc.
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
I will to commit it without any review/discussion.
Thanks,
Jan
gdb/
2011-04-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (struct dwarf2_cu): New field has_loclist.
(process_full_comp_unit): Set also symtab->locations_valid. Move the
symtab->language code.
(var_decode_location): Set cu->has_loclist.
* symtab.c (skip_prologue_sal): New variables saved_pc, force_skip and
skip. Intialize force_skip from locations_valid. Move the prologue
skipping code into two passes.
* symtab.h (struct symtab): Make the primary field a bitfield. New
field locations_valid.
gdb/testsuite/
2011-04-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.dwarf2/dw2-skip-prologue.S: New file.
* gdb.dwarf2/dw2-skip-prologue.c: New file.
* gdb.dwarf2/dw2-skip-prologue.exp: New file.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -396,6 +396,13 @@ struct dwarf2_cu
DIEs for namespaces, we don't need to try to infer them
from mangled names. */
unsigned int has_namespace_info : 1;
+
+ /* This CU references .debug_loc. See the symtab->locations_valid field.
+ This test is imperfect as there may exist optimized debug code not using
+ any location list and still facing inlining issues if handled as
+ unoptimized code. For a future better test see GCC PR other/32998. */
+
+ unsigned int has_loclist : 1;
};
/* Persistent data held for a compilation unit, even when not
@@ -4654,13 +4661,15 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
symtab = end_symtab (highpc + baseaddr, objfile, SECT_OFF_TEXT (objfile));
- /* Set symtab language to language from DW_AT_language.
- If the compilation is from a C file generated by language preprocessors,
- do not set the language if it was already deduced by start_subfile. */
- if (symtab != NULL
- && !(cu->language == language_c && symtab->language != language_c))
+ if (symtab != NULL)
{
- symtab->language = cu->language;
+ /* Set symtab language to language from DW_AT_language. If the
+ compilation is from a C file generated by language preprocessors, do
+ not set the language if it was already deduced by start_subfile. */
+ if (!(cu->language == language_c && symtab->language != language_c))
+ symtab->language = cu->language;
+
+ symtab->locations_valid = cu->has_loclist;
}
if (dwarf2_per_objfile->using_index)
@@ -11221,6 +11230,9 @@ var_decode_location (struct attribute *a
SYMBOL_CLASS (sym) = LOC_COMPUTED;
dwarf2_symbol_mark_computed (attr, sym, cu);
+
+ if (SYMBOL_COMPUTED_OPS (sym) == &dwarf2_loclist_funcs)
+ cu->has_loclist = 1;
}
/* Given a pointer to a DWARF information entry, figure out if we need
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2454,12 +2454,13 @@ skip_prologue_sal (struct symtab_and_line *sal)
struct symbol *sym;
struct symtab_and_line start_sal;
struct cleanup *old_chain;
- CORE_ADDR pc;
+ CORE_ADDR pc, saved_pc;
struct obj_section *section;
const char *name;
struct objfile *objfile;
struct gdbarch *gdbarch;
struct block *b, *function_block;
+ int force_skip, skip;
/* Do not change the SAL is PC was specified explicitly. */
if (sal->explicit_pc)
@@ -2497,46 +2498,69 @@ skip_prologue_sal (struct symtab_and_line *sal)
gdbarch = get_objfile_arch (objfile);
- /* If the function is in an unmapped overlay, use its unmapped LMA address,
- so that gdbarch_skip_prologue has something unique to work on. */
- if (section_is_overlay (section) && !section_is_mapped (section))
- pc = overlay_unmapped_address (pc, section);
+ /* Process the prologue in two passes. In the first pass try to skip the
+ prologue (SKIP is true) and verify there is a real need for it (indicated
+ by FORCE_SKIP). If no such reason was found run a second pass where the
+ prologue is not skipped (SKIP is false). */
- /* Skip "first line" of function (which is actually its prologue). */
- pc += gdbarch_deprecated_function_start_offset (gdbarch);
- pc = gdbarch_skip_prologue (gdbarch, pc);
+ skip = 1;
+ force_skip = 1;
- /* For overlays, map pc back into its mapped VMA range. */
- pc = overlay_mapped_address (pc, section);
+ /* Be conservative - allow direct PC (without skipping prologue) only if we
+ have proven the CU (Compilation Unit) supports it. sal->SYMTAB does not
+ have to be set by the caller so we use SYM instead. */
+ if (sym && SYMBOL_SYMTAB (sym)->locations_valid)
+ force_skip = 0;
- /* Calculate line number. */
- start_sal = find_pc_sect_line (pc, section, 0);
-
- /* Check if gdbarch_skip_prologue left us in mid-line, and the next
- line is still part of the same function. */
- if (start_sal.pc != pc
- && (sym? (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) <= start_sal.end
- && start_sal.end < BLOCK_END (SYMBOL_BLOCK_VALUE (sym)))
- : (lookup_minimal_symbol_by_pc_section (start_sal.end, section)
- == lookup_minimal_symbol_by_pc_section (pc, section))))
+ saved_pc = pc;
+ do
{
- /* First pc of next line */
- pc = start_sal.end;
- /* Recalculate the line number (might not be N+1). */
- start_sal = find_pc_sect_line (pc, section, 0);
- }
+ pc = saved_pc;
- /* On targets with executable formats that don't have a concept of
- constructors (ELF with .init has, PE doesn't), gcc emits a call
- to `__main' in `main' between the prologue and before user
- code. */
- if (gdbarch_skip_main_prologue_p (gdbarch)
- && name && strcmp (name, "main") == 0)
- {
- pc = gdbarch_skip_main_prologue (gdbarch, pc);
- /* Recalculate the line number (might not be N+1). */
+ /* If the function is in an unmapped overlay, use its unmapped LMA address,
+ so that gdbarch_skip_prologue has something unique to work on. */
+ if (section_is_overlay (section) && !section_is_mapped (section))
+ pc = overlay_unmapped_address (pc, section);
+
+ /* Skip "first line" of function (which is actually its prologue). */
+ pc += gdbarch_deprecated_function_start_offset (gdbarch);
+ if (skip)
+ pc = gdbarch_skip_prologue (gdbarch, pc);
+
+ /* For overlays, map pc back into its mapped VMA range. */
+ pc = overlay_mapped_address (pc, section);
+
+ /* Calculate line number. */
start_sal = find_pc_sect_line (pc, section, 0);
+
+ /* Check if gdbarch_skip_prologue left us in mid-line, and the next
+ line is still part of the same function. */
+ if (skip && start_sal.pc != pc
+ && (sym? (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) <= start_sal.end
+ && start_sal.end < BLOCK_END (SYMBOL_BLOCK_VALUE (sym)))
+ : (lookup_minimal_symbol_by_pc_section (start_sal.end, section)
+ == lookup_minimal_symbol_by_pc_section (pc, section))))
+ {
+ /* First pc of next line */
+ pc = start_sal.end;
+ /* Recalculate the line number (might not be N+1). */
+ start_sal = find_pc_sect_line (pc, section, 0);
+ }
+
+ /* On targets with executable formats that don't have a concept of
+ constructors (ELF with .init has, PE doesn't), gcc emits a call
+ to `__main' in `main' between the prologue and before user
+ code. */
+ if (gdbarch_skip_main_prologue_p (gdbarch)
+ && name && strcmp (name, "main") == 0)
+ {
+ pc = gdbarch_skip_main_prologue (gdbarch, pc);
+ /* Recalculate the line number (might not be N+1). */
+ start_sal = find_pc_sect_line (pc, section, 0);
+ force_skip = 1;
+ }
}
+ while (!force_skip && skip--);
/* If we still don't have a valid source line, try to find the first
PC in the lineinfo table that belongs to the same function. This
@@ -2546,7 +2570,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
the case with the DJGPP target using "gcc -gcoff" when the
compiler inserted code after the prologue to make sure the stack
is aligned. */
- if (sym && start_sal.symtab == NULL)
+ if (!force_skip && sym && start_sal.symtab == NULL)
{
pc = skip_prologue_using_lineinfo (pc, SYMBOL_SYMTAB (sym));
/* Recalculate the line number. */
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -767,7 +767,13 @@ struct symtab
should be designated the primary, so that the blockvector
is relocated exactly once by objfile_relocate. */
- int primary;
+ unsigned int primary : 1;
+
+ /* Symtab has been compiled with both optimizations and debug info so that
+ GDB may stop skipping prologues as variables locations are valid already
+ at function entry points. */
+
+ unsigned int locations_valid : 1;
/* The macro table for this symtab. Like the blockvector, this
may be shared between different symtabs --- and normally is for
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
@@ -0,0 +1,391 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .4byte .Lline1_begin /* DW_AT_stmt_list */
+ .4byte func_start /* DW_AT_low_pc */
+ .4byte func_end /* DW_AT_high_pc */
+ .ascii "main.c\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 2 /* DW_AT_language (DW_LANG_C) */
+
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "func\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ .4byte func_start /* DW_AT_low_pc */
+ .4byte func_end /* DW_AT_high_pc */
+
+/* GDB `has_loclist' detection of -O2 -g code needs to see a DW_AT_location
+ location list. There may exist -O2 -g CUs still not needing/using any such
+ location list - exactly like this CU. Make one up. */
+
+ .uleb128 0x7 /* (DIE (0x42) DW_TAG_formal_parameter) */
+ .ascii "param\0" /* DW_AT_name */
+ .long .Ltype_int - .Lcu1_begin /* DW_AT_type */
+ .long loclist /* DW_AT_location */
+
+ .uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
+ .ascii "inlined\0" /* DW_AT_name */
+ .4byte func0 /* DW_AT_low_pc */
+ .4byte func1 /* DW_AT_high_pc */
+ .byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
+ .byte 1 /* DW_AT_call_file */
+ .byte 8 /* DW_AT_call_line */
+
+ .uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
+ .ascii "inlined2\0" /* DW_AT_name */
+ .4byte func2 /* DW_AT_low_pc */
+ .4byte func3 /* DW_AT_high_pc */
+ .byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
+ .byte 1 /* DW_AT_call_file */
+ .byte 11 /* DW_AT_call_line */
+
+#ifdef INLINED
+ .uleb128 4 /* Abbrev: DW_TAG_inlined_subroutine */
+ .ascii "otherinline\0" /* DW_AT_name */
+ .4byte func3 /* DW_AT_low_pc */
+ .4byte func_end /* DW_AT_high_pc */
+ .byte 3 /* DW_AT_inline (DW_INL_declared_inlined) */
+ .byte 1 /* DW_AT_call_file */
+ .byte 9 /* DW_AT_call_line */
+#endif
+
+#ifdef LEXICAL
+ .uleb128 5 /* Abbrev: DW_TAG_lexical_block */
+ .4byte func3 /* DW_AT_low_pc */
+ .4byte func_end /* DW_AT_high_pc */
+
+ /* GDB would otherwise ignore the DW_TAG_lexical_block. */
+ .uleb128 6 /* Abbrev: DW_TAG_variable */
+ .ascii "lexicalvar\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+
+ .byte 0 /* End of children of DW_TAG_lexical_block */
+#endif
+
+ .byte 0 /* End of children of DW_TAG_subprogram */
+
+/* Simulate `fund' is also named `func' so that the function name matches and
+ fund's SAL is not discarded in expand_line_sal_maybe. */
+
+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */
+ .byte 1 /* DW_AT_external */
+ .ascii "func\0" /* DW_AT_name */
+ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ .4byte fund_start /* DW_AT_low_pc */
+ .4byte fund_end /* DW_AT_high_pc */
+
+ .byte 0 /* End of children of DW_TAG_subprogram */
+
+.Ltype_int:
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .byte 0 /* End of children of CU */
+
+.Lcu1_end:
+
+ .section .debug_loc
+loclist:
+ /* Reset the location list base address first. */
+ .long -1, 0
+
+ .long func_start, func_end
+ .2byte 2f-1f
+1: .byte 0x50 /* DW_OP_reg0 */
+2:
+ /* Location list end. */
+ .long 0, 0
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x10 /* DW_AT_stmt_list */
+ .uleb128 0x6 /* DW_FORM_data4 */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x2e /* DW_TAG_subprogram */
+ .byte 1 /* has_children */
+ .uleb128 0x3f /* DW_AT_external */
+ .uleb128 0xc /* DW_FORM_flag */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 4 /* Abbrev code */
+ .uleb128 0x1d /* DW_TAG_inlined_subroutine */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x20 /* DW_AT_inline */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x58 /* DW_AT_call_file */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x59 /* DW_AT_call_line */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 5 /* Abbrev code */
+ .uleb128 0x0b /* DW_TAG_lexical_block */
+ .byte 1 /* has_children */
+ .uleb128 0x11 /* DW_AT_low_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .uleb128 0x12 /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_FORM_addr */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 6 /* Abbrev code */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 0x7 /* (abbrev code) */
+ .uleb128 0x5 /* (TAG: DW_TAG_formal_parameter) */
+ .byte 0x0 /* DW_children_no */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x02 /* (DW_AT_location) */
+ .uleb128 0x06 /* (DW_FORM_data4) */
+ .byte 0x0
+ .byte 0x0
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+/* Line table */
+ .section .debug_line
+.Lline1_begin:
+ .4byte .Lline1_end - .Lline1_start /* Initial length */
+.Lline1_start:
+ .2byte 2 /* Version */
+ .4byte .Lline1_lines - .Lline1_hdr /* header_length */
+.Lline1_hdr:
+ .byte 1 /* Minimum insn length */
+ .byte 1 /* default_is_stmt */
+ .byte 1 /* line_base */
+ .byte 1 /* line_range */
+ .byte 0x10 /* opcode_base */
+
+ /* Standard lengths */
+ .byte 0
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 1
+ .byte 0
+ .byte 0
+ .byte 0
+
+ /* Include directories */
+ .byte 0
+
+ /* File names */
+ .ascii "main.c\0"
+ .uleb128 0
+ .uleb128 0
+ .uleb128 0
+
+ .ascii "other.c\0"
+ .uleb128 0
+ .uleb128 0
+ .uleb128 0
+
+ .byte 0
+
+.Lline1_lines:
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte func_start
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 4 /* ... to 5 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte func0
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -4 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte func1
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte func2
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -8 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte func3
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte func_end
+
+/* Equivalent copy but renamed s/func/fund/. */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte fund_start
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -4 /* ... to 5 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte fund0
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -4 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte fund1
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte fund2
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 2
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 -8 /* ... to 1 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte fund3
+ .byte 4 /* DW_LNS_set_file */
+ .uleb128 1
+ .byte 3 /* DW_LNS_advance_line */
+ .sleb128 8 /* ... to 9 */
+ .byte 1 /* DW_LNS_copy */
+
+ .byte 0 /* DW_LNE_set_address */
+ .uleb128 5
+ .byte 2
+ .4byte fund_end
+
+/* Line numbering end. */
+
+ .byte 0 /* DW_LNE_end_of_sequence */
+ .uleb128 1
+ .byte 1
+
+.Lline1_end:
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.c
@@ -0,0 +1,58 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+static volatile int v;
+
+asm ("func_start: .globl func_start\n");
+static int
+func (void)
+{
+ v++;
+asm ("func0: .globl func0\n");
+ v++;
+asm ("func1: .globl func1\n");
+ v++;
+asm ("func2: .globl func2\n");
+ v++;
+asm ("func3: .globl func3\n");
+ return v;
+}
+asm ("func_end: .globl func_end\n");
+
+/* Equivalent copy but renamed s/func/fund/. */
+
+asm ("fund_start: .globl fund_start\n");
+static int
+fund (void)
+{
+ v++;
+asm ("fund0: .globl fund0\n");
+ v++;
+asm ("fund1: .globl fund1\n");
+ v++;
+asm ("fund2: .globl fund2\n");
+ v++;
+asm ("fund3: .globl fund3\n");
+ return v;
+}
+asm ("fund_end: .globl fund_end\n");
+
+int
+main (void)
+{
+ return func () + fund ();
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
@@ -0,0 +1,74 @@
+# Copyright 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+load_lib dwarf.exp
+
+# Test multiple location breakpoints vs. prologue analysis on -O2 -g code.
+# when the first statement of a function is an inlined function GDB could
+# crash. Map of this testcase:
+#
+# File name Line number Starting address
+# main.c 5 func_start
+# other.c 1 func0
+# `inlined' called at main.c line 8
+# main.c 9 func1
+# func1 = Breakpoint location 1
+# other.c 1 func2
+# `inlined2' called at main.c line 11
+# main.c 9 func3
+# func3 = Breakpoint location 2
+# `otherinline' called at main.c line 9
+# end of main func_end
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+set testfile "dw2-skip-prologue"
+set executable ${testfile}
+set binfile ${objdir}/${subdir}/${executable}
+
+if {[build_executable ${testfile}.exp ${executable} "${testfile}.c ${testfile}.S" {additional_flags=-DINLINED}] == -1} {
+ return -1
+}
+
+# We need those symbols global to access them from the .S file.
+set test "strip stub symbols"
+set objcopy_program [transform objcopy]
+set result [catch "exec $objcopy_program \
+ -N func0 -N func1 -N func2 -N func3 -N func_start -N func_end \
+ -N fund0 -N fund1 -N fund2 -N fund3 -N fund -N fund_start \
+ ${binfile}" output]
+verbose "result is $result"
+verbose "output is $output"
+if {$result != 0} {
+ fail $test
+ return
+}
+pass $test
+
+clean_restart $executable
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_breakpoint "func"
+gdb_continue_to_breakpoint "func"
+
+# Sanity check GDB has really found 2 locations
+gdb_test {info break $bpnum} "\r\n2\\.1\[ \t\]\[^\n\]*\r\n2\\.2\[ \t\]\[^\n\]*" "2 locations found"
+
+gdb_test "p v" " = 0" "no statement got executed"

View File

@ -1,228 +0,0 @@
http://sourceware.org/ml/gdb-patches/2011-04/msg00551.html
Subject: [patch] physname-related CU expansion issue for C++ (PR 12708)
Hi,
http://sourceware.org/bugzilla/show_bug.cgi?id=12708#c1
The dependency on CU expansion is a physname regression.
But the feature of originally-typed-parameters symbols was not present before
physname at all so it is rather buggy-feature than a regression.
for
typedef int int_typedef;
void f (int_typedef x) {}
gdb -nx ./1b.o -ex 'set language c++' -ex "complete b 'f(" -ex q
+ prephysname (42284fdf9d8cdb20c8e833bdbdb2b56977fea525^)
b 'f(int)
+ prephysname -readnow
b 'f(int)
+ physname (42284fdf9d8cdb20c8e833bdbdb2b56977fea525)
b 'f(int)
+ physname -readnow
b 'f(int)
b 'f(int_typedef)
+ HEAD
b 'f(int)
+ HEAD -readnow
b 'f(int)
b 'f(int_typedef)
This is another issue from the fact that partial symtabs (and even gdbindex)
no longer contain parameters as before. 'f(' can never be found any partial
symtabs, only `f' will be present there.
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
Thanks,
Jan
gdb/
2011-04-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* symtab.c (compare_symbol_name): New function.
(completion_list_add_name, expand_partial_symbol_name): Call it,
remove the variable ncmp.
(default_make_symbol_completion_list_break_on): Reduce SYM_TEXT_LEN,
gdb_assert it.
Gdb/testsuite/
2011-04-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.cp/psymtab-parameter.cc: New file.
* gdb.cp/psymtab-parameter.exp: New file.
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3489,6 +3489,40 @@ rbreak_command (char *regexp, int from_tty)
}
+/* Evaluate if NAME matches SYM_TEXT and SYM_TEXT_LEN.
+
+ Either sym_text[sym_text_len] != '(' and then we search for any
+ symbol starting with SYM_TEXT text.
+
+ Otherwise sym_text[sym_text_len] == '(' and then we require symbol name to
+ be terminated at that point. Partial symbol tables do not have parameters
+ information. */
+
+static int
+compare_symbol_name (const char *name, const char *sym_text, int sym_text_len)
+{
+ int (*ncmp) (const char *, const char *, size_t);
+
+ ncmp = (case_sensitivity == case_sensitive_on ? strncmp : strncasecmp);
+
+ if (ncmp (name, sym_text, sym_text_len) != 0)
+ return 0;
+
+ if (sym_text[sym_text_len] == '(')
+ {
+ /* User searches for `name(someth...'. Require NAME to be terminated.
+ Normally psymtabs and gdbindex have no parameter types so '\0' will be
+ present but accept even parameters presence. In this case this
+ function is in fact strcmp_iw but whitespace skipping is not supported
+ for tab completion. */
+
+ if (name[sym_text_len] != '\0' && name[sym_text_len] != '(')
+ return 0;
+ }
+
+ return 1;
+}
+
/* Helper routine for make_symbol_completion_list. */
static int return_val_size;
@@ -3508,16 +3542,10 @@ completion_list_add_name (char *symname, char *sym_text, int sym_text_len,
char *text, char *word)
{
int newsize;
- int (*ncmp) (const char *, const char *, size_t);
-
- ncmp = (case_sensitivity == case_sensitive_on ? strncmp : strncasecmp);
/* Clip symbols that cannot match. */
-
- if (ncmp (symname, sym_text, sym_text_len) != 0)
- {
- return;
- }
+ if (!compare_symbol_name (symname, sym_text, sym_text_len))
+ return;
/* We have a match for a completion, so add SYMNAME to the current list
of matches. Note that the name is moved to freshly malloc'd space. */
@@ -3707,11 +3735,8 @@ static int
expand_partial_symbol_name (const char *name, void *user_data)
{
struct add_name_data *datum = (struct add_name_data *) user_data;
- int (*ncmp) (const char *, const char *, size_t);
-
- ncmp = (case_sensitivity == case_sensitive_on ? strncmp : strncasecmp);
- return ncmp (name, datum->sym_text, datum->sym_text_len) == 0;
+ return compare_symbol_name (name, datum->sym_text, datum->sym_text_len);
}
char **
@@ -3790,6 +3815,22 @@ default_make_symbol_completion_list_break_on (char *text, char *word,
sym_text_len = strlen (sym_text);
+ /* Prepare SYM_TEXT_LEN for compare_symbol_name. */
+
+ if (current_language->la_language == language_cplus
+ || current_language->la_language == language_java
+ || current_language->la_language == language_fortran)
+ {
+ /* These languages may have parameters entered by user but they are never
+ present in the partial symbol tables. */
+
+ const char *cs = memchr (sym_text, '(', sym_text_len);
+
+ if (cs)
+ sym_text_len = cs - sym_text;
+ }
+ gdb_assert (sym_text[sym_text_len] == '\0' || sym_text[sym_text_len] == '(');
+
return_val_size = 100;
return_val_index = 0;
return_val = (char **) xmalloc ((return_val_size + 1) * sizeof (char *));
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.cc
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2009, 2010, 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+typedef int typedefed;
+void func (typedefed param)
+{
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.cp/psymtab-parameter.exp
@@ -0,0 +1,39 @@
+# Copyright 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if { [skip_cplus_tests] } { continue }
+
+
+set testfile psymtab-parameter
+set executable ${testfile}.x
+set srcfile ${testfile}.cc
+set binfile ${objdir}/${subdir}/${executable}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug c++}] != "" } {
+ untested ${testfile}.exp
+ return -1
+}
+
+clean_restart $executable
+
+# As `main' is not present GDB fails to find the proper inferior language.
+gdb_test_no_output "set language c++"
+
+# The goal is to keep the CU (Compilation Unit) unexpanded. It would be rather
+# XFAIL than FAIL here. For example -readnow breaks it.
+gdb_test_no_output "maintenance info symtabs"
+
+# GDB has shown only the `func(int)' entry before.
+gdb_test "complete break 'func(" "break 'func\\(int\\)\r\nbreak 'func\\(typedefed\\)"

View File

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

View File

@ -1,139 +0,0 @@
Fix Python access to inlined frames (BZ 694824).
http://sourceware.org/ml/gdb-cvs/2011-04/msg00189.html
### src/gdb/ChangeLog 2011/04/27 03:52:20 1.12887.2.14
### src/gdb/ChangeLog 2011/04/29 07:32:37 1.12887.2.15
## -1,3 +1,9 @@
+2011-04-29 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix Python access to inlined frames.
+ * python/py-frame.c (frapy_read_var): Find BLOCK using get_frame_block.
+ * python/py-symbol.c (gdbpy_lookup_symbol): Likewise.
+
2011-04-26 Michael Walle <michael@walle.cc>
* remote.c (remote_start_remote): Ack packet after sending the
--- src/gdb/python/py-frame.c 2011/01/26 20:53:45 1.15
+++ src/gdb/python/py-frame.c 2011/04/29 07:32:40 1.15.2.1
@@ -436,7 +436,7 @@
FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
if (!block)
- block = block_for_pc (get_frame_address_in_block (frame));
+ block = get_frame_block (frame, NULL);
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
}
GDB_PY_HANDLE_EXCEPTION (except);
--- src/gdb/python/py-symbol.c 2011/03/17 09:36:16 1.6
+++ src/gdb/python/py-symbol.c 2011/04/29 07:32:40 1.6.2.1
@@ -275,8 +275,8 @@
TRY_CATCH (except, RETURN_MASK_ALL)
{
- selected_frame = get_selected_frame (_("No frame selected."));
- block = block_for_pc (get_frame_address_in_block (selected_frame));
+ selected_frame = get_selected_frame (_("No frame selected."));
+ block = get_frame_block (selected_frame, NULL);
}
GDB_PY_HANDLE_EXCEPTION (except);
}
### src/gdb/testsuite/ChangeLog 2011/04/25 21:25:18 1.2655.2.4
### src/gdb/testsuite/ChangeLog 2011/04/29 07:32:40 1.2655.2.5
## -1,3 +1,9 @@
+2011-04-29 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix Python access to inlined frames.
+ * gdb.python/py-frame-inline.c: New file.
+ * gdb.python/py-frame-inline.exp: New file.
+
2011-04-25 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/gdbindex-stabs-dwarf.c: New file.
--- src/gdb/testsuite/gdb.python/py-frame-inline.c
+++ src/gdb/testsuite/gdb.python/py-frame-inline.c 2011-04-29 07:33:45.912552000 +0000
@@ -0,0 +1,43 @@
+/* This test is part of GDB, the GNU debugger.
+
+ Copyright 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+volatile int v = 42;
+
+__attribute__((__always_inline__)) static int
+f (void)
+{
+ /* Provide first stub line so that GDB understand the PC is already inside
+ the inlined function and does not expect a step into it. */
+ v++;
+ v++; /* break-here */
+
+ return v;
+}
+
+__attribute__((__noinline__)) static int
+g (void)
+{
+ volatile int l = v;
+
+ return f ();
+}
+
+int
+main (void)
+{
+ return g ();
+}
--- src/gdb/testsuite/gdb.python/py-frame-inline.exp
+++ src/gdb/testsuite/gdb.python/py-frame-inline.exp 2011-04-29 07:33:46.649817000 +0000
@@ -0,0 +1,39 @@
+# Copyright (C) 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib gdb-python.exp
+
+set testfile "py-frame-inline"
+set srcfile ${testfile}.c
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ return -1
+}
+
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
+if ![runto main] then {
+ fail "Can't run to function f"
+ return 0
+}
+
+gdb_breakpoint [gdb_get_line_number "break-here"]
+gdb_continue_to_breakpoint "Block break here."
+
+gdb_test "info frame" "inlined into frame 1\r\n.*"
+
+gdb_test "up" "#1 g .*"
+
+gdb_test "python print gdb.selected_frame().read_var('l')" "\r\n42"

View File

@ -23,11 +23,11 @@ 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.2.90.20110429
Version: 7.2.90.20110525
# 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: 37%{?_with_upstream:.upstream}%{?dist}
Release: 38%{?_with_upstream:.upstream}%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
Group: Development/Debuggers
@ -260,7 +260,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
# Backported fixups post the source tarball.
#Xdrop: Just backports.
Patch232: gdb-upstream.patch
#Patch232: gdb-upstream.patch
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
#=fedoratest+ppc
@ -557,19 +557,15 @@ Patch580: gdb-bz645773-case-insensitive-1of5.patch
Patch581: gdb-bz645773-case-insensitive-2of5.patch
Patch582: gdb-bz645773-case-insensitive-3of5.patch
Patch583: gdb-bz645773-case-insensitive-4of5.patch
Patch588: gdb-bz645773-case-insensitive-5of5.patch
# Fix -O2 -g breakpoints internal error + prologue skipping (BZ 612253).
Patch589: gdb-optim-g-prologue-skip.patch
# Fix physname-related CU expansion issue for C++ (PR 12708).
Patch590: gdb-physname-expand-completer.patch
# Bundle readline-6.2 with a workaround of skipped "ask" (BZ 701131).
Patch591: gdb-bz701131-readline62-1of3.patch
Patch592: gdb-bz701131-readline62-2of3.patch
Patch593: gdb-bz701131-readline62-3of3.patch
# [stap] Fix double free.
Patch594: gdb-stap-double-free.patch
BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
# --without-system-readline
# Requires: readline%{?_isa}
@ -727,7 +723,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%if 0%{!?_with_upstream:1}
%patch232 -p1
#patch232 -p1
%patch349 -p1
%patch1 -p1
%patch3 -p1
@ -843,12 +839,10 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch581 -p1
%patch582 -p1
%patch583 -p1
%patch588 -p1
%patch589 -p1
%patch590 -p1
%patch591 -p1
%patch592 -p1
%patch593 -p1
%patch594 -p1
%patch393 -p1
%patch335 -p1
@ -1271,6 +1265,10 @@ fi
%{_infodir}/gdb.info*
%changelog
* Wed May 25 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2.90.20110525-38.fc15
- Rebase to FSF GDB 7.2.90.20110525 (which is a 7.3 pre-release).
- [stap] Fix double free (Sergio Durigan Junior).
* Tue May 3 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2.90.20110429-37.fc15
- Search also for .<seqno> files in /usr/lib/debug/.build-id (BZ 641377).

View File

@ -1,2 +1,2 @@
04e5c4b1b9e633422cc48990fe61958d libstdc++-v3-python-r155978.tar.bz2
e585e484001f5cd69e87cbcd0c99c1f7 gdb-7.2.90.20110429.tar.bz2
b6128eb0341df56d66f0a3558ebc9899 gdb-7.2.90.20110525.tar.bz2