[Issue 10210] GDB might trash EAX when stepping into a PLT call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 6 15:14:39 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10210


Martin Nowak <code at dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |
            Summary|calling through PLT trashes |GDB might trash EAX when
                   |EAX                         |stepping into a PLT call
           Severity|critical                    |minor


--- Comment #3 from Martin Nowak <code at dawg.eu> 2013-06-06 15:14:37 PDT ---
cat > bug.d << CODE
import lib;

void main()
{
    int val;
    printf("%p\n", &val);
    deref(&val) == 0 || assert(0);
}
CODE

cat > lib.d << CODE
extern(C) int printf(const char*, ...);

int deref(int* p)
{
    printf("%p\n", p);
    return *p;
}
CODE

dmd -g -m32 -fPIC -shared lib.d -ofliblib.so
dmd -g -m32 -fPIC bug.d -L-L. -L-llib -L-rpath=.
./bug

----

Oh, the above code actually works. It's not the PLT stub but the attached
debugger (gdb-7.5.1) that trashes EAX. It only happens when stepping into a
function called via PLT and I can only reproduce with emacs-GUD, probably
because of some automatic variable update.

It also means there is another reason why phobos unittests crash on X86 :(.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list