aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrazfather2018-11-14 16:17:48 -0800
committerGrazfather2018-11-14 16:17:48 -0800
commitbe9353dbbc7e27557b9d39b96fbbfe8158f5dbdb (patch)
treeb7cac34d6a738dcca6b14e1434898b464a33cf91
parent88890279ddb9fb9e6a9182ebd653c6819370513c (diff)
downloadgef-array_info.tar.gz
gef-array_info.zip
Try to resolve array accesses in context sourcearray_info
-rw-r--r--gef.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/gef.py b/gef.py
index 652c74f..9d1e9e1 100644
--- a/gef.py
+++ b/gef.py
@@ -7494,6 +7494,11 @@ class ContextCommand(GenericCommand):
if not sym.is_function and re.search(r"\W{}\W".format(symbol), line):
val = gdb.parse_and_eval(symbol)
if val.type.code in (gdb.TYPE_CODE_PTR, gdb.TYPE_CODE_ARRAY):
+ # This isn't perfect, will break on nested [], for example
+ ar = re.search(r"{}\[.+?\]".format(symbol), line)
+ if ar: # If it's an array item access
+ symbol = ar.group()
+ val = gdb.parse_and_eval(symbol)
addr = long(val.address)
addrs = DereferenceCommand.dereference_from(addr)
if len(addrs) > 2: