Re: BRSGP relocation truncations in linking kernel for Alpha.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/25/2016 01:26 AM, Michael Cree wrote:
> And while I mention gdb, it no longer works on Alpha since version
> 7.10.  Richard, would you be able to take a look at the bug report:
> https://sourceware.org/bugzilla/show_bug.cgi?id=19061

In the PR, Pedro has exactly the right pointer to the problem.

>From arch/alpha/kernel/traps.c:

    info.si_signo = SIGTRAP;
    info.si_errno = 0;
    info.si_code = TRAP_BRKPT;
    info.si_trapno = 0;
    info.si_addr = (void __user *) regs->pc;

    if (ptrace_cancel_bpt(current)) {
        regs->pc -= 4;  /* make pc point to former bpt */
    }

So we report the same si_code for executing a breakpoint insn inserted by gdb,
and a "hardware" breakpoint managed by the kernel.  But for the later, we
already back up the PC.

So gdb winds up backing up the PC twice.

This ought to be fixed by using TRAP_HWBKPT (4) for the ptrace_cancel_bpt case,
but telling gdb about the issue in gdb/nat/linux-ptrace.c like so:

#elif defined __alpha__
# define GDB_ARCH_IS_TRAP_BRKPT(X)  ((X) == TRAP_BRKPT)
# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_BRKPT || (X) == TRAP_HWBKPT)

which looks confusing, but does get checked:

    if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code)
        && GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
      {
        /* The si_code is ambiguous on this arch -- check debug
           registers.  */
        if (!check_stopped_by_watchpoint (lp))
          lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;

but at the moment the default definition of GDB_ARCH_IS_TRAP_HWBKPT is always
false for alpha.

Another fix would be to completely disable gdb's use of "hardware" breakpoints
for alpha.  Are they really more efficient than letting gdb manage everything?


r~

--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux