简体   繁体   中英

Using GDB in timer functions

I have a C program which uses a timer, when the timer expires the program does something (sets a flag).

My question is: When i set the breakpoints and run the program using GDB, and use "step" to check line by line, does the timer keeps on ticking in the background? or does it halt till i press "s" again (the next step)?

Assuming you used CLOCK_REALTIME , yes. The timer will keep ticking along and if you spend a bunch of time looking at a single instruction it will send its signal the next time something in your program is executed. You can use CLOCK_THREAD_CPUTIME_ID or CLOCK_PROCESS_CPUTIME_ID in Linux after 2.6.12, but those will probably not get you what you want, since they don't measure wall clock time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM