mirror of https://github.com/oxen-io/lokinet
add docs to gdb-filter.py
turn off thread logging in gdb make sure everything runs in gdb when running test add note in contrib/format.sh about a GNU-ismpull/1306/head
parent
3cdca30a74
commit
eb0f29223a
@ -1,23 +1,36 @@
|
|||||||
def exit_handler (event):
|
def exit_handler (event):
|
||||||
|
"""
|
||||||
|
write exit code of the program running in gdb to a file called exit.out.txt
|
||||||
|
"""
|
||||||
code = 1
|
code = 1
|
||||||
if hasattr(event, "exit_code"):
|
if hasattr(event, "exit_code"):
|
||||||
code = event.exit_code
|
code = event.exit_code
|
||||||
with open("exit.out.txt", 'w') as f:
|
with open("exit.out.txt", 'w') as f:
|
||||||
f.write("{}".format(code))
|
f.write("{}".format(code))
|
||||||
|
|
||||||
|
def gdb_execmany(*cmds):
|
||||||
|
"""
|
||||||
|
run multiple gdb commands
|
||||||
|
"""
|
||||||
|
for cmd in cmds:
|
||||||
|
gdb.execute(cmd)
|
||||||
|
|
||||||
def crash_handler (event):
|
def crash_handler (event):
|
||||||
if (isinstance(event, gdb.SignalEvent)):
|
"""
|
||||||
log_file_name = "crash.out.txt"
|
handle a crash from the program running in gdb
|
||||||
gdb.execute("set logging file " + log_file_name )
|
"""
|
||||||
gdb.execute("set logging on")
|
if isinstance(event, gdb.SignalEvent):
|
||||||
gdb.execute("set logging redirect on")
|
log_file_name = "crash.out.txt"
|
||||||
gdb.execute("thread apply all bt full")
|
# poop out log file for stack trace of all threads
|
||||||
gdb.execute("q")
|
gdb_execmany("set logging file {}".format(log_file_name), "set logging on", "set logging redirect on", "thread apply all bt full")
|
||||||
|
# quit gdb
|
||||||
|
gdb.execute("q")
|
||||||
|
|
||||||
|
# set up event handlers to catch shit
|
||||||
gdb.events.stop.connect(crash_handler)
|
gdb.events.stop.connect(crash_handler)
|
||||||
|
|
||||||
gdb.events.exited.connect(exit_handler)
|
gdb.events.exited.connect(exit_handler)
|
||||||
gdb.execute("set confirm off")
|
|
||||||
gdb.execute("set pagination off")
|
# run settings setup
|
||||||
gdb.execute("r")
|
gdb_execmany("set confirm off", "set pagination off", "set print thread-events off")
|
||||||
gdb.execute("q")
|
# run program and exit
|
||||||
|
gdb_execmany("r", "q")
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# TODO: readlink -e is a GNU-ism
|
||||||
cd "$(readlink -e $(dirname $0)/../)"
|
cd "$(readlink -e $(dirname $0)/../)"
|
||||||
clang-format-9 -i $(find jni daemon llarp include pybind | grep -E '\.[hc](pp)?$') &> /dev/null
|
clang-format-9 -i $(find jni daemon llarp include pybind | grep -E '\.[hc](pp)?$') &> /dev/null
|
||||||
|
Loading…
Reference in New Issue