Created
July 1, 2015 09:01
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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