diff --git a/libr/core/cmd.c b/libr/core/cmd.c index b754a7c380..6794f47022 100644 --- a/libr/core/cmd.c +++ b/libr/core/cmd.c @@ -5535,7 +5535,12 @@ R_API int r_core_cmd_foreach(RCore *core, const char *cmd, char *each) { if (fcn) { r_list_sort (fcn->bbs, bb_cmp); r_list_foreach (fcn->bbs, iter, bb) { + r_core_seek (core, bb->addr, true); + r_core_cmd (core, cmd, 0); for (i = 0; i < bb->op_pos_size; i++) { + if (!bb->op_pos[i]) { + break; + } ut64 addr = bb->addr + bb->op_pos[i]; r_core_seek (core, addr, true); r_core_cmd (core, cmd, 0); diff --git a/libr/core/cmd_meta.c b/libr/core/cmd_meta.c index 4f53db222e..d012217de3 100644 --- a/libr/core/cmd_meta.c +++ b/libr/core/cmd_meta.c @@ -72,7 +72,8 @@ static const char *help_msg_CL[] = { "CL*", "", "same as above but in r2 commands format", "CL.", "", "show list all code line information (virtual address <-> source file:line)", "CL-", "*", "remove all the cached codeline information", - "CLL", "", "show source code line reading from file", + "CLL", "[f]", "show source code line associated to current offset", + "CLLf", "", "show source lines covered by the current function (see CLL@@i or list)", "CL", " addr file:line", "register new file:line source details, r2 will slurp the line", "CL", " addr base64:text", "register new source details for given address using base64", NULL @@ -333,6 +334,11 @@ static int cmd_meta_lineinfo(RCore *core, const char *input) { return 0; } if (*p == 'L') { // "CLL" + if (p[1] == 'f') { + r_core_cmd0 (core, "CLL@@i"); + // same as CLL@@i = r_core_cmd0 (core, "list"); + return 0; + } ut64 at = core->offset; if (p[1] == ' ') { at = r_num_math (core->num, p + 2); diff --git a/test/db/cmd/dwarf2 b/test/db/cmd/dwarf2 new file mode 100644 index 0000000000..f91f77ef19 --- /dev/null +++ b/test/db/cmd/dwarf2 @@ -0,0 +1,39 @@ +NAME=mach0 function dwarf +FILE=bins/mach0/twocall +CMDS=<