public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "palves at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/16157] the function get_pc_function_start (CORE_ADDR pc) maybe inaccurate
Date: Tue, 12 Nov 2013 11:46:00 -0000	[thread overview]
Message-ID: <bug-16157-4717-0IjR8Ztb9F@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16157-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=16157

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |palves at redhat dot com

--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
> 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.

The only way to tell apart a label from a function, is from the minimal
symbol's size.  Try stepping through lookup_minimal_symbol_by_pc_section_1, and
see the comments there.

> 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)

Sounds like something else might be tricking GDB into thinking you stepped into
a new function.  See the code just below "Check for subroutine calls." part of
infrun.c.  That's where the logic to detect if the program called a new
function is.
I wonder if this related to the outermost heuristics, or something odd in the
unwinder/backtrace.  What does "bt" show when the program is stopped at the
instruction just before lop2, and then again "bt" when you stepi to lop2?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  reply	other threads:[~2013-11-12 11:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-12  6:12 [Bug gdb/16157] New: " guosheng_gao at realsil dot com.cn
2013-11-12 11:46 ` palves at redhat dot com [this message]
2013-11-12 13:01 ` [Bug gdb/16157] " guosheng_gao at realsil dot com.cn
2013-11-12 13:18 ` guosheng_gao at realsil dot com.cn
2013-11-12 14:29 ` palves at redhat dot com
2013-11-13  2:49 ` guosheng_gao at realsil dot com.cn
2013-11-13  3:10 ` guosheng_gao at realsil dot com.cn
2013-11-13 10:06 ` palves at redhat dot com
2013-11-14  9:57 ` guosheng_gao at realsil dot com.cn

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=bug-16157-4717-0IjR8Ztb9F@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).