Subject: bug#22657: 24.5; "Python Exception <class 'NameError'> name 'long' is not defined" while using gdb registers buffer

From: Douglas Anderson <[email-masked]>
Date: Sun, 14 Feb 2016 12:22:47 -0700

Nice hint, yeah that helped me find it:

index 9ff94aa..63b3fdf 100644
--- a/gdb/python/lib/gdb/printer/bound_registers.py
+++ b/gdb/python/lib/gdb/printer/bound_registers.py
@@ -25,7 +25,7 @@ class MpxBound128Printer:
     def to_string (self):
         upper = self.val["ubound"]
         lower = self.val["lbound"]
-        size  = (long) ((upper) - (lower))
+        size  = (int) ((upper) - (lower))
         if size > -1:
             size = size + 1
         result = '{lbound = %s, ubound = %s} : size %s' % (lower, upper,
size)

I'll submit that patch to gdb, that fixed the exception.

Thanks,
-Doug

On Sun, Feb 14, 2016 at 11:20 AM, immerrr again <[email-masked]> wrote:

> On Sun, Feb 14, 2016 at 9:11 PM, Eli Zaretskii <[email-masked]> wrote:
> >>
> >> Breakpoint 1, 0x000000000040053a in main ()
> >> (gdb) Python Exception <class 'NameError'> name 'long' is not defined:
> >> Python Exception <class 'NameError'> name 'long' is not defined:
> >> Python Exception <class 'NameError'> name 'long' is not defined:
> >> Python Exception <class 'NameError'> name 'long' is not defined:
> >>
>
> NameError means something is undefined, so probably gdb is executing
> scripts using python3 and some script doesn't account for the fact
> that only "long" and "int" types got merged  in Python3 world and
> "long" no longer exists.
>