@@ -75,6 +75,15 @@ let debug_print_perf_commands =
75
75
|> debug_flag
76
76
;;
77
77
78
+ let debug_print_pid =
79
+ let open Command.Param in
80
+ flag
81
+ " -z-print-pid"
82
+ no_arg
83
+ ~doc: " Prints the PIDs of the processes magic-trace attaches to."
84
+ |> debug_flag
85
+ ;;
86
+
78
87
module Null_writer : Trace_writer_intf .S_trace = struct
79
88
type thread = unit
80
89
@@ -314,6 +323,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
314
323
(opts : Record_opts.t )
315
324
~elf
316
325
~debug_print_perf_commands
326
+ ~debug_print_pid
317
327
~subcommand
318
328
~collection_mode
319
329
pids
@@ -350,6 +360,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
350
360
Backend.Recording. attach_and_record
351
361
opts.backend_opts
352
362
~debug_print_perf_commands
363
+ ~debug_print_pid
353
364
~subcommand
354
365
~when_to_snapshot: opts.when_to_snapshot
355
366
~trace_scope: opts.trace_scope
@@ -436,6 +447,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
436
447
record_opts
437
448
~elf
438
449
~debug_print_perf_commands
450
+ ~debug_print_pid
439
451
~prog
440
452
~argv
441
453
~collection_mode
@@ -447,6 +459,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
447
459
record_opts
448
460
~elf
449
461
~debug_print_perf_commands
462
+ ~debug_print_pid
450
463
~subcommand: Run
451
464
~collection_mode
452
465
[ pid ]
@@ -482,12 +495,20 @@ module Make_commands (Backend : Backend_intf.S) = struct
482
495
return pid
483
496
;;
484
497
485
- let attach_and_record record_opts ~elf ~debug_print_perf_commands ~collection_mode pids =
498
+ let attach_and_record
499
+ record_opts
500
+ ~elf
501
+ ~debug_print_perf_commands
502
+ ~debug_print_pid
503
+ ~collection_mode
504
+ pids
505
+ =
486
506
let % bind.Deferred. Or_error attachment =
487
507
attach
488
508
record_opts
489
509
~elf
490
510
~debug_print_perf_commands
511
+ ~debug_print_pid
491
512
~subcommand: Attach
492
513
~collection_mode
493
514
pids
@@ -585,6 +606,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
585
606
(let % map_open.Command record_opt_fn = record_flags
586
607
and decode_opts = decode_flags
587
608
and debug_print_perf_commands = debug_print_perf_commands
609
+ and debug_print_pid = debug_print_pid
588
610
and prog = anon (" COMMAND" %: string )
589
611
and argv =
590
612
flag " --" escape ~doc: " ARGS Arguments for the command. Ignored by magic-trace."
@@ -608,6 +630,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
608
630
opts
609
631
~elf
610
632
~debug_print_perf_commands
633
+ ~debug_print_pid
611
634
~prog
612
635
~argv
613
636
~collection_mode: opts.collection_mode
@@ -680,6 +703,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
680
703
(let % map_open.Command record_opt_fn = record_flags
681
704
and decode_opts = decode_flags
682
705
and debug_print_perf_commands = debug_print_perf_commands
706
+ and debug_print_pid = debug_print_pid
683
707
and pids =
684
708
flag
685
709
" -pid"
@@ -719,6 +743,7 @@ module Make_commands (Backend : Backend_intf.S) = struct
719
743
opts
720
744
~elf
721
745
~debug_print_perf_commands
746
+ ~debug_print_pid
722
747
~collection_mode
723
748
pids
724
749
in
0 commit comments