public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-tromey-python: 2007-10-22 Daniel Jacobowitz <dan@codesourcery.com>
@ 2008-11-07 21:00 ppluzhnikov
0 siblings, 0 replies; only message in thread
From: ppluzhnikov @ 2008-11-07 21:00 UTC (permalink / raw)
To: archer-commits
The branch, archer-tromey-python has been updated
via b2f7b66e72ecc20a08dbec1e867b16adcf7b4e97 (commit)
from 01cb0077b3fd57bf730adff7a230d4edd269d4d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit b2f7b66e72ecc20a08dbec1e867b16adcf7b4e97
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Fri Nov 7 12:57:57 2008 -0800
2007-10-22 Daniel Jacobowitz <dan@codesourcery.com>
PR gdb/931
* Makefile.in (dbxread.o): Update.
* dbxread.c (read_dbx_symtab): Use cp_canonicalize_string.
* dwarf2read.c (GDB_FORM_cached_string): New.
(read_partial_die): Use dwarf2_canonicalize_name.
(dwarf2_linkage_name): Use dwarf2_name.
(dwarf2_canonicalize_name): New.
(dwarf2_name): Use dwarf2_canonicalize_name.
(dwarf_form_name, dump_die): Handle GDB_FORM_cached_string.
* stabsread.c (define_symbol, read_type): Use cp_canonicalize_string.
* symtab.c (lookup_symbol_in_language): Canonicalize input before
searching.
2008-11-07 Daniel Jacobowitz <dan@codesourcery.com>
PR gdb/931
* gdb.cp/gdb1355.exp (f_li, f_lui, f_si, f_sui): Allow canonical
output.
* gdb.cp/templates.exp: Allow canonical output. Remove KFAILs
for gdb/931.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 15 ++++++
gdb/dbxread.c | 40 +++++++++++++---
gdb/dwarf2read.c | 89 +++++++++++++++++++++++++++++++----
gdb/stabsread.c | 52 ++++++++++++++++----
gdb/symtab.c | 12 +++++
gdb/testsuite/ChangeLog | 8 +++
gdb/testsuite/gdb.cp/gdb1355.exp | 8 ++--
gdb/testsuite/gdb.cp/templates.exp | 18 +++----
8 files changed, 197 insertions(+), 45 deletions(-)
First 500 lines of diff:
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ca08460..9246144 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,18 @@
+2008-11-07 Daniel Jacobowitz <dan@codesourcery.com>
+
+ PR gdb/931
+ * Makefile.in (dbxread.o): Update.
+ * dbxread.c (read_dbx_symtab): Use cp_canonicalize_string.
+ * dwarf2read.c (GDB_FORM_cached_string): New.
+ (read_partial_die): Use dwarf2_canonicalize_name.
+ (dwarf2_linkage_name): Use dwarf2_name.
+ (dwarf2_canonicalize_name): New.
+ (dwarf2_name): Use dwarf2_canonicalize_name.
+ (dwarf_form_name, dump_die): Handle GDB_FORM_cached_string.
+ * stabsread.c (define_symbol, read_type): Use cp_canonicalize_string.
+ * symtab.c (lookup_symbol_in_language): Canonicalize input before
+ searching.
+
2008-11-07 Tom Tromey <tromey@redhat.com>
* python/python-type.c (typy_lookup_type): Rearrange to avoid
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 25ec313..e4eefea 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1188,6 +1188,8 @@ read_dbx_symtab (struct objfile *objfile)
struct internal_nlist nlist;
CORE_ADDR text_addr;
int text_size;
+ char *sym_name;
+ int sym_len;
char *namestring;
int nsl;
@@ -1681,6 +1683,28 @@ pos %d"),
if (!p)
continue; /* Not a debugging symbol. */
+ sym_len = 0;
+ if (psymtab_language == language_cplus)
+ {
+ char *new_name, *name = alloca (p - namestring + 1);
+ memcpy (name, namestring, p - namestring);
+ name[p - namestring] = '\0';
+ new_name = cp_canonicalize_string (name);
+ if (new_name != NULL)
+ {
+ sym_len = strlen (new_name);
+ sym_name = obsavestring (new_name, sym_len,
+ &objfile->objfile_obstack);
+ xfree (new_name);
+ }
+ }
+
+ if (sym_len == 0)
+ {
+ sym_name = namestring;
+ sym_len = p - namestring;
+ }
+
/* Main processing section for debugging symbols which
the initial read through the symbol tables needs to worry
about. If we reach this point, the symbol which we are
@@ -1698,7 +1722,7 @@ pos %d"),
namestring = gdbarch_static_transform_name (gdbarch,
namestring);
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
VAR_DOMAIN, LOC_STATIC,
&objfile->static_psymbols,
0, nlist.n_value,
@@ -1710,7 +1734,7 @@ pos %d"),
data_sect_index);
/* The addresses in these entries are reported to be
wrong. See the code that reads 'G's for symtabs. */
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
VAR_DOMAIN, LOC_STATIC,
&objfile->global_psymbols,
0, nlist.n_value,
@@ -1728,7 +1752,7 @@ pos %d"),
|| (p == namestring + 1
&& namestring[0] != ' '))
{
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
STRUCT_DOMAIN, LOC_TYPEDEF,
&objfile->static_psymbols,
nlist.n_value, 0,
@@ -1736,7 +1760,7 @@ pos %d"),
if (p[2] == 't')
{
/* Also a typedef with the same name. */
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
VAR_DOMAIN, LOC_TYPEDEF,
&objfile->static_psymbols,
nlist.n_value, 0,
@@ -1749,7 +1773,7 @@ pos %d"),
case 't':
if (p != namestring) /* a name is there, not just :T... */
{
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
VAR_DOMAIN, LOC_TYPEDEF,
&objfile->static_psymbols,
nlist.n_value, 0,
@@ -1829,7 +1853,7 @@ pos %d"),
case 'c':
/* Constant, e.g. from "const" in Pascal. */
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
VAR_DOMAIN, LOC_CONST,
&objfile->static_psymbols, nlist.n_value,
0, psymtab_language, objfile);
@@ -1893,7 +1917,7 @@ pos %d"),
pst->textlow = nlist.n_value;
textlow_not_set = 0;
}
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
VAR_DOMAIN, LOC_BLOCK,
&objfile->static_psymbols,
0, nlist.n_value,
@@ -1961,7 +1985,7 @@ pos %d"),
pst->textlow = nlist.n_value;
textlow_not_set = 0;
}
- add_psymbol_to_list (namestring, p - namestring,
+ add_psymbol_to_list (sym_name, sym_len,
VAR_DOMAIN, LOC_BLOCK,
&objfile->global_psymbols,
0, nlist.n_value,
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 5778fef..55cd5d0 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -517,6 +517,15 @@ struct attr_abbrev
ENUM_BITFIELD(dwarf_form) form : 16;
};
+/* Additional GDB-specific attribute forms. */
+enum
+ {
+ /* A string which has been updated to GDB's internal
+ representation (e.g. converted to canonical form) and does not
+ need to be updated again. */
+ GDB_FORM_cached_string = 0xff
+ };
+
/* Attributes have a name and a value */
struct attribute
{
@@ -964,6 +973,9 @@ static void process_die (struct die_info *, struct dwarf2_cu *);
static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *);
+static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *,
+ struct obstack *);
+
static char *dwarf2_name (struct die_info *die, struct dwarf2_cu *);
static struct die_info *dwarf2_extension (struct die_info *die,
@@ -5796,10 +5808,23 @@ read_partial_die (struct partial_die_info *part_die,
switch (attr.name)
{
case DW_AT_name:
-
- /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */
- if (part_die->name == NULL)
- part_die->name = DW_STRING (&attr);
+ switch (part_die->tag)
+ {
+ case DW_TAG_compile_unit:
+ /* Compilation units have a DW_AT_name that is a filename, not
+ a source language identifier. */
+ case DW_TAG_enumeration_type:
+ case DW_TAG_enumerator:
+ /* These tags always have simple identifiers already; no need
+ to canonicalize them. */
+ part_die->name = DW_STRING (&attr);
+ break;
+ default:
+ part_die->name
+ = dwarf2_canonicalize_name (DW_STRING (&attr), cu,
+ &cu->comp_unit_obstack);
+ break;
+ }
break;
case DW_AT_comp_dir:
if (part_die->dirname == NULL)
@@ -8028,10 +8053,29 @@ dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
if (attr && DW_STRING (attr))
return DW_STRING (attr);
- attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- return DW_STRING (attr);
- return NULL;
+ return dwarf2_name (die, cu);
+}
+
+/* Get name of a die, return NULL if not found. */
+
+static char *
+dwarf2_canonicalize_name (char *name, struct dwarf2_cu *cu,
+ struct obstack *obstack)
+{
+ if (cu->language == language_cplus)
+ {
+ char *canon_name = cp_canonicalize_string (name);
+
+ if (canon_name != NULL)
+ {
+ if (strcmp (canon_name, name) != 0)
+ name = obsavestring (canon_name, strlen (canon_name),
+ obstack);
+ xfree (canon_name);
+ }
+ }
+
+ return name;
}
/* Get name of a die, return NULL if not found. */
@@ -8042,9 +8086,29 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
struct attribute *attr;
attr = dwarf2_attr (die, DW_AT_name, cu);
- if (attr && DW_STRING (attr))
- return DW_STRING (attr);
- return NULL;
+ if (!attr || !DW_STRING (attr))
+ return NULL;
+
+ switch (die->tag)
+ {
+ case DW_TAG_compile_unit:
+ /* Compilation units have a DW_AT_name that is a filename, not
+ a source language identifier. */
+ case DW_TAG_enumeration_type:
+ case DW_TAG_enumerator:
+ /* These tags always have simple identifiers already; no need
+ to canonicalize them. */
+ return DW_STRING (attr);
+ default:
+ if (attr->form != GDB_FORM_cached_string)
+ {
+ DW_STRING (attr)
+ = dwarf2_canonicalize_name (DW_STRING (attr), cu,
+ &cu->objfile->objfile_obstack);
+ attr->form = GDB_FORM_cached_string;
+ }
+ return DW_STRING (attr);
+ }
}
/* Return the die that this die in an extension of, or NULL if there
@@ -8537,6 +8601,8 @@ dwarf_form_name (unsigned form)
return "DW_FORM_ref_udata";
case DW_FORM_indirect:
return "DW_FORM_indirect";
+ case GDB_FORM_cached_string:
+ return "GDB_FORM_cached_string";
default:
return "DW_FORM_<unknown>";
}
@@ -9068,6 +9134,7 @@ dump_die (struct die_info *die)
break;
case DW_FORM_string:
case DW_FORM_strp:
+ case GDB_FORM_cached_string:
fprintf_unfiltered (gdb_stderr, "string: \"%s\"",
DW_STRING (&die->attrs[i])
? DW_STRING (&die->attrs[i]) : "");
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 45e7cee..16f589e 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -589,6 +589,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
int deftype;
int synonym = 0;
int i;
+ char *new_name = NULL;
/* We would like to eliminate nameless symbols, but keep their types.
E.g. stab entry ":t10=*2" should produce a type 10, which is a pointer
@@ -683,9 +684,21 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
{
normal:
SYMBOL_LANGUAGE (sym) = current_subfile->language;
- SYMBOL_SET_NAMES (sym, string, p - string, objfile);
if (SYMBOL_LANGUAGE (sym) == language_cplus)
- cp_scan_for_anonymous_namespaces (sym);
+ {
+ char *name = alloca (p - string + 1);
+ memcpy (name, string, p - string);
+ name[p - string] = '\0';
+ new_name = cp_canonicalize_string (name);
+ cp_scan_for_anonymous_namespaces (sym);
+ }
+ if (new_name != NULL)
+ {
+ SYMBOL_SET_NAMES (sym, new_name, strlen (new_name), objfile);
+ xfree (new_name);
+ }
+ else
+ SYMBOL_SET_NAMES (sym, string, p - string, objfile);
}
p++;
@@ -1519,18 +1532,35 @@ again:
if (*p != ':')
return error_type (pp, objfile);
}
- to = type_name =
- (char *) obstack_alloc (&objfile->objfile_obstack, p - *pp + 1);
-
- /* Copy the name. */
- from = *pp + 1;
- while (from < p)
- *to++ = *from++;
- *to = '\0';
+ type_name = NULL;
+ if (current_subfile->language == language_cplus)
+ {
+ char *new_name, *name = alloca (p - *pp + 1);
+ memcpy (name, *pp, p - *pp);
+ name[p - *pp] = '\0';
+ new_name = cp_canonicalize_string (name);
+ if (new_name != NULL)
+ {
+ type_name = obsavestring (new_name, strlen (new_name),
+ &objfile->objfile_obstack);
+ xfree (new_name);
+ }
+ }
+ if (type_name == NULL)
+ {
+ to = type_name =
+ (char *) obstack_alloc (&objfile->objfile_obstack, p - *pp + 1);
+
+ /* Copy the name. */
+ from = *pp + 1;
+ while (from < p)
+ *to++ = *from++;
+ *to = '\0';
+ }
/* Set the pointer ahead of the name which we just read, and
the colon. */
- *pp = from + 1;
+ *pp = p + 1;
}
/* If this type has already been declared, then reuse the same
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 90629ec..87ff6ce 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -55,6 +55,7 @@
#include "gdb_stat.h"
#include <ctype.h>
#include "cp-abi.h"
+#include "cp-support.h"
#include "observer.h"
#include "gdb_assert.h"
#include "solist.h"
@@ -1211,6 +1212,17 @@ lookup_symbol_in_language (const char *name, const struct block *block,
modified_name = demangled_name;
needtofreename = 1;
}
+ else
+ {
+ /* If we were given a non-mangled name, canonicalize it
+ according to the language (so far only for C++). */
+ demangled_name = cp_canonicalize_string (name);
+ if (demangled_name)
+ {
+ modified_name = demangled_name;
+ needtofreename = 1;
+ }
+ }
}
else if (lang == language_java)
{
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1fc69d0..a3b1674 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-07 Daniel Jacobowitz <dan@codesourcery.com>
+
+ PR gdb/931
+ * gdb.cp/gdb1355.exp (f_li, f_lui, f_si, f_sui): Allow canonical
+ output.
+ * gdb.cp/templates.exp: Allow canonical output. Remove KFAILs
+ for gdb/931.
+
2008-11-07 Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.python/python-template.exp,
diff --git a/gdb/testsuite/gdb.cp/gdb1355.exp b/gdb/testsuite/gdb.cp/gdb1355.exp
index 8fc8c31..effc841 100644
--- a/gdb/testsuite/gdb.cp/gdb1355.exp
+++ b/gdb/testsuite/gdb.cp/gdb1355.exp
@@ -68,11 +68,11 @@ set s_tail ".*"
set f_i "${ws}int m_int;"
set f_c "${ws}char m_char;"
-set f_li "${ws}long int m_long_int;"
+set f_li "${ws}long( int)? m_long_int;"
set f_ui "${ws}unsigned int m_unsigned_int;"
-set f_lui "${ws}long unsigned int m_long_unsigned_int;"
-set f_si "${ws}short int m_short_int;"
-set f_sui "${ws}short unsigned int m_short_unsigned_int;"
+set f_lui "${ws}(long unsigned int|unsigned long) m_long_unsigned_int;"
+set f_si "${ws}short( int)? m_short_int;"
+set f_sui "${ws}(short unsigned int|unsigned short) m_short_unsigned_int;"
set f_uc "${ws}unsigned char m_unsigned_char;"
set f_f "${ws}float m_float;"
set f_d "${ws}double m_double;"
diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
index 8734fdc..4dc583d 100644
--- a/gdb/testsuite/gdb.cp/templates.exp
+++ b/gdb/testsuite/gdb.cp/templates.exp
@@ -329,13 +329,11 @@ gdb_expect {
send_gdb "print Foo<volatile char *>::foo\n"
gdb_expect {
- -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
+ -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char *>::foo" }
-re "No symbol \"Foo<volatile char \\*>\" in current context.\r\n$gdb_prompt $"
{
- # This used to be a kfail gdb/33. That problem has been
- # fixed, but now gdb/931 and gdb/1512 are rearing their ugly
- # heads.
- kfail "gdb/931" "print Foo<volatile char *>::foo"
+ # This used to be a kfail gdb/33 and then kfail gdb/931.
+ fail "print Foo<volatile char *>::foo"
}
-re "$gdb_prompt $" { fail "print Foo<volatile char *>::foo" }
timeout { fail "(timeout) print Foo<volatile char *>::foo" }
@@ -343,13 +341,11 @@ gdb_expect {
send_gdb "print Foo<volatile char*>::foo\n"
gdb_expect {
- -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<volatile char ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char*>::foo" }
+ -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo<(volatile char|char volatile) ?\\*> \\*(| const), int, .*char \\*\\)\\} $hex <Foo<.*char.*\\*>::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo<volatile char*>::foo" }
-re "No symbol \"Foo<volatile char\\*>\" in current context.\r\n$gdb_prompt $"
{
- # This used to be a kfail gdb/33. That problem has been
- # fixed, but now gdb/931 and gdb/1512 are rearing their ugly
- # heads.
- kfail "gdb/931" "print Foo<volatile char*>::foo"
+ # This used to be a kfail gdb/33 and then kfail gdb/931.
+ fail "print Foo<volatile char*>::foo"
}
-re "$gdb_prompt $" { fail "print Foo<volatile char*>::foo" }
timeout { fail "(timeout) print Foo<volatile char*>::foo" }
@@ -459,7 +455,7 @@ send_gdb "ptype quxint\n"
gdb_expect {
-re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
-re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
- -re "type = class Qux<int, ?\\(char ?\\*\\)\\(& ?string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
+ -re "type = class Qux<int, ?\\(char ?\\*\\)\\(& ?\\(?string\\)?\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
-re "type = class Qux<int, ?& ?\\(string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
kfail "gdb/1512" "ptype quxint"
}
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-07 21:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-07 21:00 [SCM] archer-tromey-python: 2007-10-22 Daniel Jacobowitz <dan@codesourcery.com> ppluzhnikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).