Skip to content

Commit

Permalink
Fix search range notation in search herald (#4871)
Browse files Browse the repository at this point in the history
* Fix search range notation in search herald
* Add doxygen to RzInterval
  • Loading branch information
kazarmy authored Jan 31, 2025
1 parent 2c1a07d commit 1b136ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion librz/core/cmd/cmd_search.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ static void do_string_search(RzCore *core, RzInterval search_itv, struct search_
const char *bytestr = lenstr > 1 ? "bytes" : "byte";
eprintf(" %d %s", kw ? kw->keyword_length : 0, bytestr);
}
eprintf(" in [0x%" PFMT64x "-0x%" PFMT64x "]\n", itv.addr, rz_itv_end(itv));
eprintf(" in [0x%" PFMT64x ",0x%" PFMT64x ")\n", itv.addr, rz_itv_end(itv));
}
if (!core->search->bckwrds) {
RzListIter *it;
Expand Down
15 changes: 9 additions & 6 deletions librz/include/rz_util/rz_itv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
extern "C" {
#endif

// An interval in 64-bit address space which is aware of address space wraparound
// Precondition: 0 <= size < 2**64 and addr + size <= 2**64
// range is [], [10, 5) => 10 <= x < (10 + 5)
/**
* \brief An interval in 64-bit address space which is aware of address space wraparound.
*
* Precondition: 0 <= size < 2**64 and addr + size <= 2**64
* Interval range is [addr, addr + size)
* e.g. with addr = 10 and size = 5, interval range is [10, 15) where 10 <= x < (10 + 5).
*/
typedef struct rz_interval_t {
// public:
ut64 addr;
ut64 size;
ut64 addr; ///< Start address of the interval.
ut64 size; ///< Size of the interval in bytes.
} RzInterval;

typedef RzInterval rz_itv_t;
Expand Down
14 changes: 7 additions & 7 deletions test/db/cmd/regexp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ EXPECT=<<EOF
0x00000010 hit4_0 .abcdbcccde.
EOF
EXPECT_ERR=<<EOF
Searching in [0x0-0x200]
Searching in [0x0,0x200)
hits: 2
Searching in [0x0-0x200]
Searching in [0x0,0x200)
hits: 0
Searching in [0x0-0x200]
Searching in [0x0,0x200)
hits: 2
Searching in [0x0-0x200]
Searching in [0x0,0x200)
hits: 1
Searching in [0x0-0x200]
Searching in [0x0,0x200)
hits: 1
EOF
RUN
Expand All @@ -107,9 +107,9 @@ EXPECT=<<EOF
0x000001fe hit1_0 .bd.
EOF
EXPECT_ERR=<<EOF
Searching in [0x0-0x200]
Searching in [0x0,0x200)
hits: 2
Searching in [0x0-0x200]
Searching in [0x0,0x200)
hits: 1
EOF
RUN
Expand Down

0 comments on commit 1b136ad

Please sign in to comment.