www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2008/09/02/02:16:47

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Rugxulo <rugxulo AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GDB does not step?
Date: Mon, 1 Sep 2008 23:03:40 -0700 (PDT)
Organization: http://groups.google.com
Lines: 71
Message-ID: <a4f76fe8-9389-4df3-9605-0757bb77f64e@m73g2000hsh.googlegroups.com>
References: <81d302d80808280111rc65dafenb19fdbc04b5b782a AT mail DOT gmail DOT com>
NNTP-Posting-Host: 65.13.115.246
Mime-Version: 1.0
X-Trace: posting.google.com 1220335421 28114 127.0.0.1 (2 Sep 2008 06:03:41 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Tue, 2 Sep 2008 06:03:41 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: m73g2000hsh.googlegroups.com; posting-host=65.13.115.246;
posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1)
Gecko/2008070208 Firefox/3.0.1,gzip(gfe),gzip(gfe)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m826F4Ro017043
Reply-To: djgpp AT delorie DOT com

Hi,

On Aug 28, 3:11 am, "Abhijeet Oundhakar" <oundha DOT  DOT  DOT  AT gmail DOT com> wrote:
>
> Hi Gurus,

I'm far far *far* from a DJGPP guru, but since no one else responded
yet (dunno why, surely someone knows this stuff !) ... I guess I'll
have to do! So please pardon any errors since I've barely ever used
GDB in my life.     :-/

> I'm new to DJGPP (just installed it yesterday). I tried a few test cases:
> compiled a very simple program with
> gxx -gfstabs+ spring.cpp -o spring.exe

Don't use GXX, use GPP. And make sure you know what you're doing if
you're going to use "-gfstabs+" instead of "-g" alone. (There are
other formats, but besides GNU Emacs, I dunno of any apps specifically
requiring COFF or anything besides default. I think the default is now
Dwarf, which is better for C++, right???)

> On starting GDB, I put a breakpoint inside a loop which reads a file
> (while(!feof(in)) ....). GDB breaks nicely at the breakpoint, but I can't
> step! Saying "n" just runs through the entire loop and comes back to the
> breakpoint.

I also find GDB's mnemonics a bit strange. Here's what (I think) I now
know (from a book I just rented from the library, _C in a Nutshell_):

'r' - run (aka, "go"?)
'file myfile.exe'        (load your .EXE)
'set args myparam1 myparam2 ...'
'b' - breakpoint (stays set until you unset it)
'c' - continue  (e.g. after run after setting temporary breakpoint in
order to run until program end)
'l' - list source code (optionally at specific func or line number)
's' - step (aka, "trace"?)
'n' - next (aka, "proceed"?)
'info reg' - show only basic 386 regs (no FPU, MMX, etc.)
'info all-reg' - show ALL reg values  (seems to always have a problem
with XMM regs, though)
'p myvar' - print value of variable myvar
'tb' - temporary breakpoint (unsets after first break)
'bt' - backtrace (show call stack, e.g. "how did I get here?")
'shell edit' - run external command (e.g. edit.exe)
Ctrl+Z - shells to OS
'q' - quit

> On the other hand, an older version of GDB (installed with Dev-C++) gave no
> problem at all. Can anyone please help?

Well, there is a 386+ version of GDB 6.4 now included with FreeBASIC.
The DJGPP version in /beta/ is the same (6.4) but additionally has an
optional TUI interface (but is compiled only for 686+, for whatever
silly reason). Maybe that will help you?? Or just type "help running"
inside GDB itself.

(EDIT:  Okay, fixed a few accuracy errors before posting, oops!! Wow,
easy to make mistakes on this sucker! Heck, the sources for GDB 6.4
are 22 MB ZIP'd! So it's very powerful but very complex. The latest
MinGW / Win32 version is 6.8-3, or so I hear.)

gpp -g -DNOASM paq8o8z.cpp -o p.exe
gdb p.exe

Yeah, it seems to work okay. Oh, and tab completion should show you
your options (for e.g. "info all" -> "info all-registers"). I'm sure
there are better people to tell you more about it, so maybe you could
join #freebasic (on FreeNode IRC) and ask there if you have more
questions. Hey, it can't hurt.    ;-)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019