aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhugsy2020-06-06 17:27:17 -0700
committerhugsy2020-06-06 17:27:17 -0700
commitd09215a785591560a9310931d7316d98915ade67 (patch)
tree7fc9c7f8ac52876559aafb6bddb048548ade441e
parent11bfee3fb8f97a3fdb686114be4ff653853b26d4 (diff)
downloadgef-d09215a785591560a9310931d7316d98915ade67.tar.gz
gef-d09215a785591560a9310931d7316d98915ade67.zip
[pucstom] added a new setting for the maximum recursion
-rw-r--r--gef.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gef.py b/gef.py
index 82f3478..4b40f6e 100644
--- a/gef.py
+++ b/gef.py
@@ -4570,8 +4570,9 @@ class PCustomCommand(GenericCommand):
def __init__(self):
super(PCustomCommand, self).__init__(complete=gdb.COMPLETE_SYMBOL)
- self.add_setting("struct_path", os.path.join(get_gef_setting("gef.tempdir"), "structs"),
+ self.add_setting("struct_path", os.sep.join([get_gef_setting("gef.tempdir"), "structs"]),
"Path to store/load the structure ctypes files")
+ self.add_setting("max_depth", 4, "Maximum level of recursion supported")
return
@@ -4689,6 +4690,10 @@ class PCustomCommand(GenericCommand):
err("Invalid structure name '{:s}'".format(struct_name))
return
+ if depth >= self.get_setting("max_depth"):
+ warn("maximum recursion level reached")
+ return
+
try:
_class, _struct = self.get_structure_class(mod_name, struct_name)
data = read_memory(addr, ctypes.sizeof(_struct))