You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2020/06/30 20:14:36 UTC

svn commit: r1879382 - /httpd/httpd/trunk/.gdbinit

Author: rpluem
Date: Tue Jun 30 20:14:36 2020
New Revision: 1879382

URL: http://svn.apache.org/viewvc?rev=1879382&view=rev
Log:
* Create helper function isValidAddress to determine if an address is valid [skip ci]

Modified:
    httpd/httpd/trunk/.gdbinit

Modified: httpd/httpd/trunk/.gdbinit
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/.gdbinit?rev=1879382&r1=1879381&r2=1879382&view=diff
==============================================================================
--- httpd/httpd/trunk/.gdbinit (original)
+++ httpd/httpd/trunk/.gdbinit Tue Jun 30 20:14:36 2020
@@ -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