disassembler

Henry Cejtin henry@sourcelight.com
Thu, 9 Aug 2001 22:34:56 -0500


The  command that I use to single step a program is `stepi', and to show what
instruction is being run I use
    display/i $pc
You can see the commands that gdb gets in the wgdb function of spy.

I don't know what you mean by
        ... a way  to  get  gdb  to  disassemble  an  arbitrary  (not
        necessarily binary) executable
What is a non-binary executable?

You  certainly  can  get  gdb  do  dump out what code looks like in a program
without running it.  Just run
    gdb a.out
and then enter the gdb command
    x/20i addr
and it will disassemble the next 20 instructions starting at addr.

Note, that there are several alternative ways to initialize  an  object.   If
you  used  %edi instead of %esi for the frontier, then you could use the stos
instruction, which SML/NJ uses.  Note, that the really right thing to  do  is
probably  to  have  the heap running in the opposite direction (frontier gets
decreased).  Then you fill in an object from end to start, and are left  with
the starting address.

Obviously  all  micro-optimizations  if  any  win at all, but as you say, the
space saving of one byte per initialization in code space probably adds up.