all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs gdb program launcher
@ 2009-03-18 16:48 Vincent Liard
  2009-03-19  6:05 ` Nick Roberts
       [not found] ` <mailman.3547.1237442762.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Vincent Liard @ 2009-03-18 16:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm working on a program that has to be launched from a script which sets 
up the execution environment. Fortunately enough, the script provides an 
option to start it with GDB and it works ok.

However, I would like to run this program with GDB from within emacs, as 
can usually be done. Thus, I start GDB with « M-x gdb » but replace the 
command with the program's launcher.

And it works, but rather than opening the source code with emacs buffers, 
it merely prints lines to be executed in the *gud* buffer as it would do 
with GDB from command line.

I (guess I) undestand GDB is unaware it has been launched from within 
emacs but I don't see how to make it interact properly... I've messed a 
bit with gdb-show-main which was set no NIL but it doesn't seem to change 
anything. Could anyone give me a clue ?

Thanks in advance,

Vincent


^ permalink raw reply	[flat|nested] 7+ messages in thread

* emacs gdb program launcher
  2009-03-18 16:48 emacs gdb program launcher Vincent Liard
@ 2009-03-19  6:05 ` Nick Roberts
       [not found] ` <mailman.3547.1237442762.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Nick Roberts @ 2009-03-19  6:05 UTC (permalink / raw)
  To: Vincent Liard; +Cc: help-gnu-emacs

 > I'm working on a program that has to be launched from a script which sets 
 > up the execution environment. Fortunately enough, the script provides an 
 > option to start it with GDB and it works ok.
 > 
 > However, I would like to run this program with GDB from within emacs, as 
 > can usually be done. Thus, I start GDB with « M-x gdb » but replace the 
 > command with the program's launcher.
 > 
 > And it works, but rather than opening the source code with emacs buffers, 
 > it merely prints lines to be executed in the *gud* buffer as it would do 
 > with GDB from command line.

You don't say what version of Emacs you are using.  If it's 22.1, or later,
you can see in the minibuffer that gdb runs with the option "--annotate=3".
Your script probably interact with Emacs in the same way as gdb would
if you removed this option.

 > I (guess I) undestand GDB is unaware it has been launched from within 
 > emacs but I don't see how to make it interact properly... I've messed a 
 > bit with gdb-show-main which was set no NIL but it doesn't seem to change 
 > anything. Could anyone give me a clue ?

Assuming your script doesn't filter the gdb output, you probably just need to
ensure that it runs gdb with the above option.

-- 
Nick                                           http://www.inet.net.nz/~nickrob




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: emacs gdb program launcher
       [not found] ` <mailman.3547.1237442762.31690.help-gnu-emacs@gnu.org>
@ 2009-03-19  9:04   ` Vincent Liard
  2009-03-20  6:18     ` Nick Roberts
       [not found]     ` <mailman.3615.1237533689.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Vincent Liard @ 2009-03-19  9:04 UTC (permalink / raw)
  To: help-gnu-emacs

>  > And it works, but rather than opening the source code with emacs
>  > buffers, it merely prints lines to be executed in the *gud* buffer as
>  > it would do with GDB from command line.
> 
> You don't say what version of Emacs you are using.  If it's 22.1, or
> later,

It's 22.2.1, sorry not to have indicated it.
Sorry for the crappy subject, too, I forgot to improve it.

> you can see in the minibuffer that gdb runs with the option
> "--annotate=3". Your script probably interact with Emacs in the same way
> as gdb would if you removed this option.

My god... Of course you're right ! For some reason, it's not yet working 
through the script, but "set annotate 3" issued on the GDB command line 
does the job perfectly.

Many thanks for your answer !

Vincent


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: emacs gdb program launcher
  2009-03-19  9:04   ` Vincent Liard
@ 2009-03-20  6:18     ` Nick Roberts
  2009-03-20  7:36       ` Lucius Fox
       [not found]       ` <mailman.3616.1237534598.31690.help-gnu-emacs@gnu.org>
       [not found]     ` <mailman.3615.1237533689.31690.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 7+ messages in thread
From: Nick Roberts @ 2009-03-20  6:18 UTC (permalink / raw)
  To: Vincent Liard; +Cc: help-gnu-emacs

 > My god... Of course you're right ! For some reason, it's not yet working 
 > through the script, but "set annotate 3" issued on the GDB command line 
 > does the job perfectly.

Yes, that will generally work but things probably won't initialise properly,
e.g, you won't be able to click in the margin to set breakpoints in buffers
for source files that Emacs is already visiting.

If the script is bash, for example, then you would probably need to replace
something like:
 
 exec gdb $@

with:

 exec gdb --annotate=3 $@

for proper initialisation.

-- 
Nick                                           http://www.inet.net.nz/~nickrob




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: emacs gdb program launcher
  2009-03-20  6:18     ` Nick Roberts
@ 2009-03-20  7:36       ` Lucius Fox
       [not found]       ` <mailman.3616.1237534598.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Lucius Fox @ 2009-03-20  7:36 UTC (permalink / raw)
  To: Nick Roberts; +Cc: help-gnu-emacs, Vincent Liard

On Thu, Mar 19, 2009 at 11:18 PM, Nick Roberts <nickrob@snap.net.nz> wrote:
>  > My god... Of course you're right ! For some reason, it's not yet working
>  > through the script, but "set annotate 3" issued on the GDB command line
>  > does the job perfectly.
>
> Yes, that will generally work but things probably won't initialise properly,
> e.g, you won't be able to click in the margin to set breakpoints in buffers
> for source files that Emacs is already visiting.
>
> If the script is bash, for example, then you would probably need to replace
> something like:
>
>  exec gdb $@
>
> with:
>
>  exec gdb --annotate=3 $@
>
> for proper initialisation.
>

Can you please tell me what is ' --annotate=3' for?


> --
> Nick                                           http://www.inet.net.nz/~nickrob
>
>
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: emacs gdb program launcher
       [not found]     ` <mailman.3615.1237533689.31690.help-gnu-emacs@gnu.org>
@ 2009-03-20  8:09       ` Vincent Liard
  0 siblings, 0 replies; 7+ messages in thread
From: Vincent Liard @ 2009-03-20  8:09 UTC (permalink / raw)
  To: help-gnu-emacs

>> My god... Of course you're right ! For some reason, it's not yet
>> working
>  > through the script, but "set annotate 3" issued on the GDB command
>  > line does the job perfectly.
> 
> Yes, that will generally work but things probably won't initialise
> properly, e.g, you won't be able to click in the margin to set
> breakpoints in buffers for source files that Emacs is already visiting.
> 
> If the script is bash, for example, then you would probably need to
> replace something like:
>  
>  exec gdb $@
> 
> with:
> 
>  exec gdb --annotate=3 $@
> 
> for proper initialisation.

That's what I did lately and it does work! (Actually, it would have 
worked yesterday if I had not set my --annotate=3 in the wrong place of a 
conditional.)

Many thanks for your concern!

Vincent


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: emacs gdb program launcher
       [not found]       ` <mailman.3616.1237534598.31690.help-gnu-emacs@gnu.org>
@ 2009-03-20  8:21         ` Vincent Liard
  0 siblings, 0 replies; 7+ messages in thread
From: Vincent Liard @ 2009-03-20  8:21 UTC (permalink / raw)
  To: help-gnu-emacs

> Can you please tell me what is ' --annotate=3' for?

If your question is about the "3", I can't tell you exactly but it's 
related to the level of depiction GDB issues when running a program.

If it's about the "annotate", I read from the GDB info page:
"The annotation LEVEL, which is specified using the `--annotate'
command line option (*note Mode Options::), controls how much
information GDB prints together with its prompt, values of expressions,
source lines, and other types of output.  Level 0 is for no
annotations, level 1 is for use when GDB is run as a subprocess of GNU
Emacs, level 3 is the maximum annotation suitable for programs that
control GDB, and level 2 annotations have been made obsolete (*note
Limitations of the Annotation Interface: (annotate)Limitations.)."

Vincent


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-20  8:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-18 16:48 emacs gdb program launcher Vincent Liard
2009-03-19  6:05 ` Nick Roberts
     [not found] ` <mailman.3547.1237442762.31690.help-gnu-emacs@gnu.org>
2009-03-19  9:04   ` Vincent Liard
2009-03-20  6:18     ` Nick Roberts
2009-03-20  7:36       ` Lucius Fox
     [not found]       ` <mailman.3616.1237534598.31690.help-gnu-emacs@gnu.org>
2009-03-20  8:21         ` Vincent Liard
     [not found]     ` <mailman.3615.1237533689.31690.help-gnu-emacs@gnu.org>
2009-03-20  8:09       ` Vincent Liard

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.