[Lldb-commits] [PATCH] D31374: Add support for tracing hello-world application on NetBSD

Kamil Rytarowski via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Mar 26 07:23:44 PDT 2017


krytarowski created this revision.
krytarowski added a project: LLDB.
Herald added a subscriber: mgorny.

This patch is a stripped down from features a NetBSD process
code (patch is kept under 2k LOC). This code has assumption that
there is only one thread within a debugged process. The only
debugger trap supported is software breakpoint (TRAP_BRKPT).
The generic platform code requires to add dummy function for
watchpoints etc. These functions are currently empty.
This code is not the final platform support as is and it's treated as
a base to extend, refactor and address issues afterwards.

Supported features:

- handle software breakpoints,
- correctly attach to a tracee,
- support NetBSD specific ptrace(2),
- monitor process termination,
- monitor SIGTRAP events,
- monitor SIGSTOP events,
- monitor other signals events,
- resume the whole process,
- get memory region info perms,
- read memory from tracee,
- write memory to tracee,
- read ELF AUXV,
- x86_64 GPR read and write code

For the generic framework include:

- halt,
- detach,
- signal,
- kill,
- allocatememory,
- deallocatememory,
- update threads,
- getarchitecture,
- getfileloadaddress,
- and others.

This code has preliminary AddThread code.

Out of interest in this patch:

- exec() traps,
- hardware debug register traps,
- single step trap,
- thread creation/termination trap,
- process fork(2), vfork(2) and vfork(2) done traps,
- syscall entry and exit trap,
- threads,
- FPR registers,
- retrieving tracee's thread name,
- non x86_64 support.

This code can be used to start a hello world application and trace it.

This code can be used by other BSD systems as a starting point to get similar
capabilities.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D31374

Files:
  source/Plugins/Process/NetBSD/CMakeLists.txt
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
  source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  source/Plugins/Process/NetBSD/NativeThreadNetBSD.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31374.93071.patch
Type: text/x-patch
Size: 65325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170326/e5a4e532/attachment-0001.bin>


More information about the lldb-commits mailing list