public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simon.marchi at polymtl dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/16481] New: Python finish breakpoint does not work with a mix of inlined and tailcalled functions
Date: Tue, 21 Jan 2014 22:51:00 -0000	[thread overview]
Message-ID: <bug-16481-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 16481
           Summary: Python finish breakpoint does not work with a mix of
                    inlined and tailcalled functions
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at polymtl dot ca

This may seem a little far fetched, but I hit this while trying to track memory
allocations with a python script. I put a Python breakpoint on __libc_malloc,
which in turn sets a finish breakpoint so that I can get the pointer to the
allocated region. I noticed that some times, the finish breakpoint is never
hit.

I put up a very simple test case here:
  https://gist.github.com/simark/8548964

Compile with
  $ gcc -g test.c -O3

Run with
  $ gdb -x finish.py a.out

As the name describe, hopefully_inlined is inlined, hopefully_tailcalled is
tailcalled (did I just invent a verb?).

The python script sets a breakpoint on the hopefully_notinlined function, which
instanciantes a finish breakpoint. On exit of the function, we should see "I am
here", but we don't.

I diagnosed the problem, and something wrong seems to happen here:
 
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/breakpoint.c;h=c8e7e8842e2ed418d78b23c466018c88bb5e2aae;hb=HEAD#l5172

>From what I understand, for kinds of breakpoints where it makes sens, GDB
checks that the current stack frame is the same as when the breakpoint was set.
For the breakpoint to cause a stop, they have to match. The comparison in this
case returns false. One of the frames has its artifical_depth to zero while the
other has it to one. I am not sure which one is right, but I think that they
should be equal...

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


             reply	other threads:[~2014-01-21 22:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-21 22:51 simon.marchi at polymtl dot ca [this message]
2014-01-21 22:58 ` [Bug python/16481] " simon.marchi at polymtl dot ca
2023-12-15 19:59 ` ssbssa at sourceware dot org

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-16481-4717@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).