summaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorgary <gary>2012-03-16 16:47:29 +0000
committergary <gary>2012-03-16 16:47:29 +0000
commitc55ff693014c302c8b91b99cee0484751f105e15 (patch)
tree1a1fa799a6d92e1d4ab85f696fd23da7803601ba /gdb/linespec.c
parente6fdde6964c1d797f9e9337adb0afe24e46ae9db (diff)
downloadgdb-c55ff693014c302c8b91b99cee0484751f105e15.tar.gz
gdb:
PR breakpoints/10738 * dwarf2read.c (use_deprecated_index_sections): New global. (struct partial_die_info): New member may_be_inlined. (read_partial_die): Set may_be_inlined where appropriate. (add_partial_subprogram): Add partial symbols for partial DIEs that may be inlined. (new_symbol_full): Add inlined subroutines to the current scope. (write_psymtabs_to_index): Bump version number. (dwarf2_read_index): Read only version 6 indices unless use_deprecated_index_sections is set. * linespec.c (symbol_and_data_callback): New structure. (iterate_inline_only): New function. (iterate_over_all_matching_symtabs): New argument "include_inline". If nonzero, also call the callback for symbols representing inlined subroutines. (lookup_prefix_sym): Pass extra argument to the above. (find_function_symbols): Likewise. (add_matching_symbols_to_info): Likewise. * NEWS: Mention that GDB can now set breakpoints on inlined functions. gdb/doc: PR breakpoints/10738 * gdb.texinfo (Inline Functions): Remove the now-unnecessary @item stating that GDB cannot set breakpoints on inlined functions. (Mode Options): Document --use-deprecated-index-sections. (Index Section Format): Document new index section version format. gdb/testsuite: PR breakpoints/10738 * gdb.opt/inline-break.exp: New file. * gdb.opt/inline-break.c: Likewise. * gdb.dwarf2/inline-break.exp: Likewise. * gdb.dwarf2/inline-break.S: Likewise. * gdb.base/annota1.exp: Cope with old .gdb_index warnings. * gdb.base/async-shell.exp: Likewise. * lib/mi-support.exp (library_loaded_re): Likewise.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c56
1 files changed, 50 insertions, 6 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index c2057cf708b..1e9770ef7c8 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -321,6 +321,33 @@ cplusplus_error (const char *name, const char *fmt, ...)
throw_error (NOT_FOUND_ERROR, "%s", message);
}
+/* A callback function and the additional data to call it with. */
+
+struct symbol_and_data_callback
+{
+ /* The callback to use. */
+ symbol_found_callback_ftype *callback;
+
+ /* Data to be passed to the callback. */
+ void *data;
+};
+
+/* A helper for iterate_over_all_matching_symtabs that is used to
+ restrict calls to another callback to symbols representing inline
+ symbols only. */
+
+static int
+iterate_inline_only (struct symbol *sym, void *d)
+{
+ if (SYMBOL_INLINED (sym))
+ {
+ struct symbol_and_data_callback *cad = d;
+
+ return cad->callback (sym, cad->data);
+ }
+ return 1; /* Continue iterating. */
+}
+
/* Some data for the expand_symtabs_matching callback. */
struct symbol_matcher_data
@@ -348,14 +375,16 @@ iterate_name_matcher (const char *name, void *d)
/* A helper that walks over all matching symtabs in all objfiles and
calls CALLBACK for each symbol matching NAME. If SEARCH_PSPACE is
not NULL, then the search is restricted to just that program
- space. */
+ space. If INCLUDE_INLINE is nonzero then symbols representing
+ inlined instances of functions will be included in the result. */
static void
iterate_over_all_matching_symtabs (const char *name,
const domain_enum domain,
symbol_found_callback_ftype *callback,
void *data,
- struct program_space *search_pspace)
+ struct program_space *search_pspace,
+ int include_inline)
{
struct objfile *objfile;
struct program_space *pspace;
@@ -394,6 +423,20 @@ iterate_over_all_matching_symtabs (const char *name,
block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
LA_ITERATE_OVER_SYMBOLS (block, name, domain, callback, data);
+
+ if (include_inline)
+ {
+ struct symbol_and_data_callback cad = { callback, data };
+ int i;
+
+ for (i = FIRST_LOCAL_BLOCK;
+ i < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (symtab)); i++)
+ {
+ block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), i);
+ LA_ITERATE_OVER_SYMBOLS (block, name, domain,
+ iterate_inline_only, &cad);
+ }
+ }
}
}
}
@@ -1885,10 +1928,10 @@ lookup_prefix_sym (char **argptr, char *p, VEC (symtab_p) *file_symtabs,
{
iterate_over_all_matching_symtabs (copy, STRUCT_DOMAIN,
collect_one_symbol, &collector,
- NULL);
+ NULL, 0);
iterate_over_all_matching_symtabs (copy, VAR_DOMAIN,
collect_one_symbol, &collector,
- NULL);
+ NULL, 0);
}
else
{
@@ -2251,7 +2294,8 @@ find_function_symbols (char **argptr, char *p, int is_quote_enclosed,
copy[p - *argptr] = 0;
iterate_over_all_matching_symtabs (copy, VAR_DOMAIN,
- collect_function_symbols, &result, NULL);
+ collect_function_symbols, &result, NULL,
+ 0);
if (VEC_empty (symbolp, result))
VEC_free (symbolp, result);
@@ -2952,7 +2996,7 @@ add_matching_symbols_to_info (const char *name,
{
iterate_over_all_matching_symtabs (name, VAR_DOMAIN,
collect_symbols, info,
- pspace);
+ pspace, 1);
search_minsyms_for_name (info, name, pspace);
}
else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt))