From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28499 invoked by alias); 21 Jan 2014 22:51:47 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 28474 invoked by uid 48); 21 Jan 2014 22:51:47 -0000 From: "simon.marchi at polymtl dot ca" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simon.marchi at polymtl dot ca X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q1/txt/msg00087.txt.bz2 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.