bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#61453: It is annoying to have to type 'print foo' before each .gdbin


From: Alan Mackenzie
Subject: bug#61453: It is annoying to have to type 'print foo' before each .gdbinit command.
Date: Sun, 12 Feb 2023 16:14:49 +0000

Hello, Eli.

On Sun, Feb 12, 2023 at 16:49:13 +0200, Eli Zaretskii wrote:
> > Date: Sun, 12 Feb 2023 14:42:38 +0000
> > Cc: 61453@debbugs.gnu.org, acm@muc.de
> > From: Alan Mackenzie <acm@muc.de>

> > I've looked at the pp command, and I think it is only capable of
> > displaying objects from within the Lisp environment; it won't display
> > Lisp_Object's in the C environment.

> Nonsense, I use it every day when debugging the C code.  The GDB
> command "pp" can display any Lisp object defined by a C expression.

OK, thanks!  I see now that pp was producing output, but like you say, on
the target Emacs (in an untidy way), not on the debugging Emacs.

> > > You do need to have a running Emacs for "pp", but if you attach to a
> > > running Emacs, you already have that.  I guess the problem is that the
> > > output of "pp" goes to the same display as the one Emacs uses, .....

> > I have an Emacs running gdb, and a seperate "target" Emacs, the one being
> > debugged.  I'm not sure which one you mean as "... the one Emacs uses".

> I mean the Emacs you debug.

Thanks.

> > > But does it really work?  You use $arg0, but that means you cannot
> > > have an arbitrary expression as an argument, and have to be very
> > > cautious with blanks and other delimiters, because GDB could decide
> > > that $arg0 is just part of the argument.

> > Thanks, that's a good point I wasn't aware of.  One way out of that would
> > be to test gdb's $argc is exactly 1, and throw an error message if not.

> How will this help?  You will ask people to deliberately remove any
> delimiters from what they type?  That's a terrible annoyance.  It
> means, for example, that you cannot simply copy/paste code fragments.

It seems that the same problem exists with pp.  It transfers $arg0 to the
target Emacs and ignores any further arguments.  It seems the
overwhelming bulk of the use of all these commands is for just a single
argument.  It is certainly so for the bulk of the commands I've amended.

I'm not removing any facilities here, so people can continue to use print
followed by, say, xpr with no arguments, when that's appropriate.  Most
of the time, xpr <arg> will work just fine.

> > Presumably, there will be some way to quote arguments to gdb functions,
> > I'll have to read the fine manual a bit more closely.

I've experimented with "if $argc > 1 printf "Error message.\n", which
seems to work OK.

> Even if there are such quoting methods (I'm not sure), using them will
> be a significant annoyance.

Having to use print to print out something nobody's interested in, which
takes up two lines in the gdb window, is a significant annoyance.
Otherwise I wouldn't have invested several hours in trying to fix it.

-- 
Alan Mackenzie (Nuremberg, Germany).





reply via email to

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