aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2016-09-26 15:00:37 -0700
committerKevin Buettner <kevinb@redhat.com>2016-11-16 11:37:11 -0700
commit1a2f3d7ff1d79b1290704e48c71e905b987393a6 (patch)
tree9408ebf33f18ab82dcc7872ca0e1dc2996a95e33 /gdb/testsuite/gdb.python/py-recurse-unwind.py
parentFix PR20789 - relaxation with negative valued diff relocs (diff)
downloadbinutils-gdb-1a2f3d7ff1d79b1290704e48c71e905b987393a6.tar.gz
binutils-gdb-1a2f3d7ff1d79b1290704e48c71e905b987393a6.tar.bz2
binutils-gdb-1a2f3d7ff1d79b1290704e48c71e905b987393a6.zip
Extend test gdb.python/py-recurse-unwind.exp
This patch modifies the unwinder (sniffer) defined in py-recurse-unwind.py so that, depending upon the value of one of its class variables, it will take different paths through the code, testing different functionality. The original test attempted to obtain the value of an undefined symbol. This somewhat expanded test checks to see if 'pc' can be read via gdb.PendingFrame.read_register() and also via gdb.parse_and_eval(). gdb/testsuite/ChangeLog: * gdb.python/py-recurse-unwind.c (main): Add loop. * gdb.python/py-recurse-unwind.py (TestUnwinder): Add calls to read_register() and gdb.parse_and_eval(). Make each code call a separate case that can be individually tested. * gdb.python/py-recurse-unwind.exp (cont_and_backtrace): New proc. Call cont_and_backtrace for each of the code paths that we want to test in the unwinder.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-recurse-unwind.py')
-rw-r--r--gdb/testsuite/gdb.python/py-recurse-unwind.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.python/py-recurse-unwind.py b/gdb/testsuite/gdb.python/py-recurse-unwind.py
index 1da7aca9339..5eb87bb0b35 100644
--- a/gdb/testsuite/gdb.python/py-recurse-unwind.py
+++ b/gdb/testsuite/gdb.python/py-recurse-unwind.py
@@ -40,13 +40,18 @@ class TestUnwinder(Unwinder):
def inc_count (cls):
cls.count += 1
+ test = 'check_undefined_symbol'
+
+ @classmethod
+ def set_test (cls, test) :
+ cls.test = test
+
def __init__(self):
Unwinder.__init__(self, "test unwinder")
self.recurse_level = 0
def __call__(self, pending_frame):
-
if self.recurse_level > 0:
gdb.write("TestUnwinder: Recursion detected - returning early.\n")
return None
@@ -54,11 +59,25 @@ class TestUnwinder(Unwinder):
self.recurse_level += 1
TestUnwinder.inc_count()
- try:
- val = gdb.parse_and_eval("undefined_symbol")
+ if TestUnwinder.test == 'check_user_reg_pc' :
+
+ pc = pending_frame.read_register('pc')
+ pc_as_int = int(pc.cast(gdb.lookup_type('int')))
+ # gdb.write("In unwinder: pc=%x\n" % pc_as_int)
+
+ elif TestUnwinder.test == 'check_pae_pc' :
+
+ pc = gdb.parse_and_eval('$pc')
+ pc_as_int = int(pc.cast(gdb.lookup_type('int')))
+ # gdb.write("In unwinder: pc=%x\n" % pc_as_int)
+
+ elif TestUnwinder.test == 'check_undefined_symbol' :
+
+ try:
+ val = gdb.parse_and_eval("undefined_symbol")
- except Exception as arg:
- pass
+ except Exception as arg:
+ pass
self.recurse_level -= 1