Comment on Exploring and Dynamically Patching Django/Python Using GDBparentComments−Luyt14y> Edited because I couldn't get monospace text workingIf you start each line with a few spaces, HN will format it as source code: b PyEval_EvalFrameEx if strcmp(PyString_AsString(f->f_code->co_name), "handle_uncaught_exception") == 0 commands disable frame 3 python gdb.execute('finish') gdb.execute('shell git stash pop') gdb.execute('call PyImport_ReloadModule(PyImport_AddModule("monospace.views"))') gdb.execute('call PyImport_ReloadModule(PyImport_AddModule("monospace.urls"))') gdb.execute('set $self = PyDict_GetItemString(f->f_locals, "self")') gdb.execute('set $request = PyDict_GetItemString(f->f_locals, "request")') gdb.execute('set $get_response = PyObject_GetAttrString($self, "get_response")') gdb.execute('set $args = Py_BuildValue("(O)", $request)') gdb.execute('set $rax PyObject_Call($get_response, $args, 0)') gdb.execute('enable') gdb.execute('c') end c end
Comments
> Edited because I couldn't get monospace text working
If you start each line with a few spaces, HN will format it as source code: