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 was wondering if gdb supports backwards stepping? I did some searching and didn't find any info that it is supported. I found wrapper programs that support back stepping, but not gdb. Just wondering if anyone can confirm or comment on this.
No, you cannot backstep in a debugger. What's done is done. The wrapper programs most likely take a snapshot of an execution image, and restores that. Normal, simple, debuggers don't do that.
Seriously, just set a breakpoint and rerun the program. If it is a Heisenbug, you've got pretty much no hope.
No, you cannot backstep in a debugger. What's done is done. The wrapper programs most likely take a snapshot of an execution image, and restores that. Normal, simple, debuggers don't do that.
Seriously, just set a breakpoint and rerun the program. If it is a Heisenbug, you've got pretty much no hope.
That what I do, I was just spoiled with Mac's X-Code debugger, which allows you to edit source while debugging. But IMHO that type of programmer leads to poor coding. I agree very much , set a breakpoint (conditional one ) and rerun.
One more thing..do you think debuggers are bad, because when I talk to kernel developers, they tend to frown on interactive debugging, according to Linus:
Quote:
'Use the Source, Luke, use the Source. Be one with the code.'. Think of Luke Skywalker discarding the automatic firing system when closing on the deathstar, and firing the proton torpedo (or whatever) manually. _Then_ do you have the right mindset for fixing kernel bugs.
Just wanted to get your opinion on this? I think they can be abused, but they also have their benefits.
Thanks,
djgerbavor3
Last edited by djgerbavore; 11-29-2006 at 04:22 PM.
My opinion is that anything which helps to find a bug and squash it is a good thing. Some people probably consider that a terribly vulgar attitude. Ho hum. Debugging a kernel is a bit more tricky than user-land apps, maybe that's the source (no pun intended) of the comment.
The major problem with using a debugger as Linus says, is that it can become a crutch that replaces true understanding of what the code is doing. Personally, I see debuggers as useful in two cases:
1.) Fatal errors
2.) Spaghetti-ish code, in that you can't tell what variables are going to have or supposed to have by just looking at the code.
In kernel code, knowing exactly how bits flow is crucial, and the only way to truly understand is to look at the code. Note that Linus does not disapprove of debug messages.
I've done MINIX kernel debugging for classwork, and I definitely agree with Linus there. Kernels are the hardest thing to debug, and debuggers don't really help in that context anyway. Pretty much, you are stuck with debug messages of some sort. Also, you can't even rely on even being able to get a debugger running at all.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.