all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Debugging Emacs with gdba
@ 2005-11-18  3:36 Nick Roberts
  2005-11-18 13:20 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Roberts @ 2005-11-18  3:36 UTC (permalink / raw



If you debug Emacs from within Emacs, read on:

I've modified gud-pp to work from the speedbar.  So if you watch a structure
e.g a window, you can place the cursor over one of the components, press
p and display its lisp value in the GUD buffer:

Speedbar:

Watch Expressions:
o	struct window *
 size	1073745994
 vec_next	struct Lisp_Vector *
 frame	140441948
 mini_p	137829369
 next	153394732
 prev	137829369
 hchild	137829369
 vchild	137829369
 parent	137829369
 ...

GUD buffer:

(gdb)
o.next = #<window 4 on  *Minibuf-0*>
(gdb)

It won't work from the tool-bar because that frame takes focus and changes
point to the value in the newly selected window.

Currently it only works on lisp objects which are components of a structure
but I could get it to work on arrays of lisp objects, if they exist in Emacs.

When the cursor is over a value in the speedbar, the tooltip now displays the
data type.  Unfortunately for lisp objects it displays "int".  It would be
nice if it displayed Lisp_Object.  I don't know how to get it to do this,
though.

Nick

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

* Re: Debugging Emacs with gdba
  2005-11-18  3:36 Debugging Emacs with gdba Nick Roberts
@ 2005-11-18 13:20 ` Eli Zaretskii
  2005-11-18 22:46   ` Nick Roberts
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2005-11-18 13:20 UTC (permalink / raw
  Cc: emacs-devel

> From: Nick Roberts <nickrob@snap.net.nz>
> Date: Fri, 18 Nov 2005 16:36:17 +1300
> 
> When the cursor is over a value in the speedbar, the tooltip now displays the
> data type.  Unfortunately for lisp objects it displays "int".  It would be
> nice if it displayed Lisp_Object.  I don't know how to get it to do this,
> though.

Does your debug info format support macro expansion?  If it does, you
could try using the `macro *' commands in GDB to display Lisp_Object.

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

* Re: Debugging Emacs with gdba
  2005-11-18 13:20 ` Eli Zaretskii
@ 2005-11-18 22:46   ` Nick Roberts
  2005-11-19 10:40     ` Eli Zaretskii
  2005-11-19 23:25     ` Richard M. Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Roberts @ 2005-11-18 22:46 UTC (permalink / raw
  Cc: emacs-devel

 > > When the cursor is over a value in the speedbar, the tooltip now displays
 > > the data type.  Unfortunately for lisp objects it displays "int".  It
 > > would be nice if it displayed Lisp_Object.  I don't know how to get it to
 > > do this, though.
 > 
 > Does your debug info format support macro expansion?  If it does, you
 > could try using the `macro *' commands in GDB to display Lisp_Object.

In fact by using a macro for Lisp_Object, the information is lost.  If I
make the change below, it works.  I think this change is right, in any
case.  If Lisp_Object is a union, its done this way.  And it's generally
useful.  Debugging with GDB from the command line, if you are unsure what
a variable is representing, you can type:

(gdb) whatis new
type = Lisp_Object

instead of getting

(gdb) whatis new
type = int

Is it OK to install this patch?

Nick


*** lisp.h	16 Nov 2005 08:02:46 +1300	1.545
--- lisp.h	19 Nov 2005 11:28:51 +1300	
***************
*** 253,259 ****
  /* If union type is not wanted, define Lisp_Object as just a number.  */
  
  #ifdef NO_UNION_TYPE
! #define Lisp_Object EMACS_INT
  #define LISP_MAKE_RVALUE(o) (0+(o))
  #endif /* NO_UNION_TYPE */
  
--- 253,259 ----
  /* If union type is not wanted, define Lisp_Object as just a number.  */
  
  #ifdef NO_UNION_TYPE
! typedef EMACS_INT Lisp_Object;
  #define LISP_MAKE_RVALUE(o) (0+(o))
  #endif /* NO_UNION_TYPE */

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

* Re: Debugging Emacs with gdba
  2005-11-18 22:46   ` Nick Roberts
@ 2005-11-19 10:40     ` Eli Zaretskii
  2005-11-19 23:25     ` Richard M. Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2005-11-19 10:40 UTC (permalink / raw
  Cc: emacs-devel

> From: Nick Roberts <nickrob@snap.net.nz>
> Date: Sat, 19 Nov 2005 11:46:32 +1300
> Cc: emacs-devel@gnu.org
> 
> Is it OK to install this patch?
> 
> Nick
> 
> 
> *** lisp.h	16 Nov 2005 08:02:46 +1300	1.545
> --- lisp.h	19 Nov 2005 11:28:51 +1300	
> ***************
> *** 253,259 ****
>   /* If union type is not wanted, define Lisp_Object as just a number.  */
>   
>   #ifdef NO_UNION_TYPE
> ! #define Lisp_Object EMACS_INT
>   #define LISP_MAKE_RVALUE(o) (0+(o))
>   #endif /* NO_UNION_TYPE */
>   
> --- 253,259 ----
>   /* If union type is not wanted, define Lisp_Object as just a number.  */
>   
>   #ifdef NO_UNION_TYPE
> ! typedef EMACS_INT Lisp_Object;
>   #define LISP_MAKE_RVALUE(o) (0+(o))
>   #endif /* NO_UNION_TYPE */

Fine with me, but please wait for Richard to give the definitive
response.

Meanwhile, I hope you did check that all the x... GDB commands defined
by src/.gdbinit that work with Lisp data types encoded in Lisp_Object
still work after this change (not that I expect them to stop working,
but still...).

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

* Re: Debugging Emacs with gdba
  2005-11-18 22:46   ` Nick Roberts
  2005-11-19 10:40     ` Eli Zaretskii
@ 2005-11-19 23:25     ` Richard M. Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard M. Stallman @ 2005-11-19 23:25 UTC (permalink / raw
  Cc: eliz, emacs-devel

    In fact by using a macro for Lisp_Object, the information is lost.  If I
    make the change below, it works.  I think this change is right, in any
    case.

Please install it, and we will see if there is any drawback for debugging.

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

end of thread, other threads:[~2005-11-19 23:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-18  3:36 Debugging Emacs with gdba Nick Roberts
2005-11-18 13:20 ` Eli Zaretskii
2005-11-18 22:46   ` Nick Roberts
2005-11-19 10:40     ` Eli Zaretskii
2005-11-19 23:25     ` Richard M. Stallman

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.