This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug exp/12347] New: Scripted strcmp() returns incorrect, constantvalue


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]