[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Setting breakpoints on dlopen
From: |
Jesse Marlin |
Subject: |
Setting breakpoints on dlopen |
Date: |
Thu, 24 May 2001 13:22:26 -0400 |
Adam Bottchen writes:
> I am running into a problem when attempting to set a breakpoint on
> dlopen within gdb under Red Hat 7.1. This problem doesn't happen at any
> other
> level of the Red Hat distribution, only the 7.1 version.
> The initial problem was found when running gdb on a perl script that
> used C extensions. The code was:
>
> -----
> #!/usr/bin/perl
> # Name: testperl
> # Description: Short Perl program using only a Perl to C extension that is
> # shipped with Perl.
> use Socket;
> my $iaddr = gethostbyname("localhost");
> my $host = gethostbyaddr($iaddr, AF_INET);
> print "host is: $host \n";
> print "Hello, testing Perl\n";
> exit 0;
> > -----
>
> I then run gdb on that script:
>
> -----
> address@hidden /root]# gdb /usr/bin/perl
> GNU gdb 5.0rh-5 Red Hat Linux 7.1
> Copyright 2001 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain
> conditions.Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for details.
> This GDB was configured as "i386-redhat-linux"...
> (no debugging symbols found)...
> (gdb) break dlopen
> Breakpoint 1 at 0x8059878
> (gdb) run testperl
> Starting program: /usr/bin/perl testperl
> Error in re-setting breakpoint 1:
> Cannot access memory at address 0x123
> Error in re-setting breakpoint 1:
> Cannot access memory at address 0x123
> Error in re-setting breakpoint 1:
> Cannot access memory at address 0x123
> Error in re-setting breakpoint 1:
> Cannot access memory at address 0x123
> Error in re-setting breakpoint 1:
> Cannot access memory at address 0x123
> Error in re-setting breakpoint 1:
> Cannot access memory at address 0x123
> Error in re-setting breakpoint 1:
> Cannot access memory at address 0x123
> host is: aixlab
> Hello, testing Perl
>
> Program exited normally.
> (gdb)
> -----
In gdb try loading the symbols manually:
(gdb) info shared
0x3000104a080 0x30002820c00 No /usr/lib/mylib.so
(gdb) add-symbol-file /usr/lib/mylib.so 0x3000104a080
add symbol table from file "/usr/lib/mylib.so" at
.text_addr = 0x3000104a080
(y or n) y
Reading symbols from /usr/lib/mylib.so...done.
Hope this helps.
>
> The breakpoint is skipped and memory access errors are displayed. This
> doesn't
> happen under Red Hat 7.0 or 6.2. This same problem will occur even when perl
> is removed from the picture, using the c code below:
>
> -----
> #include <dlfcn.h>
>
> main()
> {
> dlopen("libpthread",0);
> }
> -----
>
> Compiling with "gcc -o test test.c -ldl", the gdb output is the same when the
> breakpoint is set on dlopen. What is causing this?
> Under Red Hat 7.1, gcc is at level 2.96-81 and gdb is 5.0rh-5.
>
>
>
> _______________________________________________
> Bug-gdb mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-gdb
--
Jesse Marlin
Intec Telecom Systems
Software Engineer
Main 404-705-2800
Ph 404-705-2912
Fax 404-705-2805
Email address@hidden