diff --git a/libr/core/casm.c b/libr/core/casm.c index fd35860825..6b23cda77b 100644 --- a/libr/core/casm.c +++ b/libr/core/casm.c @@ -1,8 +1,6 @@ -/* radare - LGPL - Copyright 2009-2019 - nibble, pancake */ +/* radare - LGPL - Copyright 2009-2024 - nibble, pancake */ -#include #include -#include #define IFDBG if (0) @@ -214,9 +212,15 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6 if (mode == 'a') { // check for case sensitive matches = !r_str_ncasecmp (opst, tokens[matchcount], strlen (tokens[matchcount])); } else if (!regexp) { - matches = !!strstr (opst, tokens[matchcount]); + const char *curtok = tokens[matchcount]; + if (strchr (curtok, '$') || strchr (curtok, '*') || strchr (curtok, '^')) { + matches = r_str_glob (opst, curtok); + } else { + matches = !!strstr (opst, tokens[matchcount]); + } } else { rx = r_regex_new (tokens[matchcount], "es"); + eprintf ("JEJE pene\n"); matches = r_regex_exec (rx, opst, 0, 0, 0) == 0; r_regex_free (rx); } diff --git a/libr/core/cmd_search.inc.c b/libr/core/cmd_search.inc.c index 80af5f06e4..e8f5afc6a4 100644 --- a/libr/core/cmd_search.inc.c +++ b/libr/core/cmd_search.inc.c @@ -62,7 +62,8 @@ static RCoreHelpMessage help_msg_slash_pattern = { static RCoreHelpMessage help_msg_slash_ad = { "Usage: /ad[/<*jq>]", "[value]", "Backward search subcommands", - "/ad", " rax", "search in disasm plaintext for matching instructions", + "/ad", " rax", "search in plaintext disasm for matching instructions", + "/ad", " rax$", "search in plaintext disasm for instruction matchin given glob expression", "/adj", " rax", "json output searching in disasm with plaintext", "/adq", " rax", "quiet mode ideal for scripting", "/ad/", " ins1;ins2", "search for regex instruction 'ins1' followed by regex 'ins2'", diff --git a/test/db/cmd/cmd_search_asm b/test/db/cmd/cmd_search_asm index ae5ffdc750..06211120b7 100644 --- a/test/db/cmd/cmd_search_asm +++ b/test/db/cmd/cmd_search_asm @@ -419,3 +419,16 @@ EXPECT=<