From: Ruediger Pluem Date: Tue, 30 Jun 2020 20:14:36 +0000 (+0000) Subject: * Create helper function isValidAddress to determine if an address is valid [skip ci] X-Git-Tag: 2.5.0-alpha2-ci-test-only~1309 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce5c1daf2fb69dfb018667bb08b2d6ce311fdd0c;p=thirdparty%2Fapache%2Fhttpd.git * 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 --- diff --git a/.gdbinit b/.gdbinit index 21a0a13596e..92146b70fe6 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