Hi,

I was trying to use kdb (kdb-v1.8-2.4.5-pre2.gz, x86 architecture) to set
breakpoints in a module I'm writing, but whenever the breakpoint was hit,
kdb came up reporting an int3 Oops.

I eventually tracked the problem down to the fact that I was using a libbfd
from a binutils configured with 64 bit support enabled. This in turn meant
that bp_addr in kdb_breakpoints[] (of type bfd_vma) was an unsigned long
long.

Unfortunately, the type of the instruction pointer, eip, which is compared
against bp_addr in kdba_bp_trap(), is a long. (Its declaration is in
asm/ptrace.h). The compiler converts the long to an unsigned long long by
sign extending it. The breakpoints I was setting had the top bit set, which
meant that after sign extension, kdb didn't think that the breakpoint
belonged to it.

I made it work for me by casting eip to be an unsigned long, at line 319 in
kdba_bp.c:

                if (bp->bp_addr == ((unsigned long)ef->eip - bp->bp_adjust))
{

Are there any other consequences of having 64 bit support enabled in
binutils that will affect kdb? (eg I'm thinking of format strings like
kdb_bfd_vma_fmt).

Regards,

Simon Munton

Reply via email to