ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am debugging an real-time problem, where I cannot stop the execution for longer time. In this real-time use case, I get an even X at regular intervals and corresponding event handler function handle_x() gets called. I want to print the data within this event X, without stopping execution of program for longer time. Basically, I want to automate 'stop' (Ctrl-C), 'print' and 'cont' gdb commands such that this sequence of commands gets executed everytime when event X occurs in the system.
Is there any way to do so in GDB? I really appreciate any help.
I don't know the direct answer to your question, but when I get in situations like that, I often add temporary debug code to gather data. Declare a large text buffer and sprintf() debug information to the end of it and then later print it. Or even print it from a different thread or process. If memory or time is more critical you store only binary data.
The tracepoint facility is currently available only for remote targets. See section 17. Specifying a Debugging Target. In addition, your remote target must know how to collect trace data. This functionality is implemented in the remote stub; however, none of the stubs distributed with GDB support tracepoints as of this writing. The format of the remote packets used to implement tracepoints are described in D.6 Tracepoint Packets.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.