shell: move all heap parsing commands under dmh (#6050)

This commit is contained in:
bubblepipe 2026-03-21 01:44:59 +07:00 committed by GitHub
parent 16558a06f4
commit c76a987287
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 659 additions and 651 deletions

View file

@ -1330,7 +1330,7 @@ RZ_IPI RzCmdStatus rz_cmd_debug_dmL_handler(RzCore *core, int argc, const char *
return RZ_CMD_STATUS_OK;
}
// "dmxa"
// "dmhja"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_a_handler(RzCore *core, int argc, const char **argv) {
bool has_specified_arena = argc > 1 && RZ_STR_ISNOTEMPTY(argv[1]);
@ -1349,7 +1349,7 @@ RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_a_handler(RzCore *core, int argc,
return rz_heap_jemalloc_cmd_a(core, has_specified_arena, 0);
}
// "dmxb"
// "dmhjb"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_b_handler(RzCore *core, int argc, const char **argv) {
bool has_specified_arena = argc > 1 && RZ_STR_ISNOTEMPTY(argv[1]);
bool has_bin_info = argc > 2 && RZ_STR_ISNOTEMPTY(argv[2]);
@ -1381,7 +1381,7 @@ RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_b_handler(RzCore *core, int argc,
return rz_heap_jemalloc_cmd_b(core, has_specified_arena, 0, has_bin_info, 0);
}
// "dmxc"
// "dmhjc"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_c_handler(RzCore *core, int argc, const char **argv) {
bool has_specified_arena = argc > 1 && RZ_STR_ISNOTEMPTY(argv[1]);
@ -1400,7 +1400,7 @@ RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_c_handler(RzCore *core, int argc,
return rz_heap_jemalloc_cmd_c(core, has_specified_arena, 0);
}
// "dmxe" - Find extent for malloc address
// "dmhje" - Find extent for malloc address
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_e_handler(RzCore *core, int argc, const char **argv) {
bool has_addr = argc > 1 && RZ_STR_ISNOTEMPTY(argv[1]);
@ -1419,7 +1419,7 @@ RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_e_handler(RzCore *core, int argc,
return rz_heap_jemalloc_cmd_e(core, has_addr, 0);
}
// "dmxei" - Display extent info
// "dmhjei" - Display extent info
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_ei_handler(RzCore *core, int argc, const char **argv) {
bool has_addr = argc > 1 && RZ_STR_ISNOTEMPTY(argv[1]);
ut64 extent_addr = 0;

View file

@ -831,8 +831,8 @@ commands:
summary: Dump writable debug maps
args: []
- name: dmh
summary: Glibc heap commands
subcommands: cmd_heap_glibc
summary: Heap commands
subcommands: cmd_heap
- name: dmi
summary: List/Load symbols
subcommands:
@ -912,72 +912,6 @@ commands:
- name: sectname
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: dmw
summary: Windows heap commands
subcommands:
- name: dmw
summary: List process heaps
cname: cmd_debug_process_heaps
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args: []
- name: dmwb
summary: List allocated heap blocks
cname: cmd_debug_process_heap_block
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmwbf
summary: Create flags for each allocated heap block
cname: cmd_debug_heap_block_flag
args: []
- name: dmx
summary: Jemalloc heap commands
subcommands:
- name: dmxa
summary: Show all arenas created, or print arena_type structure for given arena.
cname: cmd_debug_heap_jemalloc_a
args:
- name: arena_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmxb
summary: Show bin info for allocations.
cname: cmd_debug_heap_jemalloc_b
args:
- name: arena_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: bin_info_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmxc
summary: >-
Show all chunks created in all arenas, or show all chunks created for a given
arena_t instance (jemalloc 4.5.0 only).
cname: cmd_debug_heap_jemalloc_c
args:
- name: arena_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmxe
summary: List all extents, or find extent for a specific malloc'd address (jemalloc 5.3.0 only)
cname: cmd_debug_heap_jemalloc_e
args:
- name: malloc_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmxei
summary: Display extent (edata_t) structure info for a given extent address (jemalloc 5.3.0 only)
cname: cmd_debug_heap_jemalloc_ei
args:
- name: extent_addr
type: RZ_CMD_ARG_TYPE_RZNUM
- name: dp
summary: List or attach to process or thread
subcommands:

View file

@ -509,18 +509,18 @@ static const RzCmdDescArg cmd_heap_fastbins_print_args[2];
static const RzCmdDescArg cmd_heap_chunks_graph_args[2];
static const RzCmdDescArg cmd_heap_info_print_args[2];
static const RzCmdDescArg cmd_main_arena_print_args[2];
static const RzCmdDescArg cmd_debug_dmi_args[3];
static const RzCmdDescArg cmd_debug_dmi_all_args[2];
static const RzCmdDescArg cmd_debug_dml_args[2];
static const RzCmdDescArg debug_memory_permission_args[3];
static const RzCmdDescArg cmd_debug_dmL_args[2];
static const RzCmdDescArg cmd_debug_dmS_args[3];
static const RzCmdDescArg cmd_debug_process_heap_block_args[2];
static const RzCmdDescArg cmd_debug_heap_jemalloc_a_args[2];
static const RzCmdDescArg cmd_debug_heap_jemalloc_b_args[3];
static const RzCmdDescArg cmd_debug_heap_jemalloc_c_args[2];
static const RzCmdDescArg cmd_debug_heap_jemalloc_e_args[2];
static const RzCmdDescArg cmd_debug_heap_jemalloc_ei_args[2];
static const RzCmdDescArg cmd_debug_dmi_args[3];
static const RzCmdDescArg cmd_debug_dmi_all_args[2];
static const RzCmdDescArg cmd_debug_dml_args[2];
static const RzCmdDescArg debug_memory_permission_args[3];
static const RzCmdDescArg cmd_debug_dmL_args[2];
static const RzCmdDescArg cmd_debug_dmS_args[3];
static const RzCmdDescArg cmd_debug_pid_list_args[2];
static const RzCmdDescArg cmd_debug_pid_attach_args[2];
static const RzCmdDescArg cmd_debug_pid_detach_args[2];
@ -10547,6 +10547,9 @@ static const RzCmdDescHelp cmd_debug_dump_maps_writable_help = {
};
static const RzCmdDescHelp dmh_help = {
.summary = "Heap commands",
};
static const RzCmdDescHelp dmhg_help = {
.summary = "Glibc heap commands",
};
static const RzCmdDescArg cmd_heap_chunks_print_args[] = {
@ -10679,6 +10682,123 @@ static const RzCmdDescHelp cmd_heap_tcache_print_help = {
.args = cmd_heap_tcache_print_args,
};
static const RzCmdDescHelp dmhw_help = {
.summary = "Windows heap commands",
};
static const RzCmdDescArg cmd_debug_process_heaps_args[] = {
{ 0 },
};
static const RzCmdDescHelp cmd_debug_process_heaps_help = {
.summary = "List process heaps",
.args = cmd_debug_process_heaps_args,
};
static const RzCmdDescArg cmd_debug_process_heap_block_args[] = {
{
.name = "addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_process_heap_block_help = {
.summary = "List allocated heap blocks",
.args = cmd_debug_process_heap_block_args,
};
static const RzCmdDescArg cmd_debug_heap_block_flag_args[] = {
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_block_flag_help = {
.summary = "Create flags for each allocated heap block",
.args = cmd_debug_heap_block_flag_args,
};
static const RzCmdDescHelp dmhj_help = {
.summary = "Jemalloc heap commands",
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_a_args[] = {
{
.name = "arena_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_a_help = {
.summary = "Show all arenas created, or print arena_type structure for given arena.",
.args = cmd_debug_heap_jemalloc_a_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_b_args[] = {
{
.name = "arena_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.optional = true,
},
{
.name = "bin_info_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_b_help = {
.summary = "Show bin info for allocations.",
.args = cmd_debug_heap_jemalloc_b_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_c_args[] = {
{
.name = "arena_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_c_help = {
.summary = "Show all chunks created in all arenas, or show all chunks created for a given arena_t instance (jemalloc 4.5.0 only).",
.args = cmd_debug_heap_jemalloc_c_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_e_args[] = {
{
.name = "malloc_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_e_help = {
.summary = "List all extents, or find extent for a specific malloc'd address (jemalloc 5.3.0 only)",
.args = cmd_debug_heap_jemalloc_e_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_ei_args[] = {
{
.name = "extent_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_ei_help = {
.summary = "Display extent (edata_t) structure info for a given extent address (jemalloc 5.3.0 only)",
.args = cmd_debug_heap_jemalloc_ei_args,
};
static const RzCmdDescHelp dmi_help = {
.summary = "List/Load symbols",
};
@ -10794,123 +10914,6 @@ static const RzCmdDescHelp cmd_debug_dmS_help = {
.args = cmd_debug_dmS_args,
};
static const RzCmdDescHelp dmw_help = {
.summary = "Windows heap commands",
};
static const RzCmdDescArg cmd_debug_process_heaps_args[] = {
{ 0 },
};
static const RzCmdDescHelp cmd_debug_process_heaps_help = {
.summary = "List process heaps",
.args = cmd_debug_process_heaps_args,
};
static const RzCmdDescArg cmd_debug_process_heap_block_args[] = {
{
.name = "addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_process_heap_block_help = {
.summary = "List allocated heap blocks",
.args = cmd_debug_process_heap_block_args,
};
static const RzCmdDescArg cmd_debug_heap_block_flag_args[] = {
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_block_flag_help = {
.summary = "Create flags for each allocated heap block",
.args = cmd_debug_heap_block_flag_args,
};
static const RzCmdDescHelp dmx_help = {
.summary = "Jemalloc heap commands",
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_a_args[] = {
{
.name = "arena_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_a_help = {
.summary = "Show all arenas created, or print arena_type structure for given arena.",
.args = cmd_debug_heap_jemalloc_a_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_b_args[] = {
{
.name = "arena_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.optional = true,
},
{
.name = "bin_info_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_b_help = {
.summary = "Show bin info for allocations.",
.args = cmd_debug_heap_jemalloc_b_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_c_args[] = {
{
.name = "arena_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_c_help = {
.summary = "Show all chunks created in all arenas, or show all chunks created for a given arena_t instance (jemalloc 4.5.0 only).",
.args = cmd_debug_heap_jemalloc_c_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_e_args[] = {
{
.name = "malloc_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
.optional = true,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_e_help = {
.summary = "List all extents, or find extent for a specific malloc'd address (jemalloc 5.3.0 only)",
.args = cmd_debug_heap_jemalloc_e_args,
};
static const RzCmdDescArg cmd_debug_heap_jemalloc_ei_args[] = {
{
.name = "extent_addr",
.type = RZ_CMD_ARG_TYPE_RZNUM,
.flags = RZ_CMD_ARG_FLAG_LAST,
},
{ 0 },
};
static const RzCmdDescHelp cmd_debug_heap_jemalloc_ei_help = {
.summary = "Display extent (edata_t) structure info for a given extent address (jemalloc 5.3.0 only)",
.args = cmd_debug_heap_jemalloc_ei_args,
};
static const RzCmdDescHelp dp_help = {
.summary = "List or attach to process or thread",
};
@ -23409,35 +23412,62 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) {
RzCmdDesc *cmd_debug_dump_maps_writable_cd = rz_cmd_desc_argv_new(core->rcmd, dmd_cd, "dmdw", rz_cmd_debug_dump_maps_writable_handler, &cmd_debug_dump_maps_writable_help);
rz_warn_if_fail(cmd_debug_dump_maps_writable_cd);
RzCmdDesc *dmh_cd = rz_cmd_desc_group_state_new(core->rcmd, dm_cd, "dmh", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_LONG, rz_cmd_heap_chunks_print_handler, &cmd_heap_chunks_print_help, &dmh_help);
RzCmdDesc *dmh_cd = rz_cmd_desc_group_new(core->rcmd, dm_cd, "dmh", NULL, NULL, &dmh_help);
rz_warn_if_fail(dmh_cd);
RzCmdDesc *cmd_arena_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmh_cd, "dmha", rz_cmd_arena_print_handler, &cmd_arena_print_help);
RzCmdDesc *dmhg_cd = rz_cmd_desc_group_state_new(core->rcmd, dmh_cd, "dmhg", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_LONG, rz_cmd_heap_chunks_print_handler, &cmd_heap_chunks_print_help, &dmhg_help);
rz_warn_if_fail(dmhg_cd);
RzCmdDesc *cmd_arena_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmhg_cd, "dmhga", rz_cmd_arena_print_handler, &cmd_arena_print_help);
rz_warn_if_fail(cmd_arena_print_cd);
RzCmdDesc *cmd_heap_bins_list_print_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmh_cd, "dmhb", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_GRAPH, rz_cmd_heap_bins_list_print_handler, &cmd_heap_bins_list_print_help);
RzCmdDesc *cmd_heap_bins_list_print_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmhg_cd, "dmhgb", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_GRAPH, rz_cmd_heap_bins_list_print_handler, &cmd_heap_bins_list_print_help);
rz_warn_if_fail(cmd_heap_bins_list_print_cd);
RzCmdDesc *cmd_heap_chunk_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmh_cd, "dmhc", rz_cmd_heap_chunk_print_handler, &cmd_heap_chunk_print_help);
RzCmdDesc *cmd_heap_chunk_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmhg_cd, "dmhgc", rz_cmd_heap_chunk_print_handler, &cmd_heap_chunk_print_help);
rz_warn_if_fail(cmd_heap_chunk_print_cd);
RzCmdDesc *cmd_heap_arena_bins_print_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmh_cd, "dmhd", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_heap_arena_bins_print_handler, &cmd_heap_arena_bins_print_help);
RzCmdDesc *cmd_heap_arena_bins_print_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmhg_cd, "dmhgd", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_heap_arena_bins_print_handler, &cmd_heap_arena_bins_print_help);
rz_warn_if_fail(cmd_heap_arena_bins_print_cd);
RzCmdDesc *cmd_heap_fastbins_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmh_cd, "dmhf", rz_cmd_heap_fastbins_print_handler, &cmd_heap_fastbins_print_help);
RzCmdDesc *cmd_heap_fastbins_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmhg_cd, "dmhgf", rz_cmd_heap_fastbins_print_handler, &cmd_heap_fastbins_print_help);
rz_warn_if_fail(cmd_heap_fastbins_print_cd);
RzCmdDesc *cmd_heap_chunks_graph_cd = rz_cmd_desc_argv_new(core->rcmd, dmh_cd, "dmhg", rz_cmd_heap_chunks_graph_handler, &cmd_heap_chunks_graph_help);
RzCmdDesc *cmd_heap_chunks_graph_cd = rz_cmd_desc_argv_new(core->rcmd, dmhg_cd, "dmhgg", rz_cmd_heap_chunks_graph_handler, &cmd_heap_chunks_graph_help);
rz_warn_if_fail(cmd_heap_chunks_graph_cd);
RzCmdDesc *cmd_heap_info_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmh_cd, "dmhi", rz_cmd_heap_info_print_handler, &cmd_heap_info_print_help);
RzCmdDesc *cmd_heap_info_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmhg_cd, "dmhgi", rz_cmd_heap_info_print_handler, &cmd_heap_info_print_help);
rz_warn_if_fail(cmd_heap_info_print_cd);
RzCmdDesc *cmd_main_arena_print_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmh_cd, "dmhm", RZ_OUTPUT_MODE_STANDARD, rz_cmd_main_arena_print_handler, &cmd_main_arena_print_help);
RzCmdDesc *cmd_main_arena_print_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmhg_cd, "dmhgm", RZ_OUTPUT_MODE_STANDARD, rz_cmd_main_arena_print_handler, &cmd_main_arena_print_help);
rz_warn_if_fail(cmd_main_arena_print_cd);
RzCmdDesc *cmd_heap_tcache_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmh_cd, "dmht", rz_cmd_heap_tcache_print_handler, &cmd_heap_tcache_print_help);
RzCmdDesc *cmd_heap_tcache_print_cd = rz_cmd_desc_argv_new(core->rcmd, dmhg_cd, "dmhgt", rz_cmd_heap_tcache_print_handler, &cmd_heap_tcache_print_help);
rz_warn_if_fail(cmd_heap_tcache_print_cd);
RzCmdDesc *dmhw_cd = rz_cmd_desc_group_modes_new(core->rcmd, dmh_cd, "dmhw", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_debug_process_heaps_handler, &cmd_debug_process_heaps_help, &dmhw_help);
rz_warn_if_fail(dmhw_cd);
RzCmdDesc *cmd_debug_process_heap_block_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmhw_cd, "dmhwb", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_debug_process_heap_block_handler, &cmd_debug_process_heap_block_help);
rz_warn_if_fail(cmd_debug_process_heap_block_cd);
RzCmdDesc *cmd_debug_heap_block_flag_cd = rz_cmd_desc_argv_new(core->rcmd, dmhw_cd, "dmhwbf", rz_cmd_debug_heap_block_flag_handler, &cmd_debug_heap_block_flag_help);
rz_warn_if_fail(cmd_debug_heap_block_flag_cd);
RzCmdDesc *dmhj_cd = rz_cmd_desc_group_new(core->rcmd, dmh_cd, "dmhj", NULL, NULL, &dmhj_help);
rz_warn_if_fail(dmhj_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_a_cd = rz_cmd_desc_argv_new(core->rcmd, dmhj_cd, "dmhja", rz_cmd_debug_heap_jemalloc_a_handler, &cmd_debug_heap_jemalloc_a_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_a_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_b_cd = rz_cmd_desc_argv_new(core->rcmd, dmhj_cd, "dmhjb", rz_cmd_debug_heap_jemalloc_b_handler, &cmd_debug_heap_jemalloc_b_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_b_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_c_cd = rz_cmd_desc_argv_new(core->rcmd, dmhj_cd, "dmhjc", rz_cmd_debug_heap_jemalloc_c_handler, &cmd_debug_heap_jemalloc_c_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_c_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_e_cd = rz_cmd_desc_argv_new(core->rcmd, dmhj_cd, "dmhje", rz_cmd_debug_heap_jemalloc_e_handler, &cmd_debug_heap_jemalloc_e_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_e_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_ei_cd = rz_cmd_desc_argv_new(core->rcmd, dmhj_cd, "dmhjei", rz_cmd_debug_heap_jemalloc_ei_handler, &cmd_debug_heap_jemalloc_ei_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_ei_cd);
RzCmdDesc *dmi_cd = rz_cmd_desc_group_state_new(core->rcmd, dm_cd, "dmi", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_QUIETEST, rz_cmd_debug_dmi_handler, &cmd_debug_dmi_help, &dmi_help);
rz_warn_if_fail(dmi_cd);
RzCmdDesc *cmd_debug_dmi_all_cd = rz_cmd_desc_argv_state_new(core->rcmd, dmi_cd, "dmia", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_QUIETEST, rz_cmd_debug_dmi_all_handler, &cmd_debug_dmi_all_help);
@ -23458,31 +23488,6 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) {
RzCmdDesc *cmd_debug_dmS_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dm_cd, "dmS", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_debug_dmS_handler, &cmd_debug_dmS_help);
rz_warn_if_fail(cmd_debug_dmS_cd);
RzCmdDesc *dmw_cd = rz_cmd_desc_group_modes_new(core->rcmd, dm_cd, "dmw", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_debug_process_heaps_handler, &cmd_debug_process_heaps_help, &dmw_help);
rz_warn_if_fail(dmw_cd);
RzCmdDesc *cmd_debug_process_heap_block_cd = rz_cmd_desc_argv_modes_new(core->rcmd, dmw_cd, "dmwb", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_cmd_debug_process_heap_block_handler, &cmd_debug_process_heap_block_help);
rz_warn_if_fail(cmd_debug_process_heap_block_cd);
RzCmdDesc *cmd_debug_heap_block_flag_cd = rz_cmd_desc_argv_new(core->rcmd, dmw_cd, "dmwbf", rz_cmd_debug_heap_block_flag_handler, &cmd_debug_heap_block_flag_help);
rz_warn_if_fail(cmd_debug_heap_block_flag_cd);
RzCmdDesc *dmx_cd = rz_cmd_desc_group_new(core->rcmd, dm_cd, "dmx", NULL, NULL, &dmx_help);
rz_warn_if_fail(dmx_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_a_cd = rz_cmd_desc_argv_new(core->rcmd, dmx_cd, "dmxa", rz_cmd_debug_heap_jemalloc_a_handler, &cmd_debug_heap_jemalloc_a_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_a_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_b_cd = rz_cmd_desc_argv_new(core->rcmd, dmx_cd, "dmxb", rz_cmd_debug_heap_jemalloc_b_handler, &cmd_debug_heap_jemalloc_b_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_b_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_c_cd = rz_cmd_desc_argv_new(core->rcmd, dmx_cd, "dmxc", rz_cmd_debug_heap_jemalloc_c_handler, &cmd_debug_heap_jemalloc_c_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_c_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_e_cd = rz_cmd_desc_argv_new(core->rcmd, dmx_cd, "dmxe", rz_cmd_debug_heap_jemalloc_e_handler, &cmd_debug_heap_jemalloc_e_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_e_cd);
RzCmdDesc *cmd_debug_heap_jemalloc_ei_cd = rz_cmd_desc_argv_new(core->rcmd, dmx_cd, "dmxei", rz_cmd_debug_heap_jemalloc_ei_handler, &cmd_debug_heap_jemalloc_ei_help);
rz_warn_if_fail(cmd_debug_heap_jemalloc_ei_cd);
RzCmdDesc *dp_cd = rz_cmd_desc_group_state_new(core->rcmd, d_cd, "dp", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_TABLE, rz_cmd_debug_pid_list_handler, &cmd_debug_pid_list_help, &dp_help);
rz_warn_if_fail(dp_cd);
RzCmdDesc *cmd_debug_pid_attachable_list_cd = rz_cmd_desc_argv_state_new(core->rcmd, dp_cd, "dpl", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_TABLE, rz_cmd_debug_pid_attachable_list_handler, &cmd_debug_pid_attachable_list_help);

View file

@ -1325,26 +1325,42 @@ RZ_IPI RzCmdStatus rz_cmd_debug_dump_maps_handler(RzCore *core, int argc, const
RZ_IPI RzCmdStatus rz_cmd_debug_dump_maps_all_handler(RzCore *core, int argc, const char **argv);
// "dmdw"
RZ_IPI RzCmdStatus rz_cmd_debug_dump_maps_writable_handler(RzCore *core, int argc, const char **argv);
// "dmh"
RZ_IPI RzCmdStatus rz_cmd_heap_chunks_print_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "dmha"
RZ_IPI RzCmdStatus rz_cmd_arena_print_handler(RzCore *core, int argc, const char **argv);
// "dmhb"
RZ_IPI RzCmdStatus rz_cmd_heap_bins_list_print_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmhc"
RZ_IPI RzCmdStatus rz_cmd_heap_chunk_print_handler(RzCore *core, int argc, const char **argv);
// "dmhd"
RZ_IPI RzCmdStatus rz_cmd_heap_arena_bins_print_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmhf"
RZ_IPI RzCmdStatus rz_cmd_heap_fastbins_print_handler(RzCore *core, int argc, const char **argv);
// "dmhg"
RZ_IPI RzCmdStatus rz_cmd_heap_chunks_print_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "dmhga"
RZ_IPI RzCmdStatus rz_cmd_arena_print_handler(RzCore *core, int argc, const char **argv);
// "dmhgb"
RZ_IPI RzCmdStatus rz_cmd_heap_bins_list_print_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmhgc"
RZ_IPI RzCmdStatus rz_cmd_heap_chunk_print_handler(RzCore *core, int argc, const char **argv);
// "dmhgd"
RZ_IPI RzCmdStatus rz_cmd_heap_arena_bins_print_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmhgf"
RZ_IPI RzCmdStatus rz_cmd_heap_fastbins_print_handler(RzCore *core, int argc, const char **argv);
// "dmhgg"
RZ_IPI RzCmdStatus rz_cmd_heap_chunks_graph_handler(RzCore *core, int argc, const char **argv);
// "dmhi"
// "dmhgi"
RZ_IPI RzCmdStatus rz_cmd_heap_info_print_handler(RzCore *core, int argc, const char **argv);
// "dmhm"
// "dmhgm"
RZ_IPI RzCmdStatus rz_cmd_main_arena_print_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmht"
// "dmhgt"
RZ_IPI RzCmdStatus rz_cmd_heap_tcache_print_handler(RzCore *core, int argc, const char **argv);
// "dmhw"
RZ_IPI RzCmdStatus rz_cmd_debug_process_heaps_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmhwb"
RZ_IPI RzCmdStatus rz_cmd_debug_process_heap_block_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmhwbf"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_block_flag_handler(RzCore *core, int argc, const char **argv);
// "dmhja"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_a_handler(RzCore *core, int argc, const char **argv);
// "dmhjb"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_b_handler(RzCore *core, int argc, const char **argv);
// "dmhjc"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_c_handler(RzCore *core, int argc, const char **argv);
// "dmhje"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_e_handler(RzCore *core, int argc, const char **argv);
// "dmhjei"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_ei_handler(RzCore *core, int argc, const char **argv);
// "dmi"
RZ_IPI RzCmdStatus rz_cmd_debug_dmi_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "dmia"
@ -1359,22 +1375,6 @@ RZ_IPI RzCmdStatus rz_debug_memory_permission_handler(RzCore *core, int argc, co
RZ_IPI RzCmdStatus rz_cmd_debug_dmL_handler(RzCore *core, int argc, const char **argv);
// "dmS"
RZ_IPI RzCmdStatus rz_cmd_debug_dmS_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmw"
RZ_IPI RzCmdStatus rz_cmd_debug_process_heaps_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmwb"
RZ_IPI RzCmdStatus rz_cmd_debug_process_heap_block_handler(RzCore *core, int argc, const char **argv, RzOutputMode mode);
// "dmwbf"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_block_flag_handler(RzCore *core, int argc, const char **argv);
// "dmxa"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_a_handler(RzCore *core, int argc, const char **argv);
// "dmxb"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_b_handler(RzCore *core, int argc, const char **argv);
// "dmxc"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_c_handler(RzCore *core, int argc, const char **argv);
// "dmxe"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_e_handler(RzCore *core, int argc, const char **argv);
// "dmxei"
RZ_IPI RzCmdStatus rz_cmd_debug_heap_jemalloc_ei_handler(RzCore *core, int argc, const char **argv);
// "dp"
RZ_IPI RzCmdStatus rz_cmd_debug_pid_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "dpl"

View file

@ -0,0 +1,155 @@
# SPDX-FileCopyrightText: 2026 RizinOrg <info@rizin.re>
# SPDX-License-Identifier: LGPL-3.0-only
#
---
name: cmd_heap
commands:
- name: dmhg
summary: Glibc heap commands
subcommands:
- name: dmhg
cname: cmd_heap_chunks_print
summary: List heap chunks of an arena
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- RZ_OUTPUT_MODE_LONG
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhga
cname: cmd_arena_print
summary: List all the arenas
args: []
- name: dmhgb
cname: cmd_heap_bins_list_print
summary: >
Display double linked list for bins in an arena.
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_GRAPH
args:
- name: bin_num|bin_num:malloc_state
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: dmhgc
cname: cmd_heap_chunk_print
summary: Get info about heap chunk at current offset
args: []
- name: dmhgd
cname: cmd_heap_arena_bins_print
summary: >
Display state of bins in an arena. <bin_type>
can be tcache/fast/unsorted/small/large
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: bin_type
type: RZ_CMD_ARG_TYPE_CHOICES
optional: true
choices: ["small", "large", "fast", "unsorted", "tcache"]
- name: dmhgf
cname: cmd_heap_fastbins_print
summary: >
Display all parsed fastbins of main_arena's or a particular
arena fastbinY instance
args:
- name: fastbin_num|fastbin_num:malloc_state
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: dmhgg
cname: cmd_heap_chunks_graph
summary: Display heap graph of a particular arena
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhgi
cname: cmd_heap_info_print
summary: Display heap_info structure/structures for a given arena
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhgm
cname: cmd_main_arena_print
summary: List all elements of struct malloc_state
modes:
- RZ_OUTPUT_MODE_STANDARD
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhgt
cname: cmd_heap_tcache_print
summary: Display all parsed thread cache bins of all arena's tcache instance
args: []
- name: dmhw
summary: Windows heap commands
subcommands:
- name: dmhw
summary: List process heaps
cname: cmd_debug_process_heaps
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args: []
- name: dmhwb
summary: List allocated heap blocks
cname: cmd_debug_process_heap_block
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhwbf
summary: Create flags for each allocated heap block
cname: cmd_debug_heap_block_flag
args: []
- name: dmhj
summary: Jemalloc heap commands
subcommands:
- name: dmhja
summary: Show all arenas created, or print arena_type structure for given arena.
cname: cmd_debug_heap_jemalloc_a
args:
- name: arena_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhjb
summary: Show bin info for allocations.
cname: cmd_debug_heap_jemalloc_b
args:
- name: arena_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: bin_info_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhjc
summary: >-
Show all chunks created in all arenas, or show all chunks created for a given
arena_t instance (jemalloc 4.5.0 only).
cname: cmd_debug_heap_jemalloc_c
args:
- name: arena_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhje
summary: List all extents, or find extent for a specific malloc'd address (jemalloc 5.3.0 only)
cname: cmd_debug_heap_jemalloc_e
args:
- name: malloc_addr
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhjei
summary: Display extent (edata_t) structure info for a given extent address (jemalloc 5.3.0 only)
cname: cmd_debug_heap_jemalloc_ei
args:
- name: extent_addr
type: RZ_CMD_ARG_TYPE_RZNUM

View file

@ -1,86 +0,0 @@
# SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
# SPDX-License-Identifier: LGPL-3.0-only
#
---
name: cmd_heap_glibc
commands:
- name: dmh
cname: cmd_heap_chunks_print
summary: List heap chunks of an arena
type: RZ_CMD_DESC_TYPE_ARGV_STATE
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- RZ_OUTPUT_MODE_LONG
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmha
cname: cmd_arena_print
summary: List all the arenas
args: []
- name: dmhb
cname: cmd_heap_bins_list_print
summary: >
Display double linked list for bins in an arena.
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_GRAPH
args:
- name: bin_num|bin_num:malloc_state
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: dmhc
cname: cmd_heap_chunk_print
summary: Get info about heap chunk at current offset
args: []
- name: dmhd
cname: cmd_heap_arena_bins_print
summary: >
Display state of bins in an arena. <bin_type>
can be tcache/fast/unsorted/small/large
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
args:
- name: bin_type
type: RZ_CMD_ARG_TYPE_CHOICES
optional: true
choices: ["small", "large", "fast", "unsorted", "tcache"]
- name: dmhf
cname: cmd_heap_fastbins_print
summary: >
Display all parsed fastbins of main_arena's or a particular
arena fastbinY instance
args:
- name: fastbin_num|fastbin_num:malloc_state
type: RZ_CMD_ARG_TYPE_STRING
optional: true
- name: dmhg
cname: cmd_heap_chunks_graph
summary: Display heap graph of a particular arena
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhi
cname: cmd_heap_info_print
summary: Display heap_info structure/structures for a given arena
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmhm
cname: cmd_main_arena_print
summary: List all elements of struct malloc_state
modes:
- RZ_OUTPUT_MODE_STANDARD
args:
- name: malloc_state
type: RZ_CMD_ARG_TYPE_RZNUM
optional: true
- name: dmht
cname: cmd_heap_tcache_print
summary: Display all parsed thread cache bins of all arena's tcache instance
args: []

View file

@ -11,7 +11,7 @@ cmd_descs_yaml = files(
'cmd_eval.yaml',
'cmd_flag.yaml',
'cmd_flirt.yaml',
'cmd_heap_glibc.yaml',
'cmd_heap.yaml',
'cmd_history.yaml',
'cmd_help.yaml',
'cmd_info.yaml',

View file

@ -1971,7 +1971,7 @@ static int print_bin_content(RzCore *core, MallocState *main_arena, int bin_num,
}
/**
* \brief Prints unsorted bin description for an arena (used for `dmhd` command)
* \brief Prints unsorted bin description for an arena (used for `dmhgd` command)
* \param core RzCore pointer
* \param m_arena Offset of the arena in memory
* \param main_arena MallocState struct for the arena in which bin are
@ -1996,7 +1996,7 @@ static void print_unsortedbin_description(RzCore *core, ut64 m_arena, MallocStat
}
/**
* \brief Prints small bins description for an arena (used for `dmhd` command)
* \brief Prints small bins description for an arena (used for `dmhgd` command)
* \param core RzCore pointer
* \param m_arena Offset of the arena in memory
* \param main_arena Pointer to MallocState struct for the arena in which bins are
@ -2030,7 +2030,7 @@ static void print_smallbin_description(RzCore *core, ut64 m_arena, MallocState *
}
/**
* \brief Prints large bins description for an arena (used for `dmhd` command)
* \brief Prints large bins description for an arena (used for `dmhgd` command)
* \param core RzCore pointer
* \param m_arena Offset of the arena in memory
* \param main_arena Pointer to MallocState struct for the arena in which bins are
@ -2064,7 +2064,7 @@ static void print_largebin_description(RzCore *core, ut64 m_arena, MallocState *
}
/**
* \brief Prints description of bins for main arena for `dmhd` command
* \brief Prints description of bins for main arena for `dmhgd` command
* \param core RzCore pointer
* \param m_arena Offset of main arena in memory
* \param main_arena Pointer to Malloc state struct for main arena
@ -2813,7 +2813,7 @@ RZ_IPI RzCmdStatus rz_cmd_heap_arena_bins_print_handler(RzCore *core, int argc,
}
bool json = false;
if (mode == RZ_OUTPUT_MODE_JSON) { // dmhdj
if (mode == RZ_OUTPUT_MODE_JSON) { // dmhgdj
json = true;
}
RzHeapBinType bin_format = RZ_HEAP_BIN_ANY;

View file

@ -498,10 +498,10 @@ static void jemalloc_get_bins_450(RzCore *core, bool has_specified_addr, ut64 ad
}
PRINT_GA("}\n");
} else {
// Static mode - requires two arguments: dmxb <arena_addr> <bin_info_addr>
// Static mode - requires two arguments: dmhjb <arena_addr> <bin_info_addr>
arena_addr = addr;
if (!has_bin_info) {
RZ_LOG_ERROR("Usage: dmxb <arena_addr> <bin_info_addr>\n");
RZ_LOG_ERROR("Usage: dmhjb <arena_addr> <bin_info_addr>\n");
return;
}
@ -787,7 +787,7 @@ static void jemalloc_find_extent_530(RzCore *core, bool has_specified_addr, ut64
static void jemalloc_extent_info_530(RzCore *core, bool has_specified_addr, ut64 edata_addr, const RzJemallocConfig530 *config) {
if (!has_specified_addr) {
RZ_LOG_ERROR("Usage: dmxei <edata_addr>\n");
RZ_LOG_ERROR("Usage: dmhjei <edata_addr>\n");
return;
}
@ -856,10 +856,10 @@ static void jemalloc_get_bins_530(RzCore *core, bool has_specified_addr, ut64 ad
}
PRINT_GA("}\n");
} else {
// Static mode - requires two arguments: dmxb <arena_addr> <bin_info_addr>
// Static mode - requires two arguments: dmhjb <arena_addr> <bin_info_addr>
arena_addr = addr;
if (!has_bin_info) {
RZ_LOG_ERROR("Usage: dmxb <arena_addr> <bin_info_addr>\n");
RZ_LOG_ERROR("Usage: dmhjb <arena_addr> <bin_info_addr>\n");
return;
}

View file

@ -1,4 +1,4 @@
NAME=dmxa/dmxb with jemalloc 4.5.0 memory dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb with jemalloc 4.5.0 memory dump (linux-amd64-4k_page)
FILE=bins/heap/linux_jemalloc-4.5.0_x64.bin
ARGS=-n
CMDS=<<EOF
@ -14,18 +14,18 @@ om 3 0x7f2601f5b380 0x900 0xc rw- je_arena_bin_info
om 3 0x7f2601a00140 0x2758 0x90c rw- arena
om 3 0x7f2601800000 0x200000 0x3064 rw- [heap]
dmxa 0x7f2601a00140~ind
dmxa 0x7f2601a00140~nthreads: application
dmxa 0x7f2601a00140~extent_sn_next
dmxa 0x7f2601a00140~spare
dmxa 0x7f2601a00140~purging
dmxa 0x7f2601a00140~nactive
dmxa 0x7f2601a00140~bins
dmhja 0x7f2601a00140~ind
dmhja 0x7f2601a00140~nthreads: application
dmhja 0x7f2601a00140~extent_sn_next
dmhja 0x7f2601a00140~spare
dmhja 0x7f2601a00140~purging
dmhja 0x7f2601a00140~nactive
dmhja 0x7f2601a00140~bins
echo ----
dmxb 0x7f2601a00140 0x7f2601f5b380~?regsize
dmxb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x800
dmxb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x3800
dmxb 0x7f2601a00140 0x7f2601f5b380~nregs : 0x200
dmhjb 0x7f2601a00140 0x7f2601f5b380~?regsize
dmhjb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x800
dmhjb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x3800
dmhjb 0x7f2601a00140 0x7f2601f5b380~nregs : 0x200
EOF
EXPECT=<<EOF
ind = 0x0
@ -43,7 +43,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmxa/dmxb/dmxei with jemalloc 5.3.0 memory dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb/dmhjei with jemalloc 5.3.0 memory dump (linux-amd64-4k_page)
FILE=bins/heap/linux_jemalloc-5.3.0_x64.bin
ARGS=-n
CMDS=<<EOF
@ -57,19 +57,19 @@ om 3 0x561974e68b00 1440 0x0 rw- bin_info
om 3 0x7faa2cc010c0 0x20000 1440 rw- arena
om 3 0x7faa2cc16500 128 0x205a0 rw- extent
dmxa 0x7faa2cc010c0~ind
dmxa 0x7faa2cc010c0~nthreads: application
dmxa 0x7faa2cc010c0~stats
dmxa 0x7faa2cc010c0~dss_prec
dmxa 0x7faa2cc010c0~create_time.ns
dmhja 0x7faa2cc010c0~ind
dmhja 0x7faa2cc010c0~nthreads: application
dmhja 0x7faa2cc010c0~stats
dmhja 0x7faa2cc010c0~dss_prec
dmhja 0x7faa2cc010c0~create_time.ns
echo ----
dmxb 0x7faa2cc010c0 0x561974e68b00~?reg_size
dmxb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x800
dmxb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x3800
dmxb 0x7faa2cc010c0 0x561974e68b00~nregs : 0x200
dmhjb 0x7faa2cc010c0 0x561974e68b00~?reg_size
dmhjb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x800
dmhjb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x3800
dmhjb 0x7faa2cc010c0 0x561974e68b00~nregs : 0x200
echo ----
dmxei 0x7faa2cc16500~Extent
dmxei 0x7faa2cc16500~Allocated Address
dmhjei 0x7faa2cc16500~Extent
dmhjei 0x7faa2cc16500~Allocated Address
EOF
EXPECT=<<EOF
ind = 0x0
@ -88,7 +88,7 @@ Extent @ 0x7faa2cc16500
EOF
RUN
NAME=dmxa/dmxb/dmxei with jemalloc 5.3.0 memory dump (linux-riscv64-4k_page)
NAME=dmhja/dmhjb/dmhjei with jemalloc 5.3.0 memory dump (linux-riscv64-4k_page)
FILE=bins/heap/linux_jemalloc-5.3.0_riscv64.bin
ARGS=-n
CMDS=<<EOF
@ -102,19 +102,19 @@ om 3 0x55555d5b4830 1440 0x0 rw- bin_info
om 3 0x7fff960010c0 0x20000 1440 rw- arena
om 3 0x7fff96016500 128 0x205a0 rw- extent
dmxa 0x7fff960010c0~ind
dmxa 0x7fff960010c0~nthreads: application
dmxa 0x7fff960010c0~stats
dmxa 0x7fff960010c0~dss_prec
dmxa 0x7fff960010c0~create_time.ns
dmhja 0x7fff960010c0~ind
dmhja 0x7fff960010c0~nthreads: application
dmhja 0x7fff960010c0~stats
dmhja 0x7fff960010c0~dss_prec
dmhja 0x7fff960010c0~create_time.ns
echo ----
dmxb 0x7fff960010c0 0x55555d5b4830~?reg_size
dmxb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x800
dmxb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x3800
dmxb 0x7fff960010c0 0x55555d5b4830~nregs : 0x200
dmhjb 0x7fff960010c0 0x55555d5b4830~?reg_size
dmhjb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x800
dmhjb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x3800
dmhjb 0x7fff960010c0 0x55555d5b4830~nregs : 0x200
echo ----
dmxei 0x7fff96016500~Extent
dmxei 0x7fff96016500~Allocated Address
dmhjei 0x7fff96016500~Extent
dmhjei 0x7fff96016500~Allocated Address
EOF
EXPECT=<<EOF
ind = 0x0
@ -133,16 +133,16 @@ Extent @ 0x7fff96016500
EOF
RUN
NAME=dmxa/dmxb/dmxe with 32-bit jemalloc 5.3.0 runtime (freebsd-amd64-4k_page)
NAME=dmhja/dmhjb/dmhje with 32-bit jemalloc 5.3.0 runtime (freebsd-amd64-4k_page)
FILE=bins/heap/simpleheap-jemalloc-5.3.0-static-amd64-bsd
ARGS=-Rstdout=/dev/null -Rstderr=/dev/null -Rstdin=/dev/zero -d
CMDS=<<EOF
dcu 0x00218ab5
dmxa~?narenas
dmhja~?narenas
echo ----
dmxb~reg_size : 0x800
dmhjb~reg_size : 0x800
echo ----
dmxe~Total extents found:
dmhje~Total extents found:
EOF
EXPECT=<<EOF
1

View file

@ -1,4 +1,4 @@
NAME=dmh/dmha with memory dump
NAME=dmhg/dmhga with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -6,11 +6,11 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmha~?0x7ffff7f8a000
dmhga~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmh~?allocated
dmhg~?allocated
e dbg.glibc.tcache=1
dmh~?allocated
dmhg~?allocated
EOF
EXPECT=<<EOF
1
@ -19,7 +19,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmht with memory dump
NAME=dmhgt with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -28,9 +28,9 @@ om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=0
dmht~?Items[2]
dmhgt~?Items[2]
e dbg.glibc.tcache=1
dmht~?Items[2]
dmhgt~?Items[2]
EOF
EXPECT=<<EOF
0
@ -38,7 +38,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhl with memory dump
NAME=dmhgl with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -46,14 +46,14 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmhl~?0x7ffff7f8a000
dmhgl~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmhl~?0x555555559000
dmhl~?0x555555559010
dmhgl~?0x555555559000
dmhgl~?0x555555559010
e dbg.glibc.tcache=1
dmhl~?0x555555559000
dmhl~?0x55555555c1a0
dmhl~?0x55555555c1c0
dmhgl~?0x555555559000
dmhgl~?0x55555555c1a0
dmhgl~?0x55555555c1c0
EOF
EXPECT=<<EOF
1
@ -66,7 +66,7 @@ EOF
RUN
NAME=dmhc with memory dump
NAME=dmhgc with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -74,10 +74,10 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=1
dmhc @ 0x555555559290~?0x20
dmhc @ 0x555555559290~?0x555555559010
dmhc @ 0x55555555c1a0~?0x1a0a
dmhc @ 0x5555555592b0~?0x2ef0
dmhgc @ 0x555555559290~?0x20
dmhgc @ 0x555555559290~?0x555555559010
dmhgc @ 0x55555555c1a0~?0x1a0a
dmhgc @ 0x5555555592b0~?0x2ef0
EOF
EXPECT=<<EOF
1
@ -87,25 +87,25 @@ EXPECT=<<EOF
EOF
RUN
NAME=multi-arena dmh/dmhb/dmhc/dmhd/dmhf/dhmg/dmhm/dmht/dmha/dmhi aarch64
NAME=multi-arena dmhg/dmhgb/dmhgc/dmhgd/dmhgf/dmhgg/dmhgm/dmhgt/dmhga/dmhgi aarch64
FILE=bins/heap/multi-arena-glibc-2.31-aarch64
ARGS=-d
CMDS=<<EOF
db @ sym.breakpoint_here
dc
dmh~allocated?
dmhb~Bin 000?
# dmhc~hello?
dmhd~Tcache?
dmhg~allocated?
dmhgb~Bin 000?
# dmhgc~hello?
dmhgd~Tcache?
echo ----
dmhf~Fast bins?
dmhg~Top?
dmhm~malloc_state?
dmht~thread?
dmhgf~Fast bins?
dmhgg~Top?
dmhgm~malloc_state?
dmhgt~thread?
echo ----
dmha~Thread?
$arena=$`dmha | grep "Thread arena" | head -1 | awk -F'addr=' '{print $2}' | awk -F',' '{print $1}'`
dmhi `$arena`~?malloc_info
dmhga~Thread?
$arena=$`dmhga | grep "Thread arena" | head -1 | awk -F'addr=' '{print $2}' | awk -F',' '{print $1}'`
dmhgi `$arena`~?malloc_info
EOF
REGEXP_FILTER_OUT=(?m)^[[:space:]]*\K([0-9]+|----)(?=[[:space:]]*$)
EXPECT=<<EOF

View file

@ -1,13 +1,13 @@
NAME=dmxa/dmxb/dmxe with 64-bit jemalloc 5.3.0 runtime (aarch64-linux-)
NAME=dmhja/dmhjb/dmhje with 64-bit jemalloc 5.3.0 runtime (aarch64-linux-)
FILE=bins/heap/simpleheap-jemalloc-5.3.0-static-aarch64
ARGS=-d
CMDS=<<EOF
dcu sym.imp.getchar
dmxa~?narenas
dmhja~?narenas
echo ----
dmxb~reg_size : 0x800
dmhjb~reg_size : 0x800
echo ----
dmxe~Total extents found:
dmhje~Total extents found:
EOF
EXPECT=<<EOF
1
@ -18,7 +18,7 @@ Total extents found: 16
EOF
RUN
NAME=dmxa/dmxb with jemalloc 4.5.0 memory dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb with jemalloc 4.5.0 memory dump (linux-amd64-4k_page)
FILE=bins/heap/linux_jemalloc-4.5.0_x64.bin
ARGS=-n
CMDS=<<EOF
@ -34,18 +34,18 @@ om 3 0x7f2601f5b380 0x900 0xc rw- je_arena_bin_info
om 3 0x7f2601a00140 0x2758 0x90c rw- arena
om 3 0x7f2601800000 0x200000 0x3064 rw- [heap]
dmxa 0x7f2601a00140~ind
dmxa 0x7f2601a00140~nthreads: application
dmxa 0x7f2601a00140~extent_sn_next
dmxa 0x7f2601a00140~spare
dmxa 0x7f2601a00140~purging
dmxa 0x7f2601a00140~nactive
dmxa 0x7f2601a00140~bins
dmhja 0x7f2601a00140~ind
dmhja 0x7f2601a00140~nthreads: application
dmhja 0x7f2601a00140~extent_sn_next
dmhja 0x7f2601a00140~spare
dmhja 0x7f2601a00140~purging
dmhja 0x7f2601a00140~nactive
dmhja 0x7f2601a00140~bins
echo ----
dmxb 0x7f2601a00140 0x7f2601f5b380~?regsize
dmxb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x800
dmxb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x3800
dmxb 0x7f2601a00140 0x7f2601f5b380~nregs : 0x200
dmhjb 0x7f2601a00140 0x7f2601f5b380~?regsize
dmhjb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x800
dmhjb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x3800
dmhjb 0x7f2601a00140 0x7f2601f5b380~nregs : 0x200
EOF
EXPECT=<<EOF
ind = 0x0
@ -64,7 +64,7 @@ EOF
RUN
NAME=dmxa/dmxb/dmxei with jemalloc 5.3.0 memory dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb/dmhjei with jemalloc 5.3.0 memory dump (linux-amd64-4k_page)
FILE=bins/heap/linux_jemalloc-5.3.0_x64.bin
ARGS=-n
CMDS=<<EOF
@ -78,19 +78,19 @@ om 3 0x561974e68b00 1440 0x0 rw- bin_info
om 3 0x7faa2cc010c0 0x20000 1440 rw- arena
om 3 0x7faa2cc16500 128 0x205a0 rw- extent
dmxa 0x7faa2cc010c0~ind
dmxa 0x7faa2cc010c0~nthreads: application
dmxa 0x7faa2cc010c0~stats
dmxa 0x7faa2cc010c0~dss_prec
dmxa 0x7faa2cc010c0~create_time.ns
dmhja 0x7faa2cc010c0~ind
dmhja 0x7faa2cc010c0~nthreads: application
dmhja 0x7faa2cc010c0~stats
dmhja 0x7faa2cc010c0~dss_prec
dmhja 0x7faa2cc010c0~create_time.ns
echo ----
dmxb 0x7faa2cc010c0 0x561974e68b00~?reg_size
dmxb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x800
dmxb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x3800
dmxb 0x7faa2cc010c0 0x561974e68b00~nregs : 0x200
dmhjb 0x7faa2cc010c0 0x561974e68b00~?reg_size
dmhjb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x800
dmhjb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x3800
dmhjb 0x7faa2cc010c0 0x561974e68b00~nregs : 0x200
echo ----
dmxei 0x7faa2cc16500~Extent
dmxei 0x7faa2cc16500~Allocated Address
dmhjei 0x7faa2cc16500~Extent
dmhjei 0x7faa2cc16500~Allocated Address
EOF
EXPECT=<<EOF
ind = 0x0
@ -109,7 +109,7 @@ Extent @ 0x7faa2cc16500
EOF
RUN
NAME=dmxa/dmxb/dmxei with jemalloc 5.3.0 memory dump (linux-riscv64-4k_page)
NAME=dmhja/dmhjb/dmhjei with jemalloc 5.3.0 memory dump (linux-riscv64-4k_page)
FILE=bins/heap/linux_jemalloc-5.3.0_riscv64.bin
ARGS=-n
CMDS=<<EOF
@ -123,19 +123,19 @@ om 3 0x55555d5b4830 1440 0x0 rw- bin_info
om 3 0x7fff960010c0 0x20000 1440 rw- arena
om 3 0x7fff96016500 128 0x205a0 rw- extent
dmxa 0x7fff960010c0~ind
dmxa 0x7fff960010c0~nthreads: application
dmxa 0x7fff960010c0~stats
dmxa 0x7fff960010c0~dss_prec
dmxa 0x7fff960010c0~create_time.ns
dmhja 0x7fff960010c0~ind
dmhja 0x7fff960010c0~nthreads: application
dmhja 0x7fff960010c0~stats
dmhja 0x7fff960010c0~dss_prec
dmhja 0x7fff960010c0~create_time.ns
echo ----
dmxb 0x7fff960010c0 0x55555d5b4830~?reg_size
dmxb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x800
dmxb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x3800
dmxb 0x7fff960010c0 0x55555d5b4830~nregs : 0x200
dmhjb 0x7fff960010c0 0x55555d5b4830~?reg_size
dmhjb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x800
dmhjb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x3800
dmhjb 0x7fff960010c0 0x55555d5b4830~nregs : 0x200
echo ----
dmxei 0x7fff96016500~Extent
dmxei 0x7fff96016500~Allocated Address
dmhjei 0x7fff96016500~Extent
dmhjei 0x7fff96016500~Allocated Address
EOF
EXPECT=<<EOF
ind = 0x0
@ -154,14 +154,14 @@ Extent @ 0x7fff96016500
EOF
RUN
NAME=dmxa/dmxb/dmxe/dmxei with jemalloc 5.3.0 core dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb/dmhje/dmhjei with jemalloc 5.3.0 core dump (linux-amd64-4k_page)
FILE=bins/heap/segfault-jemalloc5.3.0-amd64-core
CMDS=<<EOF
dmxa~narena
dmxa~0x55ae211c05c0
dmxb~0x7f4550214528
dmxe~0x7f4550216500
dmxei 0x7f4550216980~Size
dmhja~narena
dmhja~0x55ae211c05c0
dmhjb~0x7f4550214528
dmhje~0x7f4550216500
dmhjei 0x7f4550216980~Size
EOF
EXPECT=<<EOF
narenas : 129
@ -173,12 +173,12 @@ EOF
RUN
NAME=dmxa/dmxb/dmxc with jemalloc 4.5.0 core dump (linux-aarch64-4k_page)
NAME=dmhja/dmhjb/dmhjc with jemalloc 4.5.0 core dump (linux-aarch64-4k_page)
FILE=bins/heap/segfault-jemalloc4.5.0-aarch64-core
CMDS=<<EOF
dmxa~narena
dmxb~0xffffa6e00140
dmxc~Chunk
dmhja~narena
dmhjb~0xffffa6e00140
dmhjc~Chunk
EOF
EXPECT=<<EOF
narenas : 32

View file

@ -1,4 +1,4 @@
NAME=dmh/dmha with memory dump
NAME=dmhg/dmhga with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -6,11 +6,11 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmha~?0x7ffff7f8a000
dmhga~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmh~?allocated
dmhg~?allocated
e dbg.glibc.tcache=1
dmh~?allocated
dmhg~?allocated
EOF
EXPECT=<<EOF
1
@ -19,7 +19,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmht with memory dump
NAME=dmhgt with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -28,9 +28,9 @@ om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=0
dmht~?Items[2]
dmhgt~?Items[2]
e dbg.glibc.tcache=1
dmht~?Items[2]
dmhgt~?Items[2]
EOF
EXPECT=<<EOF
0
@ -38,7 +38,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhl with memory dump
NAME=dmhgl with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -46,14 +46,14 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmhl~?0x7ffff7f8a000
dmhgl~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmhl~?0x555555559000
dmhl~?0x555555559010
dmhgl~?0x555555559000
dmhgl~?0x555555559010
e dbg.glibc.tcache=1
dmhl~?0x555555559000
dmhl~?0x55555555c1a0
dmhl~?0x55555555c1c0
dmhgl~?0x555555559000
dmhgl~?0x55555555c1a0
dmhgl~?0x55555555c1c0
EOF
EXPECT=<<EOF
1
@ -65,7 +65,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhc with memory dump
NAME=dmhgc with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -73,10 +73,10 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=1
dmhc @ 0x555555559290~?0x20
dmhc @ 0x555555559290~?0x555555559010
dmhc @ 0x55555555c1a0~?0x1a0a
dmhc @ 0x5555555592b0~?0x2ef0
dmhgc @ 0x555555559290~?0x20
dmhgc @ 0x555555559290~?0x555555559010
dmhgc @ 0x55555555c1a0~?0x1a0a
dmhgc @ 0x5555555592b0~?0x2ef0
EOF
EXPECT=<<EOF
1

View file

@ -1,4 +1,4 @@
NAME=dmh/dmha with memory dump
NAME=dmhg/dmhga with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -6,11 +6,11 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmha~?0x7ffff7f8a000
dmhga~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmh~?allocated
dmhg~?allocated
e dbg.glibc.tcache=1
dmh~?allocated
dmhg~?allocated
EOF
EXPECT=<<EOF
1
@ -19,7 +19,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmht with memory dump
NAME=dmhgt with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -28,9 +28,9 @@ om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=0
dmht~?Items[2]
dmhgt~?Items[2]
e dbg.glibc.tcache=1
dmht~?Items[2]
dmhgt~?Items[2]
EOF
EXPECT=<<EOF
0
@ -38,7 +38,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhl with memory dump
NAME=dmhgl with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -46,14 +46,14 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmhl~?0x7ffff7f8a000
dmhgl~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmhl~?0x555555559000
dmhl~?0x555555559010
dmhgl~?0x555555559000
dmhgl~?0x555555559010
e dbg.glibc.tcache=1
dmhl~?0x555555559000
dmhl~?0x55555555c1a0
dmhl~?0x55555555c1c0
dmhgl~?0x555555559000
dmhgl~?0x55555555c1a0
dmhgl~?0x55555555c1c0
EOF
EXPECT=<<EOF
1
@ -65,7 +65,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhc with memory dump
NAME=dmhgc with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -73,10 +73,10 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=1
dmhc @ 0x555555559290~?0x20
dmhc @ 0x555555559290~?0x555555559010
dmhc @ 0x55555555c1a0~?0x1a0a
dmhc @ 0x5555555592b0~?0x2ef0
dmhgc @ 0x555555559290~?0x20
dmhgc @ 0x555555559290~?0x555555559010
dmhgc @ 0x55555555c1a0~?0x1a0a
dmhgc @ 0x5555555592b0~?0x2ef0
EOF
EXPECT=<<EOF
1

View file

@ -1,10 +1,10 @@
NAME=use of dmh, then any command which use grep and index
NAME=use of dmhg, then any command which use grep and index
FILE=bins/elf/simple_malloc_x86_64
ARGS=-d
CMDS=<<EOF
db @ sym.main
dc
dmh > /dev/null
dmhg > /dev/null
aa > /dev/null
dr r13=rip
pdf @ sym.main~:4
@ -14,16 +14,16 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmh allocated
NAME=dmhg allocated
FILE=bins/elf/simple_malloc_x86_64
ARGS=-d
CMDS=<<EOF
(dmh_tail n; dmh~:-${n}.. | sed 's/11c\|120/1__/; s/xf1\|xed/x__/')
(dmhg_tail n; dmhg~:-${n}.. | sed 's/11c\|120/1__/; s/xf1\|xed/x__/')
dcu main
.(dmh_tail 2)
.(dmhg_tail 2)
echo ----
7dso
.(dmh_tail 3)
.(dmhg_tail 3)
EOF
REGEXP_FILTER_OUT=(status=[a-z]+)|(size=0x[_a-f0-9]+)
EXPECT=<<EOF
@ -40,7 +40,7 @@ size=0x__40
EOF
RUN
NAME=dmh/dmha with memory dump
NAME=dmhg/dmhga with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -48,11 +48,11 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmha~?0x7ffff7f8a000
dmhga~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmh~?allocated
dmhg~?allocated
e dbg.glibc.tcache=1
dmh~?allocated
dmhg~?allocated
EOF
EXPECT=<<EOF
1
@ -61,7 +61,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmht with memory dump
NAME=dmhgt with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -70,9 +70,9 @@ om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=0
dmht~?Items[2]
dmhgt~?Items[2]
e dbg.glibc.tcache=1
dmht~?Items[2]
dmhgt~?Items[2]
EOF
EXPECT=<<EOF
0
@ -80,7 +80,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhl with memory dump
NAME=dmhgl with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -88,14 +88,14 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
dmhl~?0x7ffff7f8a000
dmhgl~?0x7ffff7f8a000
e dbg.glibc.tcache=0
dmhl~?0x555555559000
dmhl~?0x555555559010
dmhgl~?0x555555559000
dmhgl~?0x555555559010
e dbg.glibc.tcache=1
dmhl~?0x555555559000
dmhl~?0x55555555c1a0
dmhl~?0x55555555c1c0
dmhgl~?0x555555559000
dmhgl~?0x55555555c1a0
dmhgl~?0x55555555c1c0
EOF
EXPECT=<<EOF
1
@ -107,16 +107,16 @@ EXPECT=<<EOF
EOF
RUN
NAME=check dmhf
NAME=check dmhgf
FILE=bins/elf/glibc-heap-2.31
ARGS=-Rsetenv=LD_PRELOAD=bins/elf/libc-2.31.so -d
CMDS=<<EOF
db @ 0x004011fa
dc
dmhf~?Chunk
dmhf 1~?Chunk
dmhf 2~?Chunk
dmhf 3~?Chunk
dmhgf~?Chunk
dmhgf 1~?Chunk
dmhgf 2~?Chunk
dmhgf 3~?Chunk
EOF
EXPECT=<<EOF
8
@ -126,7 +126,7 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhc with memory dump
NAME=dmhgc with memory dump
FILE=bins/heap/linux_glibc-2.30_x64.bin
ARGS=-n
CMDS=<<EOF
@ -134,10 +134,10 @@ CMDS=<<EOF
om 3 0x7ffff7f8a000 0x898 0x0 rw- arena
om 3 0x555555559000 0x3200 0x898 rw- [heap]
e dbg.glibc.tcache=1
dmhc @ 0x555555559290~?0x20
dmhc @ 0x555555559290~?0x555555559010
dmhc @ 0x55555555c1a0~?0x1a0a
dmhc @ 0x5555555592b0~?0x2ef0
dmhgc @ 0x555555559290~?0x20
dmhgc @ 0x555555559290~?0x555555559010
dmhgc @ 0x55555555c1a0~?0x1a0a
dmhgc @ 0x5555555592b0~?0x2ef0
EOF
EXPECT=<<EOF
1
@ -147,15 +147,15 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhb/dmhg/dmhm
NAME=dmhgb/dmhgg/dmhgm
FILE=bins/elf/glibc-heap-2.31
ARGS=-Rsetenv=LD_PRELOAD=bins/elf/libc-2.31.so -d
CMDS=<<EOF
db @ 0x004011fa
dc
dmhb~Bin 000:?
dmhg~Top?
dmhm~Large?
dmhgb~Bin 000:?
dmhgg~Top?
dmhgm~Large?
EOF
EXPECT=<<EOF
1
@ -164,15 +164,15 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmhb/dmhg/dmhm
NAME=dmhgb/dmhgg/dmhgm
FILE=bins/elf/glibc-heap-2.31
ARGS=-Rsetenv=LD_PRELOAD=bins/elf/libc-2.31.so -d
CMDS=<<EOF
db @ 0x004011fa
dc
dmhb~Bin 000:?
dmhg~Top?
dmhm~Large?
dmhgb~Bin 000:?
dmhgg~Top?
dmhgm~Large?
EOF
EXPECT=<<EOF
1
@ -181,14 +181,14 @@ EXPECT=<<EOF
EOF
RUN
NAME=multi-arena dmha/dmhi
NAME=multi-arena dmhga/dmhgi
FILE=bins/heap/multi-arena-glibc-2.31-amd64
ARGS=-d
CMDS=<<EOF
dc
dmha~Thread?
$arena=$`dmha | grep "Thread arena" | head -1 | awk -F'addr=' '{print $2}' | awk -F',' '{print $1}'`
dmhi `$arena`~?malloc_info
dmhga~Thread?
$arena=$`dmhga | grep "Thread arena" | head -1 | awk -F'addr=' '{print $2}' | awk -F',' '{print $1}'`
dmhgi `$arena`~?malloc_info
EOF
REGEXP_FILTER_OUT=(?m)^[[:space:]]*\K([0-9]+|----)(?=[[:space:]]*$)
EXPECT=<<EOF

View file

@ -1,12 +1,12 @@
NAME=dmhd with no allocated bins
NAME=dmhgd with no allocated bins
FILE=bins/elf/simple_malloc_x86_64
ARGS=-d
CMDS=<<EOF
dcu main
dmhd~?0 chunks
dmhd small~?0 chunks
dmhd large~?0 chunks
dmhd unsorted~?0 chunks
dmhgd~?0 chunks
dmhgd small~?0 chunks
dmhgd large~?0 chunks
dmhgd unsorted~?0 chunks
EOF
EXPECT=<<EOF
3
@ -17,18 +17,18 @@ EOF
RUN
NAME=check dmhd fast / tcache with chunks
NAME=check dmhgd fast / tcache with chunks
FILE=bins/elf/glibc-heap-2.31
ARGS=-Rsetenv=LD_PRELOAD=bins/elf/libc-2.31.so -d
CMDS=<<EOF
db @ 0x004011fa
dc
dmhd~?Chunk
dmhd fast~?size=0x20
dmhgd~?Chunk
dmhgd fast~?size=0x20
dc
dmhd tcache~?Items: 6
dmhgd tcache~?Items: 6
dc
dmhd tcache~?Items: 5
dmhgd tcache~?Items: 5
EOF
EXPECT=<<EOF
15

View file

@ -4,12 +4,12 @@ ARGS=-Rsetenv=LD_PRELOAD=bins/elf/libc-2.32.so -d
CMDS=<<EOF
db @ 0x004011fa
dc
dmht~?0xffffffffffff
dmht~?Items: 7
dmhgt~?0xffffffffffff
dmhgt~?Items: 7
dc
dmht~?Items: 6
dmhgt~?Items: 6
dc
dmht~?Items: 5
dmhgt~?Items: 5
EOF
EXPECT=<<EOF
0
@ -25,11 +25,11 @@ ARGS=-Rsetenv=LD_PRELOAD=bins/elf/libc-2.31.so -d
CMDS=<<EOF
db @ 0x004011fa
dc
dmht~?Items: 7
dmhgt~?Items: 7
dc
dmht~?Items: 6
dmhgt~?Items: 6
dc
dmht~?Items: 5
dmhgt~?Items: 5
EOF
EXPECT=<<EOF
1
@ -44,11 +44,11 @@ ARGS=-Rsetenv=LD_PRELOAD=bins/elf/libc-2.27.so -d
CMDS=<<EOF
db @ 0x004011fa
dc
dmht~?Items: 7
dmhgt~?Items: 7
dc
dmht~?Items: 6
dmhgt~?Items: 6
dc
dmht~?Items: 5
dmhgt~?Items: 5
EOF
EXPECT=<<EOF
1

View file

@ -1,4 +1,4 @@
NAME=dmxa/dmxb with jemalloc 4.5.0 memory dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb with jemalloc 4.5.0 memory dump (linux-amd64-4k_page)
FILE=bins/heap/linux_jemalloc-4.5.0_x64.bin
ARGS=-n
CMDS=<<EOF
@ -14,18 +14,18 @@ om 3 0x7f2601f5b380 0x900 0xc rw- je_arena_bin_info
om 3 0x7f2601a00140 0x2758 0x90c rw- arena
om 3 0x7f2601800000 0x200000 0x3064 rw- [heap]
dmxa 0x7f2601a00140~ind
dmxa 0x7f2601a00140~nthreads: application
dmxa 0x7f2601a00140~extent_sn_next
dmxa 0x7f2601a00140~spare
dmxa 0x7f2601a00140~purging
dmxa 0x7f2601a00140~nactive
dmxa 0x7f2601a00140~bins
dmhja 0x7f2601a00140~ind
dmhja 0x7f2601a00140~nthreads: application
dmhja 0x7f2601a00140~extent_sn_next
dmhja 0x7f2601a00140~spare
dmhja 0x7f2601a00140~purging
dmhja 0x7f2601a00140~nactive
dmhja 0x7f2601a00140~bins
echo ----
dmxb 0x7f2601a00140 0x7f2601f5b380~?regsize
dmxb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x800
dmxb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x3800
dmxb 0x7f2601a00140 0x7f2601f5b380~nregs : 0x200
dmhjb 0x7f2601a00140 0x7f2601f5b380~?regsize
dmhjb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x800
dmhjb 0x7f2601a00140 0x7f2601f5b380~regsize : 0x3800
dmhjb 0x7f2601a00140 0x7f2601f5b380~nregs : 0x200
EOF
EXPECT=<<EOF
ind = 0x0
@ -43,16 +43,16 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmxa/dmxb/dmxe with 32-bit jemalloc 4.5.0 runtime (linux-x86-4k_page)
NAME=dmhja/dmhjb/dmhje with 32-bit jemalloc 4.5.0 runtime (linux-x86-4k_page)
FILE=bins/heap/simpleheap-jemalloc-4.5.0-static-i386
ARGS=-d
CMDS=<<EOF
dcu sym.imp.getchar
dmxa~?narenas
dmhja~?narenas
echo ----
dmxb~regsize : 0x800
dmhjb~regsize : 0x800
echo ----
dmxc~?Chunk
dmhjc~?Chunk
EOF
EXPECT=<<EOF
1
@ -65,16 +65,16 @@ RUN
NAME=dmxa/dmxb/dmxe with 64-bit jemalloc 4.5.0 runtime (linux-amd64-4k_page)
NAME=dmhja/dmhjb/dmhje with 64-bit jemalloc 4.5.0 runtime (linux-amd64-4k_page)
FILE=bins/heap/simpleheap-jemalloc-4.5.0-static-amd64
ARGS=-d
CMDS=<<EOF
dcu sym.imp.getchar
dmxa~?narenas
dmhja~?narenas
echo ----
dmxb~regsize : 0x800
dmhjb~regsize : 0x800
echo ----
dmxc~?Chunk
dmhjc~?Chunk
EOF
EXPECT=<<EOF
1
@ -86,7 +86,7 @@ EOF
RUN
NAME=dmxa/dmxb/dmxei with jemalloc 5.3.0 memory dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb/dmhjei with jemalloc 5.3.0 memory dump (linux-amd64-4k_page)
FILE=bins/heap/linux_jemalloc-5.3.0_x64.bin
ARGS=-n
CMDS=<<EOF
@ -100,19 +100,19 @@ om 3 0x561974e68b00 1440 0x0 rw- bin_info
om 3 0x7faa2cc010c0 0x20000 1440 rw- arena
om 3 0x7faa2cc16500 128 0x205a0 rw- extent
dmxa 0x7faa2cc010c0~ind
dmxa 0x7faa2cc010c0~nthreads: application
dmxa 0x7faa2cc010c0~stats
dmxa 0x7faa2cc010c0~dss_prec
dmxa 0x7faa2cc010c0~create_time.ns
dmhja 0x7faa2cc010c0~ind
dmhja 0x7faa2cc010c0~nthreads: application
dmhja 0x7faa2cc010c0~stats
dmhja 0x7faa2cc010c0~dss_prec
dmhja 0x7faa2cc010c0~create_time.ns
echo ----
dmxb 0x7faa2cc010c0 0x561974e68b00~?reg_size
dmxb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x800
dmxb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x3800
dmxb 0x7faa2cc010c0 0x561974e68b00~nregs : 0x200
dmhjb 0x7faa2cc010c0 0x561974e68b00~?reg_size
dmhjb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x800
dmhjb 0x7faa2cc010c0 0x561974e68b00~reg_size : 0x3800
dmhjb 0x7faa2cc010c0 0x561974e68b00~nregs : 0x200
echo ----
dmxei 0x7faa2cc16500~Extent
dmxei 0x7faa2cc16500~Allocated Address
dmhjei 0x7faa2cc16500~Extent
dmhjei 0x7faa2cc16500~Allocated Address
EOF
EXPECT=<<EOF
ind = 0x0
@ -132,16 +132,16 @@ EOF
RUN
NAME=dmxa/dmxb/dmxe with 32-bit jemalloc 5.3.0 runtime (linux-x86-4k_page)
NAME=dmhja/dmhjb/dmhje with 32-bit jemalloc 5.3.0 runtime (linux-x86-4k_page)
FILE=bins/heap/simpleheap-jemalloc-5.3.0-static-i386
ARGS=-d
CMDS=<<EOF
dcu sym.imp.getchar
dmxa~?narenas
dmhja~?narenas
echo ----
dmxb~reg_size : 0x800
dmhjb~reg_size : 0x800
echo ----
dmxe~?Total extents found:
dmhje~?Total extents found:
EOF
EXPECT=<<EOF
1
@ -154,16 +154,16 @@ RUN
NAME=dmxa/dmxb/dmxe with 64-bit jemalloc 5.3.0 runtime (linux-amd64-4k_page)
NAME=dmhja/dmhjb/dmhje with 64-bit jemalloc 5.3.0 runtime (linux-amd64-4k_page)
FILE=bins/heap/simpleheap-jemalloc-5.3.0-static-amd64
ARGS=-d
CMDS=<<EOF
dcu sym.imp.getchar
dmxa~?narenas
dmhja~?narenas
echo ----
dmxb~reg_size : 0x800
dmhjb~reg_size : 0x800
echo ----
dmxe~Total extents found:
dmhje~Total extents found:
EOF
EXPECT=<<EOF
1
@ -174,7 +174,7 @@ Total extents found: 16
EOF
RUN
NAME=dmxa/dmxb/dmxei with jemalloc 5.3.0 memory dump (linux-riscv64-4k_page)
NAME=dmhja/dmhjb/dmhjei with jemalloc 5.3.0 memory dump (linux-riscv64-4k_page)
FILE=bins/heap/linux_jemalloc-5.3.0_riscv64.bin
ARGS=-n
CMDS=<<EOF
@ -188,19 +188,19 @@ om 3 0x55555d5b4830 1440 0x0 rw- bin_info
om 3 0x7fff960010c0 0x20000 1440 rw- arena
om 3 0x7fff96016500 128 0x205a0 rw- extent
dmxa 0x7fff960010c0~ind
dmxa 0x7fff960010c0~nthreads: application
dmxa 0x7fff960010c0~stats
dmxa 0x7fff960010c0~dss_prec
dmxa 0x7fff960010c0~create_time.ns
dmhja 0x7fff960010c0~ind
dmhja 0x7fff960010c0~nthreads: application
dmhja 0x7fff960010c0~stats
dmhja 0x7fff960010c0~dss_prec
dmhja 0x7fff960010c0~create_time.ns
echo ----
dmxb 0x7fff960010c0 0x55555d5b4830~?reg_size
dmxb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x800
dmxb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x3800
dmxb 0x7fff960010c0 0x55555d5b4830~nregs : 0x200
dmhjb 0x7fff960010c0 0x55555d5b4830~?reg_size
dmhjb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x800
dmhjb 0x7fff960010c0 0x55555d5b4830~reg_size : 0x3800
dmhjb 0x7fff960010c0 0x55555d5b4830~nregs : 0x200
echo ----
dmxei 0x7fff96016500~Extent
dmxei 0x7fff96016500~Allocated Address
dmhjei 0x7fff96016500~Extent
dmhjei 0x7fff96016500~Allocated Address
EOF
EXPECT=<<EOF
ind = 0x0
@ -219,14 +219,14 @@ Extent @ 0x7fff96016500
EOF
RUN
NAME=dmxa/dmxb/dmxe/dmxei with jemalloc 5.3.0 core dump (linux-amd64-4k_page)
NAME=dmhja/dmhjb/dmhje/dmhjei with jemalloc 5.3.0 core dump (linux-amd64-4k_page)
FILE=bins/heap/segfault-jemalloc5.3.0-amd64-core
CMDS=<<EOF
dmxa~narena
dmxa~0x55ae211c05c0
dmxb~0x7f4550214528
dmxe~0x7f4550216500
dmxei 0x7f4550216980~Size
dmhja~narena
dmhja~0x55ae211c05c0
dmhjb~0x7f4550214528
dmhje~0x7f4550216500
dmhjei 0x7f4550216980~Size
EOF
EXPECT=<<EOF
narenas : 129

View file

@ -1,14 +1,14 @@
NAME=dmh crash without arena/heap map
NAME=dmhg crash without arena/heap map
FILE==
ARGS=
CMDS=<<EOF
dmh
dmhg
o malloc://512 0x20000 rwx
omn 0x20000 arena
dmh
dmhg
o malloc://512 0x10000 rwx
omn 0x10000 [heap]
dmh
dmhg
EOF
EXPECT=
RUN

View file

@ -694,19 +694,19 @@ EXPECT=<<EOF
EOF
RUN
NAME=dmh commands on arm64 core dump
NAME=dmhg commands on arm64 core dump
FILE=bins/heap/segfault-glibc-aarch64-core
CMDS=<<EOF
dmh~Arena
dmha
dmhb~Bin?
dmhc @ 0xaaab126cd290~0xaaab126cd2a0
dmhg~Arena
dmhga
dmhgb~Bin?
dmhgc @ 0xaaab126cd290~0xaaab126cd2a0
echo ----
dmhd~Empty
dmhf~Arena
dmhgd~Empty
dmhgf~Arena
echo ----
dmhg~0x410?
dmhm~malloc_state
dmhgg~0x410?
dmhgm~malloc_state
EOF
EXPECT=<<EOF
Arena @ 0xffff9a780a50