Bug 19225 - Function Decorator bug with static inline
Summary: Function Decorator bug with static inline
Status: RESOLVED DUPLICATE of bug 18565
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: 7.9
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-10 10:33 UTC by Kevin Pouget
Modified: 2016-06-19 22:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Pouget 2015-11-10 10:33:05 UTC
I found a bug with Function Decorator when debugging a GOMP application:

**Minimal Example**

class BugFrame(gdb.frames.FrameDecorator):
    pass
    
class BugFrameFilter:
    def __init__(self):
        self.enabled = True
        self.priority = 1
        
    def filter(self, frames):
        for frame in frames:
            yield BugFrame(frame)

gdb.frame_filters["Bug frame filter"] = BugFrameFilter()

**Wrong backtrace**
(gdb) break /build/gcc/src/gcc-5.2.0/libgomp/config/linux/wait.h:55
(gdb) where
#0  0x00007ffff7bcab0b in gomp_barrier_wait_end (val=0, addr=0x6028a4) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/wait.h:55
#1  0x00007ffff7bcab0b in gomp_barrier_wait_end (val=0, addr=0x6028a4) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/wait.h:64
#2  0x00007ffff7bcab0b in gomp_barrier_wait_end (bar=0x6028a0, state=0) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/bar.c:48
#3  0x00007ffff7bc83f8 in gomp_thread_start (xdata=<optimized out>) at /build/gcc/src/gcc-5.2.0/libgomp/team.c:112
#4  0x00007ffff79a34a4 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff76e113d in clone () at /usr/lib/libc.so.6

do_wait and do_spin both look like that:

static inline void do_wait (int *addr, int val)
{
  if (do_spin (addr, val))
    futex_wait (addr, val);
}

**Expected backtrace**

(gdb) where n
#0  do_spin (val=0, addr=0x6028a4) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/wait.h:55
#1  do_wait (val=0, addr=0x6028a4) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/wait.h:64
#2  gomp_barrier_wait_end (bar=0x6028a0, state=0) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/bar.c:48
#3  0x00007ffff7bc83f8 in gomp_thread_start (xdata=<optimized out>) at /build/gcc/src/gcc-5.2.0/libgomp/team.c:112
#4  0x00007ffff79a34a4 in start_thread () from /usr/lib/libpthread.so.0
#5  0x00007ffff76e113d in clone () from /usr/lib/libc.so.6


**Quick fix** (for information)

class BugFixFrame(gdb.frames.FrameDecorator):
    def function(self):
        return self.inferior_frame().name()
    
class BugFixFrameFilter:
    def __init__(self):
        self.enabled = True
        self.priority = 99999
        
    def filter(self, frames):
        for frame in frames:
            yield BugFixFrame(frame)

gdb.frame_filters["Bug fix frame filter"] = BugFixFrameFilter()

now correct result:

where
#0  0x00007ffff7bcab0b in do_spin (val=0, addr=0x6028a4) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/wait.h:55
#1  0x00007ffff7bcab0b in do_wait (val=0, addr=0x6028a4) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/wait.h:64
#2  0x00007ffff7bcab0b in gomp_barrier_wait_end (bar=0x6028a0, state=0) at /build/gcc/src/gcc-5.2.0/libgomp/config/linux/bar.c:48
#3  0x00007ffff7bc83f8 in gomp_thread_start (xdata=<optimized out>) at /build/gcc/src/gcc-5.2.0/libgomp/team.c:112
#4  0x00007ffff79a34a4 in start_thread () at /usr/lib/libpthread.so.0
#5  0x00007ffff76e113d in clone () at /usr/lib/libc.so.6
Comment 1 Tom Tromey 2016-06-19 22:28:54 UTC
Looks like a dup of 18565.

*** This bug has been marked as a duplicate of bug 18565 ***