This is an archive of the discontinued LLVM Phabricator instance.

Battery of NetBSD support improvements
ClosedPublic

Authored by krytarowski on Mar 28 2017, 8:22 PM.

Details

Summary

Include initial support for:

  • single step mode (PT_STEP)
  • single step trap handling (TRAP_TRACE)
  • exec() trap (TRAP_EXEC)
  • add placeholder interfaces for FPR
  • initial code for NetBSD core(5) files
  • minor tweaks

While there improve style of altered elf-core/ files.

This code raises the number of passing tests on NetBSD to around 50% (600+/1200+).

The introduced code is subject to improve afterwards for additional features and bug fixes.

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Mar 28 2017, 8:22 PM

Next: watchpoints, FPR.

Current core(5) file format is a subject to change (AUXV can be shortened)... I'm working on the final nits for the NetBSD-8 interfaces.

Adding Jim as a reviewer, since Pavel is mostly out of the keyboard for longer time.

labath added inline comments.Mar 29 2017, 6:39 AM
source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
249

This is the third place i'm seeing this code. Any chance of turning it into a function?

432

I guess you should be playing with the pt_suspend/resume here to step only the requested thread(s). Is that something you plan to do as a follow up?

krytarowski added inline comments.Mar 29 2017, 7:24 AM
source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
249

Everything that touches threads will be refactored in future.

I suspect that at the end this code will lost its capability to iterate threads after exec() as all of them are terminated.

Here is a code that handles it in an expanded way and fore 1 thread only.

432

I'm planning to reuse PT_RESUME/PT_SUSPEND to select thread/s for execution.

And reuse PT_SETSTEP/PT_CLEARSTEP to mark them optionally for single-step mode.

And at the end use global PT_CONTINUE as it has option to emit a signal (PT_STEP cannot send a signal).

I think I will start the threading segment with proper handling of core(5) files. It looks like the simplest start point.

OpenBSD uses very similar format and can catch up quickly.

kettenis edited edge metadata.Mar 29 2017, 7:32 AM

The core file reading bits look ok to me.

source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
382–383

Probably should update this comment

source/Plugins/Process/elf-core/ProcessElfCore.cpp
456

Unfortunate that the note numbers are different from architecture to architecture on NetBSD.

krytarowski added inline comments.Mar 29 2017, 7:42 AM
source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
382–383

Right!

source/Plugins/Process/elf-core/ProcessElfCore.cpp
456

Yes, we reuse PT_GETREGS and PT_GETFPREGS per port variables.

This is placeholder to start working on amd64 with threading support.

labath added inline comments.Mar 29 2017, 1:04 PM
source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
249

That's fine, but if they're identical right now, you could still merge them together, right? (A lot of the temporary things have a tendency to become permanent).

432

Ok, as long as you're aware of that, I'm fine.

krytarowski added inline comments.Mar 29 2017, 7:02 PM
source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
249

I will merge this. Even if this is temporary solution.

Apply changes from review. No visible regressions in "check-lldb".

jingham resigned from this revision.Mar 30 2017, 12:40 PM

Kyril, I haven't been involved in the lldb-server parts of lldb. Greg sketched out those interfaces and mostly folks working on Windows & Linux have fleshed them out. I haven't been following the design discussions for lldb-server, and am not in a position to study them now. So I'm not a good person to review these changes.

You might try adding Greg as a reviewer, though I don't know how much time he will have right now, since he's starting a new job.

labath accepted this revision.Mar 30 2017, 1:22 PM

Thank you. Keep up the good work.

This revision is now accepted and ready to land.Mar 30 2017, 1:22 PM
krytarowski closed this revision.Mar 30 2017, 1:37 PM

Thanks! I noted that I introduced some bugs.. but I will fix them in future revisions. I will move on to threads now. FPR/watchpoints will be done later, on the cost on adding some code for cores and helping out with base system work.

LLDB/NetBSD is now out of the box functional as a debugger for a single thread.