LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-29-2006, 03:02 PM   #1
djgerbavore
Member
 
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 458

Rep: Reputation: 30
back stepping in gdb


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.

Thanks,


djgerbavor3
 
Old 11-29-2006, 03:07 PM   #2
demon_vox
Member
 
Registered: May 2006
Location: Argentina
Distribution: SuSE 10
Posts: 173

Rep: Reputation: 30
I am not sure, but as far as I know, you cannot backstep with gdb

Cheers!
 
Old 11-29-2006, 04:12 PM   #3
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
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.
 
Old 11-29-2006, 04:20 PM   #4
djgerbavore
Member
 
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 458

Original Poster
Rep: Reputation: 30
Quote:
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.
 
Old 11-29-2006, 05:05 PM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
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.
 
Old 11-29-2006, 07:47 PM   #6
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
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.

Last edited by tuxdev; 11-29-2006 at 07:54 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
single stepping with gnu gdb ashlesha Linux - General 1 07-10-2006 07:05 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 01:41 PM
linux reported stepping VS intel stepping whysyn Linux - Hardware 2 05-27-2005 10:21 AM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM
thinking of stepping back to 9.1 nirvanix Slackware 8 07-01-2004 01:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration