]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Create helper function isValidAddress to determine if an address is valid [skip ci]
authorRuediger Pluem <rpluem@apache.org>
Tue, 30 Jun 2020 20:14:36 +0000 (20:14 +0000)
committerRuediger Pluem <rpluem@apache.org>
Tue, 30 Jun 2020 20:14:36 +0000 (20:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879382 13f79535-47bb-0310-9956-ffa450edef68

.gdbinit

index 21a0a13596e4613242e53cd70af964eeeb190957..92146b70fe63c31fc9ff70c80ba688aa69ed4c4b 100644 (file)
--- 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