Rebase to FSF GDB 7.2.90.20110429 (which is a 7.3 pre-release).
Fix -O2 -g breakpoints internal error + prologue skipping (BZ 612253). Fix case insensitive symbols for Fortran by iFort (BZ 645773). Fix physname-related CU expansion issue for C++ (PR 12708). Fix Python access to inlined frames (BZ 694824).
This commit is contained in:
parent
09dd7775eb
commit
f314eb3eb5
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
/libstdc++-v3-python-r155978.tar.bz2
|
||||
/gdb-7.2.90.20110411.tar.bz2
|
||||
/gdb-7.2.90.20110429.tar.bz2
|
||||
|
1779
gdb-archer.patch
1779
gdb-archer.patch
File diff suppressed because it is too large
Load Diff
84
gdb-bz645773-case-insensitive-1of5.patch
Normal file
84
gdb-bz645773-case-insensitive-1of5.patch
Normal file
@ -0,0 +1,84 @@
|
||||
[patch] Code cleanup: New SYMBOL_HASH_NEXT
|
||||
http://sourceware.org/ml/gdb-patches/2011-04/msg00022.html
|
||||
http://sourceware.org/ml/gdb-cvs/2011-04/msg00043.html
|
||||
|
||||
### src/gdb/ChangeLog 2011/04/06 03:24:22 1.12908
|
||||
### src/gdb/ChangeLog 2011/04/06 19:50:03 1.12909
|
||||
## -1,3 +1,12 @@
|
||||
+2011-04-06 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
+
|
||||
+ Code cleanup.
|
||||
+ * dictionary.c (dict_hash): Use SYMBOL_HASH_NEXT.
|
||||
+ * dwarf2read.c (mapped_index_string_hash): Refer to SYMBOL_HASH_NEXT
|
||||
+ in the function comment, a new note on values compatibility.
|
||||
+ * minsyms.c (msymbol_hash_iw, msymbol_hash): Use SYMBOL_HASH_NEXT.
|
||||
+ * symtab.h (SYMBOL_HASH_NEXT): New.
|
||||
+
|
||||
2011-04-06 Thiago Jung Bauermann <bauerman@br.ibm.com>
|
||||
|
||||
* ppc-linux-nat.c (check_condition): Add len output parameter.
|
||||
--- src/gdb/dictionary.c 2011/01/07 19:36:15 1.21
|
||||
+++ src/gdb/dictionary.c 2011/04/06 19:50:04 1.22
|
||||
@@ -826,7 +826,7 @@
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
default:
|
||||
- hash = hash * 67 + *string - 113;
|
||||
+ hash = SYMBOL_HASH_NEXT (hash, *string);
|
||||
string += 1;
|
||||
break;
|
||||
}
|
||||
--- src/gdb/dwarf2read.c 2011/04/04 14:10:12 1.520
|
||||
+++ src/gdb/dwarf2read.c 2011/04/06 19:50:04 1.521
|
||||
@@ -1962,11 +1962,11 @@
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
-/* The hash function for strings in the mapped index. This is the
|
||||
- same as the hashtab.c hash function, 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 function for strings in the mapped index. This is the same as
|
||||
+ 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
|
||||
+ SYMBOL_HASH_NEXT. */
|
||||
|
||||
static hashval_t
|
||||
mapped_index_string_hash (const void *p)
|
||||
--- src/gdb/minsyms.c 2011/03/28 20:29:51 1.81
|
||||
+++ src/gdb/minsyms.c 2011/04/06 19:50:05 1.82
|
||||
@@ -91,7 +91,7 @@
|
||||
++string;
|
||||
if (*string && *string != '(')
|
||||
{
|
||||
- hash = hash * 67 + *string - 113;
|
||||
+ hash = SYMBOL_HASH_NEXT (hash, *string);
|
||||
++string;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@
|
||||
unsigned int hash = 0;
|
||||
|
||||
for (; *string; ++string)
|
||||
- hash = hash * 67 + *string - 113;
|
||||
+ hash = SYMBOL_HASH_NEXT (hash, *string);
|
||||
return hash;
|
||||
}
|
||||
|
||||
--- src/gdb/symtab.h 2011/04/04 15:19:59 1.177
|
||||
+++ src/gdb/symtab.h 2011/04/06 19:50:05 1.178
|
||||
@@ -1004,6 +1004,12 @@
|
||||
|
||||
extern unsigned int msymbol_hash (const char *);
|
||||
|
||||
+/* Compute the next hash value from previous HASH and the character C. This
|
||||
+ is only a GDB in-memory computed value with no external files compatibility
|
||||
+ requirements. */
|
||||
+
|
||||
+#define SYMBOL_HASH_NEXT(hash, c) ((hash) * 67 + (c) - 113)
|
||||
+
|
||||
extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);
|
||||
|
||||
extern void
|
139
gdb-bz645773-case-insensitive-2of5.patch
Normal file
139
gdb-bz645773-case-insensitive-2of5.patch
Normal file
@ -0,0 +1,139 @@
|
||||
http://sourceware.org/ml/gdb-patches/2011-04/msg00124.html
|
||||
Subject: [patch 1/3] case insensitive: Reformat code
|
||||
|
||||
Hi,
|
||||
|
||||
just some reformatting to make the later patch more clear. There should be no
|
||||
functionality difference by this patch. c1+c2 are a bit ugly but I found any
|
||||
other solution a bit ugly.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Format the code for the next patch.
|
||||
* dwarf2read.c (struct mapped_index): Include delimiting newlines.
|
||||
* utils.c (strcmp_iw_ordered): Reformat the code for the next patch.
|
||||
New variables c1 and c2.
|
||||
|
||||
--- a/gdb/dwarf2read.c
|
||||
+++ b/gdb/dwarf2read.c
|
||||
@@ -150,14 +150,19 @@ struct mapped_index
|
||||
{
|
||||
/* The total length of the buffer. */
|
||||
off_t total_size;
|
||||
+
|
||||
/* A pointer to the address table data. */
|
||||
const gdb_byte *address_table;
|
||||
+
|
||||
/* Size of the address table data in bytes. */
|
||||
offset_type address_table_size;
|
||||
+
|
||||
/* The symbol table, implemented as a hash table. */
|
||||
const offset_type *symbol_table;
|
||||
+
|
||||
/* Size in slots, each slot is 2 offset_types. */
|
||||
offset_type symbol_table_slots;
|
||||
+
|
||||
/* A pointer to the constant pool. */
|
||||
const char *constant_pool;
|
||||
};
|
||||
--- a/gdb/utils.c
|
||||
+++ b/gdb/utils.c
|
||||
@@ -3023,48 +3023,55 @@ strcmp_iw (const char *string1, const char *string2)
|
||||
int
|
||||
strcmp_iw_ordered (const char *string1, const char *string2)
|
||||
{
|
||||
- while ((*string1 != '\0') && (*string2 != '\0'))
|
||||
+ /* Formatting stub. */
|
||||
+ if (1)
|
||||
{
|
||||
- while (isspace (*string1))
|
||||
- {
|
||||
- string1++;
|
||||
- }
|
||||
- while (isspace (*string2))
|
||||
- {
|
||||
- string2++;
|
||||
- }
|
||||
- if (*string1 != *string2)
|
||||
+ /* C1 and C2 are valid only if *string1 != '\0' && *string2 != '\0'.
|
||||
+ Provide stub characters if we are already at the end of one of the
|
||||
+ strings. */
|
||||
+ char c1 = 'X', c2 = 'X';
|
||||
+
|
||||
+ while (*string1 != '\0' && *string2 != '\0')
|
||||
{
|
||||
- break;
|
||||
+ while (isspace (*string1))
|
||||
+ string1++;
|
||||
+ while (isspace (*string2))
|
||||
+ string2++;
|
||||
+
|
||||
+ c1 = *string1;
|
||||
+ c2 = *string2;
|
||||
+ if (c1 != c2)
|
||||
+ break;
|
||||
+
|
||||
+ if (*string1 != '\0')
|
||||
+ {
|
||||
+ string1++;
|
||||
+ string2++;
|
||||
+ }
|
||||
}
|
||||
- if (*string1 != '\0')
|
||||
+
|
||||
+ switch (*string1)
|
||||
{
|
||||
- string1++;
|
||||
- string2++;
|
||||
+ /* Characters are non-equal unless they're both '\0'; we want to
|
||||
+ make sure we get the comparison right according to our
|
||||
+ comparison in the cases where one of them is '\0' or '('. */
|
||||
+ case '\0':
|
||||
+ if (*string2 == '\0')
|
||||
+ return 0;
|
||||
+ else
|
||||
+ return -1;
|
||||
+ case '(':
|
||||
+ if (*string2 == '\0')
|
||||
+ return 1;
|
||||
+ else
|
||||
+ return -1;
|
||||
+ default:
|
||||
+ if (*string2 == '\0' || *string2 == '(')
|
||||
+ return 1;
|
||||
+ else
|
||||
+ return c1 - c2;
|
||||
}
|
||||
}
|
||||
-
|
||||
- switch (*string1)
|
||||
- {
|
||||
- /* Characters are non-equal unless they're both '\0'; we want to
|
||||
- make sure we get the comparison right according to our
|
||||
- comparison in the cases where one of them is '\0' or '('. */
|
||||
- case '\0':
|
||||
- if (*string2 == '\0')
|
||||
- return 0;
|
||||
- else
|
||||
- return -1;
|
||||
- case '(':
|
||||
- if (*string2 == '\0')
|
||||
- return 1;
|
||||
- else
|
||||
- return -1;
|
||||
- default:
|
||||
- if (*string2 == '(')
|
||||
- return 1;
|
||||
- else
|
||||
- return *string1 - *string2;
|
||||
- }
|
||||
}
|
||||
|
||||
/* A simple comparison function with opposite semantics to strcmp. */
|
||||
|
188
gdb-bz645773-case-insensitive-3of5.patch
Normal file
188
gdb-bz645773-case-insensitive-3of5.patch
Normal file
@ -0,0 +1,188 @@
|
||||
http://sourceware.org/ml/gdb-patches/2011-04/msg00125.html
|
||||
Subject: [patch 2/3] case insensitive: re_comp->regcomp
|
||||
|
||||
Hi,
|
||||
|
||||
re_comp cannot be passed REG_ICASE. Therefore change the code. The should
|
||||
have no functionality impact.
|
||||
|
||||
The new boolean field `preg_p' could be maybe replaced by a conditional
|
||||
`preg.buffer != NULL' which would work with libiberty regcomp implementation
|
||||
but I do not see it guaranteed anywhere. GDB is always using static libiberty
|
||||
implementation which I do not see why in the case it is running on glibc.
|
||||
But if it gets fixed one day and it starts to use externally linked
|
||||
regcomp/regexec I would find the `preg.buffer != NULL' conditional dangerous.
|
||||
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/
|
||||
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
Replace re_comp/re_exec by regcomp/regexec.
|
||||
* symtab.c (struct search_symbols_data): New fields preg, preg_p.
|
||||
(search_symbols_name_matches): Use them, use regexec.
|
||||
(search_symbols): New variable retval_chain, adjust the use of
|
||||
old_chain against it. Replace re_comp by regcomp. Use the new struct
|
||||
search_symbols_data fields, use regexec instead of re_exec.
|
||||
|
||||
Index: gdb-7.2.90.20110429/gdb/symtab.c
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110429.orig/gdb/symtab.c 2011-04-29 09:43:33.000000000 +0200
|
||||
+++ gdb-7.2.90.20110429/gdb/symtab.c 2011-04-29 09:43:55.000000000 +0200
|
||||
@@ -2958,7 +2958,10 @@ struct search_symbols_data
|
||||
{
|
||||
int nfiles;
|
||||
char **files;
|
||||
- char *regexp;
|
||||
+
|
||||
+ /* It is true if PREG contains valid data, false otherwise. */
|
||||
+ unsigned preg_p : 1;
|
||||
+ regex_t preg;
|
||||
};
|
||||
|
||||
/* A callback for expand_symtabs_matching. */
|
||||
@@ -2976,7 +2979,7 @@ search_symbols_name_matches (const char
|
||||
{
|
||||
struct search_symbols_data *data = user_data;
|
||||
|
||||
- return data->regexp == NULL || re_exec (symname);
|
||||
+ return !data->preg_p || regexec (&data->preg, symname, 0, NULL, 0) == 0;
|
||||
}
|
||||
|
||||
/* Search the symbol table for matches to the regular expression REGEXP,
|
||||
@@ -3023,9 +3026,13 @@ search_symbols (char *regexp, domain_enu
|
||||
struct symbol_search *sr;
|
||||
struct symbol_search *psr;
|
||||
struct symbol_search *tail;
|
||||
- struct cleanup *old_chain = NULL;
|
||||
struct search_symbols_data datum;
|
||||
|
||||
+ /* OLD_CHAIN .. RETVAL_CHAIN is always freed, RETVAL_CHAIN .. current
|
||||
+ CLEANUP_CHAIN is freed only in the case of an error. */
|
||||
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
|
||||
+ struct cleanup *retval_chain;
|
||||
+
|
||||
if (kind < VARIABLES_DOMAIN || kind >= ALL_DOMAIN)
|
||||
error (_("must search on specific domain"));
|
||||
|
||||
@@ -3036,6 +3043,7 @@ search_symbols (char *regexp, domain_enu
|
||||
|
||||
sr = *matches = NULL;
|
||||
tail = NULL;
|
||||
+ datum.preg_p = 0;
|
||||
|
||||
if (regexp != NULL)
|
||||
{
|
||||
@@ -3045,6 +3053,7 @@ search_symbols (char *regexp, domain_enu
|
||||
and <TYPENAME> or <OPERATOR>. */
|
||||
char *opend;
|
||||
char *opname = operator_chars (regexp, &opend);
|
||||
+ int errcode;
|
||||
|
||||
if (*opname)
|
||||
{
|
||||
@@ -3073,8 +3082,16 @@ search_symbols (char *regexp, domain_enu
|
||||
}
|
||||
}
|
||||
|
||||
- if (0 != (val = re_comp (regexp)))
|
||||
- error (_("Invalid regexp (%s): %s"), val, regexp);
|
||||
+ errcode = regcomp (&datum.preg, regexp, REG_NOSUB);
|
||||
+ if (errcode != 0)
|
||||
+ {
|
||||
+ char *err = get_regcomp_error (errcode, &datum.preg);
|
||||
+
|
||||
+ make_cleanup (xfree, err);
|
||||
+ error (_("Invalid regexp (%s): %s"), err, regexp);
|
||||
+ }
|
||||
+ datum.preg_p = 1;
|
||||
+ make_regfree_cleanup (&datum.preg);
|
||||
}
|
||||
|
||||
/* Search through the partial symtabs *first* for all symbols
|
||||
@@ -3083,7 +3100,6 @@ search_symbols (char *regexp, domain_enu
|
||||
|
||||
datum.nfiles = nfiles;
|
||||
datum.files = files;
|
||||
- datum.regexp = regexp;
|
||||
ALL_OBJFILES (objfile)
|
||||
{
|
||||
if (objfile->sf)
|
||||
@@ -3094,6 +3110,8 @@ search_symbols (char *regexp, domain_enu
|
||||
&datum);
|
||||
}
|
||||
|
||||
+ retval_chain = old_chain;
|
||||
+
|
||||
/* Here, we search through the minimal symbol tables for functions
|
||||
and variables that match, and force their symbols to be read.
|
||||
This is in particular necessary for demangled variable names,
|
||||
@@ -3117,8 +3135,9 @@ search_symbols (char *regexp, domain_enu
|
||||
MSYMBOL_TYPE (msymbol) == ourtype3 ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype4)
|
||||
{
|
||||
- if (regexp == NULL
|
||||
- || re_exec (SYMBOL_NATURAL_NAME (msymbol)) != 0)
|
||||
+ if (!datum.preg_p
|
||||
+ || regexec (&datum.preg, SYMBOL_NATURAL_NAME (msymbol), 0,
|
||||
+ NULL, 0) == 0)
|
||||
{
|
||||
if (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol)))
|
||||
{
|
||||
@@ -3156,8 +3175,9 @@ search_symbols (char *regexp, domain_enu
|
||||
QUIT;
|
||||
|
||||
if (file_matches (real_symtab->filename, files, nfiles)
|
||||
- && ((regexp == NULL
|
||||
- || re_exec (SYMBOL_NATURAL_NAME (sym)) != 0)
|
||||
+ && ((!datum.preg_p
|
||||
+ || regexec (&datum.preg, SYMBOL_NATURAL_NAME (sym), 0,
|
||||
+ NULL, 0) == 0)
|
||||
&& ((kind == VARIABLES_DOMAIN
|
||||
&& SYMBOL_CLASS (sym) != LOC_TYPEDEF
|
||||
&& SYMBOL_CLASS (sym) != LOC_UNRESOLVED
|
||||
@@ -3199,7 +3219,7 @@ search_symbols (char *regexp, domain_enu
|
||||
tail = sort_search_symbols (&dummy, nfound);
|
||||
sr = dummy.next;
|
||||
|
||||
- old_chain = make_cleanup_free_search_symbols (sr);
|
||||
+ make_cleanup_free_search_symbols (sr);
|
||||
}
|
||||
else
|
||||
tail = sort_search_symbols (prevtail, nfound);
|
||||
@@ -3221,8 +3241,9 @@ search_symbols (char *regexp, domain_enu
|
||||
MSYMBOL_TYPE (msymbol) == ourtype3 ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype4)
|
||||
{
|
||||
- if (regexp == NULL
|
||||
- || re_exec (SYMBOL_NATURAL_NAME (msymbol)) != 0)
|
||||
+ if (!datum.preg_p
|
||||
+ || regexec (&datum.preg, SYMBOL_NATURAL_NAME (msymbol), 0,
|
||||
+ NULL, 0) == 0)
|
||||
{
|
||||
/* Functions: Look up by address. */
|
||||
if (kind != FUNCTIONS_DOMAIN ||
|
||||
@@ -3244,7 +3265,7 @@ search_symbols (char *regexp, domain_enu
|
||||
if (tail == NULL)
|
||||
{
|
||||
sr = psr;
|
||||
- old_chain = make_cleanup_free_search_symbols (sr);
|
||||
+ make_cleanup_free_search_symbols (sr);
|
||||
}
|
||||
else
|
||||
tail->next = psr;
|
||||
@@ -3256,9 +3277,9 @@ search_symbols (char *regexp, domain_enu
|
||||
}
|
||||
}
|
||||
|
||||
+ discard_cleanups (retval_chain);
|
||||
+ do_cleanups (old_chain);
|
||||
*matches = sr;
|
||||
- if (sr != NULL)
|
||||
- discard_cleanups (old_chain);
|
||||
}
|
||||
|
||||
/* Helper function for symtab_symbol_info, this function uses
|
666
gdb-bz645773-case-insensitive-4of5.patch
Normal file
666
gdb-bz645773-case-insensitive-4of5.patch
Normal file
@ -0,0 +1,666 @@
|
||||
http://sourceware.org/ml/gdb-patches/2011-04/msg00418.html
|
||||
Subject: Re: [patch 3/3] case insensitive: the fix [rediff]
|
||||
|
||||
On Fri, 22 Apr 2011 21:05:07 +0200, Eli Zaretskii wrote:
|
||||
> This @table will look weird in the manual: it produces lines that
|
||||
> begin with a lower-case letter. Perhaps reorder thusly:
|
||||
|
||||
OK, thanks for the review.
|
||||
|
||||
|
||||
Regards,
|
||||
Jan
|
||||
|
||||
|
||||
gdb/doc/
|
||||
2011-04-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* gdb.texinfo (Index Section Format): Change the version to 5.
|
||||
Describe the different formula.
|
||||
|
||||
gdb/
|
||||
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* dwarf2read.c: Include ctype.h.
|
||||
(struct mapped_index): New field version.
|
||||
(mapped_index_string_hash): New parameter index_version. New comment
|
||||
for it. Call tolower appropriately.
|
||||
(find_slot_in_mapped_hash): New variable cmp, initialize it, use it.
|
||||
Choose the right index version for mapped_index_string_hash.
|
||||
(dwarf2_read_index): Support also the index version 5. Initialize the
|
||||
new struct mapped_index field version.
|
||||
(hash_strtab_entry): Pass INT_MAX for the new parameter, explain why.
|
||||
(find_slot): Explain the version needs. Pass INT_MAX for the new
|
||||
parameter.
|
||||
(write_psymtabs_to_index): Produce version 5.
|
||||
* minsyms.c (lookup_minimal_symbol): New variable cmp, initialize it,
|
||||
use it. New comment for SYMBOL_MATCHES_SEARCH_NAME.
|
||||
* psymtab.c (lookup_partial_symbol): Find the
|
||||
SYMBOL_MATCHES_SEARCH_NAME start of the found block of matching
|
||||
entries.
|
||||
* symtab.c (lookup_symbol_in_language): Remove the case_sensitive_off
|
||||
NAME lowercasing.
|
||||
(search_symbols): Pass REG_ICASE to regcomp for case_sensitive_off.
|
||||
(completion_list_add_name): New variable ncmp, initialize it, use it.
|
||||
* symtab.h (SYMBOL_HASH_NEXT): Always call tolower.
|
||||
* utils.c (strcmp_iw): Support case_sensitive_off.
|
||||
(strcmp_iw_ordered): Sort in a way compatible with case_sensitive_off.
|
||||
New function comment part. New variables saved_string1,
|
||||
saved_string2 and case_pass. Add a proper second pass.
|
||||
|
||||
gdb/testsuite/
|
||||
2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/fortran-sym-case.c: New file.
|
||||
* gdb.base/fortran-sym-case.exp: New file.
|
||||
* gdb.dwarf2/dw2-case-insensitive-debug.S: New file.
|
||||
* 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
|
||||
===================================================================
|
||||
--- 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
|
||||
@@ -152,6 +152,9 @@ DEF_VEC_I (offset_type);
|
||||
a comment by the code that writes the index. */
|
||||
struct mapped_index
|
||||
{
|
||||
+ /* Index data format version. */
|
||||
+ int version;
|
||||
+
|
||||
/* The total length of the buffer. */
|
||||
off_t total_size;
|
||||
|
||||
@@ -1990,17 +1993,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
|
||||
- SYMBOL_HASH_NEXT. */
|
||||
+ SYMBOL_HASH_NEXT.
|
||||
+
|
||||
+ Use INT_MAX for INDEX_VERSION if you generate the current index format. */
|
||||
|
||||
static hashval_t
|
||||
-mapped_index_string_hash (const void *p)
|
||||
+mapped_index_string_hash (int index_version, const void *p)
|
||||
{
|
||||
const unsigned char *str = (const unsigned char *) p;
|
||||
hashval_t r = 0;
|
||||
unsigned char c;
|
||||
|
||||
while ((c = *str++) != 0)
|
||||
- r = r * 67 + c - 113;
|
||||
+ {
|
||||
+ if (index_version >= 5)
|
||||
+ c = tolower (c);
|
||||
+ r = r * 67 + c - 113;
|
||||
+ }
|
||||
|
||||
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);
|
||||
offset_type slot, step;
|
||||
+ int (*cmp) (const char *, const char *);
|
||||
|
||||
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;
|
||||
|
||||
str = index->constant_pool + MAYBE_SWAP (index->symbol_table[i]);
|
||||
- if (!strcmp (name, str))
|
||||
+ if (!cmp (name, str))
|
||||
{
|
||||
*vec_out = (offset_type *) (index->constant_pool
|
||||
+ MAYBE_SWAP (index->symbol_table[i + 1]));
|
||||
@@ -2071,15 +2088,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
|
||||
- indices. */
|
||||
+ indices. Index version 4 uses a different hash function than index
|
||||
+ version 5 and later. */
|
||||
if (version < 4)
|
||||
return 0;
|
||||
/* Indexes with higher version than the one supported by GDB may be no
|
||||
longer backward compatible. */
|
||||
- if (version > 4)
|
||||
+ if (version > 5)
|
||||
return 0;
|
||||
|
||||
map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
|
||||
+ map->version = version;
|
||||
map->total_size = dwarf2_per_objfile->gdb_index.size;
|
||||
|
||||
metadata = (offset_type *) (addr + sizeof (offset_type));
|
||||
@@ -15602,13 +15621,16 @@ struct strtab_entry
|
||||
const char *str;
|
||||
};
|
||||
|
||||
-/* Hash function for a strtab_entry. */
|
||||
+/* Hash function for a strtab_entry.
|
||||
+
|
||||
+ Function is used only during write_hash_table so no index format backward
|
||||
+ compatibility is needed. */
|
||||
|
||||
static hashval_t
|
||||
hash_strtab_entry (const void *e)
|
||||
{
|
||||
const struct strtab_entry *entry = e;
|
||||
- return mapped_index_string_hash (entry->str);
|
||||
+ return mapped_index_string_hash (INT_MAX, entry->str);
|
||||
}
|
||||
|
||||
/* Equality function for a strtab_entry. */
|
||||
@@ -15746,12 +15768,15 @@ cleanup_mapped_symtab (void *p)
|
||||
}
|
||||
|
||||
/* Find a slot in SYMTAB for the symbol NAME. Returns a pointer to
|
||||
- the slot. */
|
||||
+ the slot.
|
||||
+
|
||||
+ Function is used only during write_hash_table so no index format backward
|
||||
+ compatibility is needed. */
|
||||
|
||||
static struct symtab_index_entry **
|
||||
find_slot (struct mapped_symtab *symtab, const char *name)
|
||||
{
|
||||
- offset_type index, step, hash = mapped_index_string_hash (name);
|
||||
+ offset_type index, step, hash = mapped_index_string_hash (INT_MAX, name);
|
||||
|
||||
index = hash & (symtab->size - 1);
|
||||
step = ((hash * 17) & (symtab->size - 1)) | 1;
|
||||
@@ -16279,7 +16304,7 @@ write_psymtabs_to_index (struct objfile
|
||||
total_len = size_of_contents;
|
||||
|
||||
/* The version number. */
|
||||
- val = MAYBE_SWAP (4);
|
||||
+ val = MAYBE_SWAP (5);
|
||||
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
|
||||
===================================================================
|
||||
--- 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
|
||||
@@ -239,11 +239,16 @@ lookup_minimal_symbol (const char *name,
|
||||
|
||||
if (pass == 1)
|
||||
{
|
||||
- match = strcmp (SYMBOL_LINKAGE_NAME (msymbol),
|
||||
- modified_name) == 0;
|
||||
+ int (*cmp) (const char *, const char *);
|
||||
+
|
||||
+ cmp = (case_sensitivity == case_sensitive_on
|
||||
+ ? strcmp : strcasecmp);
|
||||
+ match = cmp (SYMBOL_LINKAGE_NAME (msymbol),
|
||||
+ modified_name) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
+ /* The function respects CASE_SENSITIVITY. */
|
||||
match = SYMBOL_MATCHES_SEARCH_NAME (msymbol,
|
||||
modified_name);
|
||||
}
|
||||
Index: gdb-7.2.90.20110429/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
|
||||
@@ -690,8 +690,15 @@ lookup_partial_symbol (struct partial_sy
|
||||
internal_error (__FILE__, __LINE__,
|
||||
_("failed internal consistency check"));
|
||||
|
||||
- while (top <= real_top
|
||||
- && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name))
|
||||
+ /* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
|
||||
+ search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
|
||||
+ while (top >= start && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name))
|
||||
+ top--;
|
||||
+
|
||||
+ /* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */
|
||||
+ top++;
|
||||
+
|
||||
+ while (top <= real_top && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name))
|
||||
{
|
||||
if (symbol_matches_domain (SYMBOL_LANGUAGE (*top),
|
||||
SYMBOL_DOMAIN (*top), domain))
|
||||
Index: gdb-7.2.90.20110429/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
|
||||
@@ -1062,19 +1062,6 @@ lookup_symbol_in_language (const char *n
|
||||
}
|
||||
}
|
||||
|
||||
- if (case_sensitivity == case_sensitive_off)
|
||||
- {
|
||||
- char *copy;
|
||||
- int len, i;
|
||||
-
|
||||
- len = strlen (name);
|
||||
- copy = (char *) alloca (len + 1);
|
||||
- for (i= 0; i < len; i++)
|
||||
- copy[i] = tolower (name[i]);
|
||||
- copy[len] = 0;
|
||||
- modified_name = copy;
|
||||
- }
|
||||
-
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
- errcode = regcomp (&datum.preg, regexp, REG_NOSUB);
|
||||
+ errcode = regcomp (&datum.preg, regexp,
|
||||
+ REG_NOSUB | (case_sensitivity == case_sensitive_off
|
||||
+ ? REG_ICASE : 0));
|
||||
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)
|
||||
{
|
||||
int newsize;
|
||||
+ int (*ncmp) (const char *, const char *, size_t);
|
||||
+
|
||||
+ ncmp = (case_sensitivity == case_sensitive_on ? strncmp : strncasecmp);
|
||||
|
||||
/* 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
|
||||
===================================================================
|
||||
--- 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
|
||||
is only a GDB in-memory computed value with no external files compatibility
|
||||
requirements. */
|
||||
|
||||
-#define SYMBOL_HASH_NEXT(hash, c) ((hash) * 67 + (c) - 113)
|
||||
+#define SYMBOL_HASH_NEXT(hash, c) \
|
||||
+ ((hash) * 67 + tolower ((unsigned char) (c)) - 113)
|
||||
|
||||
extern struct objfile * msymbol_objfile (struct minimal_symbol *sym);
|
||||
|
||||
Index: gdb-7.2.90.20110429/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
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* 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/>. */
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **aRGv)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gdb-7.2.90.20110429/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
|
||||
@@ -0,0 +1,27 @@
|
||||
+# 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/>.
|
||||
+
|
||||
+set testfile fortran-sym-case
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+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
|
||||
===================================================================
|
||||
--- /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
|
||||
@@ -0,0 +1,102 @@
|
||||
+/* 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 */
|
||||
+ .ascii "file1.txt\0" /* DW_AT_name */
|
||||
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
|
||||
+ .byte 8 /* DW_AT_language (DW_LANG_Fortran90) */
|
||||
+ .4byte FUNC_lang /* DW_AT_low_pc */
|
||||
+ .4byte main /* DW_AT_high_pc */
|
||||
+
|
||||
+ .uleb128 3 /* Abbrev: DW_TAG_subprogram */
|
||||
+ .byte 1 /* DW_AT_external */
|
||||
+ .ascii "FUNC_lang\0" /* DW_AT_name */
|
||||
+ .4byte FUNC_lang /* DW_AT_low_pc */
|
||||
+ .4byte main /* DW_AT_high_pc */
|
||||
+ .byte 1 /* DW_AT_prototyped */
|
||||
+ .4byte .Ltype - .Lcu1_begin /* DW_AT_type */
|
||||
+
|
||||
+.Ltype:
|
||||
+ .uleb128 0x5 /* Abbrev: DW_TAG_base_type */
|
||||
+ .byte 0x4 /* DW_AT_byte_size */
|
||||
+ .byte 0x5 /* DW_AT_encoding */
|
||||
+ .ascii "foo\0" /* DW_AT_name */
|
||||
+
|
||||
+ .byte 0 /* End of children of CU */
|
||||
+.Lcu1_end:
|
||||
+
|
||||
+/* Abbrev table */
|
||||
+ .section .debug_abbrev
|
||||
+.Labbrev1_begin:
|
||||
+ .uleb128 1 /* Abbrev code */
|
||||
+ .uleb128 0x11 /* DW_TAG_compile_unit */
|
||||
+ .byte 1 /* has_children */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x25 /* DW_AT_producer */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x13 /* DW_AT_language */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .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 0x2e /* DW_TAG_subprogram */
|
||||
+ .byte 0 /* has_children */
|
||||
+ .uleb128 0x3f /* DW_AT_external */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .uleb128 0x11 /* DW_AT_low_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x12 /* DW_AT_high_pc */
|
||||
+ .uleb128 0x1 /* DW_FORM_addr */
|
||||
+ .uleb128 0x27 /* DW_AT_prototyped */
|
||||
+ .uleb128 0xc /* DW_FORM_flag */
|
||||
+ .uleb128 0x49 /* DW_AT_type */
|
||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .uleb128 0x5 /* Abbrev code */
|
||||
+ .uleb128 0x24 /* DW_TAG_base_type */
|
||||
+ .byte 0x0 /* DW_children_no */
|
||||
+ .uleb128 0xb /* DW_AT_byte_size */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x3e /* DW_AT_encoding */
|
||||
+ .uleb128 0xb /* DW_FORM_data1 */
|
||||
+ .uleb128 0x3 /* DW_AT_name */
|
||||
+ .uleb128 0x8 /* DW_FORM_string */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+
|
||||
+ .byte 0x0 /* Terminator */
|
||||
+ .byte 0x0 /* Terminator */
|
||||
Index: gdb-7.2.90.20110429/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
|
||||
@@ -0,0 +1,38 @@
|
||||
+/* 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/>. */
|
||||
+
|
||||
+/* Use DW_LANG_Fortran90 for case insensitive DWARF. */
|
||||
+
|
||||
+void
|
||||
+FUNC_lang (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+/* Symbol is present only in ELF .symtab. */
|
||||
+
|
||||
+void
|
||||
+FUNC_symtab (void)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ FUNC_lang ();
|
||||
+ FUNC_symtab ();
|
||||
+ return 0;
|
||||
+}
|
||||
Index: gdb-7.2.90.20110429/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
|
||||
@@ -0,0 +1,49 @@
|
||||
+# 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
|
||||
+
|
||||
+# This test can only be run on targets which support DWARF-2 and use gas.
|
||||
+if {![dwarf2_support]} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-case-insensitive"
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "show case-sensitive" {Case sensitivity in name search is "auto; currently on"\.}
|
||||
+
|
||||
+gdb_test "info functions fUnC_lang" \
|
||||
+ "All functions matching regular expression \"fUnC_lang\":" \
|
||||
+ "regexp case-sensitive on"
|
||||
+
|
||||
+gdb_test "set case-sensitive off" {warning: the current case sensitivity setting does not match the language\.}
|
||||
+
|
||||
+gdb_test "info functions fUnC_lang" \
|
||||
+ "All functions matching regular expression \"fUnC_lang\":\[\r\n\]+File file1.txt:\r\nfoo FUNC_lang\\(void\\);" \
|
||||
+ "regexp case-sensitive off"
|
||||
+
|
||||
+gdb_test "p fuNC_lang" { = {foo \(void\)} 0x[0-9a-f]+ <FUNC_lang>}
|
||||
+gdb_test "p fuNC_symtab" { = {<text variable, no debug info>} 0x[0-9a-f]+ <FUNC_symtab>}
|
||||
+
|
||||
+if {[gdb_breakpoint "fuNC_lang"] == 1} {
|
||||
+ pass "setting breakpoint at fuNC_lang"
|
||||
+}
|
||||
+
|
||||
+if {[gdb_breakpoint "fuNC_symtab"] == 1} {
|
||||
+ pass "setting breakpoint at fuNC_symtab"
|
||||
+}
|
||||
Index: gdb-7.2.90.20110429/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
|
||||
@@ -3003,10 +3003,12 @@ strcmp_iw (const char *string1, const ch
|
||||
{
|
||||
string2++;
|
||||
}
|
||||
- if (*string1 != *string2)
|
||||
- {
|
||||
- break;
|
||||
- }
|
||||
+ if (case_sensitivity == case_sensitive_on && *string1 != *string2)
|
||||
+ break;
|
||||
+ if (case_sensitivity == case_sensitive_off
|
||||
+ && (tolower ((unsigned char) *string1)
|
||||
+ != tolower ((unsigned char) *string2)))
|
||||
+ break;
|
||||
if (*string1 != '\0')
|
||||
{
|
||||
string1++;
|
||||
@@ -3027,6 +3029,10 @@ strcmp_iw (const char *string1, const ch
|
||||
strcmp_iw(LIST_ELT, NAME), then the place to start looking is right
|
||||
where this function would put NAME.
|
||||
|
||||
+ This function must be neutral to the CASE_SENSITIVITY setting as the user
|
||||
+ may choose it during later lookup. Therefore this function always sorts
|
||||
+ primarily case-insensitively and secondarily case-sensitively.
|
||||
+
|
||||
Here are some examples of why using strcmp to sort is a bad idea:
|
||||
|
||||
Whitespace example:
|
||||
@@ -3052,8 +3058,10 @@ strcmp_iw (const char *string1, const ch
|
||||
int
|
||||
strcmp_iw_ordered (const char *string1, const char *string2)
|
||||
{
|
||||
- /* Formatting stub. */
|
||||
- if (1)
|
||||
+ const char *saved_string1 = string1, *saved_string2 = string2;
|
||||
+ enum case_sensitivity case_pass = case_sensitive_off;
|
||||
+
|
||||
+ for (;;)
|
||||
{
|
||||
/* C1 and C2 are valid only if *string1 != '\0' && *string2 != '\0'.
|
||||
Provide stub characters if we are already at the end of one of the
|
||||
@@ -3067,8 +3075,17 @@ strcmp_iw_ordered (const char *string1,
|
||||
while (isspace (*string2))
|
||||
string2++;
|
||||
|
||||
+ switch (case_pass)
|
||||
+ {
|
||||
+ case case_sensitive_off:
|
||||
+ c1 = tolower ((unsigned char) *string1);
|
||||
+ c2 = tolower ((unsigned char) *string2);
|
||||
+ break;
|
||||
+ case case_sensitive_on:
|
||||
c1 = *string1;
|
||||
c2 = *string2;
|
||||
+ break;
|
||||
+ }
|
||||
if (c1 != c2)
|
||||
break;
|
||||
|
||||
@@ -3086,7 +3103,7 @@ strcmp_iw_ordered (const char *string1,
|
||||
comparison in the cases where one of them is '\0' or '('. */
|
||||
case '\0':
|
||||
if (*string2 == '\0')
|
||||
- return 0;
|
||||
+ break;
|
||||
else
|
||||
return -1;
|
||||
case '(':
|
||||
@@ -3097,9 +3114,22 @@ strcmp_iw_ordered (const char *string1,
|
||||
default:
|
||||
if (*string2 == '\0' || *string2 == '(')
|
||||
return 1;
|
||||
- else
|
||||
- return c1 - c2;
|
||||
+ else if (c1 > c2)
|
||||
+ return 1;
|
||||
+ else if (c1 < c2)
|
||||
+ return -1;
|
||||
+ /* PASSTHRU */
|
||||
}
|
||||
+
|
||||
+ if (case_pass == case_sensitive_on)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* Otherwise the strings were equal in case insensitive way, make
|
||||
+ a more fine grained comparison in a case sensitive way. */
|
||||
+
|
||||
+ case_pass = case_sensitive_on;
|
||||
+ string1 = saved_string1;
|
||||
+ string2 = saved_string2;
|
||||
}
|
||||
}
|
||||
|
62
gdb-bz645773-case-insensitive-5of5.patch
Normal file
62
gdb-bz645773-case-insensitive-5of5.patch
Normal file
@ -0,0 +1,62 @@
|
||||
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 **
|
||||
|
@ -1,8 +1,8 @@
|
||||
Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
|
||||
Index: gdb-7.2.90.20110429/gdb/dwarf2read.c
|
||||
===================================================================
|
||||
--- gdb-7.2.50.20110117.orig/gdb/dwarf2read.c 2011-01-17 15:50:41.000000000 +0100
|
||||
+++ gdb-7.2.50.20110117/gdb/dwarf2read.c 2011-01-17 15:56:23.000000000 +0100
|
||||
@@ -7465,12 +7465,14 @@ read_set_type (struct die_info *die, str
|
||||
--- 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
|
||||
return set_die_type (die, set_type, cu);
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
|
||||
struct attribute *attr;
|
||||
struct symbol *sym;
|
||||
CORE_ADDR base = (CORE_ADDR) 0;
|
||||
@@ -7495,10 +7497,40 @@ read_common_block (struct die_info *die,
|
||||
@@ -7599,10 +7601,40 @@ read_common_block (struct die_info *die,
|
||||
}
|
||||
if (die->child != NULL)
|
||||
{
|
||||
@ -60,7 +60,7 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
|
||||
attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
|
||||
if (sym != NULL && attr != NULL)
|
||||
{
|
||||
@@ -7516,8 +7548,25 @@ read_common_block (struct die_info *die,
|
||||
@@ -7620,8 +7652,25 @@ read_common_block (struct die_info *die,
|
||||
SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
|
||||
add_symbol_to_list (sym, &global_symbols);
|
||||
}
|
||||
@ -86,7 +86,7 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11111,6 +11160,13 @@ new_symbol_full (struct die_info *die, s
|
||||
@@ -11286,6 +11335,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 +100,7 @@ Index: gdb-7.2.50.20110117/gdb/dwarf2read.c
|
||||
if (SYMBOL_CLASS (sym) == LOC_STATIC
|
||||
&& SYMBOL_VALUE_ADDRESS (sym) == 0
|
||||
&& !dwarf2_per_objfile->has_section_at_zero)
|
||||
@@ -11283,6 +11339,11 @@ new_symbol_full (struct die_info *die, s
|
||||
@@ -11458,6 +11514,11 @@ new_symbol_full (struct die_info *die, s
|
||||
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
|
||||
list_to_add = &global_symbols;
|
||||
break;
|
||||
@ -112,10 +112,10 @@ Index: gdb-7.2.50.20110117/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.50.20110117/gdb/f-lang.c
|
||||
Index: gdb-7.2.90.20110429/gdb/f-lang.c
|
||||
===================================================================
|
||||
--- gdb-7.2.50.20110117.orig/gdb/f-lang.c 2011-01-17 15:56:07.000000000 +0100
|
||||
+++ gdb-7.2.50.20110117/gdb/f-lang.c 2011-01-17 15:56:48.000000000 +0100
|
||||
--- 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
|
||||
@@ -446,27 +446,3 @@ _initialize_f_language (void)
|
||||
|
||||
add_language (&f_language_defn);
|
||||
@ -144,10 +144,10 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
|
||||
- }
|
||||
- return (NULL);
|
||||
-}
|
||||
Index: gdb-7.2.50.20110117/gdb/f-lang.h
|
||||
Index: gdb-7.2.90.20110429/gdb/f-lang.h
|
||||
===================================================================
|
||||
--- gdb-7.2.50.20110117.orig/gdb/f-lang.h 2011-01-17 15:54:14.000000000 +0100
|
||||
+++ gdb-7.2.50.20110117/gdb/f-lang.h 2011-01-17 15:56:23.000000000 +0100
|
||||
--- 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
|
||||
@@ -52,36 +52,8 @@ enum f90_range_type
|
||||
NONE_BOUND_DEFAULT /* "(low:high)" */
|
||||
};
|
||||
@ -185,10 +185,10 @@ Index: gdb-7.2.50.20110117/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.50.20110117/gdb/f-valprint.c
|
||||
Index: gdb-7.2.90.20110429/gdb/f-valprint.c
|
||||
===================================================================
|
||||
--- gdb-7.2.50.20110117.orig/gdb/f-valprint.c 2011-01-17 15:54:36.000000000 +0100
|
||||
+++ gdb-7.2.50.20110117/gdb/f-valprint.c 2011-01-17 15:59:38.000000000 +0100
|
||||
--- 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
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "gdbcore.h"
|
||||
#include "command.h"
|
||||
@ -198,7 +198,7 @@ Index: gdb-7.2.50.20110117/gdb/f-valprint.c
|
||||
|
||||
extern void _initialize_f_valprint (void);
|
||||
static void info_common_command (char *, int);
|
||||
@@ -489,22 +491,54 @@ f_val_print (struct type *type, const gd
|
||||
@@ -501,22 +503,54 @@ f_val_print (struct type *type, const gd
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ Index: gdb-7.2.50.20110117/gdb/f-valprint.c
|
||||
}
|
||||
|
||||
/* This function is used to print out the values in a given COMMON
|
||||
@@ -514,11 +548,9 @@ list_all_visible_commons (char *funname)
|
||||
@@ -526,11 +560,9 @@ list_all_visible_commons (char *funname)
|
||||
static void
|
||||
info_common_command (char *comname, int from_tty)
|
||||
{
|
||||
@ -280,7 +280,7 @@ Index: gdb-7.2.50.20110117/gdb/f-valprint.c
|
||||
|
||||
/* We have been told to display the contents of F77 COMMON
|
||||
block supposedly visible in this function. Let us
|
||||
@@ -530,74 +562,31 @@ info_common_command (char *comname, int
|
||||
@@ -542,74 +574,31 @@ info_common_command (char *comname, int
|
||||
/* The following is generally ripped off from stack.c's routine
|
||||
print_frame_info(). */
|
||||
|
||||
@ -371,11 +371,11 @@ Index: gdb-7.2.50.20110117/gdb/f-valprint.c
|
||||
}
|
||||
|
||||
void
|
||||
Index: gdb-7.2.50.20110117/gdb/stack.c
|
||||
Index: gdb-7.2.90.20110429/gdb/stack.c
|
||||
===================================================================
|
||||
--- gdb-7.2.50.20110117.orig/gdb/stack.c 2011-01-17 15:47:37.000000000 +0100
|
||||
+++ gdb-7.2.50.20110117/gdb/stack.c 2011-01-17 15:56:23.000000000 +0100
|
||||
@@ -1498,6 +1498,8 @@ iterate_over_block_locals (struct block
|
||||
--- 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
|
||||
@@ -1525,6 +1525,8 @@ iterate_over_block_locals (struct block
|
||||
case LOC_COMPUTED:
|
||||
if (SYMBOL_IS_ARGUMENT (sym))
|
||||
break;
|
||||
@ -384,26 +384,26 @@ Index: gdb-7.2.50.20110117/gdb/stack.c
|
||||
(*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
|
||||
break;
|
||||
|
||||
Index: gdb-7.2.50.20110117/gdb/symtab.h
|
||||
Index: gdb-7.2.90.20110429/gdb/symtab.h
|
||||
===================================================================
|
||||
--- gdb-7.2.50.20110117.orig/gdb/symtab.h 2011-01-17 15:47:37.000000000 +0100
|
||||
+++ gdb-7.2.50.20110117/gdb/symtab.h 2011-01-17 15:56:23.000000000 +0100
|
||||
@@ -408,7 +408,10 @@ typedef enum domain_enum_tag
|
||||
FUNCTIONS_DOMAIN,
|
||||
--- 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
|
||||
@@ -411,7 +411,10 @@ typedef enum domain_enum_tag
|
||||
TYPES_DOMAIN,
|
||||
|
||||
/* All defined types */
|
||||
- TYPES_DOMAIN
|
||||
+ TYPES_DOMAIN,
|
||||
/* Any type. */
|
||||
- ALL_DOMAIN
|
||||
+ ALL_DOMAIN,
|
||||
+
|
||||
+ /* Fortran common blocks. Their naming must be separate from VAR_DOMAIN. */
|
||||
+ COMMON_BLOCK_DOMAIN
|
||||
}
|
||||
domain_enum;
|
||||
|
||||
Index: gdb-7.2.50.20110117/gdb/testsuite/gdb.fortran/common-block.exp
|
||||
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.exp
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.fortran/common-block.exp 2011-01-17 15:56:23.000000000 +0100
|
||||
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.exp 2011-04-29 09:41:20.000000000 +0200
|
||||
@@ -0,0 +1,101 @@
|
||||
+# Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
@ -506,10 +506,10 @@ Index: gdb-7.2.50.20110117/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.50.20110117/gdb/testsuite/gdb.fortran/common-block.f90
|
||||
Index: gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.f90
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ gdb-7.2.50.20110117/gdb/testsuite/gdb.fortran/common-block.f90 2011-01-17 15:56:23.000000000 +0100
|
||||
+++ gdb-7.2.90.20110429/gdb/testsuite/gdb.fortran/common-block.f90 2011-04-29 09:41:20.000000000 +0200
|
||||
@@ -0,0 +1,67 @@
|
||||
+! Copyright 2008 Free Software Foundation, Inc.
|
||||
+!
|
||||
|
830
gdb-optim-g-prologue-skip.patch
Normal file
830
gdb-optim-g-prologue-skip.patch
Normal file
@ -0,0 +1,830 @@
|
||||
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"
|
||||
|
228
gdb-physname-expand-completer.patch
Normal file
228
gdb-physname-expand-completer.patch
Normal file
@ -0,0 +1,228 @@
|
||||
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\\)"
|
||||
|
139
gdb-upstream.patch
Normal file
139
gdb-upstream.patch
Normal file
@ -0,0 +1,139 @@
|
||||
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"
|
35
gdb.spec
35
gdb.spec
@ -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.20110411
|
||||
Version: 7.2.90.20110429
|
||||
|
||||
# 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: 34%{?_with_upstream:.upstream}%{?dist}
|
||||
Release: 35%{?_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
|
||||
@ -262,7 +262,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,6 +557,19 @@ Patch574: gdb-core-thread-internalerr-3of3.patch
|
||||
# rebuild to fix it, we need to be able to use gdb :)
|
||||
Patch579: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
|
||||
|
||||
# Fix case insensitive symbols for Fortran by iFort (BZ 645773).
|
||||
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
|
||||
|
||||
BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
|
||||
Requires: readline%{?_isa}
|
||||
BuildRequires: readline-devel%{?_isa}
|
||||
@ -713,7 +726,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
|
||||
@ -826,6 +839,13 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch573 -p1
|
||||
%patch574 -p1
|
||||
%patch579 -p1
|
||||
%patch580 -p1
|
||||
%patch581 -p1
|
||||
%patch582 -p1
|
||||
%patch583 -p1
|
||||
%patch588 -p1
|
||||
%patch589 -p1
|
||||
%patch590 -p1
|
||||
|
||||
%patch390 -p1
|
||||
%patch393 -p1
|
||||
@ -1254,6 +1274,13 @@ fi
|
||||
%{_infodir}/gdb.info*
|
||||
|
||||
%changelog
|
||||
* Fri Apr 29 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2.90.20110429-35.fc15
|
||||
- Rebase to FSF GDB 7.2.90.20110429 (which is a 7.3 pre-release).
|
||||
- Fix -O2 -g breakpoints internal error + prologue skipping (BZ 612253).
|
||||
- Fix case insensitive symbols for Fortran by iFort (BZ 645773).
|
||||
- Fix physname-related CU expansion issue for C++ (PR 12708).
|
||||
- Fix Python access to inlined frames (BZ 694824).
|
||||
|
||||
* Mon Apr 11 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2.90.20110411-34.fc15
|
||||
- Rebase to FSF GDB 7.2.90.20110411 (which is a 7.3 pre-release).
|
||||
- Include the proper fix for anonymous struct typedefs (Tom Tromey, BZ 672230).
|
||||
|
Loading…
Reference in New Issue
Block a user