From: Richard Fateman

Subject: Re: Getting Lisp code - similar to "disassemble"

Date: 2003-8-28 10:44

The "original" code may have disappeared, so the common
lisp standard doesn't have a way to get it back, I think.
Best way is to save the code when you do the defun, or
to look at the file.  There is a way of finding
the code in an implementation-dependent way, but you may
not recognize it since it will have been macro-expanded
etc.  The compiler presumably uses this
to get inside the interpreted function, but
it might not meet your expectations.

RJF


manikanti sreedhar reddy wrote:

>Hi, > >Let us suppose say a function is defined as described below: > > cl-user(1): (defun sayHello() > (print "Hello")) > SAYHELLO > > cl-user(2):(fdefinition 'sayHello) > #<Interpreted Function SAYHELLO> > > cl-user(3): > > >Now, I am interested to get the actual function definition (lisp code), >which is similar to the functionality of "disassemble" (the disassemble >returns the assembly code, I am interested to retrieve the lisp code). > > cl-user(4): (disassemble 'sayHello) > > ;; disassembly of #<Function (:ANONYMOUS-LAMBDA 0) @ > #x715d1cd2> > ;; formals: > ;; constant vector: > 0: "Hello" > 1: PRINT > > ;; code start: #x715d1c8c: > 0: 55 pushl ebp > 1: 8b ec movl ebp,esp > 3: 56 pushl esi > 4: 83 ec 24 subl esp,$36 > 7: e3 02 jcxz 11 > 9: cd 61 int $97 ; > EXCL::TRAP-ARGERR > 11: 80 7f 97 00 cmpb [edi-105],$0 ; > SYS::C_INTERRUPT > 15: 74 02 jz 19 > 17: cd 64 int $100 ; > EXCL::TRAP-SIGNAL-HIT > 19: 8b 46 12 movl eax,[esi+18] ; "Hello" > 22: 8b 5e 16 movl ebx,[esi+22] ; PRINT > 25: b1 01 movb cl,$1 > 27: ff d7 call *edi > 29: c9 leave > 30: 8b 75 fc movl esi,[ebp-4] > 33: c3 ret > >Is there any function or set of steps to get the lisp code? > >Thanks, > >-Sreedhar Reddy > > > >