From ce5c1daf2fb69dfb018667bb08b2d6ce311fdd0c Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Tue, 30 Jun 2020 20:14:36 +0000 Subject: [PATCH] * Create helper function isValidAddress to determine if an address is valid [skip ci] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879382 13f79535-47bb-0310-9956-ffa450edef68 --- .gdbinit | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.gdbinit b/.gdbinit index 21a0a13596..92146b70fe 100644 --- a/.gdbinit +++ b/.gdbinit @@ -592,6 +592,27 @@ document dump_pool_and_children Dump the whole pool hierarchy starting from the given pool. end +python + +class isValidAddress (gdb.Function): + """Determines if the argument is a valid address.""" + + def __init__(self): + super(isValidAddress, self).__init__("isValidAddress") + + def invoke(self, address): + inf = gdb.inferiors()[0] + result = 1 + try: + inf.read_memory(address, 8) + except: + result = 0 + return result + +isValidAddress() + +end + # Set sane defaults for common signals: handle SIGPIPE noprint pass nostop handle SIGUSR1 print pass nostop