NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/48616: ld.elf_so errno causes confusing gdb output
>Number: 48616
>Category: bin
>Synopsis: ld.elf_so errno causes confusing gdb output
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 25 08:30:00 +0000 2014
>Originator: Andreas Gustafsson
>Release: 6.1.3
>Organization:
>Environment:
System: NetBSD
Architecture: i386
Machine: i386
>Description:
libc and ld.elf_so both contain a variable called "errno". If you
debug an ordinary single-threaded dynamically linked program using gdb
and enter "print errno", gdb prints the ld.elf_so errno, which is
confusing for the user who was probably more interested in the libc
one.
>How-To-Repeat:
cat >testcase.c <<EOF
#include <errno.h>
#include <stdlib.h>
int main(int argc, char **argv) {
errno = 42;
abort();
return 0;
}
EOF
cat >test.gdb <<EOF
run
print errno
info variables ^errno$
EOF
cc -g testcase.c -o testcase
gdb --batch -x test.gdb ./testcase
This will output "$1 = 2" rather than the expected "$1 = 42", and the
"info variables" command shows two errno variables at different
addresses:
0x00007f7ff7e13830 errno
0x00007f7ff7b3a704 errno
>Fix:
Perhaps rename the ld.elf_so errno?
Home |
Main Index |
Thread Index |
Old Index