4

I have a buffer which holds some lldb output which contains a lot of address ranges like [0x00007fff60489000-0x00007fff604c0000).

Given an address (in hex as well), how would I search for a range which contains that address? I assume this will need some custom elisp code.

Bwmat
  • 4,314
  • 3
  • 27
  • 42

1 Answers1

0

You can use calc for this. The syntax for hexadecimals is slightly different, and I won't show how to convert them, but the core of your functionality can be written as follows.

(require 'calc)

(defun is-between (n low high)
  (and (equal "1" (calc-eval (concat n " - " low " > 0")))
       (equal "1" (calc-eval (concat high " - " n " > 0")))))

(is-between "16#f0" "16#f" "16#ff")
Lyn Headley
  • 11,368
  • 3
  • 33
  • 35
  • 1
    This provides only a predicate for testing a number, not an answer for how to search for its occurrence. Consider beefing up your answer by providing a search command. Hint: bind variable `isearch-filter-predicate`. – Drew Jan 26 '16 at 02:22