# SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
# SPDX-License-Identifier: LGPL-3.0-only
---
name: cmd_debug
commands:
  - name: db
    summary: Breakpoints commands
    subcommands:
      - name: db
        summary: Add breakpoint at current offset
        cname: cmd_debug_add_bp
        args: []
      - name: dbl
        summary: List all breakpoints
        cname: cmd_debug_list_bp
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        default_mode: RZ_OUTPUT_MODE_TABLE
        modes:
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_QUIET
        details:
          - name: Apply a command to all breakpoints
            entries:
              - text: "Disable all the breakpoints"
                comment: "dbd @@c:dblq"
              - text: "Enable all the breakpoints"
                comment: "dbe @@c:dblq"
              - text: "Toggle all the breakpoints"
                comment: "dbs @@c:dblq"
        args: []
      - name: dbH
        summary: Add hardware breakpoint at current offset
        cname: cmd_debug_add_hw_bp
        args: []
      - name: db-
        summary: Remove breakpoint at current offset
        cname: cmd_debug_remove_bp
        args: []
      - name: db-*
        summary: Remove all breakpoints
        cname: cmd_debug_remove_all_bp
        args: []
      - name: db.
        summary: Show breakpoint info at current offset
        cname: cmd_debug_show_cur_bp
        args: []
      - name: dbc
        summary: Set a command <cmd> to be run when the breakpoint at the current offset is hit
        cname: cmd_debug_command_bp
        args:
          - name: cmd
            type: RZ_CMD_ARG_TYPE_CMD
      - name: dbC
        summary: Make the breakpoint at the current offset conditional, and hit only when <cmd> evaluates to 0
        cname: cmd_debug_add_cond_bp
        args:
          - name: cmd
            type: RZ_CMD_ARG_TYPE_CMD
        details:
          - name: Usage example
            entries:
              - text: "Example of a condition"
                comment: "%v rax-0x0"
      - name: dbd
        summary: Disable breakpoint at current offset
        cname: cmd_debug_disable_bp
        args: []
      - name: dbe
        summary: Enable breakpoint at current offset
        cname: cmd_debug_enable_bp
        args: []
      - name: dbs
        summary: Toggle breakpoint at current offset
        cname: cmd_debug_toggle_bp
        args: []
      - name: dbf
        summary: Put a breakpoint into every no-return function
        cname: cmd_debug_add_bp_noreturn_func
        args: []
      - name: dbm
        summary: Add a breakpoint at an offset from a module's base
        cname: cmd_debug_add_bp_module
        args:
          - name: module
            type: RZ_CMD_ARG_TYPE_STRING
          - name: offset
            type: RZ_CMD_ARG_TYPE_RZNUM
      - name: dbn
        summary: Show name of current breakpoint / Set name for current breakpoint
        cname: cmd_debug_name_bp
        args:
          - name: name
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
      - name: dbi
        summary: Breakpoint index commands
        subcommands:
          - name: dbi
            summary: Show breakpoint index at current offset
            cname: cmd_debug_show_bp_index
            args: []
          - name: dbil
            summary: List breakpoints indexes
            cname: cmd_debug_list_bp_indexes
            args: []
          - name: dbi-
            summary: Remove breakpoint by index
            cname: cmd_debug_remove_bp_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dbix
            summary: Set expression for breakpoint at given index
            cname: cmd_debug_set_expr_bp_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
              - name: expr
                type: RZ_CMD_ARG_TYPE_STRING
          - name: dbic
            summary: Run a command at breakpoint index
            cname: cmd_debug_run_command_bp_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
              - name: cmd
                type: RZ_CMD_ARG_TYPE_CMD
          - name: dbie
            summary: Enable breakpoint by index
            cname: cmd_debug_enable_bp_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dbid
            summary: Disable breakpoint by index
            cname: cmd_debug_disable_bp_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dbis
            summary: Toggle breakpoint by index
            cname: cmd_debug_toggle_bp_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dbite
            summary: Enable breakpoint trace by index
            cname: cmd_debug_enable_bp_trace_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dbitd
            summary: Disable breakpoint trace by index
            cname: cmd_debug_disable_bp_trace_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dbits
            summary: Toggle breakpoint trace by index
            cname: cmd_debug_toggle_bp_trace_index
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
      - name: dbh
        summary: List archs which supports software breakpoints
        cname: cmd_debug_bp_plugin
        args: []
      - name: dbt
        summary: Backtrace commands
        subcommands:
          - name: dbt
            summary: Display backtrace based on dbg.btdepth and dbg.btalgo
            cname: cmd_debug_display_bt
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            modes:
              - RZ_OUTPUT_MODE_STANDARD
              - RZ_OUTPUT_MODE_JSON
              - RZ_OUTPUT_MODE_TABLE
              - RZ_OUTPUT_MODE_QUIET
            args: []
          - name: dbt=
            summary: Display backtrace in one line (see dbt= s and dbt= b for sp or bp)
            cname: cmd_debug_display_bt_oneline
            args:
              - name: s/b
                type: RZ_CMD_ARG_TYPE_STRING
                optional: true
          - name: dbtv
            summary: Display backtrace with local vars if any
            cname: cmd_debug_display_bt_local_vars
            args: []
          - name: dbta
            summary: Display ascii-art representation of the stack backtrace
            cname: cmd_debug_display_bt_ascii
            args: []
          - name: dbte
            summary: Enable breakpoint trace at current offset
            cname: cmd_debug_bt_enable_bp_trace
            args: []
          - name: dbtd
            summary: Disable breakpoint trace at current offset
            cname: cmd_debug_bt_disable_bp_trace
            args: []
          - name: dbts
            summary: Toggle breakpoint trace at current offset
            cname: cmd_debug_bt_toggle_bp_trace
            args: []
      - name: dbx
        summary: View expression for all the breakpoints / Set expression for breakpoint at current offset
        cname: cmd_debug_bp_set_expr_cur_offset
        args:
          - name: expr
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
      - name: dbw
        summary: Add watchpoint at current offset
        cname: cmd_debug_add_watchpoint
        args:
          - name: perm
            type: RZ_CMD_ARG_TYPE_CHOICES
            choices:
              - r
              - w
              - rw
          - name: size
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
        details:
          - name: Valid permission arguments
            entries:
              - text: "r"
                comment: "read only"
              - text: "w"
                comment: "write only"
              - text: "rw"
                comment: "read-write"
          - name: Example sizes
            entries:
              - text: "1"
                comment: "watch only a single byte"
              - text: "2"
                comment: "watch a 16-bit value"
              - text: "4"
                comment: "watch a 32-bit value"
              - text: "8"
                comment: "watch a 64-bit value"
      - name: dbW
        summary: Set conditional breakpoint on a window message handler (only for Windows)
        cname: cmd_debug_set_cond_bp_win
        args:
          - name: WM_DEFINE
            type: RZ_CMD_ARG_TYPE_STRING
          - name: handle/name
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
  - name: dc
    summary: Continue execution
    subcommands:
      - name: dc
        summary: Continue execution of all children
        cname: cmd_debug_continue_execution
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dcb
        summary: Continue back until breakpoint
        cname: cmd_debug_continue_back
        args: []
      - name: dcc
        summary: Continue until call (use step into)
        cname: cmd_debug_continue_call
        args: []
      - name: dcco
        summary: Continue until call (use step out)
        cname: cmd_debug_continue_call_over
        args: []
      - name: dccu
        summary: Continue until unknown call (call reg)
        cname: cmd_debug_continue_unknown_call
        args: []
      - name: dce
        summary: Continue execution (pass exception to program) (Windows only)
        cname: cmd_debug_continue_exception
        args: []
      - name: dcf
        summary: Continue until fork
        cname: cmd_debug_continue_fork
        args: []
      - name: dck
        summary: Continue sending signal to process
        cname: cmd_debug_continue_send_signal
        args:
          - name: signal
            type: RZ_CMD_ARG_TYPE_RZNUM
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dcp
        summary: Continue until program code (mapped io section)
        cname: cmd_debug_continue_mapped_io
        args: []
      - name: dcr
        summary: Continue until ret (uses step over)
        cname: cmd_debug_continue_ret
        args: []
      - name: dcs
        summary: Continue until syscall
        cname: cmd_debug_continue_syscall
        args:
          - name: syscall
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
      - name: dct
        summary: Traptrace from curseek to len, no argument to list
        cname: cmd_debug_continue_traptrace
        args:
          - name: len
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dcu
        summary: Debug continue until
        cname: cmd_debug_continue_until
        args:
          - name: address
            type: RZ_CMD_ARG_TYPE_RZNUM
            default_value: "$$"
  - name: dd
    summary: Debug file descriptors commands
    subcommands:
      - name: dd
        summary: Open and map <file> given the path
        cname: cmd_debug_descriptor_open
        args:
          - name: file
            type: RZ_CMD_ARG_TYPE_FILE
      - name: dd-
        summary: Close the <fd> file descriptor
        cname: cmd_debug_descriptor_close
        args:
          - name: fd
            type: RZ_CMD_ARG_TYPE_NUM
      - name: ddl
        summary: List all file descriptors
        cname: cmd_debug_descriptor_list
        args: []
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_TABLE
      - name: dds
        summary: Seek given <fd> to the <offset>
        cname: cmd_debug_descriptor_seek
        args:
          - name: fd
            type: RZ_CMD_ARG_TYPE_NUM
          - name: offset
            type: RZ_CMD_ARG_TYPE_NUM
      - name: ddd
        summary: Duplicate <fd_src> to <fd_dst>
        cname: cmd_debug_descriptor_dup
        args:
          - name: fd_src
            type: RZ_CMD_ARG_TYPE_NUM
          - name: fd_dst
            type: RZ_CMD_ARG_TYPE_NUM
      - name: ddr
        summary: Read <len> bytes from <fd> file at <offset>
        cname: cmd_debug_descriptor_read
        args:
          - name: fd
            type: RZ_CMD_ARG_TYPE_NUM
          - name: offset
            type: RZ_CMD_ARG_TYPE_NUM
          - name: len
            type: RZ_CMD_ARG_TYPE_NUM
      - name: ddw
        summary: Write <len> bytes to <fd> file at <offset>
        cname: cmd_debug_descriptor_write
        args:
          - name: fd
            type: RZ_CMD_ARG_TYPE_NUM
          - name: offset
            type: RZ_CMD_ARG_TYPE_NUM
          - name: len
            type: RZ_CMD_ARG_TYPE_NUM
  - name: de
    summary: Manage ESIL watchpoints
    subcommands:
      - name: de
        summary: Add ESIL watchpoint
        cname: cmd_debug_esil_add
        args:
          - name: perm
            type: RZ_CMD_ARG_TYPE_STRING
          - name: kind
            type: RZ_CMD_ARG_TYPE_CHOICES
            choices:
              - reg
              - mem
          - name: expression
            type: RZ_CMD_ARG_TYPE_STRING
        details:
          - name: Examples
            entries:
              - text: de
                arg_str: "r reg rip"
                comment: Stop when reads RIP register
              - text: de
                arg_str: "rw mem ADDR"
                comment: Stop when read or write in ADDR
              - text: de
                arg_str: "w r rdx"
                comment: Stop when rdx register is modified
              - text: de
                arg_str: "x m FROM..TO"
                comment: Stop when rip in range
      - name: de-*
        summary: Remove all ESIL watchpoints
        cname: cmd_debug_esil_remove
        args: []
      - name: del
        summary: List all ESIL watchpoints
        cname: cmd_debug_esil_list
        args: []
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_TABLE
          - RZ_OUTPUT_MODE_STANDARD
      - name: dec
        summary: Continue execution until matching expression
        cname: cmd_debug_esil_continue
        args: []
      - name: des
        summary: Step-in <N> instructions with ESIL
        cname: cmd_debug_esil_step
        args:
          - name: N
            type: RZ_CMD_ARG_TYPE_NUM
      - name: desu
        summary: Step until specified <address>
        cname: cmd_debug_esil_step_until
        args:
          - name: <address>
            type: RZ_CMD_ARG_TYPE_RZNUM
  - name: dg
    summary: Generate core dump file
    cname: cmd_debug_core_dump_generate
    args:
      - name: filename
        type: RZ_CMD_ARG_TYPE_FILE
        optional: true
  - name: do
    summary: Debug (re)open commands
    subcommands:
      - name: dor
        summary: Set rz-run profile options (e dbg.profile)
        cname: cmd_debug_process_profile
        args_str: " [<key>=<val> [<key>=<val> ...]]"
        args:
          - name: key=val
            type: RZ_CMD_ARG_TYPE_EVAL_FULL
            flags: RZ_CMD_ARG_FLAG_ARRAY
      - name: doe
        summary: Edit rz-run startup profile with $EDITOR
        cname: cmd_debug_process_profile_edit
        args: []
      - name: doc
        summary: Close debug session
        cname: cmd_debug_process_close
        args: []
  - name: ds
    summary: Debug step commands
    subcommands:
      - name: ds
        cname: cmd_debug_step
        summary: Step <num> instruction
        args:
          - name: num
            type: RZ_CMD_ARG_TYPE_RZNUM
            default_value: 1
      - name: dsb
        cname: cmd_debug_step_back
        summary: Step back <num> instruction
        args:
          - name: num
            type: RZ_CMD_ARG_TYPE_RZNUM
            default_value: 1
      - name: dsf
        cname: cmd_debug_step_frame
        summary: Step until end of frame
        args: []
      - name: dsi
        cname: cmd_debug_step_cond
        summary: Continue until condition matches
        args:
          - name: cond
            type: RZ_CMD_ARG_TYPE_STRING
      - name: dsl
        cname: cmd_debug_step_line
        summary: Step <num> source line
        args:
          - name: num
            type: RZ_CMD_ARG_TYPE_RZNUM
            default_value: 1
      - name: dso
        cname: cmd_debug_step_over
        summary: Step over <num> instructions
        args:
          - name: num
            type: RZ_CMD_ARG_TYPE_RZNUM
            default_value: 1
      - name: dsp
        cname: cmd_debug_step_prog
        summary: Step into program (skip libs)
        args: []
      - name: dss
        cname: cmd_debug_step_skip
        summary: Skip <num> step instructions
        args:
          - name: num
            type: RZ_CMD_ARG_TYPE_RZNUM
            default_value: 1
      - name: dsu
        summary: Debug step until commands
        subcommands:
          - name: dsu
            cname: cmd_debug_step_until
            summary: Step until <addr>
            args:
              - name: addr
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dsui
            cname: cmd_debug_step_until_instr
            summary: Step until an instruction that matches <instr>
            args:
              - name: instr
                type: RZ_CMD_ARG_TYPE_STRING
          - name: dsuir
            cname: cmd_debug_step_until_instr_regex
            summary: Step until an instruction that matches <regex>
            args:
              - name: regex
                type: RZ_CMD_ARG_TYPE_STRING
          - name: dsuo
            cname: cmd_debug_step_until_optype
            summary: Step until an instruction matches one of the <optype>s
            args:
              - name: optype
                type: RZ_CMD_ARG_TYPE_STRING
                flags: RZ_CMD_ARG_FLAG_ARRAY
          - name: dsue
            cname: cmd_debug_step_until_esil
            summary: Step until <esil> expression matches
            args:
              - name: esil
                type: RZ_CMD_ARG_TYPE_STRING
          - name: dsuf
            cname: cmd_debug_step_until_flag
            summary: Step until pc == <flag> matching name
            args:
              - name: flag
                type: RZ_CMD_ARG_TYPE_FLAG
  - name: dt
    summary: Trace commands
    subcommands:
      - name: dt
        summary: Get trace info at the current address
        cname: cmd_debug_trace
        args: []
      - name: dtl
        summary: List all traces
        cname: cmd_debug_traces
        args: []
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_QUIET
          - RZ_OUTPUT_MODE_STANDARD
      - name: dtl=
        summary: List all traces in ascii art
        cname: cmd_debug_traces_ascii
        args: []
      - name: dt+
        summary: Add trace for address N times
        cname: cmd_debug_trace_add
        args:
          - name: times
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dt++
        summary: Add trace for some address
        cname: cmd_debug_trace_add_addrs
        args:
          - name: addrs
            type: RZ_CMD_ARG_TYPE_RZNUM
            flags: RZ_CMD_ARG_FLAG_ARRAY
      - name: dt-
        summary: Reset traces (instruction/calls)
        cname: cmd_debug_traces_reset
        args: []
      - name: dtc
        summary: Trace call/ret
        cname: cmd_debug_trace_calls
        args:
          - name: from
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
          - name: to
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
          - name: addr
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dte
        summary: Esil trace logs
        subcommands:
          - name: dte
            summary: Esil trace log for a single instruction for that index log
            cname: cmd_debug_trace_esil
            args:
              - name: idx
                type: RZ_CMD_ARG_TYPE_RZNUM
          - name: dtel
            summary: Esil trace log for a single instruction
            cname: cmd_debug_trace_esils
            args: []
          - name: dte-*
            summary: Delete all esil traces
            cname: cmd_debug_traces_esil_delete
            args: []
          - name: dtei
            summary: Esil trace log for a single instruction
            cname: cmd_debug_traces_esil_i
            args: []
      - name: dtg
        summary: Graph call/ret trace
        subcommands:
          - name: dtg
            summary: Graph call/ret trace
            cname: cmd_debug_trace_graph
            args: []
            modes:
              - RZ_OUTPUT_MODE_STANDARD
          - name: dtgi
            summary: Interactive debug trace
            cname: cmd_debug_trace_interactive
            args: []
      - name: dts
        summary: Debug trace session commands
        subcommands:
          - name: dts+
            summary: Start trace session
            cname: cmd_debug_start_trace_session
            args: []
          - name: dts-
            summary: Stop trace session
            cname: cmd_debug_stop_trace_session
            args: []
          - name: dtst
            cname: cmd_debug_save_trace_session
            summary: Save trace sessions to disk
            args:
              - name: dir
                type: RZ_CMD_ARG_TYPE_FOLDER
          - name: dtsf
            cname: cmd_debug_load_trace_session
            summary: Load trace sessions to disk
            args:
              - name: dir
                type: RZ_CMD_ARG_TYPE_FOLDER
          - name: dtsm
            cname: cmd_debug_list_trace_session_mmap
            summary: List current memory map and hash
            args: []
      - name: dtt
        summary: Select trace tag (no arg unsets)
        cname: cmd_debug_trace_tag
        args:
          - name: tag
            type: RZ_CMD_ARG_TYPE_STRING
  - name: di
    summary: Debug information
    cname: debug_info
    type: RZ_CMD_DESC_TYPE_ARGV_STATE
    modes:
      - RZ_OUTPUT_MODE_STANDARD
      - RZ_OUTPUT_MODE_JSON
      - RZ_OUTPUT_MODE_QUIET
    args: []
  - name: dk
    summary: Debug signals management
    subcommands:
      - name: dk
        summary: Send signal to the child
        cname: cmd_debug_signal
        args:
          - name: signal
            type: RZ_CMD_ARG_TYPE_NUM
      - name: dkl
        summary: List all signal handlers of the child process
        cname: cmd_debug_signal_list
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_QUIET
          - RZ_OUTPUT_MODE_TABLE
        args: []
      - name: dkn
        summary: Resolve the name of signal given the number
        cname: cmd_debug_signal_name
        args:
          - name: signal
            type: RZ_CMD_ARG_TYPE_NUM
      - name: dkN
        summary: Resolve the signal number given the name
        cname: cmd_debug_signal_number
        args:
          - name: name
            type: RZ_CMD_ARG_TYPE_STRING
      - name: dko
        summary: Set skip or continue options for a given signal
        cname: cmd_debug_signal_option
        args:
          - name: signal
            type: RZ_CMD_ARG_TYPE_NUM
          - name: option
            type: RZ_CMD_ARG_TYPE_CHOICES
            choices: ["skip", "continue", "reset"]
            default_value: "reset"
        details:
          - name: Signal options
            entries:
              - text: skip
                comment: Do not enter into the signal handler
              - text: continue
                comment: Enter into the signal handler
              - text: reset
                comment: Remove all previously set signal options
  - name: dl
    summary: Debug handler
    subcommands:
      - name: dl
        summary: Set debugger handler
        cname: cmd_debug_handler_set
        args:
          - name: handler
            type: RZ_CMD_ARG_TYPE_NUM
      - name: dll
        summary: List debugger handler
        cname: cmd_debug_handler_list
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_QUIET
        args: []
  - name: dm
    summary: Memory map commands
    subcommands:
      - name: dm
        cname: cmd_debug_list_maps
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        summary: >
          List memory maps
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_TABLE
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_QUIET
        args: []
      - name: dm+
        cname: cmd_debug_allocate_maps
        summary: >
          Allocate <size> bytes at current offset
        args:
          - name: size
            type: RZ_CMD_ARG_TYPE_RZNUM
      - name: dm=
        cname: cmd_debug_list_maps_ascii
        summary: List memory maps of current process with ASCII art bars
        args: []
      - name: dm.
        cname: cmd_debug_map_current
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        summary: Show map name of current address
        args: []
        modes: 
          - RZ_OUTPUT_MODE_STANDARD
      - name: dmm
        summary: Module memory map commands
        subcommands:
          - name: dmm
            summary: List modules (libraries, binaries loaded in memory)
            cname: cmd_debug_modules
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            modes:
              - RZ_OUTPUT_MODE_STANDARD
              - RZ_OUTPUT_MODE_JSON
            args: []
          - name: dmm.
            cname: cmd_debug_current_modules
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            modes:
              - RZ_OUTPUT_MODE_STANDARD
              - RZ_OUTPUT_MODE_JSON
            summary: List memory map of current module
            args: []
      - name: dm-
        summary: Deallocate memory map at current offset
        cname: cmd_debug_deallocate_map
        args: []
      - name: dmd
        summary: Dump debug map regions to a file (from-to.dmp)
        subcommands:
          - name: dmd
            summary: Dump debug maps to <filename>
            cname: cmd_debug_dump_maps
            args:
              - name: filename
                type: RZ_CMD_ARG_TYPE_FILE
                optional: true
          - name: dmda
            cname: cmd_debug_dump_maps_all
            summary: Dump all debug maps
            args: []
          - name: dmdw
            cname: cmd_debug_dump_maps_writable
            summary: Dump writable debug maps
            args: []
      - name: dmh
        summary: Heap commands
        subcommands: cmd_heap
      - name: dmi
        summary: List/Load symbols
        subcommands:
          - name: "dmi"
            summary: List libraries and library symbols.
            cname: cmd_debug_dmi
            args:
              - name: lib_name
                type: RZ_CMD_ARG_TYPE_STRING
                optional: true
              - name: symbol_name
                type: RZ_CMD_ARG_TYPE_STRING
                optional: true
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            modes:
              - RZ_OUTPUT_MODE_STANDARD
              - RZ_OUTPUT_MODE_JSON
              - RZ_OUTPUT_MODE_QUIET
              - RZ_OUTPUT_MODE_QUIETEST
          - name: "dmia"
            summary: List all info of target library.
            cname: cmd_debug_dmi_all
            args:
              - name: lib_name
                type: RZ_CMD_ARG_TYPE_STRING
                optional: true
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            modes:
              - RZ_OUTPUT_MODE_STANDARD
              - RZ_OUTPUT_MODE_JSON
              - RZ_OUTPUT_MODE_QUIET
              - RZ_OUTPUT_MODE_QUIETEST
          - name: "dmi."
            summary: List closest symbol to the current address.
            cname: cmd_debug_dmi_closest
            args: []
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            modes:
              - RZ_OUTPUT_MODE_STANDARD
              - RZ_OUTPUT_MODE_JSON
              - RZ_OUTPUT_MODE_QUIET
              - RZ_OUTPUT_MODE_QUIETEST
      - name: dml
        summary: Load contents of file into current map region
        cname: cmd_debug_dml
        args:
          - name: file
            type: RZ_CMD_ARG_TYPE_FILE
      - name: dmp
        summary: >
          Change page at current offset with <size>, protection <perms>
          / Change dbg.map permissions to <perms>
        cname: debug_memory_permission
        args:
          - name: perms
            type: RZ_CMD_ARG_TYPE_STRING
          - name: size
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dmL
        summary: >
          Allocate <size> bytes at current offset and promote to huge page
        cname: cmd_debug_dmL
        args:
          - name: size
            type: RZ_CMD_ARG_TYPE_RZNUM
      - name: dmS
        summary: List sections of target lib
        cname: cmd_debug_dmS
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
        args:
          - name: addr|libname
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
          - name: sectname
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
  - name: dp
    summary: List or attach to process or thread
    subcommands:
      - name: dp
        summary: List current pid and children
        cname: cmd_debug_pid_list
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_TABLE
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dpl
        summary: List all attachable pids
        cname: cmd_debug_pid_attachable_list
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_TABLE
        args: []
      - name: dpa
        summary: Attach to selected <pid>
        cname: cmd_debug_pid_attach
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dp-
        summary: Detach from selected <pid>
        cname: cmd_debug_pid_detach
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dp=
        summary: Select <pid>
        cname: cmd_debug_pid_select
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
      - name: dpc
        summary: Select forked pid (see dbg.forks)
        cname: cmd_debug_pid_select_forked
        args: []
      - name: dpc*
        summary: Display forked pid (see dbg.forks)
        cname: cmd_debug_pid_display_forked
        args: []
      - name: dpe
        summary: Show path to executable
        cname: cmd_debug_executable_path
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dpf
        summary: Attach to pid like file fd
        cname: cmd_debug_pid_attach_fd
        args: []
      - name: dpk
        summary: Send <signal> to process <pid>
        cname: cmd_debug_pid_signal
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
          - name: signal
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dpT
        summary: List threads of specified or current <pid>
        cname: cmd_debug_thread_list
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_TABLE
        args:
          - name: pid
            type: RZ_CMD_ARG_TYPE_RZNUM
            optional: true
      - name: dpt=
        summary: Select <thread-id>
        cname: cmd_debug_pid_thread_select
        args:
          - name: thread-id
            type: RZ_CMD_ARG_TYPE_RZNUM

  #####################################################
  # Keep this in sync with ar in cmd_analysis.yaml from here...
  - name: dr
    summary: CPU Registers
    details:
      - name: Register Filter
        entries:
          - text: "dr"
            arg_str: ""
            comment: Show a sensible default selection of registers
          - text: "dr"
            arg_str: " rax"
            comment: Show a single register
          - text: "dr"
            arg_str: " 16"
            comment: Show 16 bits wide gpr registers
          - text: "dr"
            arg_str: " xmm"
            comment: Show registers of type xmm (see `drT` for possible types)
          - text: "dr"
            arg_str: " PC"
            comment: Show the register with the given role (see `drR` for possible roles)
          - text: "dr"
            arg_str: " all"
            comment: Show all registers available
    subcommands:
      - name: dr
        summary: Show registers with their values, or assign registers (`dr reg1=value reg2=value`)
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        cname: debug_regs
        args_str: " [<filter1> [= <value>] <filter2> [= <value>] ...]"
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_TABLE
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_QUIET
        args:
          - name: filters
            type: RZ_CMD_ARG_TYPE_REG_FILTER
            flags: RZ_CMD_ARG_FLAG_ARRAY
            optional: true
      - name: dr=
        summary: Show registers in columns
        type: RZ_CMD_DESC_TYPE_ARGV
        cname: debug_regs_columns
        args:
          - name: filter
            type: RZ_CMD_ARG_TYPE_REG_FILTER
            optional: true
      - name: drr
        summary: Show register references (telescoping)
        type: RZ_CMD_DESC_TYPE_ARGV_MODES
        cname: debug_regs_references
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
        args:
          - name: filter
            type: RZ_CMD_ARG_TYPE_REG_FILTER
            optional: true
      - name: dri
        summary: Show register grouped by their values
        type: RZ_CMD_DESC_TYPE_ARGV
        cname: debug_regs_valgroup
        args:
          - name: filter
            type: RZ_CMD_ARG_TYPE_REG_FILTER
            optional: true
      - name: drA
        summary: Show values of default function argument registers (A0, A1, A2, ...) with telescoping
        cname: debug_regs_args
        type: RZ_CMD_DESC_TYPE_ARGV_MODES
        details: [] # Explicitly empty to not show parent ones
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
        args: []
      - name: drcc
        summary: Show calling convention defined by registers
        cname: debug_reg_cc
        args: []
        details: [] # Explicitly empty to not show parent ones
      - name: drd
        summary: Show register differences from previous contents
        cname: debug_regs_diff
        args: []
        details: [] # Explicitly empty to not show parent ones
      - name: dro
        summary: Show previous register contents
        cname: debug_regs_prev
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_TABLE
          - RZ_OUTPUT_MODE_JSON
          - RZ_OUTPUT_MODE_QUIET
        args:
          - name: filter
            type: RZ_CMD_ARG_TYPE_REG_FILTER
            flags: RZ_CMD_ARG_FLAG_LAST
            optional: true
      - name: drF
        summary: Show fpu registers
        type: RZ_CMD_DESC_TYPE_ARGV
        cname: debug_regs_fpu
        args_str: " [<register> [= <value>]]"
        args:
          - name: reg
            type: RZ_CMD_ARG_TYPE_STRING
            flags: RZ_CMD_ARG_FLAG_LAST
            optional: true
      - name: drf
        summary: Show commands for setting registers as flags
        subcommands:
          - name: drf
            summary: Show commands for setting registers as flags
            cname: debug_reg_flags
            args:
              - name: filter
                type: RZ_CMD_ARG_TYPE_REG_FILTER
                optional: true
          - name: drf-
            summary: Show commands for unsetting flags from `drf`
            cname: debug_reg_flags_unset
            args:
              - name: filter
                type: RZ_CMD_ARG_TYPE_REG_FILTER
                optional: true
      - name: dra
        summary: Register arena commands (underlying binary data)
        details: [] # Explicitly empty to not show parent ones
        subcommands:
          - name: dra
            summary: Show all currently allocated register arenas
            cname: debug_reg_arenas
            args: []
          - name: dra+
            summary: Push a new set of arenas to the stack
            cname: debug_reg_arenas_push
            args: []
          - name: dra-
            summary: Pop a set of arenas from the stack
            cname: debug_reg_arenas_pop
            args: []
          - name: draS
            summary: Show number of stack elements
            cname: debug_reg_arenas_stack_size
            args: []
          - name: dras
            summary: Swap last two register arenas on the stack
            cname: debug_reg_arenas_swap
            args: []
          - name: dra0
            summary: Reset the specified or all arena contents to 0
            cname: debug_reg_arenas_zero
            args:
              - name: type
                type: RZ_CMD_ARG_TYPE_REG_TYPE
                optional: true
          - name: drab
            summary: Display hexdump of given arena (or gpr if none given)
            cname: debug_reg_arenas_hexdump
            args:
              - name: type
                type: RZ_CMD_ARG_TYPE_REG_TYPE
                optional: true
          - name: draw
            summary: Write hexadecimal data <hex> into the given arena (or gpr if none given)
            cname: debug_reg_arenas_write_hex
            args:
              - name: hex
                type: RZ_CMD_ARG_TYPE_STRING
              - name: type
                type: RZ_CMD_ARG_TYPE_REG_TYPE
                optional: true
      - name: drp
        summary: Register profile commands (defining available registers)
        details: [] # Explicitly empty to not show parent ones
        subcommands:
          - name: drp
            summary: Show the current register profile
            cname: debug_reg_profile
            args: []
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            modes:
              - RZ_OUTPUT_MODE_STANDARD
              - RZ_OUTPUT_MODE_JSON
          - name: drpc
            summary: Show register profile comments
            cname: debug_reg_profile_comments
            args: []
          - name: drpo
            summary: Load a new register profile from file
            cname: debug_reg_profile_open
            args:
              - name: file
                type: RZ_CMD_ARG_TYPE_FILE
          - name: drpg
            summary: Convert gdb profile from the given file to rizin register profile
            cname: debug_reg_profile_gdb
            args:
              - name: file
                type: RZ_CMD_ARG_TYPE_FILE
      - name: drc
        summary: Conditional flags (aliases to processor flags)
        cname: debug_reg_cond
        args: []
        details:
          - name: Basic
            entries:
              - text: eq
                arg_str: ""
                comment: equal
              - text: ne
                arg_str: ""
                comment: not equal
              - text: cf
                arg_str: ""
                comment: carry flag set
              - text: neg
                arg_str: ""
                comment: negative value (has sign)
              - text: of
                arg_str: ""
                comment: overflow
          - name: Unsigned
            entries:
              - text: hi
                arg_str: ""
                comment: higher
              - text: he
                arg_str: ""
                comment: higher or equal
              - text: lo
                arg_str: ""
                comment: lower
              - text: loe
                arg_str: ""
                comment: lower or equal
          - name: Signed
            entries:
              - text: gt
                arg_str: ""
                comment: greater
              - text: ge
                arg_str: ""
                comment: greater or equal
              - text: lt
                arg_str: ""
                comment: less
              - text: le
                arg_str: ""
                comment: less or equal
      - name: drT
        summary: List all register types
        cname: debug_reg_types
        details: [] # Explicitly empty to not show parent ones
        args: []
      - name: drR
        summary: List all register roles
        cname: debug_reg_roles
        details: [] # Explicitly empty to not show parent ones
        args: []
  # ... to here
  #####################################################
      - name: drx # this is under registers but debug-specific so should not be sync with cmd_analysis.yaml
        summary: Show hardware breakpoint registers
        details: []
        subcommands:
          - name: drx
            summary: Show or modify hardware breakpoint registers
            cname: debug_drx
            args:
              - name: number
                type: RZ_CMD_ARG_TYPE_NUM
                optional: true
              - name: address
                type: RZ_CMD_ARG_TYPE_RZNUM
              - name: length
                type: RZ_CMD_ARG_TYPE_NUM
              - name: perms
                type: RZ_CMD_ARG_TYPE_STRING
          - name: drx-
            summary: Clear hardware breakpoint
            cname: debug_drx_unset
            args:
              - name: number
                type: RZ_CMD_ARG_TYPE_NUM
  - name: dw
    summary: Block prompt until <pid> dies
    cname: cmd_debug_wait
    args:
      - name: pid
        type: RZ_CMD_ARG_TYPE_NUM
        optional: true
  - name: dW
    summary: Windows process commands
    subcommands:
      - name: dW
        summary: List process windows
        cname: cmd_debug_windows_list
        args: []
      - name: dWi
        summary: Identify window under cursor
        cname: cmd_debug_window_identify
        args: []
  - name: dx
    summary: Code injection commands
    subcommands:
      - name: dx
        summary: Inject opcodes
        cname: cmd_debug_inject_opcode
        args:
          - name: opcode
            type: RZ_CMD_ARG_TYPE_STRING
        details:
          - name: Examples
            entries:
              - text: dx
                arg_str: " 9090"
                comment: Insert two 0x90 bytes (nop instruction on x86 platforms)
      - name: dxa
        summary: Assemble code and inject
        cname: cmd_debug_inject_assembly
        args:
          - name: asm
            type: RZ_CMD_ARG_TYPE_STRING
        details:
          - name: Examples
            entries:
              - text: dxa
                arg_str: " mov eax,6; mov ebx,0; int 0x80"
                comment: Assemble and insert 3 instructions
      - name: dxe
        summary: Compile RzEgg expression and inject
        cname: cmd_debug_inject_egg
        args:
          - name: expression
            type: RZ_CMD_ARG_TYPE_STRING
      - name: dxr
        summary: Inject opcodes and restore state
        cname: cmd_debug_inject_opcode_restore
        args:
          - name: opcode
            type: RZ_CMD_ARG_TYPE_STRING
      - name: dxs
        summary: Syscall injection
        cname: cmd_debug_inject_syscall
        args:
          - name: syscall
            type: RZ_CMD_ARG_TYPE_STRING
        details:
          - name: Examples
            entries:
              - text: dxs
                arg_str: " write 1, 0x8048, 12"
                comment: Inject the write() syscall with given arguments
