Re: [PATCH] remote: Avoid unwanted shlib internal BPs When debugging Linux kernel or u-boot with Abatron BDI emulator an error occurs:

Pedro Alves
2012-06-01T14:08:42Z

On 06/01/2012 02:36 PM, Joakim Tjernlund wrote:

> ..
> (gdb) tar remote bdi:2001
> Remote debugging using bdi:2001
> 0xeff80050 in ?? ()
> (gdb) mon reset
> (gdb) cont
> Continuing.
> Warning:
> Cannot insert breakpoint -1.
> Error accessing memory address 0xc0000000: Unknown error 4294967295.
>
> (gdb) maintenance info breakpoints
> Num Type Disp Enb Address What
> -1 shlib events keep y 0xc0000000 <_stext> inf 1
>
> gdb mistakenly inserts a special shared library BP even though
> there area no such libs in either linux or u-boot.

GDB has no special knowledge of the Linux kernel, nor of u-boot.
A GNU/Linux targeted GDB (*-*-linux-gnu) recognizes, and knows how to
debug user space applications. If the kernel binary or the u-boot binary
look very much like GNU/Linux user space programs, the *-*-linux-gnu targeted
GDB will assume that's what they are. If you used a bare metal elf/eabi
targeted GDB, which is really what those programs are, you'd not see this.

> Fix this by explicitly informing remote_add_inferior() that
> the remote is attached.

NAK. This is not a "fix", it's papering over the problem, and
regresses GDB. It makes GDB always detach on quit, instead of asking
the remote end whether it is "attached" or whether it has "spawned"
the inferior.

--
Pedro Alves