public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "j.b.w at gmx dot ch" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/14757] New: Print of expressions with no debug information gives wrong results
Date: Tue, 23 Oct 2012 21:28:00 -0000	[thread overview]
Message-ID: <bug-14757-4717@http.sourceware.org/bugzilla/> (raw)

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

             Bug #: 14757
           Summary: Print of expressions with no debug information gives
                    wrong results
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: j.b.w@gmx.ch
    Classification: Unclassified


Created attachment 6696
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6696
Example program showing different types of functions

When I print expressions involving functions for which no debug information is
available, the result is wrong.

Consider the attached example program, and the following gdb session:

(gdb) print sqrt
$1 = {<text variable, no debug info>} 0x7ffff7879010 <sqrt>
(gdb) print std::sqrt
No symbol "sqrt" in namespace "std".
(gdb) print mysqrt
$2 = {double (double)} 0x40083c <mysqrt(double)>
(gdb) print sqrt(0.5)
$3 = 0
(gdb) print std::sqrt(0.5)
No symbol "sqrt" in namespace "std".
(gdb) print mysqrt(0.5)
$4 = 0.25

I would expect the call "print sqrt(0.5)" to give an error message indicating
that the expression cannot be printed due to missing debug information. Giving
a wrong result without any indication that something is wrong is... wrong.

Also, I'm puzzled as to why "print std::sqrt(0.5)" fails, given that the
program compiles (so std::sqrt apparently exists).

There is a related StackOverflow question at
http://stackoverflow.com/questions/5122570/why-does-gdb-evaluate-sqrt3-to-0

-- 
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.


                 reply	other threads:[~2012-10-23 21:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14757-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).