This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] solib-svr4: Avoid unwanted shlib internal BPs When debugging Linux kernel or u-boot
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Joakim Tjernlund <Joakim dot Tjernlund at transmode dot se>, gdb-patches at sourceware dot org
- Date: Fri, 1 Jun 2012 19:22:14 +0200
- Subject: Re: [PATCH] solib-svr4: Avoid unwanted shlib internal BPs When debugging Linux kernel or u-boot
- References: <1338562868-22411-1-git-send-email-Joakim.Tjernlund@transmode.se> <4FC8EC08.1060609@redhat.com>
On Fri, 01 Jun 2012 18:21:28 +0200, Pedro Alves wrote:
> --- a/gdb/solib-svr4.c
> +++ b/gdb/solib-svr4.c
> @@ -1707,7 +1707,7 @@ enable_break (struct svr4_info *info, int from_tty)
> }
> }
>
> - if (!current_inferior ()->attach_flag)
> + if (interp_name != NULL && !current_inferior ()->attach_flag)
> {
> for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
> {
It has a regression in the case below.
OTOH one has to strip _start to make it a regression as with _start GDB did not
catch startup libraries even before.
This is why I suggested to omit only "__start" and "_start" but not "main" if
INTERP_NAME == NULL.
But maybe so broken systems are not so common nowadays to still care about
them.
Regards,
Jan
==> 53.C <==
#include <dlfcn.h>
#include <assert.h>
#include <stdio.h>
static void *lib;
class C {
public:
C();
} c;
C::C() {
lib = dlopen ("./53l.so", RTLD_NOW);
assert(lib);
puts("opened");
}
int main () {
void (*fp)(void)=(void (*)(void))dlsym(lib,"l");
assert(fp);
fp();
}
==> 53l.C <==
#include <stdio.h>
class D {
public:
D();
} d;
D::D() {
puts ("in-library before-main");
}
extern "C" void l(void) {
puts ("in-library after-main");
}
$ ./gdb-unpatched ./53 -ex 'set breakpoint pending on' -ex 'b l' -ex run
Breakpoint 1, 0x00007ffff7dfd71e in l () from ./53l.so
(gdb) _
$ ./gdb-patched ./53 -ex 'set breakpoint pending on' -ex 'b l' -ex run
[Inferior 1 (process 2188) exited normally]
(gdb) _