This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/16157] New: the function get_pc_function_start (CORE_ADDR pc) maybe inaccurate
- From: "guosheng_gao at realsil dot com.cn" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 12 Nov 2013 06:12:30 +0000
- Subject: [Bug gdb/16157] New: the function get_pc_function_start (CORE_ADDR pc) maybe inaccurate
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=16157
Bug ID: 16157
Summary: the function get_pc_function_start (CORE_ADDR pc)
maybe inaccurate
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: guosheng_gao at realsil dot com.cn
get_pc_function_start(CORE_ADDR pc) try to get the function start for a special
pc, but the function
lookup_minimal_symbol_by_pc(CORE_ADDR pc) may return a minimal_symbol, which is
not a function(e.g. a label in assembler code). So the fstart is not a function
start address, too.
This may cause a problem: in following code, GDB can not stop when try to next
over Line 1.(lop2 and lop3 are mistaken for a function, so GDB thinks that it
step into a new function, set a breakpoint at the address stored in register
$ra, and run to it)
Is this correct?
==========================
#.globl hardware_hazard_hook .text
.globl _start
.ent _start
_start:
.set noreorder
addiu v0, 1
addiu v0, 1
lop3:
addiu v0, 1
addiu v0, 1
lop2:
addiu v0, 1// Line 1
addiu v0, 1
lop1:
addiu v0, 1
addiu v0, 1
addiu v0, 1
addiu v0, 1
nop
...
-------------------------------
gdb/minsyms.c
CORE_ADDR
get_pc_function_start (CORE_ADDR pc)
{
struct block *bl;
struct minimal_symbol *msymbol;
bl = block_for_pc (pc);
if (bl)
{
struct symbol *symbol = block_linkage_function (bl);
if (symbol)
{
bl = SYMBOL_BLOCK_VALUE (symbol);
return BLOCK_START (bl);
}
}
msymbol = lookup_minimal_symbol_by_pc (pc);
if (msymbol)
{
CORE_ADDR fstart = SYMBOL_VALUE_ADDRESS (msymbol);
if (find_pc_section (fstart))
return fstart;
}
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.