Bug 18565

Summary: Frame filters do not display inlined functions
Product: gdb Reporter: Jan Kratochvil <jan>
Component: pythonAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: jan, kevin.pouget, tromey, tromey
Priority: P2    
Version: HEAD   
Target Milestone: 7.12   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 18566    
Attachments: Fix+testcase

Description Jan Kratochvil 2015-06-20 17:52:19 UTC
Created attachment 8379 [details]
Fix+testcase

https://bugzilla.redhat.com/show_bug.cgi?id=1233787

#0  0x00007f283a4edf93 in process_event (binding=0x54eeb00, event=0x7063a70, window=0x0, handler=0x888fe60, screen=0x16b96c0 [MetaScreen], display=0x34ccc10 [MetaDisplay]) at core/keybindings.c:1737
#1  0x00007f283a4edf93 in process_event (display=display@entry=0x34ccc10 [MetaDisplay], screen=screen@entry=0x16b96c0 [MetaScreen], window=window@entry=0x0, event=event@entry=0x7063a70) at core/keybindings.c:1791

$ eu-stack -v --core=coredump
#0  0x00007f283a4edf93     invoke_handler - libmutter.so.0
    core/keybindings.c:1737
#1  0x00007f283a4edf93     process_event - libmutter.so.0
    core/keybindings.c:1791

Frame #0 is inlined.

Attaching a fix but it has a regression of some bogus indentation/spaces:

#22 0x00000000004007fc in 1cnuf () at ./gdb.python/py-framefilter.c:99^M
    #23 0x00000000004007fc in func2 (f=3) at ./gdb.python/py-framefilter.c:120^M
#24 0x0000000000400818 in 3cnuf (i=3) at ./gdb.python/py-framefilter.c:126^M

Additionally #23 should not display the PC as #22 is inlined into it.
Comment 1 Tom Tromey 2016-06-19 22:27:49 UTC
I came up with this same patch.
I don't see the indentation problem.  Do I need to do something
special to get it?
Otherwise I plan to submit this soon.
Comment 2 Tom Tromey 2016-06-19 22:28:55 UTC
*** Bug 19225 has been marked as a duplicate of this bug. ***
Comment 3 Tom Tromey 2016-06-19 22:29:22 UTC
*** Bug 16219 has been marked as a duplicate of this bug. ***
Comment 4 Jan Kratochvil 2016-06-20 06:47:51 UTC
(In reply to Tom Tromey from comment #1)
> I don't see the indentation problem.  Do I need to do something
> special to get it?

I do not remember.  If it works now then I am sure fine with it.
Comment 5 Sourceware Commits 2016-08-03 15:56:14 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d10153cfc6cb319a75ceb3e3d34ac30efa17e518

commit d10153cfc6cb319a75ceb3e3d34ac30efa17e518
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Aug 3 08:27:56 2016 -0600

    Avoid potential memory leak in find_frame_funname
    
    The PR 18565 thread pointed out that, if cp_remove_params can throw
    (we aren't quite sure), then find_frame_funname could leak some
    memory.  This patch avoids any potential issue by rearranging some
    code in find_frame_funname.
    
    Built and regtested on x86-64 Fedora 24.
    
    2016-08-03  Tom Tromey  <tom@tromey.com>
    
    	* stack.c (find_frame_funname): Avoid any possible leak in case
    	cp_remove_params can throw.
Comment 6 Sourceware Commits 2016-08-03 15:56:19 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=282a0691a725d1f6653840728449adb297c8c856

commit 282a0691a725d1f6653840728449adb297c8c856
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Jun 12 20:45:29 2016 -0600

    PR python/18565 - make Frame.function work for inline frames
    
    PR python/18565 notes that calling frame filters don't work properly for
    inlined functions.  This happens because Frame.function on an inline
    frame will yield the wrong result.  This patch changes this code to use
    find_frame_funname instead, which handles inline frames properly.
    
    Built and regtested on x86-64 Fedora 24.
    
    2016-08-03  Tom Tromey  <tom@tromey.com>
    
    	PR python/18565:
    	* python/py-frame.c (frapy_function): Use find_frame_funname.
    
    2016-08-03  Tom Tromey  <tom@tromey.com>
    
    	PR python/18565:
    	* gdb.python/py-frame-inline.exp: Add Frame.function test.
Comment 7 Sourceware Commits 2016-08-03 16:03:14 UTC
The gdb-7.12-branch branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d2ed2edaf76fc10505214290d04c3cf312acfbca

commit d2ed2edaf76fc10505214290d04c3cf312acfbca
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Aug 3 08:27:56 2016 -0600

    Avoid potential memory leak in find_frame_funname
    
    The PR 18565 thread pointed out that, if cp_remove_params can throw
    (we aren't quite sure), then find_frame_funname could leak some
    memory.  This patch avoids any potential issue by rearranging some
    code in find_frame_funname.
    
    Built and regtested on x86-64 Fedora 24.
    
    2016-08-03  Tom Tromey  <tom@tromey.com>
    
    	* stack.c (find_frame_funname): Avoid any possible leak in case
    	cp_remove_params can throw.
Comment 8 Sourceware Commits 2016-08-03 16:03:19 UTC
The gdb-7.12-branch branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ff4a25a115a0f477174eb0b4763d186a590c035a

commit ff4a25a115a0f477174eb0b4763d186a590c035a
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Jun 12 20:45:29 2016 -0600

    PR python/18565 - make Frame.function work for inline frames
    
    PR python/18565 notes that calling frame filters don't work properly for
    inlined functions.  This happens because Frame.function on an inline
    frame will yield the wrong result.  This patch changes this code to use
    find_frame_funname instead, which handles inline frames properly.
    
    Built and regtested on x86-64 Fedora 24.
    
    2016-08-03  Tom Tromey  <tom@tromey.com>
    
    	PR python/18565:
    	* python/py-frame.c (frapy_function): Use find_frame_funname.
    
    2016-08-03  Tom Tromey  <tom@tromey.com>
    
    	PR python/18565:
    	* gdb.python/py-frame-inline.exp: Add Frame.function test.
Comment 9 Tom Tromey 2016-08-03 16:04:31 UTC
Fixed.