gdb, git, strace

This commit is contained in:
nemirwen 2024-04-30 15:44:31 +02:00
parent 753b7cb2ee
commit 499a8bfb7e

15
how_to
View file

@ -1230,6 +1230,11 @@ gdb tricks:
(gdb) while ($i < <length>)
> print foo[$i++].attribute
> end
Dynamic printf:
# Breakpoint that prints instead of stopping
# https://sourceware.org/gdb/current/onlinedocs/gdb.html/Dynamic-Printf.html
# https://developers.redhat.com/articles/2021/10/13/printf-style-debugging-using-gdb-part-2
(gdb) dprintf meow.c:42,"foo:%d bar:%s\n", number, string
Non-standard zsh cd trick:
# https://dataswamp.org/~solene/2020-09-04-cd-command.html
@ -1248,6 +1253,12 @@ Git:
git config url."git@example.org:user/".pushInsteadOf "https://example.org/user/"
Prevent git from trying to auto-detect user name and email:
user.useConfigOnly = true
Revert a rebase after continue/commit:
# https://stackoverflow.com/a/135614
# Find last sane state (prefixed with "commit:" instead of "rebase:"
git reflog
# /!\ Be careful to either your modifications or remember what you did
git reset --hard 'HEAD@{<n>}'
Setup a midi synth:
# http://www.tedfelix.com/linux/linux-midi.html
@ -1419,3 +1430,7 @@ Change default java environment (archlinux):
archlinux-java status
# Example
archlinux set java-18-openjdk
strace:
print all file access:
strace -yy -f -e trace=file -- <bin>