Skip to content

Commit

Permalink
samples/lindbg: add live target, env
Browse files Browse the repository at this point in the history
  • Loading branch information
jjyg committed May 19, 2022
1 parent 25b60f5 commit e9cf2ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions samples/lindebug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,17 @@ def load_commands
opts = {}
OptionParser.new { |opt|
opt.on('-m map', '--map filemap') { |f| opts[:filemap] = f }
opt.on('-e env=value', '--env key=value') { |f| k, v = f.split('=', 2) ; ENV[k] = v }
opt.on('--cpu cpu') { |c| opts[:sc_cpu] = c }
}.parse!(ARGV)

case ARGV.first
when /^live:(.*)/
t = $1
t = t.to_i if $1 =~ /^[0-9]+$/
os = Metasm::OS.current
raise 'no such target' if not target = os.find_process(t) || os.create_process(t)
dbg = target.debugger
when /^emu:(.*)/
exepath = $1
opts[:sc_cpu] = eval(opts[:sc_cpu]) if opts[:sc_cpu] =~ /[.(\s:]/
Expand Down

0 comments on commit e9cf2ba

Please sign in to comment.