Port-arm archive

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

Re: [gdb] - step after attach fails on current.



On Fri, Nov 03, 2017 at 07:21:42PM +0000, Gopikrishnan S wrote:
>    Hello,
>    I have NetBSD-current running on an RPi 3. When I attach to a program
>    (which is waiting for the debugger in a loop) with gdb and try to step,
>    or perform any activity that involves writing to the program text such
>    as inserting a breakpoint, I see that the ptrace (PT_IO,...) call fails
>    with errno EFAULT. EFAULT is not among the documented errnos set by
>    ptrace.
>    I spent some time trying to find the root cause of this failure. The
>    EFAULT is generated from a call to copyin() in
>    src/sys/kern/subr_copy.c:copyin_vmspace(). I suspect that the call is
>    failing because the page protection bits are not being set correctly on
>    attach
>    on the RPi.
>    I can reproduce this on NetBSD-current [8.99.3] on evbarm (RPi).
>    I dont have a spare machine/SD-card lying around to test this on
>    -release. FWIW I cannot reproduce this with either -current or -release
>    on amd64 though. Also FWIW, continuing without setting any breakpoints
>    seems to work fine.

I don't see this on a Pi 1 B+ running NetBSD 7.1.  But I only tried
this with the following simple program:

void main()
{
int x = 0;
        while (1) {
                x = (x+1)%2;
        }
}

I might be misreading something, but the "LWP 0" and "LWP 1" in your
output suggest that you are trying this with multithreaded code, is
that the case?  I also tried a multithreaded version of the code above
(where main() just calls pthread_create() with a while loop as above
as parameter, and then pthread_join() ), and it still works for me.
Can you post your code or a minimal version thereof?


>    This GDB was configured as "arm--netbsdelf-eabi".

I'm a bit surprised that this does not say "arm--netbsdelf-eabihf",
(that's what it says for me).  But I don't have a running Pi 3 with
NetBSD-current right now so I can't compare with that.

Unless somebody else has something more constructive to add, I'll try
installing -current on that Pi 1 and/or on a Pi 3 some time the next
few days and see what happens there.


  Harold


Home | Main Index | Thread Index | Old Index