Message-ID: <3AD10B71.9019CC9@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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 79 Date: Sun, 08 Apr 2001 18:08:01 -0700 NNTP-Posting-Host: 216.119.23.157 X-Complaints-To: abuse AT onemain DOT com X-Trace: nntp1.onemain.com 986778254 216.119.23.157 (Sun, 08 Apr 2001 21:04:14 EDT) NNTP-Posting-Date: Sun, 08 Apr 2001 21:04:14 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: [...] > No, GDB doesn't slow down programs, unless the program does something > very special, such as issues a lot of DPMI function calls, or > generates lots of SIGFPE exceptions. > > Normal programs don't do that. But your program, especially its car5 > function, allocates lots of memory in very small chunks (because it > creates lots of temporary Bset objects), which forces the library to > requests lots of small allocations from the DPMI server. Each such > allocation gets caught by GDB, because it needs to be aware of all > memory allocated by the program being debugged, to be able to > deallocate that memory if the program is restarted without exiting the > debugger. This causes a huge overhead, which is why you see this > terrible slowdown. Here is a much smaller program that also demonstrates a terrible slowdown under gdb. That is, the program below takes much more than 10 times as long to run under gdb. ---------------------------------- #include int count = 0; int i, j, k; unsigned long ii, jj, mm; class Paths { public: static void car7() { for( i=0; i<10; i++) { cout << "car7, i=" << i << '\n'; ii = i; for( j=0; j<100; j++) { jj = j | ii; for( k=0; k<10000; k++) { mm = jj | k; if ( mm == 127) if ( ++count < 5) cout << "car7: " << (i*100+j)*10000+k << '\n'; } } } } }; int main() { cout << "Calling car7\n"; Paths::car7(); cout << "all done.\n"; } ----------------------------------- I compile the program with: gxx -g -Os -Wall test.cpp -o test.exe Then I run it from the command line like this: test It completes in less than 1/2 second. It writes 16 short lines. Then I run it under gdb like this: gdb test.exe break main run n After 20 seconds it has only produced 3 lines of output. The program does not allocate any memory in the function car7. Clearly there is something wrong somewhere. Can anyone tell me how to fix this? 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/