[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gud : Phase error in gdb-pre-prompt (got pre-emacs)

From: hui wang
Subject: Re: gud : Phase error in gdb-pre-prompt (got pre-emacs)
Date: Thu, 3 Jul 2008 15:16:39 +0800

2008/6/28 Nick Roberts <address@hidden>:
 > I tried again with "gdb --annotate=3" (= without binary as parameter) and
 > loaded the binary with
 > (gdb) file binary.bin
 > There was no "initialising..." message visible and I could start
 > immediately. What's the difference ?

Emacs just builds a list of filenames from GDB that were used to build the
executable.  If you specify the name later in the GUD buffer, it doesn't build
that list.  That makes it quicker but if there are relevant files in existing
buffers or you visit them they won't be enabled for debugging, e.g., you won't
be able to click in the fringe to set a breakpoint until execution has already
stopped there.
How to disable emacs from "builds a list of filenames from GDB?"
I have the same problem, and You have given me similiar solution. But it does not work.
So now, I prefer emacs not build it. Maybe there should be a flag for it.

 > > There are several factors that might make this slow:
 > >
 > > 1) An executable that was created from a large number of files.
 > address@hidden >find . \( -name \*.cpp -o -name \*.h \) | wc -l
 > 3072
 > Would this qualify as "large" ? ;)

A similar command for Emacs gives 375, so, ..err yes, that does sound rather

 > > 2) Using stabs debug format.
 > Hmm, not sure. I just compiled with gcc-2.95 (yes, that old....) and "-g".
 > "info gcc" gives me the impression that this means stabs or gdb ...

In GDB, once execution has started, e.g., after hitting a breakpoint, do

(gdb) info source
Current source file is myprog.c
Compilation directory is /home/nickrob
Located in /home/nickrob/myprog.c
Contains 262 lines.
Source language is c.
Compiled with DWARF 2 debugging format.
Includes preprocessor macro info.

Stabs is an old debug format and I suspect it might be the default for gcc-2.95.
Maybe you can compile with DWARF 2 instead (using `-gdwarf-2') then Emacs should
start up more qickly.

 > > 3) Using an old PC.
 > address@hidden >cat /proc/cpuinfo
 > vendor_id       : GenuineIntel
 > cpu family      : 15
 > model           : 2
 > model name      : Intel(R) Pentium(R) 4 CPU 2.40GHz
 > cpu MHz         : 2405.535
 > cache size      : 512 KB
 > Not that old...
 > CPU is at 20% while "initialising....".
 > /home is mounted via nfs but I can hardly see any network activity while
 > "initialising..."

By old, I guess I mean 100MHz.  It looks like it might not be CPU bound,

 > > If this is the problem I can post a patch that might speed things up but
 > I would try this :)
 > > just turning off gud-tooltip-mode might help.
 > "gud-tooltip-mode is a variable defined in `gud.el'.
 > Its value is nil"
 > So it is turned off.
 > Many thanks for your help :) For the time beeing, I'll just load the
 > binary from within gdb. Everything seems to work and I don't have to wait
 > 1:30 minutes. If my colleages see this, I will have to hear their laughter
 > till the end of days ;)

I think that has the same effect as my patch would, i.e., just not build the
list.  It just means that initially you need to set breakpoints, etc, from the
GUD buffer

All these tasks that Emacs performs behind the users back should be benchmarked
and optimised really, but I just haven't found the time.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]