Page MenuHomeFreeBSD

Export a breakpoint() function to userland.
ClosedPublic

Authored by jhb on Apr 25 2018, 2:43 AM.

Details

Summary

As a result, expand coverage of tests using breakpoint() to more
architectures.

Test Plan
  • I have not tested any of these, so testing by others and/or review would be welcome. I would probably commit these separately, but they are glummed together in the branch this is part of so it's a bit easier to solicit review/testing with a combined patch.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhb created this revision.Apr 25 2018, 2:43 AM
andrew added inline comments.Apr 25 2018, 9:50 AM
sys/arm/include/cpufunc.h
503 ↗(On Diff #41829)

What instruction is this? You might also be able to use the .inst directive here.

jhb added inline comments.Apr 25 2018, 4:34 PM
sys/arm/include/cpufunc.h
503 ↗(On Diff #41829)

This matches GDB5_BREAKPOINT from sys/arm/include/trap.h and it is what GDB uses as the default breakpoint instructions for non-thumb arm:

https://github.com/bsdjhb/gdb/blob/master/gdb/arm-tdep.c#L7761

The in-kernel breakpoint() uses .word with the value of KERNEL_BREAKPOINT and I just used that as my template.

andrew added inline comments.Apr 25 2018, 5:09 PM
sys/arm/include/cpufunc.h
503 ↗(On Diff #41829)

It seems to be udf 0xfdee. udf is an instruction that raises the undefined instruction exception.

emaste added inline comments.May 1 2018, 1:55 PM
sys/arm/include/cpufunc.h
503 ↗(On Diff #41829)

Perhaps a comment with that reference?

br accepted this revision as: br.May 1 2018, 3:29 PM
This revision is now accepted and ready to land.May 1 2018, 3:29 PM
This revision was automatically updated to reflect the committed changes.
jhb reopened this revision.May 16 2018, 6:43 PM
jhb updated this revision to Diff 44667.Jun 29 2018, 9:23 PM
  • Updated to use 'udf' on 32-bit arm and tested on 32-bit arm.
  • Still need to verify arm64.
jhb added a comment.Jul 2 2018, 6:12 PM

Have verified via ptrace_test on arm64 as well now, so both arm and arm64 have been runtime tested.

andrew accepted this revision.Jul 6 2018, 11:40 AM
This revision is now accepted and ready to land.Jul 6 2018, 11:40 AM
This revision was automatically updated to reflect the committed changes.