public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/15238] New: odd things with printing function types (p *****************_start)
@ 2013-03-06 18:52 palves at redhat dot com
  0 siblings, 0 replies; only message in thread
From: palves at redhat dot com @ 2013-03-06 18:52 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15238

             Bug #: 15238
           Summary: odd things with printing function types (p
                    *****************_start)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: exp
        AssignedTo: unassigned@sourceware.org
        ReportedBy: palves@redhat.com
    Classification: Unclassified


$ gdb ...
  ...
  0x0000003d25a01530 in _start () from /lib64/ld-linux-x86-64.so.2
  (gdb) p _start
  $1 = {<text variable, no debug info>} 0x402860 <_start>

I was trying to poke at the first address of _start.  I forgot
one needs to write "p *(char *)_start = 1", and got:

  (gdb)  p *_start = 1
  Invalid cast.

Trying to recall the correct syntax, I noticed that
dereferencing a function yields back the same thing:

  (gdb) p *_start 
  $2 = {<text variable, no debug info>} 0x402860 <_start>

and on:

  (gdb) p **_start 
  $3 = {<text variable, no debug info>} 0x402860 <_start>

and on... :

  (gdb) p *****************************************_start 
  $30 = {<text variable, no debug info>} 0x402860 <_start>

That looks bizarre.

I don't have debug info for _start, so GDB assumes 'int()':

  (gdb) ptype _start 
  type = int ()

But:

  (gdb) ptype *_start 
  Attempt to take contents of a non-pointer value.

I _think_ ptype is right in erroring out.  Maybe the print behavior is intended
though, not sure, haven't looked at the code.
But then I'm surprised that print "works" and ptype doesn't.  If an expression
works with one, it should work with the other, and the inverse too.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-06 18:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-06 18:52 [Bug exp/15238] New: odd things with printing function types (p *****************_start) palves at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).