* GDB "step" not stopping for some inline functions
@ 2013-11-26 17:46 Paul Smith
2013-12-01 19:42 ` Paul Smith
0 siblings, 1 reply; 2+ messages in thread
From: Paul Smith @ 2013-11-26 17:46 UTC (permalink / raw)
To: gdb
Hi all. I'm using GCC 4.8.2 + GDB 7.6.1 (with Python 2.7.6), on a
GNU/Linux x86_64 system. I've also tried this with GCC 4.8.1 + GDB 7.6
(with Python 2.7.5) with the same problem.
If I try to step into a certain inline function then instead of stopping
inside the function, the program runs to completion (or to the next
breakpoint)!
I don't seem to have this problem for other inline or non-inline
functions. It may not be limited to this one inline function; I haven't
tried them all. But I've tried some others and they've worked fine.
If I use "n" instead of "s", it correctly steps over the inline function
call and stops after it completes.
Also if I use "si" instead it will properly step one instruction and if
I do that until I get into the inline function (for example I move to
the opening brace of the inline function), then I can start stepping
normally again.
For example here's a GDB invocation on a gtest unit test program:
$ gdb ./BaseTest/LogTest.gtest
GNU gdb (GDB) 7.6.1
...
This GDB was configured as "x86_64-unknown-linux-gnu".
...
Reading symbols from /home/workspaces/psmith/ws3/BaseTest/LogTest.gtest...done.
(gdb) br LogTest.cpp:90
Breakpoint 1 at 0x4493fc: file /home/workspaces/psmith/ws3/BaseTest/test/LogTest.cpp, line 90.
(gdb) run
Starting program: /home/workspaces/psmith/ws3/./BaseTest/LogTest.gtest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Running main() from gtest_main.cc
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from LogTest
[ RUN ] LogTest.TestSimpleMessage
[ OK ] LogTest.TestSimpleMessage (0 ms)
[ RUN ] LogTest.TestSimpleMessageTwo
Breakpoint 1, LogTest_TestSimpleMessageTwo_Test::TestBody (this=0x71cba0) at /home/workspaces/psmith/ws3/BaseTest/test/LogTest.cpp:90
90 Log::debug("%s\n", MESSAGE);
(gdb) s
[ OK ] LogTest.TestSimpleMessageTwo (1442 ms)
[ RUN ] LogTest.TestBogusAssert
[ OK ] LogTest.TestBogusAssert (1 ms)
[----------] 3 tests from LogTest (1443 ms total)
[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran. (1443 ms total)
[ PASSED ] 3 tests.
[Inferior 1 (process 2384) exited normally]
Ouch! Same thing if I set a breakpoint earlier, then use next to get to
the Log::debug() line, then run "s"; it doesn't stop.
The inline function is nothing magical; it looks like this:
class Log {
static int activeMask;
inline static void debug(const char* text, ...)
__attribute__((format(printf, 1, 2)));
...
};
inline void Log::debug(const char* txt, ...)
{
int mask = LogDebug;
if ((activeMask & mask) == 0) {
return;
}
va_list args;
va_start(args, txt);
vlog(mask, txt, args);
va_end(args);
}
I'm compiling with these flags:
-std=c++11 -fPIC -fno-omit-frame-pointer -g
(no optimization).
Maybe it's the varargs stuff in the inline function that's causing
problems?
Does anyone else see anything like this, or have any thoughts? I can
try to extract it out into a smaller test case if necessary.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: GDB "step" not stopping for some inline functions
2013-11-26 17:46 GDB "step" not stopping for some inline functions Paul Smith
@ 2013-12-01 19:42 ` Paul Smith
0 siblings, 0 replies; 2+ messages in thread
From: Paul Smith @ 2013-12-01 19:42 UTC (permalink / raw)
To: gdb
On Tue, 2013-11-26 at 12:45 -0500, Paul Smith wrote:
> If I try to step into a certain inline function then instead of
> stopping inside the function, the program runs to completion (or to
> the next breakpoint)!
I was able to create a very simple repro case so I filed a bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=16280
If anyone has any thoughts I'm interested...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-01 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-26 17:46 GDB "step" not stopping for some inline functions Paul Smith
2013-12-01 19:42 ` Paul Smith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox