public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/12347] New: Scripted strcmp() returns incorrect, constant value
@ 2010-12-27  1:09 twists at gmail dot com
  2010-12-27  8:43 ` [Bug exp/12347] " twists at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: twists at gmail dot com @ 2010-12-27  1:09 UTC (permalink / raw)
  To: gdb-prs

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

           Summary: Scripted strcmp() returns incorrect, constant value
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: exp
        AssignedTo: unassigned@sourceware.org
        ReportedBy: twists@gmail.com


Created attachment 5165
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5165
repro test case

The glibc function strchr() is returning a constant nonsense value when used by
gdb.

The original test case:

    perl -e 'system "gdb -p $$"'
    (gdb) set print pretty on
    (gdb) p $patchlevel_sv = *PL_patchlevel
    $1 = {
      sv_any = 0x9199030,
      sv_refcnt = 1,
      sv_flags = 17412,
      sv_u = {
        svu_pv = 0x919fe98 "v5.12.2",
        svu_iv = 152698520,
        svu_uv = 152698520,
        svu_rv = 0x919fe98,
        svu_array = 0x919fe98,
        svu_hash = 0x919fe98,
        svu_gp = 0x919fe98
      }
    }
    (gdb) p $patchlevel = $patchlevel_sv->sv_u.svu_pv
    $2 = 0x919fe98 "v5.12.2"
    (gdb) p strcmp($patchlevel, "v5.10")
    $3 = 3998896
    (gdb) p strcmp($patchlevel, "v5.12")
    $4 = 3998896

An automated, minimal test is attached in gdb-strcmp-repro.tar.gz:

    tar xzf gdb-strcmp-repro.tar.gz
    cd gdb-strcmp-repro
    make

The internet complaint at
http://old.nabble.com/call-strcmp-tt28828726.html#a28828726 might also be an
instance of this.

-- 
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] 4+ messages in thread

end of thread, other threads:[~2011-06-02 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-27  1:09 [Bug exp/12347] New: Scripted strcmp() returns incorrect, constant value twists at gmail dot com
2010-12-27  8:43 ` [Bug exp/12347] " twists at gmail dot com
2010-12-28  6:42 ` schwab@linux-m68k.org
2011-06-02 13:18 ` jan.kratochvil 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).