From: Tom Tromey <tromey@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: creating the gdb-7.4 branch tomorrow (?)
Date: Tue, 06 Dec 2011 19:05:00 -0000 [thread overview]
Message-ID: <m362htmtot.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20111205081911.GG28486@adacore.com> (Joel Brobecker's message of "Mon, 5 Dec 2011 09:19:11 +0100")
[-- Attachment #1: Type: text/plain, Size: 58 bytes --]
Here is patch #4. This fixes some Ada regressions.
Tom
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch 4 --]
[-- Type: text/x-patch, Size: 11387 bytes --]
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index f960a25..250aba2 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5052,6 +5052,36 @@ done:
return ndefns;
}
+/* Implementation of the la_iterate_over_symbols method. */
+
+static void
+ada_iterate_over_symbols (const struct block *block,
+ const char *name, domain_enum domain,
+ int (*callback) (struct symbol *, void *),
+ void *data)
+{
+ int ndefs, i;
+ struct ada_symbol_info *results;
+ char *canon;
+ int nlen = strlen (name);
+
+ if (name[0] == '<' && name[nlen - 1] == '>')
+ {
+ canon = alloca (nlen - 1);
+ memcpy (canon, name + 1, nlen - 2);
+ canon[nlen - 2] = '\0';
+ }
+ else
+ canon = ada_encode (ada_fold_name (name));
+
+ ndefs = ada_lookup_symbol_list (canon, block, domain, &results);
+ for (i = 0; i < ndefs; ++i)
+ {
+ if (! (*callback) (results[i].sym, data))
+ break;
+ }
+}
+
struct symbol *
ada_lookup_encoded_symbol (const char *name, const struct block *block0,
domain_enum namespace, struct block **block_found)
@@ -12282,6 +12312,7 @@ const struct language_defn ada_language_defn = {
ada_print_array_index,
default_pass_by_reference,
c_get_string,
+ ada_iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 3a35a78..81e7849 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -863,6 +863,7 @@ const struct language_defn c_language_defn =
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
@@ -984,6 +985,7 @@ const struct language_defn cplus_language_defn =
default_print_array_index,
cp_pass_by_reference,
c_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
@@ -1023,6 +1025,7 @@ const struct language_defn asm_language_defn =
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
@@ -1067,6 +1070,7 @@ const struct language_defn minimal_language_defn =
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index c0599a5..44ff68a 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -273,6 +273,7 @@ static const struct language_defn d_language_defn =
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ NULL,
LANG_MAGIC
};
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index f538eee..7a8516d 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -309,6 +309,7 @@ const struct language_defn f_language_defn =
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 4eae356..ce65a2d 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -1197,6 +1197,7 @@ const struct language_defn java_language_defn =
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/language.c b/gdb/language.c
index 825c02d..701c479 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -1200,6 +1200,7 @@ const struct language_defn unknown_language_defn =
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
@@ -1241,6 +1242,7 @@ const struct language_defn auto_language_defn =
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
@@ -1280,6 +1282,7 @@ const struct language_defn local_language_defn =
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
\f
diff --git a/gdb/language.h b/gdb/language.h
index 1ff575f..82e6a88 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -318,6 +318,26 @@ struct language_defn
void (*la_get_string) (struct value *value, gdb_byte **buffer, int *length,
struct type **chartype, const char **charset);
+ /* Find all symbols in the current program space matching NAME in
+ DOMAIN, according to this language's rules.
+
+ The search starts with BLOCK. This function iterates upward
+ through blocks. When the outermost block has been finished,
+ the function returns.
+
+ For each one, call CALLBACK with the symbol and the DATA
+ argument. If CALLBACK returns zero, the iteration ends at that
+ point.
+
+ This field can be NULL, meaning that this language doesn't need
+ any special code aside from ordinary searches of the symbol
+ table. */
+ void (*la_iterate_over_symbols) (const struct block *block,
+ const char *name,
+ domain_enum domain,
+ int (*callback) (struct symbol *, void *),
+ void *data);
+
/* Add fields above this point, so the magic number is always last. */
/* Magic number for compat checking. */
@@ -422,6 +442,10 @@ extern enum language set_language (enum language);
#define LA_PRINT_ARRAY_INDEX(index_value, stream, options) \
(current_language->la_print_array_index(index_value, stream, options))
+#define LA_ITERATE_OVER_SYMBOLS(BLOCK, NAME, DOMAIN, CALLBACK, DATA) \
+ (current_language->la_iterate_over_symbols (BLOCK, NAME, DOMAIN, CALLBACK, \
+ DATA))
+
/* Test a character to decide whether it can be printed in literal form
or needs to be printed in another representation. For example,
in C the literal form of the character with octal value 141 is 'a'
diff --git a/gdb/linespec.c b/gdb/linespec.c
index f8ae062..8b357a3 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -375,8 +375,9 @@ iterate_over_all_matching_symtabs (const char *name,
if (symtab->primary)
{
struct block *block;
+
block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
- iterate_over_symbols (block, name, domain, callback, data);
+ LA_ITERATE_OVER_SYMBOLS (block, name, domain, callback, data);
}
}
}
@@ -1836,10 +1837,10 @@ lookup_prefix_sym (char **argptr, char *p, VEC (symtab_p) *file_symtabs,
gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup);
set_current_program_space (SYMTAB_PSPACE (elt));
search_block = get_search_block (elt);
- iterate_over_symbols (search_block, copy, STRUCT_DOMAIN,
- collect_one_symbol, &collector);
- iterate_over_symbols (search_block, copy, VAR_DOMAIN,
- collect_one_symbol, &collector);
+ LA_ITERATE_OVER_SYMBOLS (search_block, copy, STRUCT_DOMAIN,
+ collect_one_symbol, &collector);
+ LA_ITERATE_OVER_SYMBOLS (search_block, copy, VAR_DOMAIN,
+ collect_one_symbol, &collector);
}
}
@@ -2191,28 +2192,6 @@ find_function_symbols (char **argptr, char *p, int is_quote_enclosed,
iterate_over_all_matching_symtabs (copy, VAR_DOMAIN,
collect_function_symbols, &result, NULL);
- /* If looking up the given name failed, try using the current
- language to look up a symbol. This may augment the search. If a
- symbol is found this way, repeat the iteration, but using the
- discovered name. */
- if (VEC_empty (symbolp, result)
- && current_language->la_language == language_ada)
- {
- struct symbol *function_symbol;
-
- function_symbol = lookup_symbol (copy, get_selected_block (0),
- VAR_DOMAIN, 0);
- if (function_symbol && SYMBOL_CLASS (function_symbol) == LOC_BLOCK)
- {
- xfree (copy);
- copy = xstrdup (SYMBOL_SEARCH_NAME (function_symbol));
- *user_function = copy;
- iterate_over_all_matching_symtabs (copy, VAR_DOMAIN,
- collect_function_symbols,
- &result, NULL);
- }
- }
-
if (VEC_empty (symbolp, result))
VEC_free (symbolp, result);
else
@@ -2807,9 +2786,9 @@ add_matching_symbols_to_info (const char *name,
been filtered out earlier. */
gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup);
set_current_program_space (SYMTAB_PSPACE (elt));
- iterate_over_symbols (get_search_block (elt), name,
- VAR_DOMAIN, collect_symbols,
- info);
+ LA_ITERATE_OVER_SYMBOLS (get_search_block (elt), name,
+ VAR_DOMAIN, collect_symbols,
+ info);
}
}
}
@@ -2842,22 +2821,6 @@ decode_variable (struct linespec_state *self, char *copy)
add_matching_symbols_to_info (lookup_name, &info, NULL);
- /* If looking up the given name failed, try using the current
- language to look up a symbol. This may augment the search. If a
- symbol is found this way, repeat the iteration, but using the
- discovered name. */
- if (info.result.nelts == 0 && current_language->la_language == language_ada)
- {
- struct symbol *sym;
-
- sym = lookup_symbol (lookup_name, get_selected_block (0), VAR_DOMAIN, 0);
- if (sym)
- {
- copy = SYMBOL_SEARCH_NAME (sym);
- add_matching_symbols_to_info (copy, &info, NULL);
- }
- }
-
if (info.result.nelts > 0)
{
if (self->canonical)
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index f83c622..106dfcf 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -401,6 +401,7 @@ const struct language_defn m2_language_defn =
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index dcf9459..1da92a5 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -541,6 +541,7 @@ const struct language_defn objc_language_defn = {
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 05955b4..895a51c 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1024,6 +1024,7 @@ const struct language_defn opencl_language_defn =
default_print_array_index,
default_pass_by_reference,
c_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 655279b..30b890f 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -459,6 +459,7 @@ const struct language_defn pascal_language_defn =
default_print_array_index,
default_pass_by_reference,
default_get_string,
+ iterate_over_symbols,
LANG_MAGIC
};
diff --git a/gdb/testsuite/gdb.ada/homonym.exp b/gdb/testsuite/gdb.ada/homonym.exp
index b5dff1b..d568633 100644
--- a/gdb/testsuite/gdb.ada/homonym.exp
+++ b/gdb/testsuite/gdb.ada/homonym.exp
@@ -31,6 +31,24 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
clean_restart ${testfile}
+
+# Do these tests before running, so we are operating in a known
+# environment.
+
+gdb_test "break Get_Value" \
+ "Breakpoint \[0-9\]+ at $hex: Get_Value. .2 locations." \
+ "set breakpoint at Get_Value"
+
+gdb_test "break homonym.adb:Get_Value" \
+ "Breakpoint \[0-9\]+ at $hex: homonym.adb:Get_Value. .2 locations." \
+ "set breakpoint at homonym.adb:Get_Value"
+
+gdb_test "break <homonym__get_value>" \
+ "Breakpoint \[0-9\]+ at $hex: <homonym__get_value>. .2 locations." \
+ "set breakpoint at <homonym__get_value>"
+
+delete_breakpoints
+
set bp_location [gdb_get_line_number "BREAK_1" ${testdir}/homonym.adb]
runto "homonym.adb:$bp_location"
@@ -86,6 +104,3 @@ gdb_test "ptype lcl" \
gdb_test "print lcl" \
"= 17" \
"print lcl at BREAK_2"
-
-
-
--
1.7.6.4
next prev parent reply other threads:[~2011-12-06 18:54 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-05 8:19 Joel Brobecker
2011-12-06 18:45 ` Tom Tromey
2011-12-06 18:53 ` Tom Tromey
2011-12-06 18:54 ` Tom Tromey
2011-12-06 19:05 ` Tom Tromey
2011-12-06 19:05 ` Tom Tromey [this message]
2011-12-06 19:07 ` Tom Tromey
2011-12-06 19:10 ` Tom Tromey
2011-12-07 4:09 ` Hui Zhu
2011-12-07 9:54 ` Joel Brobecker
2011-12-07 16:24 ` Stan Shebs
2011-12-07 23:50 ` Stan Shebs
2011-12-08 8:22 ` Joel Brobecker
2011-12-07 9:11 ` Jan Kratochvil
2011-12-07 10:01 ` Joel Brobecker
2011-12-08 15:33 ` FYI: fixlet in ovsrch.exp (Was: creating the gdb-7.4 branch tomorrow (?)) Tom Tromey
2011-12-09 17:17 ` Crash regression for gdb.base/ending-run.exp [Re: creating the gdb-7.4 branch tomorrow (?)] Jan Kratochvil
2011-12-09 19:05 ` Tom Tromey
2011-12-09 21:00 ` Jan Kratochvil
2011-12-09 17:17 ` Regression for gdb.base/sigstep.exp with .debug_types " Jan Kratochvil
2011-12-09 17:26 ` Regression for gdb.base/sigstep.exp with .debug_types Jan Kratochvil
2011-12-09 20:50 ` Tom Tromey
2011-12-09 21:55 ` Jan Kratochvil
2011-12-10 9:46 ` Tom Tromey
2011-12-10 19:27 ` [commit] testsuite: KFAIL gdb.cp/static-method.exp [Re: Regression for gdb.base/sigstep.exp with .debug_types] Jan Kratochvil
2011-12-11 9:26 ` Joel Brobecker
2011-12-11 12:42 ` Jan Kratochvil
2011-12-11 12:46 ` Joel Brobecker
2011-12-14 19:02 ` [patch] gcc KFAILs to XFAILs [Re: [commit] testsuite: KFAIL gdb.cp/static-method.exp] Jan Kratochvil
2011-12-14 19:43 ` Doug Evans
2011-12-14 19:51 ` [doc patch] gdbint: XFAIL vs. KFAIL [Re: [patch] gcc KFAILs to XFAILs] Jan Kratochvil
2011-12-15 5:33 ` Eli Zaretskii
2011-12-19 11:16 ` Jan Kratochvil
2011-12-19 13:41 ` Eli Zaretskii
2011-12-19 13:42 ` [commit] " Jan Kratochvil
2011-12-19 13:43 ` [commit] [patch] gcc KFAILs to XFAILs [Re: [commit] testsuite: KFAIL gdb.cp/static-method.exp] Jan Kratochvil
2011-12-09 20:17 ` Regression for gdb.base/sigstep.exp with .debug_types [Re: creating the gdb-7.4 branch tomorrow (?)] Tom Tromey
2011-12-09 20:20 ` Jan Kratochvil
2011-12-14 11:52 ` creating the gdb-7.4 branch tomorrow (?) Andreas Schwab
2011-12-14 13:20 ` Joel Brobecker
2011-12-14 13:34 ` Andreas Schwab
2011-12-14 19:28 ` Joel Brobecker
2011-12-14 21:16 ` Andreas Schwab
2011-12-14 21:31 ` Joel Brobecker
2011-12-14 22:06 ` Andreas Schwab
2011-12-15 17:43 ` Tom Tromey
2012-07-22 19:41 ` Andreas Schwab
2012-08-15 19:34 ` Tom Tromey
2012-08-22 14:23 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m362htmtot.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).