Skip to content

Instantly share code, notes, and snippets.

View ricksladkey's full-sized avatar

Rick Sladkey ricksladkey

View GitHub Profile
@TuxSH
TuxSH / Message.md
Last active December 7, 2017 07:01
Git diff: GDB: Allow for single-stepping on bare-metal ARM

This commit adds proper support for single-stepping on arm-none-eabi.

arm_software_single_step is now always registered in arm_gdbarch_init (arm-tdep.c) before calling gdbarch_osabi_init. Additionally, arm_software_single_step now checks whether or not the target supports single-stepping itself (which is the case for most simulators, emulators, etc.).

Following this change, we need to assume, without the knowledge the OS (if there is one) that SVC instructions return to the next user-mode instruction by default (arm_get_next_pcs_syscall_next_pc currently returns 0 which is virtually guaranteed to fail).

gdb/Changelog:

  • arm-tdep.c (arm_software_single_step): Check whether the target actually has declared single-step support. Declare this function static. (arm_get_next_pcs_syscall_next_pc): Assume that SVC instructions return to the next user-mode instruction by default.
@Jonty
Jonty / gist:6705090
Last active October 29, 2018 15:06
Unicode printable character filter
def strip_string(self, string):
"""Cleans a string based on a whitelist of printable unicode categories
You can find a full list of categories here:
http://www.fileformat.info/info/unicode/category/index.htm
"""
letters = ('LC', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu')
numbers = ('Nd', 'Nl', 'No')
marks = ('Mc', 'Me', 'Mn')
punctuation = ('Pc', 'Pd', 'Pe', 'Pf', 'Pi', 'Po', 'Ps')