+2018-06-29 Pedro Alves <palves@redhat.com>
+
+ * blockframe.c (find_pc_sect_containing_function): New function.
+ * breakpoint.c (print_breakpoint_location): Don't call
+ find_pc_sect_function.
+ * linespec.c (create_sals_line_offset): Record the location's
+ symbol in the sal.
+ * linespec.c (convert_address_location_to_sals): Fill in sal's
+ symbol with find_pc_sect_containing_function.
+ * symtab.c (find_function_start_sal): Rename to ...
+ (find_function_start_sal_1): ... this.
+ (find_function_start_sal): Reimplement as wrapper around
+ find_function_start_sal_1, and use
+ find_pc_sect_containing_function to fill in the sal's symbol.
+ (find_function_start_sal(symbol*, bool)): Adjust.
+ * symtab.h (find_pc_function, find_pc_sect_function): Adjust
+ comments.
+ (find_pc_sect_containing_function): Declare.
+
2018-06-29 Pedro Alves <palves@redhat.com>
* inline-frame.c (stopped_by_user_bp_inline_frame): Return
return find_pc_sect_function (pc, find_pc_mapped_section (pc));
}
+/* See symtab.h. */
+
+struct symbol *
+find_pc_sect_containing_function (CORE_ADDR pc, struct obj_section *section)
+{
+ const block *bl = block_for_pc_sect (pc, section);
+
+ if (bl == nullptr)
+ return nullptr;
+
+ return block_containing_function (bl);
+}
+
/* These variables are used to cache the most recent result
of find_pc_partial_function. */
{
const struct symbol *sym = loc->symbol;
- if (sym == NULL)
- sym = find_pc_sect_function (loc->address, loc->section);
-
if (sym)
{
uiout->text ("in ");
if (self->funfirstline)
skip_prologue_sal (&intermediate_results[i]);
+ intermediate_results[i].symbol = sym;
add_sal_to_sals (self, &values, &intermediate_results[i],
sym ? SYMBOL_NATURAL_NAME (sym) : NULL, 0);
}
sal.pc = address;
sal.section = find_pc_overlay (address);
sal.explicit_pc = 1;
+ sal.symbol = find_pc_sect_containing_function (sal.pc, sal.section);
std::vector<symtab_and_line> sals;
add_sal_to_sals (self, &sals, &sal, core_addr_to_string (address), 1);
return sal.symtab != 0;
}
-/* See symtab.h. */
+/* Helper for find_function_start_sal. Does most of the work, except
+ setting the sal's symbol. */
-symtab_and_line
-find_function_start_sal (CORE_ADDR func_addr, obj_section *section,
- bool funfirstline)
+static symtab_and_line
+find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section,
+ bool funfirstline)
{
symtab_and_line sal = find_pc_sect_line (func_addr, section, 0);
/* See symtab.h. */
+symtab_and_line
+find_function_start_sal (CORE_ADDR func_addr, obj_section *section,
+ bool funfirstline)
+{
+ symtab_and_line sal
+ = find_function_start_sal_1 (func_addr, section, funfirstline);
+
+ /* find_function_start_sal_1 does a linetable search, so it finds
+ the symtab and linenumber, but not a symbol. Fill in the
+ function symbol too. */
+ sal.symbol = find_pc_sect_containing_function (sal.pc, sal.section);
+
+ return sal;
+}
+
+/* See symtab.h. */
+
symtab_and_line
find_function_start_sal (symbol *sym, bool funfirstline)
{
fixup_symbol_section (sym, NULL);
symtab_and_line sal
- = find_function_start_sal (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
- SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym),
- funfirstline);
+ = find_function_start_sal_1 (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
+ SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym),
+ funfirstline);
sal.symbol = sym;
return sal;
}
/* from blockframe.c: */
-/* lookup the function symbol corresponding to the address. */
+/* lookup the function symbol corresponding to the address. The
+ return value will not be an inlined function; the containing
+ function will be returned instead. */
extern struct symbol *find_pc_function (CORE_ADDR);
-/* lookup the function corresponding to the address and section. */
+/* lookup the function corresponding to the address and section. The
+ return value will not be an inlined function; the containing
+ function will be returned instead. */
extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *);
+/* lookup the function symbol corresponding to the address and
+ section. The return value will be the closest enclosing function,
+ which might be an inline function. */
+
+extern struct symbol *find_pc_sect_containing_function
+ (CORE_ADDR pc, struct obj_section *section);
+
/* Find the symbol at the given address. Returns NULL if no symbol
found. Only exact matches for ADDRESS are considered. */
+2018-06-29 Pedro Alves <palves@redhat.com>
+
+ * gdb.opt/inline-break.exp (line number, address): Add "info
+ break" tests.
+
2018-06-29 Pedro Alves <palves@redhat.com>
* gdb.opt/inline-break.c (func1): Add "break here" marker.
# Set the breakpoint by line number, and check that GDB reports
# the breakpoint location being the inline function.
gdb_test "break $srcfile:$line" ".*Breakpoint .* at .*: file .*$srcfile, line $line."
+
+ gdb_test "info break \$bpnum" "in func1 at .*$srcfile:$line"
+
gdb_test "continue" "Breakpoint .*, func1 \\(x=1\\) at .*$srcfile:$line.*break here.*" \
"breakpoint hit presents stop at inlined function"
# Set the breakpoint by address, and check that GDB reports the
# breakpoint location being the inline function.
gdb_test "break *$address" ".*Breakpoint .* at $address: file .*$srcfile, line $line."
+
+ gdb_test "info break \$bpnum" "in func1 at .*$srcfile:$line"
+
gdb_test "continue" "Breakpoint .*, func1 \\(x=1\\) at .*$srcfile:$line.*break here.*" \
"breakpoint hit presents stop at inlined function"
}