[gnu.gdb.bug] GDB and types

chase@orc.olivetti.com (07/12/89)

(Output follows)

  GDB 3.0, Copyright (C) 1988 Free Software Foundation, Inc.

  (gdb) x 0x824c
  0x824c <Object__New>:   0x4e560000
  (gdb) whatis Object__New
  type = void ()
  (gdb) whatis & Object__New
  type = void (*)()
  (gdb) p (  void (*)()   ) 0x824c
  Invalid syntax in expression.
  (gdb) p (  void ()   ) 0x824c
  Invalid syntax in expression.

If GDB can tell me that Object____New is a "void ()" at address 0x824c,
then it should be able to tell me that "(void (*)()) 0x824c" is in fact
Object____New.  Cdecl concurs:

   cdecl> explain (void (*)())x
   cast x into pointer to function returning void


In general, if I have an array of pointers to functions, I'd like to
be able to saying something like

  p *( (PF *) array) @ length

and have the names of the functions printed (even if they aren't all
of the same type).  That's what I was really trying to do.  (Yes, I
know it's illegal in C, but we all know that it works on most
machines.)

David