Changes:
- always perform polling on inferior_ptid, never -1
-1 can cause catching fork/vfork events in random order
polling on pid will guarantee to report events in expected order
- assume availability of KERN_PROC_PATHNAME
- drop dead code for KERN_PROC_AUXV (FreeBSD-specific sysctl)
AUXV on NetBSD is handled with PIOD_READ_AUXV
- drop unused nbsd_fetch_kinfo_proc
- drop unneeded hacks for fork/vfork code
- drop support for FreeBSD specific flags returned for PT_LWPINFO
NetBSD uses PT_GET_SIGINFO / PT_GET_PROCESS_STATE for most pieces of
information
- port nbsd_thread_name to NetBSD
- enable LWP and FORK events in nbsd_enable_proc_events
- use NetBSD new batteries for distinguishing event type in to_wait
map most events into GDB types
breakpoint, single step, hw breakpoint/watchpoint ones are still not
used with the full power here
- add support for EXEC events
- clean up
This change makes GDB functional with threaded code and it is good enough
to pass t_regress / threads test.
It's possible to execute and step processes with multiple threads, use
scheduler-lock, follow-fork etc features.
What does not work:
- the LWP EXIT event and wait() are not synchronized and can deadlock
this has been observed with exiting go applications
- GDB VFORK code is still disabled and awaits kernel fixing
Short term goal is to correct LWP EXIT and follow up with VFORK fixes.
Long term goal is to rewrite NetBSD GDB support and write new support in
the remote process plugin (gdb-server) framework.
PR kern/53120
PR port-arm/51677
PR bin/54060
PR bin/49662
PR kern/52548
Fixes 'panic: kernel diagnostic assertion "cv_is_valid(cv)" failed'
during fdcisa(4) probe on Milan's DIAGNOSTIC kernel, caused by
a stray interrupt from the FDC right after isa_intr_establish().
No visible bad side effect on TT030 with this change.
Should be pulled up to netbsd-8.
Stop disabling LWP create and exit events for PT_SYSCALL tracing.
PT_SYSCALL disabled EXEC reporting for legacy reasons, there is no need
to repeat it for LWP and CHLD events.
Pass full siginfo from trapsignal events (SEGV, BUS, ILL, TRAP, FPE).
This adds missing information about signals like fault address.
Set ps_lwp always.
Before passing siginfo to userland through p_sigctx.ps_info, make sure
that it was zeroed for unused bytes. LWP and CHLD events do not set si_addr
and si_trap, these pieces of information are passed for crashes (like
software breakpoint).
LLDB crash reporting works now correctly:
(lldb) r
Process 552 launched: '/tmp/a.out' (x86_64)
Process 552 stopped
* thread #1, stop reason = signal SIGSEGV: invalid address (fault address: 0x123456)
from the uname -p value already fetched.
this means eg, build.sh on evbarm will build the native platform rather
than "earm" (armv5) -- which was the default even on arm64 hosts.
Rename trace_thrad[1234] to more meaningful names:
- trace_thread_nolwpevents
- trace_thread_lwpexit
- trace_thread_lwpcreate
- trace_thread_lwpcreate_and_exit
In my local tests LWP CREATE events work as expected.
LWP EXIT ones are still racy and keep them disabled racy.
PR kern/51995
Add MI toplevel startlwp function.
Switch all userland LWPs to go through lwp_create using a shared
mi_startlwp() function between all MD ABIs.
Add debugger related event handling in mi_startlwp() and continue with
standard p->p_emul->e_startlwp at the end of this routine.
Use eventswitch() to notify the event of LWP exit in lwp_exit().
ATF ptrace(2) tests signal9 and signal10 now pass.
Route all crash and debugger related signal through eventswitch(), that
calls sigswitch() with preprocessed arguments.
This code avoids code duplication and allows to introduce changes that
will affect all callers of sigswitch() in debugger-related events.
No functional change intended.
If the address parameter is 0, report error.
It's a popular mistake to set Program Counter to 0x0.
In certain kernels this is allowable parameter and causes
portability issue.
Disallow explicitly zeroed PC, instead of triggering
a harder to debug crash later.
broke ifreq by the first ether_ioct() and the second ether_ioctl() caused
unexpected behavior. One of bug example is that SIOCGIFMEDIA always failed.
This bug was added in if_alc.c rev. 1.16.
XXX pullup-8
vcpu_run. This saves a few syscalls and copyins.
For example on Windows 10, moving the mouse from the left to right sides of
the screen generates ~500 events, which now don't result in syscalls.
The error handling is done in vcpu_run and it is less precise, but this
doesn't matter a lot, and will be solved with future NVMM error codes.