unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* gdb call with core
@ 2006-05-12  9:57 Klaus Zeitler
  2006-05-12 11:25 ` Eli Zaretskii
       [not found] ` <17509.46549.5651.16043@localhost.localdomain>
  0 siblings, 2 replies; 11+ messages in thread
From: Klaus Zeitler @ 2006-05-12  9:57 UTC (permalink / raw)


When the core file is not in the same dir as the emacs image, I can call
gdb in the dir, where the core file resides, with: 
"gdb <path-to-emacs>/emacs core".
This doesn't work in emacs, here I have to specify:
"<path-to-emacs>/emacs <path-to-core-dir>/core"

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             kzeitler@lucent.com  |
 ------------------------------------------
---
You should not confuse your career with your life.

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

* Re: gdb call with core
  2006-05-12  9:57 gdb call with core Klaus Zeitler
@ 2006-05-12 11:25 ` Eli Zaretskii
  2006-05-12 11:50   ` Klaus Zeitler
       [not found] ` <17509.46549.5651.16043@localhost.localdomain>
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2006-05-12 11:25 UTC (permalink / raw)
  Cc: emacs-devel

> From: Klaus Zeitler <kzeitler@lucent.com>
> Date: Fri, 12 May 2006 11:57:34 +0200
> 
> When the core file is not in the same dir as the emacs image, I can call
> gdb in the dir, where the core file resides, with: 
> "gdb <path-to-emacs>/emacs core".
> This doesn't work in emacs, here I have to specify:
> "<path-to-emacs>/emacs <path-to-core-dir>/core"

What happens if you type "M-x cd RET <path-to-core-dir> RET", before
invoking GDB (you may need to switch to a buffer that doesn't visit
any file, before you invoke `cd')?  Does it work then?

Emacs behaves as if you were in the current buffer's
default-directory; if that is not where the core file resides, the
behavior you describe is perfectly reasonable and expected.

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

* Re: gdb call with core
  2006-05-12 11:25 ` Eli Zaretskii
@ 2006-05-12 11:50   ` Klaus Zeitler
  2006-05-12 13:36     ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Klaus Zeitler @ 2006-05-12 11:50 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
    Eli> 
    Eli> What happens if you type "M-x cd RET <path-to-core-dir> RET", before
    Eli> invoking GDB (you may need to switch to a buffer that doesn't visit
    Eli> any file, before you invoke `cd')?  Does it work then?

No, emacs always changes the default dir to the dir where the image resides.

Klaus

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             kzeitler@lucent.com  |
 ------------------------------------------
---
If they can make penicillin out of moldy bread, they
can sure make something out of you.  -- Muhammad Ali

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

* Re: gdb call with core
       [not found] ` <17509.46549.5651.16043@localhost.localdomain>
@ 2006-05-12 12:03   ` Klaus Zeitler
  0 siblings, 0 replies; 11+ messages in thread
From: Klaus Zeitler @ 2006-05-12 12:03 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "nickrob" == nickrob  <nickrob@snap.net.nz> writes:
    nickrob> 
    nickrob> This is because Emacs sets the working directory to
    nickrob> <path-to-emacs> first so that you debug in the directory of the
    nickrob> executable.  If the Emacs you want to debug is in your path and
    nickrob> you know that core is in `default-directory', you can do "gdb
    nickrob> emacs core".

yes, that's how I normally work, with the image being in my path.
Since I still have emacs 21.3 first in my PATH, I had to specify the
image with its dir and to my amazement emacs didn't find the core even
though the default dir was the one with the core.

    nickrob> Otherwise you have to specify <path-to-core-dir> as
    nickrob> you say.

No big deal as you say, but it's one of the rare cases where it's more 
convenient in the shell than in emacs. That's why I brought it up.

Klaus

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             kzeitler@lucent.com  |
 ------------------------------------------
---
Xerox never comes up with anything original.

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

* Re: gdb call with core
  2006-05-12 11:50   ` Klaus Zeitler
@ 2006-05-12 13:36     ` Eli Zaretskii
  2006-05-12 14:26       ` Stefan Monnier
  2006-05-15  6:14       ` Klaus Zeitler
  0 siblings, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2006-05-12 13:36 UTC (permalink / raw)
  Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Klaus Zeitler <kzeitler@lucent.com>
> Date: Fri, 12 May 2006 13:50:59 +0200
> 
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>     Eli> 
>     Eli> What happens if you type "M-x cd RET <path-to-core-dir> RET", before
>     Eli> invoking GDB (you may need to switch to a buffer that doesn't visit
>     Eli> any file, before you invoke `cd')?  Does it work then?
> 
> No, emacs always changes the default dir to the dir where the image resides.

I can see why this is reasonable.  Why do you think it's bad?

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

* Re: gdb call with core
  2006-05-12 13:36     ` Eli Zaretskii
@ 2006-05-12 14:26       ` Stefan Monnier
  2006-05-13  6:59         ` Nick Roberts
  2006-05-15  6:14       ` Klaus Zeitler
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2006-05-12 14:26 UTC (permalink / raw)
  Cc: Klaus Zeitler, emacs-devel

Eli> What happens if you type "M-x cd RET <path-to-core-dir> RET", before
Eli> invoking GDB (you may need to switch to a buffer that doesn't visit
Eli> any file, before you invoke `cd')?  Does it work then?
>> 
>> No, emacs always changes the default dir to the dir where the image resides.

Yes, and I've found it to be a pain as well.

> I can see why this is reasonable.  Why do you think it's bad?

He gave one example, there are plenty of others: I often want to run an
executable /dir1/foo under GDB (in Emacs) but in the current dir rather than
in /dir1, so I have to do M-x gdb ... and then inside GDB I need to change
back to where I was.  Also I've sometimes used .gdbinit files specific to
the place where I run the executable rather than where I compile it.

It's pretty easy to do M-x cd before doing M-x gdb (and it's not much more
typing since the extra dir you type in M-x cd is saved in the M-x gdb step)
if that's what you want, so I'd rather get rid of this annoying
`auto-cd' behavior of GUD.


        Stefan

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

* Re: gdb call with core
  2006-05-12 14:26       ` Stefan Monnier
@ 2006-05-13  6:59         ` Nick Roberts
  2006-05-13 16:25           ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Nick Roberts @ 2006-05-13  6:59 UTC (permalink / raw)
  Cc: Klaus Zeitler, Eli Zaretskii, emacs-devel

 > It's pretty easy to do M-x cd before doing M-x gdb (and it's not much more
 > typing since the extra dir you type in M-x cd is saved in the M-x gdb step)
 > if that's what you want, so I'd rather get rid of this annoying
 > `auto-cd' behavior of GUD.

In that case, if you just did M-x gdb, which most people would, you would start
in default-directory which can be fairly unintuitive at times, e.g
/usr/share/info if you are viewing Info.  The GDB manual also describes the
current behaviour so that would need to be updated.  Despite its faults, people
are used to the current bahaviour and I think you would get more complaints by
changing it.


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

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

* Re: gdb call with core
  2006-05-13  6:59         ` Nick Roberts
@ 2006-05-13 16:25           ` Stefan Monnier
  2006-05-13 21:45             ` Nick Roberts
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2006-05-13 16:25 UTC (permalink / raw)
  Cc: Klaus Zeitler, Eli Zaretskii, emacs-devel

>> It's pretty easy to do M-x cd before doing M-x gdb (and it's not much more
>> typing since the extra dir you type in M-x cd is saved in the M-x gdb step)
>> if that's what you want, so I'd rather get rid of this annoying
>> `auto-cd' behavior of GUD.

> In that case, if you just did M-x gdb, which most people would, you would
> start in default-directory which can be fairly unintuitive at times, e.g
> /usr/share/info if you are viewing Info.

Under Unix and in Emacs as well, normally things are run in the
default-directory.  So I'd find it hard to believe that people would find it
counter-intuitive.
But maybe it wouldn't always be convenient.

> The GDB manual also describes the current behaviour so that would need to
> be updated.  Despite its faults, people are used to the current bahaviour
> and I think you would get more complaints by changing it.

How 'bout the following:
M-x gdb first prompts for a directory to which to `cd', and then for
the command to run there?

Even if some people find it less convnient, at least they won't get
confused, since it makes the behavior more explicit.


        Stefan

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

* Re: gdb call with core
  2006-05-13 16:25           ` Stefan Monnier
@ 2006-05-13 21:45             ` Nick Roberts
  0 siblings, 0 replies; 11+ messages in thread
From: Nick Roberts @ 2006-05-13 21:45 UTC (permalink / raw)
  Cc: Klaus Zeitler, Eli Zaretskii, emacs-devel

 > > In that case, if you just did M-x gdb, which most people would, you would
 > > start in default-directory which can be fairly unintuitive at times, e.g
 > > /usr/share/info if you are viewing Info.
 > 
 > Under Unix and in Emacs as well, normally things are run in the
 > default-directory.  So I'd find it hard to believe that people would find it
 > counter-intuitive.
 > But maybe it wouldn't always be convenient.

I guess you are likening the current working directory in Unix to the
default-directory in Emacs.  However the user has to change the former
explicitly so is generally more aware of what it is. In Emacs its done behind
the users back so, for example, when I use Info its /usr/share/info when I
look at the Info directory node, and ~/emacs/info when I view the Emacs Info
manual.

 > > The GDB manual also describes the current behaviour so that would need to
 > > be updated.  Despite its faults, people are used to the current bahaviour
 > > and I think you would get more complaints by changing it.
 > 
 > How 'bout the following:
 > M-x gdb first prompts for a directory to which to `cd', and then for
 > the command to run there?

Well I guess we could make C-u M-x gdb to this...

 > Even if some people find it less convnient, at least they won't get
 > confused, since it makes the behavior more explicit.

...or the Emacs tried and test way of adding yet another user option.

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

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

* Re: gdb call with core
  2006-05-12 13:36     ` Eli Zaretskii
  2006-05-12 14:26       ` Stefan Monnier
@ 2006-05-15  6:14       ` Klaus Zeitler
  2006-05-15 20:37         ` Eli Zaretskii
  1 sibling, 1 reply; 11+ messages in thread
From: Klaus Zeitler @ 2006-05-15  6:14 UTC (permalink / raw)
  Cc: emacs-devel

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
    Eli> 
    Eli> I can see why this is reasonable.  Why do you think it's bad?

I hope I didn't say "bad", I just wanted to point out that it's sometimes
a bit inconvenient.

Besides the current behavior is also sometimes a bit confusing. For example
last Friday I tried to look at an emacs core (in my current directory where
emacs had just written the core) with "gdb path-to-emacs/emacs core". After a
short glance I decided to take a closer look, which for me means I need emacs
with gud, so I started emacs in this directory and tried the same command that
I had just executed in the shell and now emacs couldn't find the core.

I recall that I had a similar problem a while ago where I ran a Perl script
with two files as parameters and these files did (similar to the core file)
reside in another directory. In that case I had to specify the directory
twice for the parameters.

Klaus

-- 
 ------------------------------------------
|  Klaus Zeitler      Lucent Technologies  |
|  Email:             kzeitler@lucent.com  |
 ------------------------------------------
---
The day Microsoft makes something that does not suck,
is probably the day they start making vacuum cleaners.

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

* Re: gdb call with core
  2006-05-15  6:14       ` Klaus Zeitler
@ 2006-05-15 20:37         ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2006-05-15 20:37 UTC (permalink / raw)
  Cc: emacs-devel

> Cc: emacs-devel@gnu.org
> From: Klaus Zeitler <kzeitler@lucent.com>
> Date: Mon, 15 May 2006 08:14:03 +0200
> 
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>     Eli> 
>     Eli> I can see why this is reasonable.  Why do you think it's bad?
> 
> I hope I didn't say "bad", I just wanted to point out that it's sometimes
> a bit inconvenient.

``Bad'' as in ``inconvenient''.

> Besides the current behavior is also sometimes a bit confusing. For example
> last Friday I tried to look at an emacs core (in my current directory where
> emacs had just written the core) with "gdb path-to-emacs/emacs core". After a
> short glance I decided to take a closer look, which for me means I need emacs
> with gud, so I started emacs in this directory and tried the same command that
> I had just executed in the shell and now emacs couldn't find the core.

It takes time to get used to the notion that in Emacs, you are always
in the directory of the current buffer.  When you do get used to it,
things like that really make sense to you.

In other words, the fact that you invoked Emacs from some directory
says nothing at all about what will be the value of PWD for some
arbitrary Emacs command.

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

end of thread, other threads:[~2006-05-15 20:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-12  9:57 gdb call with core Klaus Zeitler
2006-05-12 11:25 ` Eli Zaretskii
2006-05-12 11:50   ` Klaus Zeitler
2006-05-12 13:36     ` Eli Zaretskii
2006-05-12 14:26       ` Stefan Monnier
2006-05-13  6:59         ` Nick Roberts
2006-05-13 16:25           ` Stefan Monnier
2006-05-13 21:45             ` Nick Roberts
2006-05-15  6:14       ` Klaus Zeitler
2006-05-15 20:37         ` Eli Zaretskii
     [not found] ` <17509.46549.5651.16043@localhost.localdomain>
2006-05-12 12:03   ` Klaus Zeitler

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).