From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2607 invoked by alias); 23 Oct 2012 21:28:10 -0000 Received: (qmail 2585 invoked by uid 48); 23 Oct 2012 21:28:07 -0000 From: "j.b.w at gmx dot ch" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: j.b.w at gmx dot ch X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2012-q4/txt/msg00103.txt.bz2 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 = {} 0x7ffff7879010 (gdb) print std::sqrt No symbol "sqrt" in namespace "std". (gdb) print mysqrt $2 = {double (double)} 0x40083c (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.