From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 378 invoked by alias); 10 Jan 2002 15:49:10 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 349 invoked from network); 10 Jan 2002 15:49:06 -0000 Received: from unknown (HELO heimdall.inter.net.il) (192.114.186.17) by sources.redhat.com with SMTP; 10 Jan 2002 15:49:06 -0000 Received: from zaretsky ([192.116.55.139]) by heimdall.inter.net.il (Mirapoint) with ESMTP id BDL84212; Thu, 10 Jan 2002 17:48:48 +0200 (IST) Date: Thu, 10 Jan 2002 07:49:00 -0000 From: "Eli Zaretskii" To: ac131313@cygnus.com Message-Id: <9743-Thu10Jan2002174616+0200-eliz@is.elta.co.il> X-Mailer: emacs 21.1.50 (via feedmail 8 I) and Blat ver 1.8.9 CC: gdb@sources.redhat.com In-reply-to: <3C3DA906.6010803@cygnus.com> (message from Andrew Cagney on Thu, 10 Jan 2002 09:45:26 -0500) Subject: Re: Request/question from RMS Reply-to: Eli Zaretskii References: <3C3DA906.6010803@cygnus.com> X-SW-Source: 2002-01/txt/msg00088.txt.bz2 > Date: Thu, 10 Jan 2002 09:45:26 -0500 > From: Andrew Cagney > > > In Emacs .gdbinit I found this: > > > > define xreload > > set $valmask = ((long)1 << gdb_valbits) - 1 > > set $nonvalbits = gdb_emacs_intbits - gdb_valbits > > end [...] > > I think GDB should avoid making this necessary--that it should > > reread .gdbinit when it reloads the executable. Or there should > > be a certain user-defined command that will be run after GDB > > reloads the executable. > > I know there are now things like posthook-run commands. However, > without knowing how EMACS uses the above (I've no desire to debug emacs, > debugging mozilla was scary enough :-^) it is hard to suggest a replacement. Here's an example of how this is used: define xint print (($ & $valmask) << $nonvalbits) >> $nonvalbits end document xint Print $, assuming it is an Emacs Lisp integer. This gets the sign right. end define xsymbol print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits) output (char*)$->name->data echo \n end document xsymbol Print the name and address of the symbol $. This command assumes that $ is an Emacs Lisp symbol value. end In other words, Emacs Lisp objects are represented by C int's, whereby a few high bits are used for the tag that distinguishes between the types, while the rest of the int is normally a pointer to a place where the object is stored (an Emacs integer is an exception: it represents itself). When you debug Emacs, you use commands like xint and xsymbol to display the values of the Lisp object (here, an integer and a symbol, respectively) in human-readable format. Here's an example of usage: (gdb) p Qnil $1 = 270900228 (gdb) xsymbol $2 = (struct Lisp_Symbol *) 0x259c04 0x129928 "nil" (gdb) (`Qnil' is the C variable which holds the Lisp symbol `nil'.)