[Lldb-commits] [lldb] r251305 - Convert `long` to `int`, and portably detect all integral types.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 26 09:51:09 PDT 2015


Author: zturner
Date: Mon Oct 26 11:51:09 2015
New Revision: 251305

URL: http://llvm.org/viewvc/llvm-project?rev=251305&view=rev
Log:
Convert `long` to `int`, and portably detect all integral types.

Modified:
    lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py
    lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
    lldb/trunk/test/lldbcurses.py
    lldb/trunk/test/python_api/sbdata/TestSBData.py
    lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py

Modified: lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py?rev=251305&r1=251304&r2=251305&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py (original)
+++ lldb/trunk/test/functionalities/abbreviation/TestCommonShortSpellings.py Mon Oct 26 11:51:09 2015
@@ -32,7 +32,7 @@ class CommonShortSpellingsTestCase(TestB
             ('ta st li', 'target stop-hook list'),
         ]
 
-        for (short, long) in abbrevs:
-            command_interpreter.ResolveCommand(short, result)
+        for (short_val, long_val) in abbrevs:
+            command_interpreter.ResolveCommand(short_val, result)
             self.assertTrue(result.Succeeded())
-            self.assertEqual(long, result.GetOutput())
+            self.assertEqual(long_val, result.GetOutput())

Modified: lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/array_types/TestArrayTypes.py?rev=251305&r1=251304&r2=251305&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/lang/c/array_types/TestArrayTypes.py Mon Oct 26 11:51:09 2015
@@ -182,7 +182,7 @@ class ArrayTypesTestCase(TestBase):
                         "Variable 'long_6' should have 6 children")
         child5 = variable.GetChildAtIndex(5)
         self.DebugSBValue(child5)
-        self.assertTrue(long(child5.GetValue(), 0) == 6,
+        self.assertTrue(int(child5.GetValue(), 0) == 6,
                         "long_6[5] == 6")
 
         # Last, check that "long_6" has a value type of eValueTypeVariableLocal

Modified: lldb/trunk/test/lldbcurses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbcurses.py?rev=251305&r1=251304&r2=251305&view=diff
==============================================================================
--- lldb/trunk/test/lldbcurses.py (original)
+++ lldb/trunk/test/lldbcurses.py Mon Oct 26 11:51:09 2015
@@ -1,5 +1,8 @@
+import lldb_shared
+
 import curses, curses.panel
 import sys
+import six
 import time 
 
 class Point(object):
@@ -138,7 +141,7 @@ class Window(object):
             for key in arg:
                 self.add_key_action(key, callback, description)
         else:
-            if isinstance(arg, ( int, long )):
+            if isinstance(arg, six.integer_types):
                 key_action_dict = { 'key'         : arg, 
                                     'callback'    : callback,
                                     'description' : decription }

Modified: lldb/trunk/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbdata/TestSBData.py?rev=251305&r1=251304&r2=251305&view=diff
==============================================================================
--- lldb/trunk/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/trunk/test/python_api/sbdata/TestSBData.py Mon Oct 26 11:51:09 2015
@@ -220,8 +220,8 @@ class SBDataAPICase(TestBase):
         self.assertTrue(data2.uint8[4] == 111, 'o == 111')
         self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
 
-        uint_lists = [ [1,2,3,4,5], [long(i) for i in [1, 2, 3, 4, 5]] ]
-        int_lists = [ [2, -2], [long(i) for i in [2, -2]] ]
+        uint_lists = [ [1,2,3,4,5], [int(i) for i in [1, 2, 3, 4, 5]] ]
+        int_lists = [ [2, -2], [int(i) for i in [2, -2]] ]
 
         for l in uint_lists:
             data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), l)

Modified: lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py?rev=251305&r1=251304&r2=251305&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py (original)
+++ lldb/trunk/test/tools/lldb-server/lldbgdbserverutils.py Mon Oct 26 11:51:09 2015
@@ -9,6 +9,7 @@ import os
 import os.path
 import platform
 import re
+import six
 import socket_packet_pump
 import subprocess
 import time
@@ -808,8 +809,8 @@ def process_is_running(pid, unknown_valu
         If we don't know how to check running process ids on the given OS:
         return the value provided by the unknown_value arg.
     """
-    if type(pid) not in [int, long]:
-        raise Exception("pid must be of type int (actual type: %s)" % str(type(pid)))
+    if not isinstance(pid, six.integer_types):
+        raise Exception("pid must be an integral type (actual type: %s)" % str(type(pid)))
 
     process_ids = []
 




More information about the lldb-commits mailing list