Skip to content

Instantly share code, notes, and snippets.

@KaiHa
Created July 1, 2015 09:01
Show Gist options
  • Save KaiHa/5131dad81fa51f486216 to your computer and use it in GitHub Desktop.
Save KaiHa/5131dad81fa51f486216 to your computer and use it in GitHub Desktop.
A simple sysdig chisel to try to attach gdb to a short lived process
-- This is a sysdig chisel
description = "attach gdb to a spawned process"
short_description = "attach gdb to a spawned process"
category = "misc"
-- Chisel argument list
args = {}
-- Initialization callback
function on_init()
-- Request the fileds that we need
pid = chisel.request_field("proc.pid")
return true
end
-- Event parsing callback
function on_event()
if attached ~= true then
attached = true
print("attaching gdb to pid " .. evt.field(pid) .. "...")
os.execute("gdb -p " .. evt.field(pid))
sysdig.end_capture()
end
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment