🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #182

GDB and types

#182
From: chase
Date: Tue, 11 Jul 1989 21:00
34 lines
1463 bytes
(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
Technical Details
Message-ID: <44615@oliveb.olivetti.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!apple!oliveb!orc.olivetti.com!chase

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!apple!oliveb!orc.olivetti.com!chase
From: chase@orc.olivetti.com
Newsgroups: gnu.gdb.bug
Subject: GDB and types
Summary: GDB should be able to parse the types it prints.
Message-ID: <44615@oliveb.olivetti.com>
Date: 11 Jul 89 21:00:17 GMT
Sender: news@oliveb.olivetti.com
Reply-To: chase@orc.olivetti.com ()
Distribution: gnu
Organization: Olivetti Research Center, Menlo Park, CA
Lines: 34