Message-ID: <3AD5216F.128D108C@jps.net> From: Dennis Yelle X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: gdb still doesn't work for me References: <3AD0B992 DOT 44D0D3C3 AT jps DOT net> <4634-Sun08Apr2001234906+0300-eliz AT is DOT elta DOT co DOT il> <3AD10B71 DOT 9019CC9 AT jps DOT net> <3AD1E414 DOT 8D811D08 AT jps DOT net> <9auqog$6ah$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3AD3339E DOT 2C1F2F32 AT jps DOT net> <1858-Wed11Apr2001145958+0300-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 56 Date: Wed, 11 Apr 2001 20:30:55 -0700 NNTP-Posting-Host: 216.119.21.139 X-Complaints-To: abuse AT onemain DOT com X-Trace: nntp1.onemain.com 987046005 216.119.21.139 (Wed, 11 Apr 2001 23:26:45 EDT) NNTP-Posting-Date: Wed, 11 Apr 2001 23:26:45 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: [...] > I do see that after "run", the program doesn't stop on the first > executable line of the `main' function, which is this: > > count = 0; > > Instead, it stops here: > > count += 2; > > which is _after_ Paths::car7() was called. Yes, that is another thing I have noticed several times with different versions of gdb. I set a breakpoint and run, and the program either runs to completion, or stops someplace other than the place where I put the breakpoint. This is one of the reasons I just concluded that gdb was unusable, and so I didn't ever try very hard to use it. > So I set a breakpoint on the first executable line of `main': > > (gdb) b 19 > (gdb) run > (gdb) n > > And _now_ it indeed runs very slowly. > > The problem seems to be that GCC inlines the call to Paths::car7(), > and that confuses GDB's "next" command. When "next" sees a call to a > function, it single-steps into the function over which it wants to > step, then sets a temporary breakpoint at the return address of that > function. But with an inlined function, there is no return address to > put a breakpoint on, and so GDB ends up single-stepping the whole > region of the instructions in the inlined call. > > One way to avoid this is tell GCC not to inline (with the > "-fno-default-inline" option). Yes. Thanks. That option seems to make it work properly, with either -g or with -gstabs. > Another way is to not use the `n' > command, and instead use "tb +1" and "c" commands. The first sets a > temporary breakpoint on the next source line, the second runs the > program until that breakpoint. Well, OK, so, is there a way to define a single character command that will do the equivalent of the "tb +1" and "c" commands? That would help me out a lot, if I could do that. Dennis Yelle -- I am a computer programmer and I am looking for a job. There is a link to my resume here: http://table.jps.net/~vert/